0

I know that this question has been answered before for section and chapter titles, but I cannot seem to apply it to subsection titles. I would like to globally change the format of subsection titles to the one presented in the MWE:

\documentclass[]{article} 
\usepackage[T1]{fontenc}  

\newcommand\ruleafter{\vspace*{-.5cm}\noindent\rule{\textwidth}{1pt}\vspace*{-.2cm}}

%opening
\title{}
\author{}

\begin{document}

\subsection{\textsc{Subsection title}}\ruleafter

\end{document}

I have tried using titlesec, but without success. Any suggestions? Thanks in advance!

PS: The questions considering the section and the chapter format, respectively:

How can I make a bold horizontal rule under each section title?

Add a rule after chapter title using titlesec

1
  • Welcome to TeX.Stackexchange! Can you add links to the answers for section and chapter titles? Feb 5, 2018 at 13:26

1 Answer 1

3

If you don't mind using titlesec then:

\documentclass[]{article}
\usepackage[T1]{fontenc}

\usepackage{titlesec}

\titleformat{\subsection}
  {\scshape\bfseries} % format
  {\thesection}% label
  {1pt}% sep
  {\hspace{1ex}} % before-code
  [\rule{\textwidth}{1pt}]

%opening
\title{}
\author{}

\begin{document}

\subsection{Subsection title}

\end{document}
7
  • Thanks! But now the text is not boldface anymore, and adding the option removes small caps, in turn. Feb 6, 2018 at 6:59
  • 3
    The command \sc, along with all similar two letter commands, has been obsolete for 25 years.
    – egreg
    Feb 6, 2018 at 9:01
  • @YulanvanOppen Sorry, forgot the bold face. The second mandatory argument to \titleformat is the formatting of the title. I updated the answer. Feb 6, 2018 at 9:04
  • @egreg Indeed, I didn't realize until he asked for bold too. Thanks! \scshape and \bfseries are okay to use? Feb 6, 2018 at 9:05
  • 1
    @PhelypeOleinik Yes, these are good. On the other hand, not many font familes provide boldface small caps.
    – egreg
    Feb 6, 2018 at 9:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .