3

Issue

I am trying to set spacing between paragraphs using \parskip but it also affects section titles and "breaks" formatting.

Question

How can I set up a skip between paragraphs without having it influence section formating?

Bonus question

The frame around the title in the screenshot without parksip is closer to the top than to the bottom of the text. Why is that and how can I fix it?

Demo

  1. Default

default

  1. With parskip

parskip

MWE

\documentclass{article}
\usepackage{mwe}
\usepackage{titlesec}
\setlength{\parskip}{1em}
\titlespacing*{\section}{0pt}{0pt}{0pt}
\titleformat{\section}
  [frame]
  {\normalfont}
  {}
  {0pt}
  {\quad \Large \bfseries \Roman{section}. \enskip \MakeUppercase}
\begin{document}
\section{Section 1}\label{sec:section-1}
\lipsum[1]
\subsection{Subsection}\label{sec:subsection}
\lipsum[2]
\lipsum[3]
\end{document}

Relevant thread

  • using the parskip package instead of setting parskip directly will do some of this, but better is to use a class designed for setting with non zero paragraph skip, so the headings already account for this. – David Carlisle Mar 15 '17 at 14:27
  • @DavidCarlisle While it does look nicer it does not completely fix my issue. It also cannot be customized. Could you please explain to me how one would go about creating such a class? – Florian Mar 15 '17 at 16:01
1

Proposed solution

Following the advice of @DavidCarlisle, I removed the custom settings on parskip and simply let the parskip package manage the basic spacing.

Since I still wanted to customize some things, I used the following settings using the titlesec package to tailor it to my needs:

\titlespacing*{\section}      {0em}{.75em}{.5em}
\titlespacing*{\subsection}   {0em}{.50em}{.25em}
\titlespacing*{\subsubsection}{0em}{.50em}{.25em}
\titlespacing*{\paragraph}    {0em}{.25em}{.25em}

MWE

\documentclass{article}
\usepackage{mwe}
\usepackage{titlesec}
\usepackage{parskip}
\titlespacing*{\section}      {0em}{.75em}{.5em}
\titlespacing*{\subsection}   {0em}{.50em}{.25em}
\titlespacing*{\subsubsection}{0em}{.50em}{.25em}
\titlespacing*{\paragraph}    {0em}{.25em}{.25em}
\titleformat{\section}
  [frame]
  {\normalfont}
  {}
  {0pt}
  {\quad \Large \bfseries \Roman{section}. \enskip \MakeUppercase}
\begin{document}
\section{Section 1}\label{sec:section-1}
\lipsum[1]
\subsection{Subsection}\label{sec:subsection}
\lipsum[2]
\lipsum[3]
\end{document}

Demo

enter image description here

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.