13

I am using the titlesec package but the numbering of section and subsections disappeared. I need to retrieve it. my code is

\titleformat{\section}[block]{\color{blue}\Large\bfseries\filcenter}{}{1em}{}
\titleformat{\subsection}[hang]{\bfseries}{}{1em}{}    

I need to achive the following specs: Main headings: Arial, Size 12, Bold, Uppercase, Center Justified.

Sub-headings: Arial, Size 12, Bold, Title case, Left Justified.

lockstep
  • 250,273
user16558
  • 359
  • 2
    Add \thesection in the second mandatory argument. Similarly, add \thesubsection in the the corresponding command. Your specifications don't say anything about changing colors, and yet you have a change to blue? – Gonzalo Medina Apr 21 '13 at 04:41
  • 1
    A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Micha Apr 21 '13 at 04:53
  • Thank you very much for this help, Really I do not need the blue line but it was just for test. If I want to achieve the given specs what should I do? – user16558 Apr 21 '13 at 06:01

1 Answers1

16

You should use \thesection and \thesubsection in the appropriate places; also \MakeUppercase should go in the last argument for \section.

\documentclass{article}
\usepackage{tgtermes,tgheros} % use your preferred ones for the fonts
\usepackage{lipsum} % this is just to produce some text

\usepackage{titlesec}
\titleformat{\section}[block]
  {\fontsize{12}{15}\bfseries\sffamily\filcenter}
  {\thesection}
  {1em}
  {\MakeUppercase}
\titleformat{\subsection}[hang]
  {\fontsize{12}{15}\bfseries\sffamily}
  {\thesubsection}
  {1em}
  {}

\begin{document}

\lipsum[1]

\section{A section title}

\lipsum[2]

\subsection{A subsection title}

\lipsum[3]

\end{document}

enter image description here

egreg
  • 1,121,712