0

Given many lines of text from a parameter or \input file, that contain end-of-line tags, ascenders and descenders:

\documentclass{minimal}
\begin{document}

% Some Code <Here> to disable TeX from
% factoring in ascenders and descenders
% in determining `\baselinestretch`

This is an ugly line of texting with "xxx".\\
Yay for descenders hanging with "xxx".\\
And ascenders' apostrophes with "xxx".\\
\end{document}

I would like to save the "vertical space" that TeX adds when it considers ascenders and descenders, and make those lines as compact as the lines that don't have them.

How does one make the baselineskip EXACTLY the same between each line, regardless if there are ascenders or descenders?

How does one enable or disable TeX from dynamically adjusting the baseline because of these?

Note, the distance between the bottoms and tops of the "x"s should always be consistent.

The distinction between this and other similar questions is that this is not limited to two lines, or even just one paragraph, (but rather, an entire chapter).

17
  • what you ask for is the default behaviour of tex. Please always provide a complete test file that shows the problem. Perhaps you have some non-standard settings giving you uneven baseline spacing but hard to guess with no information shown. Dec 21, 2019 at 16:16
  • baselineskip is the baseline-to-baseline spacing so the actual glue added will vary depending on the height and depth of the characters to ensure that the space between your xxx will be equal (unless the line has something really big that forces the lines apart, an inline 10-row matrix for example...) . Basically you posted the code above asking how to make the space between the xxx equal, so it is really your responsibility to provide an example where the spacing is not equal, so people have a question to answer. Dec 21, 2019 at 16:26
  • why would you want to disable that? If you do the linespacing will be totally uneven with lines with lowercase closer together than lines with uppercase, do you really want that? Dec 21, 2019 at 16:31
  • you have not defined your terms "same baselineskip" would normally be interpreted to mean the same baseline to baseline spacing. and that is what you get by default. The actual glue tex adds is from the bottom of one row to the top of the next, so if they are just rows of .... the added glue is almost \baselineskip as the line boxes have little height but if the rows are AgAgAg then to maintain baseline spacing the glue between the bottom of a g and the top of an A needs to be less. Dec 21, 2019 at 16:39
  • 1
    \baselineskip is designed to precisely fit descenders (\strut). If you want it to fit \mathstrut, that could probably be done. OTOH, if you want to save space, use \baselineskip=0pt and revert to \lineskip. Dec 21, 2019 at 16:43

1 Answer 1

2

Here's how to get superugly output. The distance between baselines is fixed at 2ex, notwithstanding ascenders and descenders.

You'll get clashes, though.

\documentclass{article}

\begin{document}

\setlength\baselineskip{2ex}
\setlength\lineskiplimit{-\maxdimen}

\noindent
This is an ugly line of texting with "xxx".\\
Yay for descenders hanging with "xxx".\\
And ascenders' apostrophes with "xxx".

\end{document}

enter image description here

If you change “an” in the first line with “ap”, you get

enter image description here

3
  • This is exactly what I was looking for (with \baselineskip), except, according to John's comment, I added \lineskip to add whitespace back in (not gluey)... Could you add that here to show how you can make it readable afterwards? What is the difference between \lineskip and \lineskiplimit in this context? Dec 21, 2019 at 17:06
  • 1
    @elikakohen \lineskip is the amount of glue added if the distance between the lines is less than \lineskiplimit once ascenders, descenders and the baselineskip are taken into account. Since \lineskiplimit is set to the smallest possible dimension, no two lines will be deemed too near to each other, so the distance between baselines will be \baselineskip in every case. I'm not sure what you mean by “make it readable afterwards”. Increase the baseline skip, if that's what you mean.
    – egreg
    Dec 21, 2019 at 17:14
  • To "save space" (for printing, presumably?), shrink the font and let the reader zoom in (magnify) unlimited: you could fit a whole chapter on a page, like microfilm readers do. Or an InfoDot. If physical printing is required, "saving space" is not the priority for readability: good font, large size, nice paper, good ink.
    – Cicada
    Dec 22, 2019 at 4:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .