![更改字体大小和两行之间的距离](https://linux22.com/image/275389/%E6%9B%B4%E6%94%B9%E5%AD%97%E4%BD%93%E5%A4%A7%E5%B0%8F%E5%92%8C%E4%B8%A4%E8%A1%8C%E4%B9%8B%E9%97%B4%E7%9A%84%E8%B7%9D%E7%A6%BB.png)
我的字体大小有问题。我想在我的 Latex 文档中全局更改标题的字体大小。因此我创建了一个新命令。这是一个 MWE
\documentclass[BCOR=8mm,DIV=12,11pt,twoside,titlepage,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,ngerman]{babel}
\usepackage{scrpage2}
\usepackage{float}
\usepackage{ifthen}
\begin{document}
\newcommand{\titel}[2]{
\ifthenelse{\equal{#1}{\empty}}{}{
\ifthenelse{\equal{#2}{\empty}}{
\begin{center} \textbf{\fontsize{60pt}{25pt}\selectfont #1} \normalfont\vspace*{-2ex} \end{center}}
{
\begin{center} \textbf{\fontsize{60pt}{25pt}\selectfont #1} \normalfont\vspace*{-2ex} \end{center}
\begin{center} \textbf{\huge --- \\ \Huge #2}\end{center}}}}
\titel{I want the 2 linesof this title to be more seperated}{such that the letters aren't that close.}
\end{document}
现在标题很大,但如果标题分成两行,则标题行之间的距离太小,导致字母互相接触。
我只想让两条线之间的距离更大。我不想通过
part 1 of the title \\ part 2 of the title
在标题命令中,因为它会影响标题(参见命令\kopftitle
)
我很感激你的帮助!
答案1
您的代码至少存在三个问题。首先,LaTeX 的默认字体系列(Computer Modern)不提供字体大小60pt
;通过加载提供此字体大小的字体系列(例如 Latin Modern)来修复此问题。其次,指令\fontsize{x}{y}\selectfont
应该前指令\textbf
。最后,的第二个参数\fontsize
应该大于第一个参数;对于许多字体系列,习惯上让所谓的基线跳跃比字体的标称尺寸大约大 10% 到 20%。
考虑到这些评论,以下是您的 MWE 的输出。(请注意,我已将 baselineskip 设置为比标题行中的字体大小大 10%。您可能需要摆弄此参数。)
\documentclass[BCOR=8mm,DIV=12,11pt,twoside,titlepage,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english,ngerman]{babel}
\usepackage{scrpage2,float,ifthen}
\usepackage{lmodern}% choose a font family that suits your needs
\newcommand{\titel}[2]{
\ifthenelse{\equal{#1}{\empty}}{}{%
\ifthenelse{\equal{#2}{\empty}}{%
\begin{center}
\fontsize{60pt}{66pt}\selectfont \textbf{#1}
\end{center}}
{\begin{center}
\fontsize{60pt}{66pt}\selectfont \textbf{#1}
\end{center}
\begin{center} \textbf{\huge --- \\ \Huge #2 \\ \null}
\end{center}%
}
}
}
\begin{document}
\titel{I want the lines of this title to be more separated}{so that the letters aren't too close.}
\noindent
And here's some text set in ``normal'' font size (11 pionts)\dots
\end{document}