3

I am attempting to implement the following formatting:

desired format

I have done my best to adapt it into the following:

\documentclass{article}

\usepackage{titlesec} % section headings \usepackage{enumitem} % customize lists \setcounter{secnumdepth}{0} % disable section auto-enumerating

\titleformat{\subsection}[wrap]{\normalfont}{}{}{} \titlespacing{\subsection}{2pc}{1pc}{2pc}

\begin{document}

\section{Chapter 5} \subsection{5.1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget malesuada mi, nec feugiat lacus. Nullam est mi, feugiat eu congue ut, ultricies sed nulla. Cras sed eros id odio lobortis viverra a a est. Nulla facilisi. Duis a metus sit amet sapien accumsan egestas. Quisque dignissim magna eros, a auctor lectus sollicitudin ultrices.

\begin{enumerate}[label={\alph*.}] \item Donec sit amet nulla velit. Nulla facilisi. Aenean placerat, metus dapibus hendrerit tincidunt, diam sem ultricies sapien, nec ultricies diam odio eu ligula. Praesent non eros posuere, tristique turpis dapibus, fermentum tortor. Nam tempus tristique ex ac fermentum?

Answer content (a)

\item Duis vitae congue felis. Cras sollicitudin facilisis enim. Phasellus rhoncus libero ultrices turpis semper, id ornare quam cursus. Praesent sed aliquet tortor. Cras nec blandit sapien?

Answer content (b)

\end{enumerate}

\end{document}

This renders as:

render

A critical piece that I am failing to adapt is the un-indentation of the Answer contents (a) & (b). What is the best way to go about formatting these un-indented sub-elements of the list, without breaking from the {enumeration} environment?

Thanks! (This question was adapted based on responses from Willie Wong, Werner♦, and barbara beeton to a previous question.)

shea
  • 63
  • 2
    You can insert a \leftskip-\leftmargin. But it would be better if you edit your document to show a more realistic use case. In particular, in your use case, (I) do you expect the "Answer content (a)" to be a single paragraph or multiple paragraphs? (II) is the code supposed to print "Answer content (a)" automatically, or is that just a place holder? Depending on your needs, it is possible https://tex.stackexchange.com/questions/217722/enumitem-indented-list-where-new-paragraphs-are-not-indented already answered your question. – Willie Wong Dec 14 '23 at 04:01
  • 2
    It is difficult to see the real structure because of the lorem-ipsum text, but I would probably stop and resume the enumerate. – Ulrike Fischer Dec 14 '23 at 08:48
  • both of these are fitting solutions! i went with using enumitem's [resume] feature in the spirit of letting $\LaTeX$ handle as much of the explicit formatting as possible (not sure if thats reasoning applies here). cheers folks. [very supplementary question: is there a recommended format (without lorem-ipsum) for these kinds of mockups? perhaps a diagram of the layout without text (blank boxes)? i see these are used in the enumitem documentation.] – shea Dec 14 '23 at 09:50
  • 2
    You are already using enumitem, I would just end the list after item (a), write the stuff that is not part of the list, then restart it using \begin{enumerate}[resume*] (the starred veresion will here get the formattting from the previous list. – daleif Dec 14 '23 at 10:46

1 Answers1

2

Thanks to Ulrike and daleif for my solution (using the 'resume' feature of enumitem). I imagine future users may find Willie's comment helpful given how my question is phrased. Here is the final result:

result

Using the following code:

\documentclass{article}

\usepackage{titlesec} % section headings \usepackage{enumitem} % customize lists \setcounter{secnumdepth}{0} % disable section auto-enumerating \setlength{\parindent}{0pt} % disable auto-indent

\titleformat{\subsection}[wrap]{\normalfont}{}{}{} \titlespacing{\subsection}{1pc}{1pc}{1.5pc}

\begin{document}

\section{Chapter 5} \subsection{5.1}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget malesuada mi, nec feugiat lacus. Nullam est mi, feugiat eu congue ut, ultricies sed nulla. Cras sed eros id odio lobortis viverra a a est. Nulla facilisi. Duis a metus sit amet sapien accumsan egestas. Quisque dignissim magna eros, a auctor lectus sollicitudin ultrices.

\begin{enumerate}[label={\alph*.}] \item Donec sit amet nulla velit. Nulla facilisi. Aenean placerat, metus dapibus hendrerit tincidunt, diam sem ultricies sapien, nec ultricies diam odio eu ligula. Praesent non eros posuere, tristique turpis dapibus, fermentum tortor. Nam tempus tristique ex ac fermentum? \end{enumerate}

Answer content for first sub-question. Sed pulvinar neque sit amet turpis euismod, non dignissim ex aliquet.

\begin{enumerate}[resume*] % '*' necessary for custom format \item Duis vitae congue felis. Cras sollicitudin facilisis enim. Phasellus rhoncus libero ultrices turpis semper, id ornare quam cursus. Praesent sed aliquet tortor. Cras nec blandit sapien? \end{enumerate}

Answer content for second sub-question. Etiam mauris ipsum, consequat et tellus non, efficitur vestibulum elit. Duis purus elit, volutpat quis laoreet id, commodo sit amet tellus. Vestibulum pellentesque ut sem semper tincidunt. Phasellus velit sapien, faucibus eget lacus a, hendrerit tempor elit.

\end{document}

shea
  • 63