# Dealing with variable-height fonts

I'm having problems using LaTeX to deal with a certain font that I'd like to use for an art project. I'm writing a basic document, but when I use this font to write normal text, the baseline ends up automatically varying (presumably because some capitals in the font are too tall, though interestingly, letters going below the baseline like f, g, and y do not seem to affect this).

Since the font (1805 Austerlitz Script) is not free and I thus cannot simply distribute it, I'm not sure there's a point in posting a MWE, but I took a screenshot to show how the text (with no coding in between it) is printed with uneven baselines. Note that this also happened with some but not all "handwriting"-type script fonts I tested.

The first six lines are all one paragraph, and the last two lines are a second paragraph. There is no manual coding and no special environment for this text. All glyphs shown here are the same font size. As you can see though, the capital "H" in however is a particular culprit in this font, forcing substantially more space between lines 1 and 2 than there is between lines 3 and 4. But not all capitals affect this (cf. the capital A in line 3).

I realize that this is probably a font issue. However, is there any way to force LaTeX to print all the text with an equal baseline (less than shown)? I do not care if it results in overlapping text (it's an art project, so form over function). I'd rather not to have to enter code manually every time this extra gap occurs between lines since this document is a test for a much longer document using the same font. The font itself is non-negotiable.

The issue does persevere regardless of the global font size. Changing \baselineheight doesn't seem to help as a lower value (even negative) seems to only reduce space between paragraphs. It does not cause the text I have to even approach overlapping. Interestingly, the issue vanishes completely when I use the same font in Microsoft Word, leading me to believe there's something simple I can set up in LaTeX to fix this.

Thanks in advance for any and all recommendations. Sorry if this is a repeat question or one with an easy answer—I've been searching for hours to try to figure out how to do this.

— CB

• You can set \lineskip and \lineskiplimit to avoid such a change (see e.g. tex.stackexchange.com/a/549219/2388), but why don't you enlarge the \baselineskip instead? Jan 14, 2021 at 9:37
• as discussed in the answer that @UlrikeFischer links to you have a choice, increase the baseline spacing so that even if the large descender from g was directly above the large capital H they would not over-print. This is safe but may look a bit over-spaced. Or you use \lineskiplimit negative which would allow the lines to be closer but you would need to check by eye if there was any over-printing. Jan 14, 2021 at 12:01
• Enlarging \baselinekip seems to just create ungodly amounts of space between each line, unless I'm missing something. Changing \lineskiplimit to be negative seemed like what I needed, but didn't affect the space projected by capitals until I got to \lineskiplimit=-21pt. Links to output in my comment below. Jan 14, 2021 at 20:45

(You can always make a mwe:-)

\documentclass{article}
\showoutput
\showboxdepth=3
\begin{document}

\fontfamily{cmdh}\selectfont

\def\z{High Dig  \^{H}at fff gg ABC $f=g$ }
\def\zz{one two three four five }

\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z\z
\zz\zz\zz\zz\zz\zz\zz\zz\zz\zz\zz\zz\zz\zz

\end{document}


Produces

where TeX is making even linespacing when lowercase letters are used, but gives up and just forces 1pt of space between each row of text when larger letters are involved.

You can see this by eye or check the log,

$pdflatex dd683 | grep '\.\.\..*lineskip' ...\glue(\lineskip) 1.0 ...\glue(\lineskip) 1.0 ...\glue(\lineskip) 1.0 ...\glue(\lineskip) 1.0 ...\glue(\lineskip) 1.0 ...\glue(\lineskip) 1.0 ...\glue(\baselineskip) 0.33333 ...\glue(\baselineskip) 2.27777 ...\glue(\baselineskip) 2.27777 ...\glue(\baselineskip) 2.27777  If you are on windows you may not have grep but ignore that just look for lines using lineskip (bad, usually) and baselineskip (good, usually) So you have a choice: accept uneven spacing, or increase the spacing so it fits even the worst case, or force even spacing and check for any over-printing. The lines in the first part of the paragraph are logged as ...\hbox(13.91667+1.94444)  so they are 14pt above the baseline and 2pt below, so setting a baselineskip of 16pt should be enough: Changing the font selection to  \fontfamily{cmdh}\fontsize{10pt}{16pt}\selectfont  produces a log of $ pdflatex dd683  | grep '\.\.\..*lineskip'
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 0.13889
...\glue(\baselineskip) 4.33333
...\glue(\baselineskip) 6.27777
...\glue(\baselineskip) 6.27777
...\glue(\baselineskip) 6.27777


so even baseline spacing, looking like

But that may be rather spacy so you could use

\lineskiplimit=-5pt
\fontfamily{cmdh}\fontsize{10pt}{13pt}\selectfont


which allows an over-print of up to 5pt using a baseline spacing of 13pt, producing a log of

\$ pdflatex dd683  | grep '\.\.\..*lineskip'
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) -2.86111
...\glue(\baselineskip) 1.33333
...\glue(\baselineskip) 3.27777
...\glue(\baselineskip) 3.27777
...\glue(\baselineskip) 3.27777


showing even spacing but some negative spacing of arount 3pt inserted, this looks like

Which probably looks better than the fully spaced version in general but the math italic f does hit the accented H so if that happened in your real case you would have to decide to accept it or re-word of add a thin space so they miss or increase the baseline spacing slightly.

• "So you have a choice: accept uneven spacing, or increase the spacing so it fits even the worst case, or force even spacing and check for any over-printing." I'm specifically interested in forcing even spacing, but it doesn't seem like even \lineskiplimit will help with that. Setting \lineskiplimit as far as -20pt results in change to everything except the excessive space caused by capitals: link Setting it to -21pt finally affects the space caused by capitals, but far too dramatically for a 1 pt change: link Jan 14, 2021 at 20:42
• @user119767 \lineskiplimit is only used at all in the bad case that the text does not fit in the specified baseline spacing so I'm not sure I understand your comment although I will (this time) look at your links, following external links is not really how the site works. Jan 14, 2021 at 20:44
• @user119767 hmm well your links were not that helpful just tiny fragment images. You do not need to guess, as I show in this question if you box a run of text with the tallest and capitals and deepest descenders then tex will show you the heigh and depth. If you make -\lineskiplimit+\baselineskip larger than that total height+depth then you will always get even baseline spacing. set \lineskiplimit to -\maxdimen if you never want to deviate from even baseline even if you put a 5-row matrix mid-line. Jan 14, 2021 at 20:49
• @user119767 " but far too dramatically for a 1 pt change" changine \baselineskip by a 1pt changes the point at which \lineskip is used or not used, but switching to \lineskip affects the visible spacing by 1pt more than the overlap so may well move the affected line by 22pt not 1pt, that is what it means. Jan 14, 2021 at 20:52
• I would keep \lineskiplimit as in your second image, to keep even spacing but increase baselineskip so that even spacing is a larger value. Jan 14, 2021 at 20:54