TeX - LaTeX Asked on July 16, 2021
For my section headings, I like the look of using shorter numbers (they detract less from the section title), and get by with using the smaller
command. However, they are a smaller font size so skinnier as well, which looks a bit strange. I’m not requesting old-style numbers (hang below baseline). Any ideas on how I could achieve this? Perhaps vertically shrink text?
Edit:
Perhaps one solution is to use scalebox
(top) vs. smaller
(bottom)
scalebox{1}[0.8]{1} Intro
{smaller 1} Intro
Since you didn’t want old-style numbers, here is a solution that scales the height of the numbers to the x-height of the current font, but leaves the width unchanged. This should result in strokes the same thickness.
documentclass{article}
usepackage[T1]{fontenc}
usepackage{cmbright}
usepackage{xfp} % For fpeval
usepackage{graphicx} % For scalebox
providecommandliningnums[1]{#1}
newlength{capsheight}
newlength{xheight}
newcommandsmallnums[1]{%
settoheight{capsheight}{X}%
settoheight{xheight}{x}%
scalebox{1.0}[fpeval{thexheight / thecapsheight}]{liningnums{#1}}%
}
begin{document}
smallnums{12} Drummers Drumming *
oldstylenums{11} Pipers Piping
10 Lords a-Leaping
fontfamily{lmss}itshapeselectfont
smallnums{9} Ladies Dancing *
oldstylenums{8} Maids a-Milking
7 Swans a-Swimming
fontfamily{lmtt}upshapebfseriesselectfont
smallnums{6} Geese a-Laying *
oldstylenums{5} Golden Rings
4 Calling Birds
normalfontfontfamily{lmr}selectfont
smallnums{3} French Hens *
oldstylenums{2} Turtledoves
And 1 Partridge in 1 Pear Tree
end{document}
Answered by Davislor on July 16, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP