我有以下 LaTeX 代码:
\documentclass[a4paper]{report}
\usepackage{color}
\usepackage{hyperref}
\usepackage[usenames,dvipsnames,table]{xcolor}
\newcommand{\ADDRESS}{
\begin{minipage}[t]{0.40\textwidth}
\begin{flushright}
{\bf \textcolor{gray}{\tiny{My company}}}\\
\textcolor{gray}{\tiny{1 West 1st Avenue}}\\
\textcolor{gray}{\tiny{City Province}}\\
\textcolor{gray}{\tiny{Tel: 1-777-777-7777}}\\
\textcolor{blue}{\tiny{\href{mailto:[email protected]}{[email protected]}}}\\
\textcolor{blue}{\tiny{\href{http://www.mycompany.com/}{www.mycompany.com}}}\\
\end{flushright}
\end{minipage}
}
\begin{document}
\hfill \ADDRESS
\end{document}
但是,当我编译该文档时,出现了一些不需要的双倍行距...我怎样才能消除双倍行距,为什么会出现双倍行距?
答案1
间距“问题”源于局部字体更改。如果您全局更改字体,它也会影响\baselineskip
,即明显的“双倍间距”:
\documentclass[a4paper]{report}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\usepackage[usenames,dvipsnames,table]{xcolor}% http://ctan.org/pkg/xcolor
\newcommand{\ADDRESS}{
\begin{minipage}[t]{0.40\textwidth}
\raggedleft\tiny%
{\bfseries\textcolor{gray}{My company}}\\
\textcolor{gray}{1 West 1st Avenue}\\
\textcolor{gray}{City Province}\\
\textcolor{gray}{Tel: 1-777-777-7777}\\
\textcolor{blue}{\href{mailto:[email protected]}{[email protected]}}\\
\textcolor{blue}{\href{http://www.mycompany.com/}{www.mycompany.com}}
\end{minipage}
}
\begin{document}
\hfill \ADDRESS
\end{document}
注意使用开关\bfseries
(例如粗体) 和\tiny
(用于字体大小),以及\raggedleft
删除flushright
环境添加的一些垂直空间。 的使用\bfseries
仅限于 中的第一个项目\ADDRESS
。
使用 Marco 的建议,使用\color{gray}
和\color{blue}
也足以在一定范围内设置颜色{...}
:
\documentclass[a4paper]{report}
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\usepackage[usenames,dvipsnames,table]{xcolor}% http://ctan.org/pkg/xcolor
\newcommand{\ADDRESS}{
\begin{minipage}[t]{0.40\textwidth}
\raggedleft\tiny%
{\color{gray}{\bfseries My company} \\
1 West 1st Avenue \\
City Province \\
Tel: 1-777-777-7777} \\
{\color{blue} \href{mailto:[email protected]}{[email protected]} \\
\href{http://www.mycompany.com/}{www.mycompany.com}}
\end{minipage}
}
\begin{document}
\hfill \ADDRESS
\end{document}