Customize line spacing within a single list of enumerate environment
in case that this features you like to have in all enumerate
lists:
\documentclass[12pt]{article}
%\usepackage{enumitem}
\usepackage{etoolbox} % <--- added
\AtBeginEnvironment{enumerate}{\linespread{.84}\selectfont}% <--- added
\begin{document}
\begin{enumerate}
\item Shall I compare thee to a summer's day?
Thou art more lovely and more temperate.
\item Rough winds do shake the darling buds of May,
And summer' lease hath all too short a date.
\end{enumerate}
\end{document}
note:
package etoolbox
provide bunch of very helpful macros. among them is \AtBeginEnvironment
which insert at beginning of named environment's the code which you like to execute at its beginning. this make the same result as it is obtained, when you all your enumitem
lists write as
{\linespace{0.84}\selectfont}
\begin{enumerate}
\item Shall I compare thee to a summer's day?
Thou art more lovely and more temperate.
\item Rough winds do shake the darling buds of May,
And summer' lease hath all too short a date.
\end{enumerate}
}
in your case i use it to reduce line spreading in all enumerate
list from normal 1
to 0.84
. this has nothing with package enumitem
, however it works also with it if you use it for other list settings.
in case, that you wish to change line spreading only in one ˙enumeratelist, than you use above showed example and omit
etoolboxand definition with
\AtBeginEnvironment`.
for more help you should provide complete small document which we can copy and test. solution in my mwe (minimal working example) works as advertised :-).
Related videos on Youtube
Comments
-
Musen over 1 year
For example, the following code
\documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[itemsep=0ex] \item Shall I compare thee to a summer’s day? Thou art more lovely and more temperate. \item Rough winds do shake the darling buds of May, And summer’s lease hath all too short a date. \end{enumerate} \end{document}
will yield the texts in the following format
I want to reduce the space between space within a list, like the space between "temperate" and the "shall I" line. I tried
enumerate
package keywords likeitemsep
,parsep
, ornosep
, and none of them worked. Bothitemsep
andparsep
reduced space between sentence 1 and 2 rather than line 1 and 2.I think enumerate should be able to control this but I cannot find it.
-
cfr almost 6 yearsWelcome! Please edit to make your code compilable. That's much more useful than a mere fragment. Your snippet isn't supported by core LaTeX, we don't know what class you are using etc.
-
cfr almost 6 yearsAlso your curly apostrophes don't typeset.
-
Admin almost 6 yearsIt sounds like you want to decrease the line spacing, in which case this is nothing to do with the
enumerate
environment. Try\renewcommand{\baselinestretch}{0.8}
. -
Musen almost 6 years@cfr Thank you for your comment! I left class file out for not being wordy. It should compile now.
-
cfr almost 6 yearsThe class can affect the typesetting of the environment, so leaving it out means we don't know what the starting point is. Your apostrophes still disappear, though.
-
cfr almost 6 yearsYou want less than the standard line spacing? Use
setspace
's commands locally, I guess. But, really, just don't do this. Unless you are being forced to make it look like Word. Then you might want to load thephilosophy
package and be done with it. -
cfr almost 6 years@Andrew Are you sure that won't affect the spacing between items and between the list and surrounding text?
-
Musen almost 6 years@cfr Hi, I think your suggestion does work! Even though you may not think it is elegant enough, can you write it as an answer? Thus I can endorse it and make other people know this solution?
-
Admin almost 6 years@cfr No, not really. That's why I said "try" :) Happy to delete the comment if you prefer.
-
cfr almost 6 years@Andrew No, wasn't suggesting that. I don't know it will; just wondered if you knew it wouldn't.
-
-
Musen almost 6 yearsCan you explain a little bit more about command
AtBeginEnvironment
and what it does? Also wondering why you made it even without\usepackage{enumitem}
? -
Musen almost 6 yearsAlso, I can see it works in the minimal case I set up, but it does not work in my real document. I think your explanation may guide me to a practical solution.
-
Emera Jade almost 6 years@Musen If it works in your MWE but not in your real document, it might be helpful to show your complete document or preamble. It could be another package specific settings that interfere with enumitem.
-
rickhg12hs almost 2 yearsWith the
enumitem
package, you could also just include thebefore
option. E.g.,\begin{enumerate}[before=\linespread{.84}\selectfont]
.