TransWikia.com

Xelatex: Section fontsize

TeX - LaTeX Asked by user246264 on August 3, 2021

documentclass[12pt]{book}
usepackage{titlesec}
titleformat{chapter}{centeringbfseriesfontsize{20pt}{0}selectfont}{Chapter thechapter.}{10pt}{}

I can modify the Chapter normally.
However, it is not possible in section and subsection.
According to the specification of the paper section must be 16pt bold font, and subsection must be 14pt bold font.

titleformat{section}{bfseriesfontsize{16pt}{0}selectfont}{thesection}{10pt}{}
titleformat{subsection}{bfseriesfontsize{14pt}{0}selectfont}{thesubsection}{10pt}{}

What is the problem?

One Answer

Completing your fragments to an example document:

documentclass[12pt]{book}
usepackage{titlesec}
%usepackage{lmodern}
titleformat{chapter}{centeringbfseriesfontsize{20pt}{0}selectfont}{Chapter thechapter.}{10pt}{}

titleformat{section}{bfseriesfontsize{16pt}{0}selectfont}{thesection}{10pt}{}
titleformat{subsection}{bfseriesfontsize{14pt}{0}selectfont}{thesubsection}{10pt}{}

showoutput
begin{document}

section{aaa}
zz
end{document}

If you use this with pdflatex then you get the warning

LaTeX Font Warning: Font shape `OT1/cmr/bx/n' in size <16> not available
(Font)              size <17.28> substituted on input line 12.

and the showoutput log confirms the aaa heading uses 17.28pt font

....OT1/cmr/bx/n/17.28 a

This is due to historic compatibility issues forcing Computer Modern to be used in a fixed set of sizes. You can use the fix-cm package or choose a different font package eg Latin modern (commented out in the example above).

However you indicated you are using xelatex, which already defaults to the OpenType Latin Modern and 16pt font is used in that case:

....TU/lmr/bx/n/16 aaa

Answered by David Carlisle on August 3, 2021

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