Change \parskip only inside enumerate & itemize environment

前端 未结 4 1119
闹比i
闹比i 2021-02-15 12:29

Is there any way that I can change \\parskip to a different value inside certain environments, namely enumerate and itemize.

I wan

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-15 13:07

    The following addition to the preamble updates enumerate to make the suggested change:

    \let\oldenumerate\enumerate% Keep a copy of \enumerate (or \begin{enumerate})
    \let\endoldenumerate\endenumerate% Keep a copy of \endenumerate (or \end{enumerate})
    \renewenvironment{enumerate}
      {\begin{oldenumerate}
         \setlength{\parskip}{0pt}}% Adjust \parskip to suit your needs
      {\end{oldenumerate}}
    

    Here is a complete minimal example showing the adjustment when setting \parskip to 0pt:

    enter image description here

    \documentclass{article}
    \begin{document}
    
    \begin{enumerate}
      \item First line
    
        Second line
    \end{enumerate}
    
    \let\oldenumerate\enumerate
    \let\endoldenumerate\endenumerate
    \renewenvironment{enumerate}
      {\begin{oldenumerate}
         \setlength{\parskip}{0pt}}
      {\end{oldenumerate}}
    
    \begin{enumerate}
      \item First line
    
        Second line
    \end{enumerate}
    
    \end{document}
    

    One would do exactly the same for itemize.

提交回复
热议问题