10

Consider the following example that uses changepage's adjustwidth to set a single paragraph at 80% of the text width (on the left). Compare this to the use of \parshape (on the right):

enter image description here

\documentclass{article}
\usepackage[a5paper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{changepage,lipsum}% http://ctan.org/pkg/{changepage,lipsum}
\begin{document}

\lipsum[1]

\begin{adjustwidth}{0pt}{.2\textwidth}
\hspace*{\parindent}\lipsum[2]
\end{adjustwidth}

\lipsum[2]

\clearpage

\lipsum[1]

\parshape 1 0pt .8\textwidth
\lipsum[2]

\lipsum[2]

\end{document}

How can I adjust the vertical spacing introduced by adjustwidth so that it matches that of the \parshape output?

I understand that adjustwidth sets its contents in a list (see changepage.tex), and lists naturally have some gap above/below it. However, \topsep is set to zero (\z@) already, so I'm not sure where these lengths come from/how to remove them.

1 Answer 1

9

The extra space comes from \partopsep. You can set \partopsep to 0pt:

\documentclass{article}
\usepackage[a5paper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{changepage,lipsum}% http://ctan.org/pkg/{changepage,lipsum}

\makeatletter
\renewenvironment{adjustwidth}[2]{%
  \begin{list}{}{%
    \partopsep\z@%
    \topsep\z@%
    \listparindent\parindent%
    \parsep\parskip%
    \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
                 {\setlength{\leftmargin}{#1}}%
    \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
                 {\setlength{\rightmargin}{#2}}%
    }
    \item[]}{\end{list}}
\makeatother

\begin{document}

\lipsum[1]

\begin{adjustwidth}{0pt}{.2\textwidth}
\hspace*{\parindent}\lipsum[2]
\end{adjustwidth}

\lipsum[2]

\clearpage

\lipsum[1]

\parshape 1 0pt .8\textwidth
\lipsum[2]

\lipsum[2]

\end{document}

Or, with the help of etoolbox:

\documentclass{article}
\usepackage[a5paper]{geometry}% http://ctan.org/pkg/geometry
\usepackage{changepage,lipsum}% http://ctan.org/pkg/{changepage,lipsum}
\usepackage{etoolbox}
\AtBeginEnvironment{adjustwidth}{\partopsep0pt}

\begin{document}

\lipsum[1]

\begin{adjustwidth}{0pt}{.2\textwidth}
\hspace*{\parindent}\lipsum[2]
\end{adjustwidth}

\lipsum[2]

\clearpage

\lipsum[1]

\parshape 1 0pt .8\textwidth
\lipsum[2]

\lipsum[2]

\end{document}

enter image description here

1
  • Is it possible to further reduce the vertical space?
    – juanuni
    Commented Apr 14, 2015 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .