TeX - LaTeX Asked on April 7, 2021
I have an enumerate list created with enumitem
that I interrupt and then resume. Between the last item before the interruption and the first after the resumption, I insert a text paragraph. How can I horizontally align that paragraph so that:
Here’s what I tried:
documentclass[12pt]{article}
usepackage{calc}
usepackage{enumitem}
newlist{myenum}{enumerate}{1}
setlist[myenum,1]{label= upshape(arabic*), ref={arabic*}}
begin{document}
noindent Here is a list.
begin{myenum}
item
One
item
Two
end{myenum}
hspace{thelabelindent}%
Some other text will go here that may or may not fill out more than a single line of text on the page.
begin{myenum}[resume*]
item
Three
item
Four
end{myenum}
end{document}
I believe I want some arithmetic combination of lengths, such as in…
hspace{thelabelwidth-thelabelsep}
…and I would expect to use some command from package calc
to do this, but: (a) I don’t know how to combine such lengths; and (b) I don’t see just what lengths I need to combine.
this seems to do the job:
documentclass[12pt]{article}
usepackage{calc}
usepackage{enumitem}
newlist{myenum}{enumerate}{1}
setlist[myenum,1]{label= upshape(arabic*), ref={arabic*}}
newdimenmidlistindent
settowidth{midlistindent}{(1)kern-labelindentkern-labelsep}
newcommand{midlist}[1]{%
begingroup
leftskipmidlistindent
noindent #1unskippar
endgroup}
begin{document}
noindent Here is a list.
begin{myenum}
item
One
item
Two
end{myenum}
midlist{%
Some other text will go here that may or may not fill out more than a single line of text on the page.
}
begin{myenum}[resume*]
item
Three
item
Four
end{myenum}
end{document}
Correct answer by barbara beeton on April 7, 2021
You have the right idea! However, instead of using the calc
environment, enumitem
can handle it on its own. For reference, here's the dimensions figure in the enumitem
package documentation:
It appears you wish to have the left margin set to zero, and the label width equal to the item indent.
This is achieved with the following adjustments to the enumerate
environment:
begin{enumerate}[
align=left,
leftmargin=0pt,
itemindent=labelwidth,
labelsep=0pt
]
end{enumerate}
This looks like so in your document. Is this what you were after?
MWE:
documentclass[12pt]{article}
usepackage{enumitem}
newlist{myenum}{enumerate}{1}
setlist[myenum,1]{label= upshape(arabic*), ref={arabic*},
align=left,
leftmargin=0pt,
itemindent=labelwidth,
labelsep=0pt}
begin{document}
noindent Here is a list.
begin{myenum}
item One
item Two
end{myenum}
noindent Some other text will go here that may or may not fill out more than a single line of text on the page.
begin{myenum}[resume*]
item Three
item Four
end{myenum}
end{document}
Answered by pikopiko on April 7, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP