[Tex/LaTex] Specifying section font size in points

fontsizepackages

I'm writing a paper for a conference that requires section headings to have a certain format, with the font size specified in points. There seem to be two packages for changing the fonts of section headings, titlesec and sectsty. However, with sectsty I can't work out how to make subsubsection headings non-bold (which I also need), and with titlesec I can't see how to specify the font size in points, rather than just as "big", "medium", etc.

For completeness, what I need to do is this:

  • typeset \section headings in 11pt bold

  • typeset \subsection headings in 10pt bold

  • typeset \subsubsection headings in 10pt roman

  • remove the whitespace following \subsection and \subsubsection headings.

What is the best way to achieve these effects, using either package?

Best Answer

With sectsty it's difficult to change the spacings; with titlesec one has to rebuild all headings. Probably copying the definitions from article.cls and modifying them is the easiest way:

\documentclass{article}

\makeatletter
\renewcommand\section{%
  \@startsection{section}{1}
                {\z@}%
                {-3.5ex \@plus -1ex \@minus -.2ex}%
                {2.3ex \@plus.2ex}%
                {\normalfont\fontsize{10.95}{13.6}\bfseries}% 11pt
}
\renewcommand\subsection{%
  \@startsection{subsection}{2}
                {\z@}%
                {-3.25ex\@plus -1ex \@minus -.2ex}%
                {1sp}% No space after subsections
                {\normalfont\normalsize\bfseries}% normal size, boldface
}
\renewcommand\subsubsection{%
  \@startsection{subsubsection}{3}
                {\z@}%
                {-3.25ex\@plus -1ex \@minus -.2ex}%
                {1sp}% No space after subsubsections
                {\normalfont\normalsize}% normal size, medium
}
\makeatother

\usepackage{lipsum} % to provide mock text

\begin{document}
\section{This is large boldface}
\lipsum[2]
\subsection{This is normal size boldface}
\lipsum[2]
\subsubsection{This is normal size medium}
\lipsum[2]
\end{document}

enter image description here

The 1sp for getting zero space is just a trick: if we put 0pt, the heading would be in line (an optimization trick used by LaTeX not to increase the number of arguments). But 1sp is just indistinguishable from zero.

Related Question