0

I am in the final stage of polishing my book in LyX. In one paragraph I noticed an uneven line spacing. When I copy the whole paragraph to a different section, the line spacing is evened, even if both paragraphs are set to begin a new page (see the two images in comparison). To match the publisher's requirements, there is single line spacing throughout the document (no setspace). I am happy to give any more details, but I currently have no clue what could cause this. What values should I check?

enter image description here

enter image description here

\baselineskip seems to remain, as it should, constant, as I try to demonstrate with these images:

enter image description here enter image description here

Could the problem be a quote that follows the bugged paragraph? I redefined quote in the preamble with:

\renewenvironment{quote}{\fontsize{9.8pt}{11.4pt}\selectfont
\list{}{\leftmargin0.5cm
\rightmargin0cm}
\item\relax}
{\endlist}
johnny7
  • 111
  • can you show a generated latex document with just that paragraph? You should be able to get accented U and superscript 1031 without affecting the line spacing – David Carlisle Mar 29 '22 at 19:43
  • the problem appears to be that the \baselineskip is too small in the first case, note the top of the f in fast is touching the g above. Do you have \small {\normalsize some text} anywhere? that is the usual cause of this effect. – David Carlisle Mar 29 '22 at 19:45
  • Yes, throughout the document (and in the second image shown) I can swap U and Ü, only in the corrupted first image shown, swapping leads to a different line spacing. There is no \small in this paragraph. What else causes \baselineskip (unintentionally) to change? – johnny7 Mar 29 '22 at 19:59
  • if you show no code hard to say, footnotes, captions something is changing the baselineskip somwhere. – David Carlisle Mar 29 '22 at 20:01

1 Answers1

2

It looks like you have something equivalent to

enter image description here

Where in the right hand box (like your first image) the normal size text is set on a too-small baseline so the letters are too close together in most lines and accented letters or descenders cause the line spacing to change to avoid over-printing.

\documentclass{article}

\usepackage[T1]{fontenc}

\begin{document}

\parbox[t]{3cm}{ Some German text Some German text Some german text with "U and g Some German text Some German text Some German text with g Some german text with "U and g } \quad \parbox[t]{3cm}{\footnotesize{\normalsize Some German text Some German text Some german text with "U and g Some German text Some German text Some German text with g Some german text with "U and g} } \end{document}

The usual cause is as shown here having a size change command without including the end of paragraph in its scope, that causes the font size to change but the paragraph settings revert at the } so this is setting \normalsize text on a baselin spacing set for \footnotesize.


The above guess was essentially right the exmple finally provided shows the form was

enter image description here

\documentclass{article}

\usepackage[T1]{fontenc}

\newenvironment{oops}{\fontsize{9.8pt}{11.4pt}\selectfont}{} \begin{document}

\parbox[t]{3cm}{ Some German text Some German text Some german text with "U and g Some German text Some German text Some German text with g Some german text with "U and g } \quad \parbox[t]{3cm}{ Some German text Some German text Some german text with "U and g Some German text Some German text Some German text with g Some german text with "U and g \begin{oops}

\end{oops} } \end{document}

Here the second paragraph is using normal size text but does not end until inside the oops enviornment at which point \baselineskip is too small.

The solution is to make sure the paragraph ends before the size change, either by putting \par before it in the definition or (better in your real case) changing the font in the \list setup so the \list handler can take control of he paragraph end.

David Carlisle
  • 757,742
  • The paragraph itself does not seem to be the problem because I could copy it somewhere else and it worked out fine (it also doesn't have anything specific to it). So it must be the position of the paragraph in my document? I just can't figure out what it is, there is no change of font size. \the\baselineskip shows a constant value in this paragraph. – johnny7 Mar 29 '22 at 20:34
  • So I think it might be connected to \flushbottom. I have globally set \setlength\parskip{0pt} because I can't accept any spaces between (indented) paragraphs. \skip\footins is set fairly flexible with plus and minus, however, and there are footnotes on practically every page so I thought I'd be on the safe side. I noticed because when I removed all footnotes on this page, the line spacing got screwed up. What else can I offer LaTeX to stretch to get a flush bottom? – johnny7 Mar 29 '22 at 21:06
  • @johnny7 I would say it is highly unlikely to be related to \flushbottom as I said in the initial comment, it would be easy to debug if you provided an example. As you have not we have to guess, but I would say that 999 times out of 1000 uneven linspacing is caused by the issue I describe here, so if we have to guss, I'd guess this. – David Carlisle Mar 29 '22 at 21:29
  • 1
    @johnny7 whn you say \the\baselineskip is constant, do you mean it is same in the first image as the second? that certainly does not look to be the case. the lines are much closer together in the first case – David Carlisle Mar 29 '22 at 21:53
  • Yes, it is very odd! I am sorry that I am reluctant to share my text, but how can the paragraph be the cause for the problem if it is produced correctly in a different section? You're right, \raggedbottom does not solve the issue. – johnny7 Mar 29 '22 at 22:03
  • @johnny7 you don't have to share your text you can use my text just take your document cut out everything except the two paragraphs you show, change the words to foobar, and post the result, chcking the problem still shows. But I would guess \the\baselineskip is smaller in the first paragraph than the second. – David Carlisle Mar 29 '22 at 22:06
  • @johnny7 look a the example in my answer, I use identical paragraph text in the two columns, it's not the paragraph that is the problm, it's the settings in place at those points. I copied the text from one parbox to another just as you copied text from one section to another – David Carlisle Mar 29 '22 at 22:09
  • I do appreciate your patience with me indeed. If I cut out everything except the paragraphs, the problem doesn't show anymore. It has to have to do with the exact layout in this place. Maybe because of a lack of space LaTeX feels forced to squeeze a paragraph together because my given values (footins?) don't allow otherwise? – johnny7 Mar 29 '22 at 22:24
  • 1
    @johnny7 no latex will not do that, not by default (unless you have made baselineskip flexible (don't do that) you have cut out whatever it is that is giving the bad setting, you need to cut out in smaller chuncks checking it's still showing, or simply stick \the\baslineskip everywhere and see where it changes. – David Carlisle Mar 29 '22 at 22:28
  • I edited the question and provided two more images, showing a different line spacing but the same \the\baselineskip – johnny7 Mar 29 '22 at 22:35
  • sorry I give up, you are just setting riddles, it would be trivial to debug an example. – David Carlisle Mar 29 '22 at 22:37
  • I edited the question another time. If I remove a quotation that follows the paragraph, the spacing relieves and gets back to normal. I redefined the fontsize in quotes as given in my question. – johnny7 Mar 29 '22 at 23:04
  • @johnny7 well there you go, as I guessed: \fontsize{9.8pt}{11.4pt}\selectfont that is \small in all but name despite your assertion that there was no size change. put \par before it. – David Carlisle Mar 29 '22 at 23:14
  • @johnny7 I updated the answer. – David Carlisle Mar 29 '22 at 23:22
  • You were right indeed and I thank you again for your patience. I didn't think to look after the bugged paragraph and insisted there is no preceding size change. If I add \par and set \renewenvironment{quote}{\par\fontsize{9.8pt}{11.4pt}\selectfont, every paragraph before a quotation gets proper spacing. I can also try to give it after \list. It remains odd that the apparent smaller value of \baselineskip is not shown, maybe just because the quote follows the paragraph? – johnny7 Mar 29 '22 at 23:28
  • Could you provide the code for changing the font in the \list setup as you suggested? – johnny7 Mar 29 '22 at 23:43
  • just move thefont setting into the 2nd argument where you are setting the margins @johnny7 – David Carlisle Mar 29 '22 at 23:52
  • That is, after \relax? Interestingly, the two methods you suggested, adding \par or moving the font setting, lead to a minimally different indent in the first line of a quotation. – johnny7 Mar 29 '22 at 23:55
  • The correct placement of the font change is before \item\relax as described here. – johnny7 Mar 30 '22 at 22:19
  • @johnny7 well that's only needed because of microtype which isn't mentioned in this post. – David Carlisle Mar 30 '22 at 22:34