1

I found myself perplex at the fact that the same command works a different line spacing when written inside an empty environment.

Could somebody explain why, or at least give me a method to make the line spacing inside the environment as tiny as it is outside?

This is the code:

\documentclass{article}

\newenvironment{footnotepar}{}{}%Empty environment

\begin{document}

\begin{footnotepar} %The line spacing here is too large
\fontsize{8pt}{8pt}\selectfont This is a blind text. This is a blind text.
This is a blind text. This is a blind text.
This is a blind text. This is a blind text.
This is a blind text. This is a blind text. This is a blind text. 
\end{footnotepar}

\fontsize{8pt}{8pt}\selectfont This is a blind text. This is a blind text.
This is a blind text. This is a blind text.
This is a blind text. This is a blind text.
This is a blind text. This is a blind text. This is a blind text. 
\end{document}

It outputs:

enter image description here

LaTeX Version: This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2019.8.29)

  • The issue does not depend on the presence of an environment: try adding an empty line before \end{footnotepar}. The problem is well known, I’ll try to find a question that already copes with it. – GuM Sep 10 '19 at 16:15
  • @GuM Thanks. Okay, know I understand why adding \par in the environment solves the problem. By the way adding \par in the definition is a bit more elegant than having to leave a space when using the environment—this is more error prone. – loved.by.Jesus Sep 10 '19 at 16:19
  • Yes, of course! But my concern was only to put you on the right track: the simplest thing to think of is to add an empty line. – GuM Sep 10 '19 at 16:22
  • May I ask why you use an outdated TeX Live 2015 version? The current one is TeX Live 2019. – Mensch Sep 10 '19 at 18:47
  • @Mensch It is the one provided by Xubuntu Xenial. :-\ – loved.by.Jesus Sep 10 '19 at 21:39
  • @loved.by.Jesus Okay, but you get more and more issues with that outdated version. You should better install vanilla TeX LiVe, there is a question about installing it on this site ... – Mensch Sep 13 '19 at 19:24

2 Answers2

3

Let's analyze what happens.

Your footnotepar environment does essentially nothing, except grouping the text inside it.

At \end{footnotepar}, TeX executes \endgroup and this undoes all settings done inside the environment, including \fontsize{8pt}{8pt}\selectfont. This doesn't affect the size of the characters, because they have already entered TeX's scanner, but it does affect the interline spacing, for TeX only uses a single value for \baselineskip per paragraph and uses the value current at the time the paragraph is finished by \par (or an empty line, which is the same).

When does TeX see a \par in your example? At the empty line after \end{footnotepar} when \endgroup has already undone the instruction \setlength{\baselineskip}{8pt} performed by \selectfont inside the group. Too bad, the standard \baselineskip is used.

In the second paragraph, the \par is automatically supplied by \end{document}.

Everytime you do some font size change that involves division of text across lines, ensure a \par is issued at the appropriate time.

egreg
  • 1,121,712
0

enter image description hereI found a solution by tweaking here and there.

Just add \par to the definition of the environment

\newenvironment{footnotepar}{}{\par}%Empty environment 

It works, but I am totally unsatisfied and I do not understand why it is so.