AnswerBun.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!

Related Questions

Why are .gif files not supported?

2  Asked on April 18, 2021 by rpapa

     

blank page between section and figures

0  Asked on April 18, 2021 by junwei-su

       

Arrowhead won’t appear

1  Asked on April 18, 2021

     

Organise arrows in organigram

2  Asked on April 18, 2021 by moumou85

 

Predefine variale for foreach loop

2  Asked on April 18, 2021

 

pandoc codeblock containing Unicode characters

1  Asked on April 18, 2021 by gnusupporter-8964

     

Vertical Dots + symbol inside one equation

0  Asked on April 18, 2021 by javier-sanchez

 

Beameroptions in combination with pdfpc / pdfpages

1  Asked on April 18, 2021 by dorpapst

   

Solution environment in Beamer

1  Asked on April 17, 2021 by user12703198

 

Order of operations in plot(x, {function})

1  Asked on April 17, 2021 by user2795243

   

How to add grid and define z domain for 3D plotting

1  Asked on April 17, 2021 by nilcouv

     

Boxing Multiple Lines in Split

2  Asked on April 17, 2021 by jaredan-durbin

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir