8

I am attempting to eliminate the vertical space at the end of listing environments (enumerate, itemize and describe) but only when the list environment is at the end of a leftbar environment from the framed package. This particular circumstance produces an awkward overhang of the leftbar (working example below). So far I've considered three options:

  1. I realize I can adjust \topsep, \itemsep, and \partopsep, but this would not condition on being at the end of a leftbar environmnet, and affect the whole document.
  2. I could redefine the list environments to include some negative space at the end. However, this would not condition on being at the end of a leftbar environment.
  3. Finally, I could implement both the above solutions manually on a case-by-case basis. This seems inelegant and makes for a lot of work in longer documents.

If anyone has a solution it would be very much appreciated!

\documentclass{article}

\usepackage{framed}


\begin{document}

\begin{leftbar}
\begin{enumerate}

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\end{enumerate}
\end{leftbar}

\end{document}
7

You can redefine the leftbar environment to \unskip the last skip inserted by the itemize-like environments.

Add the following lines in your preamble:

\let\oldendleftbar\endleftbar
\renewcommand{\endleftbar}{\unskip\oldendleftbar}

MWE:

\documentclass{article}

\usepackage{framed,lipsum}

\let\oldendleftbar\endleftbar
\renewcommand{\endleftbar}{\unskip\oldendleftbar}


\begin{document}

\begin{leftbar}
\begin{itemize}

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\end{itemize}
\begin{enumerate}

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\item Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.

\end{enumerate}
\end{leftbar}

\begin{leftbar}
\lipsum[1]
\end{leftbar}

\end{document} 

Output:

enter image description here

  • @user126350 You're welcome. Happy it helped. – karlkoeller Feb 11 '14 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.