TeX - LaTeX Asked on October 1, 2021
I’m trying to recreate this layout for chapter headers for a book:
One side is the chapter name and the others is just numbers for the chapter count. I tried making this work with tables and multicols, but I can’t get them to both top align and I can’t reduce the width of the left-hand column enough to make the title fit properly.
How would you go about implementing this with LaTex? Possible?
You may use totcount
package along with regtotcounter{chapter}
command and then you can refer to the total chapters counts in your document by the command total{chapter}.
To apply this into your chapter title, one way is using usepackage{titlesec}
to change the default title format to include the total number of chapters, and perhaps using sffamily
(from what appears in your picture) as the font of your chapter title.
Assuming you are using the book
class (as you didn't specify), with total of 3 chapters, you get an output like this
Full code
documentclass{book}
usepackage{titlesec}
usepackage{totcount}
regtotcounter{chapter}
%
usepackage{lipsum}
%
titleformat{chapter}[hang]{sffamilyHugebfseries}{thechapter/total{chapter}}{1em}{}
begin{document}
chapter{Introduction}
section{Structure}
This book consists of total{chapter} chapters.
%
chapter{Finding The Leaks in Your Funnel}
section{Leaks}
lipsum
%
chapter{Finding Something Else}
section{Something}
lipsum
end{document}
EDIT
If you want multi-line numbering (with a smaller font for chapter numbering), change titleformat
command to
titleformat{chapter}[hang]{sffamilybfseries}{raisebox{2ex}{normalsize parbox[t][0cm]{0cm}{ thechapter / total{chapter} }}}{3em}{Huge}
You may change the parameters of 2ex
, normalsize
, or Huge
to your liking.
Correct answer by hesham on October 1, 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