7

I've been playing around with the titlesec package combined with the scrartcl class. I find the headings titles of scrartcl a bit ugly, but I do like the fact that I can scale font sizes to 8pt.

Anyway that's not the point. I'm defining sections to be of the form

1.8 --- Sectionname.

But Contents is treated like a Section, and I am thus left with the most ugly

--- Contents.

How to fix that? Am I using the titlesec package improperly?

MWE:

  \documentclass{article}
   \usepackage[compact]{titlesec}
\titleformat{\section}[block] % section
    {\scshape}
    {\thesection}
    {0pt}{\filcenter \hspace{.3em}---\hspace{.3em}}[]
\titlespacing*{\section}
    {0em} %left
    {0em} %before
    {1em} %after/below
    \begin{document}
     \tableofcontents
      \section{this a secti}
        ion.
      \end{document}

p.s. I also found myself doing things like \renewcommand{\abstractname}{\normalfont\scshape Abstract}, am I a bad person?

lockstep
  • 250,273

1 Answers1

7

You should include the --- as part of the numbered component of the sectional heading, not the text part. This way it will only show when the section is numbered:

enter image description here

\documentclass{article}
\usepackage[compact]{titlesec}% http://ctan.org/pkg/titlesec
\titleformat{\section}[block] % section
  {\scshape}
  {\thesection\hspace{.3em}---\hspace{.3em}}
  {0pt}{\filcenter}[]
\titlespacing*{\section}
  {0em} %left
  {0em} %before
  {1em} %after/below
\begin{document}
\tableofcontents
\section{This a section}
This is some regular text.
\end{document}
Werner
  • 603,163