我一直在绞尽脑汁想弄清楚为什么有些元素太高超出水平线/规则而有些元素的位置却很好。
我发现这是由于\color
-command造成的。
为什么会发生这种情况?
我怎样才能让没有 -command 的部分\color
表现得和那里一样?
MWE 截图
平均能量损失
\documentclass[
11pt,
a4paper,
]
{scrartcl}
\usepackage{
lmodern,
multicol,
}
\usepackage[svgnames]{xcolor}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\listfiles
\begin{document}
\begin{center}\huge
Title stuff
\end{center}
\begin{multicols*}{2}
\section{Word}
\begin{center}
\sffamily
\fbox{
\begin{minipage}[t]{0.9\columnwidth}
\centering\begin{minipage}[t]{0.95\columnwidth}\raggedright%
\color{DarkBlue}\textbf{Stuff:} aaaaaaaa [asdf: 1111]
\end{minipage}\par\addvspace{0.4ex}%
\color{black}\rule{0.9\columnwidth}{0.1pt}\par\addvspace{0.4ex}%
\begin{minipage}[t]{0.95\columnwidth}\small
Words.
Sentence words and aaaa asdf lorem.
Ipsum.
Words words more.
\end{minipage}
\end{minipage}}
\end{center}
\begin{center}
\sffamily
\fbox{
\begin{minipage}[t]{0.9\columnwidth}
\centering\begin{minipage}[t]{0.95\columnwidth}\raggedright%
\textbf{Stuff:} aaaaaaaa [asdf: 1111]
\end{minipage}\par\addvspace{0.4ex}%
\color{black}\rule{0.9\columnwidth}{0.1pt}\par\addvspace{0.4ex}%
\begin{minipage}[t]{0.95\columnwidth}\small
Words.
Sentence words and aaaa asdf lorem.
Ipsum.
Words words more.
\end{minipage}
\end{minipage}}
\end{center}
\end{multicols*}
\end{document}
答案1
与字体更改不同,它\color
会在文档中添加一个节点,而且在任何情况下都很难避免该节点影响间距。(grfguide 第 6 页有一个脚注,可以概括为“这不是我的错”)。
如果颜色 whatsit 以水平模式而不是垂直模式插入,通常更容易获得可理解的行为。在开始时\textcolor
使用(像所有 latex 框命令一样)来确保这一点。在您的示例中,您在每种情况下都会获得相同的间距。\leavevmode
\textcolor
\documentclass[
11pt,
a4paper,
]
{scrartcl}
\usepackage{
lmodern,
multicol,
}
\usepackage[svgnames]{xcolor}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\listfiles
\begin{document}
\begin{center}\huge
Title stuff
\end{center}
\begin{multicols*}{2}
\section{Word}
\begin{center}
\sffamily
\fbox{%%%%%
\begin{minipage}[t]{0.9\columnwidth}
\centering\begin{minipage}[t]{0.95\columnwidth}\raggedright
\textcolor{DarkBlue}{\textbf{Stuff:} aaaaaaaa [asdf: 1111]}%
\end{minipage}\par\addvspace{0.4ex}%
\textcolor{black}{\rule{0.9\columnwidth}{0.1pt}}\par\addvspace{0.4ex}%
\begin{minipage}[t]{0.95\columnwidth}\small
Words.
Sentence words and aaaa asdf lorem.
Ipsum.
Words words more.
\end{minipage}
\end{minipage}}
\end{center}
\begin{center}
\sffamily
\fbox{%%%%
\begin{minipage}[t]{0.9\columnwidth}
\centering\begin{minipage}[t]{0.95\columnwidth}\raggedright%
\textbf{Stuff:} aaaaaaaa [asdf: 1111]
\end{minipage}\par\addvspace{0.4ex}%
\textcolor{black}{\rule{0.9\columnwidth}{0.1pt}}\par\addvspace{0.4ex}%
\begin{minipage}[t]{0.95\columnwidth}\small
Words.
Sentence words and aaaa asdf lorem.
Ipsum.
Words words more.
\end{minipage}
\end{minipage}}
\end{center}
\end{multicols*}
\end{document}