0

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]{
     \hrule %makeuppercase removes the hrule already printed so explicitely added another
     \chaptitlefont\MakeUppercase{#1}

 }

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

enter image description here enter image description here

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}
2
  • Welcome to tex.sx! Please help us help you by making your code snippet a minimal working example (MWE).
    – schtandard
    Jul 3, 2020 at 11:15
  • thanks, I added one !
    – Wahouh
    Jul 3, 2020 at 12:35

1 Answer 1

1

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

1
  • 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".
    – Wahouh
    Jul 6, 2020 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.