TransWikia.com

Chapter alignment, title on the line

TeX - LaTeX Asked by Katie on December 25, 2020

Im trying to recreate this (Chapter style like this without memoir?) chapter, however it is not quite working as it says in the comments. I am now doing this, for numbered chapters, however I cannot get the chapter title on the line, instead of right as in the picture. The chapter title should thus be on the line, as far to the right as possible. Also, I have no clue what the 110 stands for (I adjusted it, but nothing changes), so if anyone knows, it would really help me understand the code haha! In addition the fontsize of the chapter name does not seem to change as expected when I change it (I do this in the normalfontLargesffamily by changing Large to different sizes, but it only changes a little when I change it to HUGE for instance. It was in the original code done with #1, but I get a “1” in the pdf.

titleformat{chapter}[block]
{normalfontLargesffamily}{}{0pt}
{parbox[t]{chapnumb}{%
   fontsize{100}{110}selectfontthechapter}%
  parbox[b]{dimexprtextwidth-chapnumbrelax}{
    raggedleft
    hfill{LARGE}
    rule{dimexprtextwidth-chapnumbrelax}{0.9pt}}}

enter image description here

One Answer

I guess you want something along these lines.

RequirePackage{fix-cm}
documentclass{book}
usepackage{titlesec}

titleformat{name=chapter}[block]
  {normalfontLargesffamily}
  {}
  {0pt}
  {%
   makebox[chapnumb][r]{fontsize{100}{0}selectfontthechapter}%
    hrulefill %
  }
titleformat{name=chapter,numberless}[block]
  {normalfontLargesffamily}
  {}
  {0pt}
  {%
   hrulefill %
  }

newlength{chapnumb}
AtBeginDocument{settowidth{chapnumb}{fontsize{100}{0}sffamily00}}

begin{document}

begingroup
letclearpagerelax
letcleardoublepagerelax

chapter*{Introduction}
chapter{Introduction}

Some text follows

endgroup

end{document}

I used the trick of letting clearpage to relax just to show together a numbered and an unnumbered chapter header.

Modify to suit you.

enter image description here

What does the 110 stand for? It sets the baseline skip for the paragraphs to be set with font size 100pt, but it's completely irrelevant as you're not actually making a paragraph. I used 0, but 42 or 1234 would have been the same.

Answered by egreg on December 25, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP