I am using a custom calss called ufpethesis, based on the book class, to format my masters thesis.

My aim is to insert the chapter numbering to the left of the chapter title, have it aligned to the left margin and preserve the custom headerline.

I have attempted to change the \@makechapterhead and \@makeschapterhead as well as subsections definitions, as pointed out in a related post How to format the chapter heading?. Here follows my attempt's output (to the left) and the original output (to the right).


As you can see, I have introduced some space when I tried to insert the chapter numbering, shifting both the headerline and chapter title to the right. The same happens in the starred version of the command:


Any ideas on how to fix this?

Here's my MWE:



\def\thickhrule{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}

\global\topskip 1.5pc
  \LARGE\bfseries \thechapter\enspace 
      \leavevmode \hskip-\leftskip 
      \rlap{\vbox to\z@{\vss
     #1\par \endgroup
  \skip@4pc \advance\skip@-\normalbaselineskip
  \vskip\skip@ }  

\global\topskip 1.5pc\relax
  \LARGE\bfseries %\centering
   #1\par \endgroup
  \skip@4pc \advance\skip@-\normalbaselineskip
  \vskip\skip@ }







%% Inicio do documento

\chapter{Capitulo segundo}
\section{Seção especial}


Here's also a version hosted on sharelatex.

  • It would be simpler with titlesed, which is done for that.
    – Bernard
    Sep 22, 2015 at 21:26
  • Thank you for your input @Bernard. I could not find reference to titlesed, did you mean titlesec? If so, I have taken a look, but could not figure out how to distinguish the starred version from non starred which ruins documents sections which rely on the non starred version such as abstract, summary, etc.
    – gpedrosa
    Sep 22, 2015 at 21:38
  • Yes, it was a typo. To format a starred section, say, you have the key numberless. Thus you can write \titleformat{name=\section{…} for numbered sections and \titleformat{name=\section,numberless}{…} for unnumbered sections, and similarly for \titlespacing if necessary. It is documented in §3.8, Extended Settings, of the doc.
    – Bernard
    Sep 22, 2015 at 21:50
  • Thanks for pointing me out in the right direction Bernard! I had a chance to play arround and using titlesec the way you mentioned did the trick. Just missing some fine tuning to my taste. I was also looking at section 4.2 in the manual, no wonder I did not find anything conclusive.
    – gpedrosa
    Sep 23, 2015 at 9:59
  • @Bernard Do you want to write up an answer?
    – Johannes_B
    Dec 25, 2015 at 9:52

1 Answer 1


Without the proper knowledge of basic TeX the answer I came up with involves the package titlesec, thanks to @Bernard's suggestion. I managed to adjust the output to my taste. A mwe with these adjustments and the outcome can be found below:


%% Preamble
\usepackage{lipsum}   % Cria texto "miolo de pote"
\usepackage{titlesec} % Modifica títulos

% Title adjustments (appearance and spacking)


\chapter{Capitulo segundo}
\subsection{Seção especial}
\subsubsection{Meu teste}
\paragraph{Paragrafo teste}



enter image description here

You must log in to answer this question.

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