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:
\documentclass[oneside,msc]{ufpethesis}
\usepackage{lipsum}
\makeatletter
\def\thickhrule{\leavevmode \leaders \hrule height 1ex \hfill \kern \z@}
\def\position{\centering}
\renewcommand{\@makechapterhead}[1]{
\global\topskip 1.5pc
\relax
\begingroup
\ignorespaces
\LARGE\bfseries \thechapter\enspace
\ifnum\c@secnumdepth>\m@ne
\leavevmode \hskip-\leftskip
\rlap{\vbox to\z@{\vss
\centering\large\sc{\chaptername}\enspace\thechapter
\vskip2.5pc}}\hskip\leftskip\fi
#1\par \endgroup
\skip@4pc \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\@makeschapterhead#1{
\global\topskip 1.5pc\relax
\begingroup
\LARGE\bfseries %\centering
#1\par \endgroup
\skip@4pc \advance\skip@-\normalbaselineskip
\vskip\skip@ }
\def\section{%
\@startsection{section}{1}{0mm}{1.5\baselineskip}
{\baselineskip}{\large\bfseries}}
\def\subsection{%
\@startsection{subsection}{2}{0mm}{1.2\baselineskip}
{.6\baselineskip}{\bfseries}}
\def\subsubsection{%
\@startsection{subsubsection}{3}{0mm}{\baselineskip}
{.6\baselineskip}{\normalfont}}
\def\paragraph{%
\@startsection{paragraph}{4}{0mm}{\baselineskip}
{-1em}{\itshape}}
\def\colophon{%
\if@openright\cleardoublepage\else\clearpage\fi
\thispagestyle{empty}
\null\vfill
\small\noindent
\@colophontext
}
\def\abstract{%
\gdef\@keywordsname{\keywordsnameEN}
\chapter*{\centerline\abstrname}}
%% Inicio do documento
\begin{document}
\chapter{Capitulo segundo}
\section{Trial}
\section{Seção especial}
Teste
\end{document}
Here's also a version hosted on sharelatex.



titlesed, which is done for that. – Bernard Sep 22 '15 at 21:26titlesed, did you meantitlesec? 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 '15 at 21:38numberless. Thus you can write\titleformat{name=\section{…}for numbered sections and\titleformat{name=\section,numberless}{…}for unnumbered sections, and similarly for\titlespacingif necessary. It is documented in §3.8, Extended Settings, of the doc. – Bernard Sep 22 '15 at 21:50titlesec. I still need a better understanding of TeX to spot where the mysterious spacing is coming from and how to fix it without the extra package – gpedrosa Dec 28 '15 at 01:54