TeX - LaTeX Asked by Wahouh on May 23, 2021
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}
{
centeringchapnamefontMakeUppercase{@chapapp}
}
renewcommand*{printchapternum}{chapnumfontthechapterspace}
renewcommand*{chaptitlefont}{Hugebfseriesboldmathsffamilycenter}
renewcommand{printchaptertitle}[1]{
hrule %makeuppercase removes the hrule already printed so explicitely added another
chaptitlefontMakeUppercase{#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}
{
centeringchapnamefontMakeUppercase{@chapapp}
}
renewcommand*{printchapternum}{chapnumfontthechapterspace}
renewcommand*{chaptitlefont}{Hugebfseriesboldmathsffamilycenter}
renewcommand{printchaptertitle}[1]{
hrule
chaptitlefontMakeUppercase{#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}
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}%
{centeringchapnamefontMakeUppercase{@chapapp}
}
makeatother
renewcommand*{printchapternum}{chapnumfontthechapterspace}
renewcommand*{chaptitlefont}{Hugebfseriesboldmathsffamilycenter}
renewcommand*{chaptitlefont}{Hugebfseriesboldmathsffamilycentering}
renewcommand{printchaptertitle}[1]{
hrule
vspace{0.5baselineskip}
chaptitlefontMakeUppercase{#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
Answered by Peter Wilson on May 23, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP