Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 7 down vote accepted

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

share|improve this answer
    
This does the trick! Thank you so much! –  user126350 Feb 11 at 7:17
    
@user126350 You're welcome. Happy it helped. –  karlkoeller Feb 11 at 7:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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