不同字体的行间距

不同字体的行间距

我可以使用什么 Latex 命令以便当我同时使用两种不同的字体时,行间间距保持不变?

例如,

(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}

第 (2) 行和第 (3) 行以及第 (3) 行和第 (4) 行之间的行间距相同。但是第 (1) 行和第 (2) 行之间的行间距较大。

我希望所有的行间空间都相同。

答案1

虽然对您的问题的评论中的答案更有可能最能满足您的特定需求,但我提供了这种替代方案,它可能更适合某些情况。

这里,我使用\Longstack,顾名思义,它是每行基线之间间距相等的堆叠。我将行基线之间的间隙长度设置为 16pt,并将堆叠左对齐。

\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}

在此处输入图片描述

答案2

为了在字体大小逐行变化的情况下获得相同的基线距离,你应该

  • \par文本行之间不要有空行(相当于),而是使用\newline指令强制换行,并且

  • 以 结尾相关文本\<fontsizeinstruction>\par,其中\<fontsizeinstruction>可以是\Huge\huge\LARGE\normalsize其他内容。除了\par,您还可以提供一个或多个完全空白的行。

然而,如果连续两行的字体大小非常大(例如,“ \Huge”),但整个段落末尾的字体大小非常小(例如,“ \tiny”),TeX 将不是让一行上的“巨大”字符与下一行上的字符“合并”(如果盲目地将基线距离设置为适合\tiny-sized 文本的距离,肯定会发生这种情况)。也就是说,TeX 会自动应用紧急基线拉伸因子,以防止两行的字形相互碰撞。顺便说一句,当您有一个对象(例如复杂的内联数学公式)太高或太深时,这种行为也会启动,并且会导致与包含大型数学对象的行上方/下方行中的内容发生碰撞。

字体大小的影响结尾以下示例说明了“段落”对基线跳过值的影响:

在此处输入图片描述

\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}

答案3

我在做这个长例子时耽误了时间,所以我想展示的部分已经解释过了,但也许 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}

相关内容