1

I wish to follow the convention of marking paragraph breaks with a line break as opposed to the LaTex default of an indent. However I do not wish to have a new line after section headings.

Previous questions have solved how to add line breaks after paragraphs e.g.: Have new line between paragraphs, no indentation and: https://stackoverflow.com/questions/2195908/latex-multiple-linebreaks

Other questions have solved how to remove linebreaks after headings e.g. Reducing spacing after headings

However when I combine these approaches the linebreaks after the paragraph override the commands removing the linebreaks from below the headings. How can both effects be achieved simultaneously?

To illustrate:

\documentclass[11pt]{article}
\usepackage{titlesec}
\setlength{\parindent}{0pt}
\parskip = 12pt plus 6pt minus 4pt

%Settings for the headings
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document}
\section{This is a section}
Here is my first paragraph; it should appear directly below the section heading.

This is my second paragraph. there should be a line break before it and the one above.
\end{document}
1

Page 4 of the manual of the titlesec manual, description of the \titlespacing command:

<after-sep> is the separation between title and text—vertical with hang, block, and display, and horizontal with runin, drop, wrap and ...margin. By making the value negative, you may define an effective space of less than \parskip.

So just do that:

\documentclass[11pt]{article}
\usepackage{titlesec}
\setlength{\parindent}{0pt}
\setlength{\parskip}{12pt plus 6pt minus 4pt}

%Settings for the headings
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{-\parskip}\relax
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{-\parskip}\relax

\begin{document}

\section{This is a section}
Here is my first paragraph;
it should appear directly below the section heading.

This is my second paragraph;
there should be a line break before it and the one above.

\subsection{This is a subsection}
The first paragraph in the subsection.

The second paragraph.

The third paragraph.

\end{document}

The output I obtain is:

Output of the code

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.