1

LaTeX is really not very user-centric when it comes to font-line spacing. Most users would expect the linespacing to change at the place where invoked. I have run into issues like this many times, and usually found hacks (uselessly changing font size, for example) to make it happen how it want it. But it would really be nice to learn how this really ought to be done correctly. So, here is the example that illustrates the question:

\documentclass[11pt]{article}

\usepackage{color} \usepackage{setspace} \setstretch{0.75} %% at 10pt, min seems to be 0.75; 0.7 is more distant, 0.8 is more distant

\newcommand{\notesclass}[2]{{\par{\setstretch{5}\medskip\noindent\tiny\textbf{#1:} #2}}\par} %% useless overkill: \renewcommand{\notesclass}[2]{\begin{minipage}{\textwidth}{\par{\setstretch{5}\medskip\noindent\tiny\textbf{#1:} #2}}\par\end{minipage}\par}

\providecommand{\source}[1]{\notesclass{Source}{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}

I am trying to define a macro that reliably typesets content (that explains my tables) in a font-size and line-spacing of my preference.

For sake of visual illustration, I have set the main text to ugly 0.75 spacing. (I also do not understand why 0.75 is the minimum setstretch spacing when 10pt is my article main font; either 0.7 or 0.8 creates linespacing that is larger.)

\begin{table}\color{blue}

--- Table Blue Starts

\source{I would have wanted the 5 spacing here. Why does this still have spacing that seems to be based on the font-size of the main paragraph (10pt)? LaTeX has recognized that it is in tiny.}

--- Table Blue Ends

\end{table}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{table}\color{red}

--- Table Red Starts

\source{I understand why this has 5 spacing relative to the actual font size that I used. It is actually what I wanted.

Alas, despite the par at the end of the notesclass macro, this has the same normalsize-

font-related 0.75 separation that I did not want. I would have wanted the 5 spacing here. Even stranger, if the documentclass is changed from 11pt to 12pt, table red changes in incongruous fashion.}

--- Table Red Ends

\end{table}

\end{document}

What comes out is

enter image description here

Of course, my intent is not to use 5.0 linespacing, but 0.95 linespacing on a footnotesize font in order to compactly display the source references for my floats.

ivo Welch
  • 3,766
  • in \tiny\textbf{#1:} #2}}\par you have reverted the font size with } before the paragraph ends so you have small text within a normalsize paragraph with normal baseline. Move the \par into the scope of \tiny if you want a tiny paragraph. – David Carlisle Apr 22 '21 at 21:56
  • your last comment is due to \lineskip (there are answers to all these on site) probably we should close as duplicate. – David Carlisle Apr 22 '21 at 21:58
  • lineskip: https://tex.stackexchange.com/questions/549218/what-is-the-behaviour-of-fontsize-if-baselineskip-is-below-a-certain-value/549219#549219 – David Carlisle Apr 22 '21 at 22:08
  • par in scope of size change: https://tex.stackexchange.com/a/278397/1090 – David Carlisle Apr 22 '21 at 22:10
  • thx, david. is there any way to make (la)tex itself more intuitive? i.e., not to do its calculation at paragraph end but immediately? or is this so deep in the bowels that this is unchangeable? – ivo Welch Apr 23 '21 at 23:22
  • I think latex is intuitive here, But perhaps your intuition is wrong though. If you have a line of AAAA and a line of ... then latex keeps the baseline equal it doesn't put the ... on lines closer together. This follows centuries of tradition. If you go AAA {\tiny AAA} BBB and have multiple sizes within the same paragraph then the same applies, the whole paragraph is set to the same baseline. This also applies if you delete BBB and the paragraph ends with small text (which was your case). – David Carlisle Apr 24 '21 at 07:11

1 Answers1

2

Your code has \par in the wrong place: it should be before the closing brace limiting the scope of \tiny.

On the other hand, a space saving of 0.7pt over three lines doesn't seem worth the pain, but you're the final judge.

You don't need setspace for this application.

\documentclass[11pt]{article}
\usepackage{lipsum}

\newcommand{\notesclass}[2]{% \par\medskip {\linespread{0.95}\tiny\noindent\textbf{#1:} #2\par}% }

\newcommand{\source}[1]{\notesclass{Source}{#1}}

\begin{document}

\source{\lipsum[1][1-4]}

As a comparison, the same with just \verb|\tiny|

\medskip{\tiny\noindent\textbf{Source:} \lipsum[1][1-4]\par}

\sbox0{\parbox[b]{\textwidth}{\source{\lipsum[1][1-4]}}}\the\ht0

\sbox0{\parbox[b]{\textwidth}{\medskip\tiny\noindent\textbf{Source:} \lipsum[1][1-4]}}\the\ht0

\end{document}

enter image description here

egreg
  • 1,121,712