TransWikia.com

Getting exact font sizes with relsize

TeX - LaTeX Asked on July 5, 2021

I’m fine-tuning the presentation of a book written using XeLaTeX, ready to send to the printers. The book has lots of tables which are all formatted in the same way. In one, column headings are just a little too wide, and I’d like to tweak the font size just a tiny bit to give a little more space around them without making them obviously smaller. I’m trying to use textscale from the relsize package to do this, but I’m finding it doesn’t allow arbitrary scaling of the font. Here’s a MWE showing this:

documentclass[10pt]{article}
usepackage{relsize}

begin{document}
Test
textscale{0.95}{Test}
textscale{0.85}{Test}
textscale{0.849}{Test}
end{document}

When I compile this using xelatex, the second and third "Test" appear to be the same size, while there’s a noticeable difference between the third and fourth, despite the fact the third should be more than 10% smaller than the second, while the fourth should be barely 0.1% smaller which ought not to be perceptible. Viewing the PDF output, it appears these are being rounded to 10pt, 9pt, 9pt and 8pt, respectively. Is there a way of achieving this without rounding?

One Answer

relsize is picking the nearest standard size small or footnotesize so you are getting the same size in two cases. The much simpler scalefnt package just does what you ask.

enter image description here

documentclass[10pt]{article}
usepackage{scalefnt}
showoutput
begin{document}
Test
scalefont{0.95}{Test}
scalefont{0.85}{Test}
scalefont{0.849}{Test}
end{document}

Note that visually you still see a difference around 8.5pt as you are changing fonts, the default declaration for lm is

DeclareFontShape{TU}{lmr}{m}{n}%
  {<-5.5>    UnicodeFontFile{lmroman5-regular}{UnicodeFontTeXLigatures}
   <5.5-6.5> UnicodeFontFile{lmroman6-regular}{UnicodeFontTeXLigatures}
   <6.5-7.5> UnicodeFontFile{lmroman7-regular}{UnicodeFontTeXLigatures}
   <7.5-8.5> UnicodeFontFile{lmroman8-regular}{UnicodeFontTeXLigatures}
   <8.5-9.5> UnicodeFontFile{lmroman9-regular}{UnicodeFontTeXLigatures}
   <9.5-11>  UnicodeFontFile{lmroman10-regular}{UnicodeFontTeXLigatures}
   <11-15>   UnicodeFontFile{lmroman12-regular}{UnicodeFontTeXLigatures}
   <15-> UnicodeFontFile{lmroman17-regular}{UnicodeFontTeXLigatures}
   }{}

so in the last two you are seeing the 8pt design font and the 9pt design font scaled to more or less 8.5pt in each case.

Correct answer by David Carlisle on July 5, 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