0

I would like to apply parskip package for some paragraphs, but not other paragraphs within the document. Is there a way to do so?

Currently, if I use \usepackage[indent = 20pt]{parskip}, the setting applies to the whole document. Is there a way to disable this setting for some paragraphs in the document?

1 Answer 1

1

First scenario: some paragraphs should be spaced.

\documentclass{article}

\usepackage{lipsum}% for mock text

\newenvironment{spacedpars}{%
  \par
  \setlength{\parskip}{1ex plus 0.2ex minus 0.1ex}%
  \addvspace{\skipeval{\topsep-\parskip}}%
}{\par\addvspace{\topsep}}

\AtBeginDocument{%
  \setlength{\parindent}{20pt}% huge indentation! 
}

\begin{document}

\lipsum[1][1-4]\par
\lipsum[2][1-4]\par
\lipsum[3][1-4]

\begin{spacedpars}
\lipsum[4][1-3]\par
\lipsum[5][1-3]\par
\lipsum[6][1-3]
\end{spacedpars}

\lipsum[7][1-4]\par
\lipsum[8][1-4]\par
\lipsum[9][1-4]

\end{document}

enter image description here

Second scenario: some paragraphs should not be spaced.

\documentclass{article}
\usepackage[indent=20pt]{parskip}

\usepackage{lipsum}% for mock text

\newenvironment{unspacedpars}{%
  \par
  \setlength{\parskip}{0pt plus 0.1pt}
  \addvspace{\topsep}%
}{\par\addvspace{\topsep}}

\begin{document}

\lipsum[1][1-4]\par
\lipsum[2][1-4]\par
\lipsum[3][1-4]

\begin{unspacedpars}
\lipsum[4][1-3]\par
\lipsum[5][1-3]\par
\lipsum[6][1-3]
\end{unspacedpars}

\lipsum[7][1-4]\par
\lipsum[8][1-4]\par
\lipsum[9][1-4]

\end{document}

enter image description here

You must log in to answer this question.

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