[Tex/LaTex] Vertical space before section title with titlesec

fontsizesectioningspacingtitlesec

I was trying to eliminate the vertical space before and after the title of a section by using the titlesec package and the command \titlespacing*{\section}{0pt}{0pt}{0pt}, but it works only in eliminating the vertical space after the section title. Before the section title there still is a portion of double space. I've searched the database and didn't find a solution.

Best Answer

Don't switch to \normalsize inside the argument of \section; use titlesecs \titleformat macro instead.

\documentclass[12pt]{extarticle}

\usepackage{setspace}
\onehalfspacing

\usepackage[compact]{titlesec}
\titleformat{\section}{\normalfont\bfseries}{\thesection}{1em}{}
\titlespacing*{\section}{0pt}{*0}{0pt}

\begin{document}

\section*{LOT}

The LOT hypothesis

\section*{The Regress Argument}

RA

\end{document}

enter image description here