# Same vertical spacing in chapter title header

I'm writing a thesis and I would like to modify the chapter heading style of the memoir class. This is the code I use for chapter header definition:

\chapterstyle{demo2}
\renewcommand*{\printchaptername}
{
\centering\chapnamefont\MakeUppercase{\@chapapp}
}
\renewcommand*{\printchapternum}{\chapnumfont\thechapter\space}
\renewcommand*{\chaptitlefont}{\Huge\bfseries\boldmath\sffamily\center}
\renewcommand{\printchaptertitle}[1]{
\chaptitlefont\MakeUppercase{#1}

}


Some of my chapter titles span over two lines, some over just one, like on those images :

Question : How would it be possible to have the same vertical space between the two horizontal lines for each title whatever the length with a vertical centering for the text ?

Thank you very much for your help !

Edit minimal working example:

chapter.sty:

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{style}[2019/06/27 Custom LaTeX style]

\chapterstyle{demo2}
\renewcommand*{\printchaptername}
{
\centering\chapnamefont\MakeUppercase{\@chapapp}
}
\renewcommand*{\printchapternum}{\chapnumfont\thechapter\space}
\renewcommand*{\chaptitlefont}{\Huge\bfseries\boldmath\sffamily\center}
\renewcommand{\printchaptertitle}[1]{
\hrule
\chaptitlefont\MakeUppercase{#1}

}



main.tex :

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage{chapter}
\title{Same vertical spacing in chapter title header}
\author{wahouh}
\date{July 2020}

\begin{document}

\maketitle

\chapter{some title very long spanning over two lines }
\chapter{Conclusions}
\end{document}

• thanks, I added one ! Jul 3, 2020 at 12:35

This is not an answer but it is too long as a comment.

The code you provided as your MWE (albeit in two parts) did not work for me. I fiddled around and produced the following as an MWE, although it could do with some tidying up.

% chapdemo2prob.tex  SE 552137

\documentclass{memoir}
\usepackage[utf8]{inputenc}
\usepackage{comment}

%\usepackage{chapter}  %%%% what is this???
%
%\NeedsTeXFormat{LaTeX2e}
%\ProvidesPackage{style}[2019/06/27 Custom LaTeX style]
%
\chapterstyle{demo2}

\makeatletter
\renewcommand*{\printchaptername}%
{\centering\chapnamefont\MakeUppercase{\@chapapp}
}
\makeatother
\renewcommand*{\printchapternum}{\chapnumfont\thechapter\space}
\renewcommand*{\chaptitlefont}{\Huge\bfseries\boldmath\sffamily\center}
\renewcommand*{\chaptitlefont}{\Huge\bfseries\boldmath\sffamily\centering}
\renewcommand{\printchaptertitle}[1]{
\hrule
\vspace{0.5\baselineskip}
\chaptitlefont\MakeUppercase{#1}
}

\title{Same vertical spacing in chapter title header}
\author{wahouh}
\date{July 2020}

\begin{document}

\maketitle

\chapter{some title very long spanning over two lines }
\chapter{Conclusions}
\end{document}


It is a version of your code but as a single file. You should at least have used \centering instead of \center in your code. It would have been very helpful if you had provided an MWE which didn't cause LaTeX errors.

What you are asking for is complicated. There would have to be an initial LaTeX run storing the spacing between the horizontal lines of each chapter title. Then on a second run taking the maximum of these and adjusting the spacing in all the chapter titles. I will not be attempting this. --- GOM

• Hi, thank you very much for your answer, indeed I understand from what you said that it is complicated. Regarding the MWE, it actually compilates as such with two separated files on overleaf. "\usepackage{chapter}" references "chapter.sty". Jul 6, 2020 at 7:05