6

What Latex command can I use so that the space between interlines remains the same when I use two different fonts simultaneously?

For example,

(1) \huge{\textbf{Dunt venim dolorerosto do odit}}

(2) \huge{\textbf{ametum vulla conum dolore}}

(3) \LARGE{ conulput in vero od el}

(4) \LARGE{Dunt venim dolorerosto do odit}

The interline spaces between lines (2) & (3), and (3) & (4) are the same. But the one between lines (1) & (2) is bigger.

I would like all the interline spaces to be the same.

Sigur
  • 37,330
  • Try {\huge ... } instead of \huge{...} – Sigur Jan 09 '14 at 19:28
  • 3
    \huge and \LARGE are switches, and don't take arguments, but should be put in groups: {\huge this is huge text}. The 'linespace' is determined by the value of the \baselineskip active at the end of the paragraph. If lines numbered '(1)' through '(4)' are real input lines in your .tex file, that probably explains the different 'interline spacing' you're seeing.... – jon Jan 09 '14 at 19:32

3 Answers3

2

While the answers in the comments to your question are more likely the answers that best serve your particular need, I provide this alternative, which may be more suitable for some situations.

Here, I use a \Longstack which is, by its definition, a stack with equal space between the baselines of each row. I set the gap length between row baselines to 16pt, and left-align the stack.

\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\begin{document}
\setstackgap{L}{16pt}
\Longstack[l]{%
(1) \huge{\textbf{Dunt venim dolorerosto do odit}}\\
(2) \huge{\textbf{ametum vulla conum dolore}}\\
(3) \LARGE{conulput in vero od el}\\
(4) \LARGE{Dunt venim dolorerosto do odit}%
}
\end{document}

enter image description here

2

To get the same baseline distances even though the font sizes change from line to line, you should

  • not have blank lines (which are equivalent to \par) between the lines of text -- instead, force line breaks with \newline instructions, and

  • end the text in question with \<fontsizeinstruction>\par, where \<fontsizeinstruction> could be \Huge, \huge, \LARGE, \normalsize or something else. Instead of \par, you can also provide one or more entirely blank lines

However, if the font size that's in effect for two consecutive lines is very large (say, "\Huge") but the font size at the end of the entire paragraph is very small (say, "\tiny"), TeX will not let the "Huge" characters on one line "merge" with the characters on the next line (which is what would surely happen if the baseline distance were set blindly to what's appropriate for \tiny-sized text). I.e., TeX automatically applies an emergency baseline stretch factor to prevent the glyphs from two lines from colliding with each other. This behavior, by the way, also kicks in when you have an object, such as an elaborate inline math formula, that's too tall or deep and would cause collisions with the stuff in the lines above/below the one with the large math object.

The effects of which font size is in effect at the end of a "paragraph" on the value of the baseline skip are illustrated in the following example:

enter image description here

\documentclass{article}
\usepackage[margin=1in]{geometry}
\begin{document}
\noindent
\Huge
(1) {\Huge\textbf{Dunt venim dolorerosto do odit}}\newline
(2) {\Huge\textbf{ametum vulla conum dolore}}\newline
(3) {\LARGE conulput in vero od el}\newline
(4) {\LARGE Dunt venim dolorerosto do odit}
% font size in effect: \Huge, hence very wide linespacing

\bigskip\noindent
\LARGE
(1) {\Huge\textbf{Dunt venim dolorerosto do odit}}\newline
(2) {\Huge\textbf{ametum vulla conum dolore}}\newline
(3) {\LARGE conulput in vero od el}\newline
(4) {\LARGE Dunt venim dolorerosto do odit}
\par

\bigskip\noindent
\normalsize
(1) {\Huge\textbf{Dunt venim dolorerosto do odit}}\newline
(2) {\Huge\textbf{ametum vulla conum dolore}}\newline
(3) {\LARGE conulput in vero od el}\newline
(4) {\LARGE Dunt venim dolorerosto do odit}
% font size in effect: \normalsize

\end{document}
Mico
  • 506,678
  • you'd be in trouble in the third group if "conulput" occurred in line 1 or 2, or didn't occur in line 3. (it's always a good idea, in a situation like this, to make sure that the example text has both ascenders and descenders in every line, or at least the first and last if all lines contain the same size text.) – barbara beeton Jan 09 '14 at 21:44
  • @barbarabeeton - TeX will add just enough emergency vertical stretch to the baseline distance so that the descenders in one line won't get tangled up with the ascenders in the next -- unless that parameter has been set to zero, of course. This may be verified by inserting "conulput" in lines 1 and 2 of the example. – Mico Jan 10 '14 at 06:17
  • yes, that's true, @Mico, but that will leave uneven baselines. i thought the intent of the question was to produce uniform baseline distances. – barbara beeton Jan 10 '14 at 13:26
  • @barbarabeeton - I think we're both arguing the same thing, viz., that one must not set the default distance between successive baselines too narrow if the font sizes are sufficiently disparate. – Mico Jan 10 '14 at 14:20
  • okay, that does come through when reading the prose carefully. unfortunately, with the descender in the third line of the third example, the baselines don't look radically different. a different example would have made the point much more obvious. – barbara beeton Jan 10 '14 at 14:25
  • okay, that does come through when reading the prose carefully. unfortunately, with the descender in the third line of the third example, the baselines don't look radically different. a different example would have made the point much more visually obvious. – barbara beeton Jan 10 '14 at 14:25
2

I was delayed while doing this long example, so part of I wanted to show is already explained, but perhaps the MWE is useful anyway since (I hope) is self explanatory (although typographically horrible) and show some commands not mentioned yet:

MWE

\documentclass[a5paper,twocolumn]{article}
\usepackage{microtype}
\usepackage[margin=2cm, columnsep=1cm]{geometry}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0em}

\begin{document}


%\Huge  

\small 

1) {\bfseries Note the effect of font size commands inside braces  in this paragraph}. The line spacing   {\Large remain} unafected, {\Huge no}  matter the {\tiny font} {\large sizes {\bfseries as far as possible} (i.e., anyway,  huge capitals will {\Huge NEED} more space, obviously)}.

\Huge 

{\normalsize 2) {\bfseries Take care of the actual default font size (that outside any  group of braces)} : Above this paragraph there are a \verb|\Huge| command } in line 18, {\scriptsize so all the lines are more spaced, no matter the font size of the line}.


\normalsize 3) {\bfseries Be careful with changes of the default font size in the middle of he paragraph}, since the last one is the relevant for the line spacing. Example:  

\newpage 

\Huge 

Now {\normalsize is \verb|\Huge|. Why the spacing is so small in this paragraph?}.
\tiny

\normalsize  Because there are a  \verb|\tiny| command {\bfseries before} of the end of the paragraph (the blank line). But starting with  \verb|\Huge| and switching to \verb|\tiny| again: 

\linespread{4}
% or  \renewcommand{\baselinestretch}{6}. 

\Huge 
Now {\normalsize is \verb|\Huge|  and} \tiny now  {\normalsize is \verb|\tiny|. Why the spacing is so big in this paragraph?.

\linespread{1}

 \normalsize What now? Until now, the spacing between lines was always the default according to the font, although taking care of  the whole paragraph. But we can scale this length  with  \verb|\linespread| or  \verb|\baselinestretch|. 


\end{document}
Fran
  • 80,769