在\ spacing

时间:2015-11-16 18:08:10

标签: latex

我使用DIV=10来设置类型区域,因为计算出的类型区域对我来说会有太大的余量。 我已经读过在设置字体和行间距后应该使用\recalctypearea。 首先:当我有一个定义的DIV值而不是DIV=calc时,这也有意义吗?

如果是,这是我的实际问题:我使用\spacing{1.2},因为\onehalfspacing似乎对我来说有点太大了。 我收到警告“Package typearea Warning: \typearea used at group level 2. Using \typearea inside any group, e.g. environments, math mode, boxes, etc. may result in many type setting problems. You should move the command \typearea outside all groups on input line 11.” 如果我使用\usepackage[onehalfspacing]{setspace}代替\usepackage{setspace} \spacing{1.2},我就不会收到此警告。

我应该忽略警告或我应该怎么做?

MWE:

\documentclass[a4paper,12pt,headinclude=false, footinclude=false,  BCOR=8mm,DIV=10]{scrreprt}

\usepackage[oldstyle]{libertine}
\setmainfont[Mapping=tex-text,Ligatures={Common},Numbers=OldStyle]{Linux Libertine O}
\setsansfont[Numbers=OldStyle]{Linux Biolinum O}
\setmonofont[Scale=MatchLowercase]{Linux Libertine Mono O}

\usepackage{setspace}
\spacing{1.2} 

\recalctypearea

\begin{document}
Text
\end{document}

1 个答案:

答案 0 :(得分:1)

包类型区域

命令\recalctypearea只是\typearea[current]{last}的缩写,表示通过当前绑定更正(BCOR,第一个参数)和最后一个DIV值(第二个参数)再次计算页面布局,请参阅KOMA-script documentation p. 37

必须事先设置BCOR和DIV值。但是,设置这些选项的所有(正常)方法之后都已经进行了页面布局计算。因此,如果您需要DIV=10,请使用以下方法之一:

% Choosing a KOMA-script class
\documentclass[DIV=10]{scrreport}

% During loading the package, if another documentclass is used
\usepackage[DIV=10]{typearea}

% Or after loading the package with one of these
% a)
\KOMAoptions{DIV=10}

% b)
\typearea{10}

因此,只有在使用\recalctypearea并且字体或页面大小已更改后才应使用DIV=calc,因为此选项已在上次设置。

与包间距的交互

设置DIV参数会影响整个页面。因此,您无法在群组中对其进行更改,例如逐项列表环境\begin{itemize}...\end{itemize}

调用\spacing{1.2}会打开一个由\endspacing关闭的新组(环境)。间距仅在此环境中更改。页面布局无法完成​​(通常)的事情。不要忽视这个警告。要更改行间距,请改用宏\linespread,例如:

\linespread{1.25} % within preamble

应该给出行间距为1.2 * 1.25 = 1.5。 (1.2是正常的基线跳过)。有关详细信息,请参阅also here

进一步提示

请注意,不建议直接调用\spacing宏。使用

\begin{spacing}{1.2}
Your Text
\end{spacing}

因为\end{spacing}将检查是否关闭了正确的环境(更好的错误报告)。

有关详细信息,请参阅spacing环境的代码:

% quote from setspace.sty, line 524 ff, fetched from CTAN at 2015-11-17
\newenvironment{spacing}[1]{%
  \par
  \begingroup             % moved from \endspacing by PGBR 29-1-91
    \setstretch {#1}%
}{%
  \restore@spacing
}

第一个代码块

{%
  \par
  \begingroup             % moved from \endspacing by PGBR 29-1-91
    \setstretch {#1}%
}
\begin{spacing}{...}调用

并启动新段落(\par)并打开一个新组(\begingroup)。在一个组中,对LaTeX变量/宏(等等)的更改只会产生局部效果。在\end{spacing}调用第二个代码块,调用适当的\endgroup