1

Is there an easy way to have \section headings be numbered in the usual way, but inherit their formatting from \subsection, so that section 3 below is formatted exactly like subsection 1.1, including the vertical spacing before and after:

enter image description here

I realise I can use the titlesec package to change the formatting of section headings, but I’m not sure how to reuse (or even discover for my own use) the subsection formatting provided by the current document class.

\documentclass{article}
\usepackage{lipsum}

\twocolumn

\begin{document}
\section{Section}
\lipsum[2]

\subsection{Subsection}
\lipsum[2]
\vfill\eject

\section{Section}
\lipsum[2]

\section{Section}
\lipsum[2]
\end{document}
2

You can also do that easily with the simplified syntax of titlesec:

\documentclass[twocolumn]{article}
\usepackage{lipsum}
\usepackage{titlesec}
\titleformat*{\section}{\large\bfseries}
\titlespacing*{\section}{0pt}{*3.25}{*1.5}

\begin{document}

\section{Section}
\lipsum[2]

\subsection{Subsection}
\lipsum[2]
\vfill\eject

\section{Section}
\lipsum[2]

\section{Section}
\lipsum[2]

\end{document} 

enter image description here

| improve this answer | |
  • Cool. For the sake of consistency with the original question (which was explicit about spacing), would be better if your MWE and screenshot included the \titlespacing settings as well. Thanks - I think I prefer this answer. – Roly Dec 29 '19 at 13:44
  • 1
    Probably I misread, and didn't notice this requirement. I'll fix that instantly. – Bernard Dec 29 '19 at 13:48
2

Taking a look for example in this answer of mine we can take a look at the general structure of the sectioning macros in the standard class article. The default for \subsection is (you can get this information by using \show\subsection in your document, which will print this (not so nicely formatted) to the terminal and log file):

\@startsection
  {subsection}
  {2}
  {\z@}
  {-3.25ex\@plus -1ex \@minus -.2ex}
  {1.5ex \@plus .2ex}
  {\normalfont\large\bfseries}%

So to get a \section that looks like \subsection we'd do:

\renewcommand\section
  {%
    \@startsection
      {section}
      {1}
      {\z@}
      {-3.25ex\@plus -1ex \@minus -.2ex}
      {1.5ex \@plus .2ex}
      {\normalfont\large\bfseries}%
  }

Complete MWE:

\documentclass{article}
\usepackage{lipsum}

\makeatletter
\renewcommand\section
  {%
    \@startsection
      {section}
      {1}
      {\z@}
      {-3.25ex\@plus -1ex \@minus -.2ex}
      {1.5ex \@plus .2ex}
      {\normalfont\large\bfseries}%
  }
\makeatother

\twocolumn

\begin{document}
\section{Section}
\lipsum[2]

\subsection{Subsection}
\lipsum[2]
\vfill\eject

\section{Section}
\lipsum[2]

\section{Section}
\lipsum[2]
\end{document}

Result:

enter image description here

| improve this answer | |

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.