summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/zhlineskip/zhlineskip-man.tex
blob: 07ac6e8a00d54a06e203ac76947fe82e14963c64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
% !TeX program = XeLaTeX
% !TeX encoding = UTF-8 Unicode
%
% 为了得到最佳的排版结果,可以考虑安装免费的思源宋体、思源黑体与 Fandol 字库
% - 思源字库可以前往
%   https://github.com/adobe-fonts/source-han-serif/tree/release
%   https://github.com/adobe-fonts/source-han-sans/tree/release
% 下载,请安装 Language-specific OTFs 的简体中文版本
% - Fandol 字库可以通过发行版 TeX Live 或 MiKTeX 安装
%
% 如果已经安装了思源、Fandol 字库,请在导言区启用 \SourceHanSCandFandoltrue
%
\documentclass[zihao=5,no-math,a4paper]{ctexart}
\newif\ifSourceHanSCandFandol
\SourceHanSCandFandolfalse
% 如果已经安装了思源、Fandol 字库,请启用 \SourceHanSCandFandoltrue
%\SourceHanSCandFandoltrue
\frenchspacing
\ctexset{
  section={
    name={第,节},
    aftername=\hskip\ccwd\relax,
    format=\Large\bfseries
  },
  subsection/aftername=\hskip\ccwd\relax,
  subsubsection/aftername=\hskip\ccwd\relax
}
\renewcommand\sectionmark[1]{%
  \markright{%
    \normalfont\sffamily
    \CTEXifname{\CTEXthesection\hskip\ccwd\relax}{}#1%
  }%
}
\usepackage{mathtools}
\usepackage[math-style=ISO]{unicode-math}
\ifSourceHanSCandFandol
  \setmainfont{TeX Gyre Pagella}[
    Scale=1.0534682080924855,
    WordSpace={0.8984910836762689,1.2030178326474623,0.6954732510288066},
    SmallCapsFeatures={LetterSpace=5}
  ]
  \setsansfont{TeX Gyre Heros}[
    Scale=1.0068587105624143,
    WordSpace={0.7863093721208319,1.4273812557583361,0.3589281163624958}
  ]
  \setmonofont{Source Han Sans SC}[
    BoldFont=Source Han Sans SC Bold,
    CharacterWidth=Half
  ]
  \setmathfont{TeX Gyre Pagella Math}[
    Scale=1.0534682080924855
  ]
  \setCJKmainfont{Source Han Serif SC Medium}[
    ItalicFont=FandolKai-Regular,
    ItalicFeatures={FakeBold=1},
    BoldFont=Source Han Serif SC Bold,
    BoldItalicFont=FandolKai-Regular,
    BoldItalicFeatures={FakeBold=3},
    CharacterWidth=Full
  ]
  \usepackage{etoolbox}
  \makeatletter
  \newcommand*\original@CJKsymbol{}
  \newcommand*\original@CJKpunctsymbol{}
  \let\original@CJKsymbol\CJKsymbol
  \let\original@CJKpunctsymbol\CJKpunctsymbol
  \newcommand*\raise@Fandol@CJK[1]{\raise0.08\ccwd\hbox{#1}}
  \appto\itshape{%
    \let\CJKsymbol\raise@Fandol@CJK
    \let\CJKpunctsymbol\raise@Fandol@CJK
  }
  \appto\upshape{%
    \let\CJKsymbol\original@CJKsymbol
    \let\CJKpunctsymbol\original@CJKpunctsymbol
  }
  \makeatother
  \setCJKsansfont{Source Han Sans SC}[
    BoldFont=Source Han Sans SC Bold,
    CharacterWidth=Full
  ]
  \setCJKmonofont{Source Han Sans SC}[
    BoldFont=Source Han Sans SC Bold,
    CharacterWidth=Full
  ]
\else
  \setmainfont{TeX Gyre Pagella}[
    SmallCapsFeatures={LetterSpace=5}
  ]
  \setsansfont{TeX Gyre Heros}
  \setmathfont{TeX Gyre Pagella Math}
\fi
\usepackage{zhlineskip}
\SetTextEnvironmentSinglespace{1.05}
\SetMathEnvironmentSinglespace{1.05}
\ifSourceHanSCandFandol
  \SetTextEnvironmentSinglespace{1.106}
  \SetMathEnvironmentSinglespace{1.106}
\fi
\usepackage{caption}
\DeclareCaptionLabelSeparator{zhcolon}{~:}% U+FF1A, Fullwidth Colon
\captionsetup{labelsep=zhcolon,format=hang}
\usepackage{enumitem}
\setlist{
  listparindent=\parindent,parsep=\parskip
}
\ifSourceHanSCandFandol
  \setlist[itemize,1]{
    itemsep=0pt,
    label=・,% U+30FB, Katakana Middle Dot
    leftmargin=\parindent,labelsep=0pt,labelwidth=0.5\parindent
  }
\else
  \setlist[itemize,1]{
    itemsep=0pt,
    label=·,% U+00B7, Middle Dot
    leftmargin=\parindent,labelsep=0pt,labelwidth=0.5\parindent
  }
\fi
\setlist[description,1]{
  font=\mdseries,
  leftmargin=\parindent,labelsep=0.5\parindent
}
\usepackage{booktabs}
\usepackage{hyperref}
\hypersetup{
  colorlinks=true,
  pdfstartview={FitH},
  unicode=true,
  pdftitle={zhlineskip-man},
  pdfauthor={张瑞熹}
}
\usepackage[open,openlevel=-1,numbered]{bookmark}
\usepackage[width=378bp]{geometry}

\makeatletter
\ifSourceHanSCandFandol
  \ExplSyntaxOn
  \xeCJK_new_class:n { PoZheHao }
  \__xeCJK_save_CJK_class:n { PoZheHao }
  \seq_map_inline:Nn \g__xeCJK_class_seq
    {
      \str_if_eq:nnF {#1} { PoZheHao }
        {
          \xeCJK_copy_inter_class_toks:nnnn { PoZheHao } {#1} { FullRight } {#1}
          \xeCJK_copy_inter_class_toks:nnnn {#1} { PoZheHao } {#1} { FullRight }
        }
    }
  \xeCJK_declare_char_class:nn { PoZheHao } { "2014 , "2015 }
  \ExplSyntaxOff
\fi
% From `doc.dtx'
\ifx\l@nohyphenation\undefined
  \newlanguage\l@nohyphenation
\fi
\newcommand*\meta{}
\DeclareRobustCommand\meta[1]{%
     \ensuremath\langle
     \ifmmode \expandafter \nfss@text \fi
     {%
      \meta@font@select
      \edef\meta@hyphen@restore
        {\hyphenchar\the\font\the\hyphenchar\font}%
      \hyphenchar\font\m@ne
      \language\l@nohyphenation
      #1\/%
      \meta@hyphen@restore
     }\ensuremath\rangle
}
\def\meta@font@select{\itshape}
% From `ltxdoc.dtx'
\newcommand*\cmd[1]{\cs{\expandafter\cmd@to@cs\string#1}}
\def\cmd@to@cs#1#2{\char\number`#2\relax}
\newcommand*\cs{}
\DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}}
\newcommand\marg[1]{%
  {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
\newcommand\oarg[1]{%
  {\ttfamily[}\meta{#1}{\ttfamily]}}
\newcommand\parg[1]{%
  {\ttfamily(}\meta{#1}{\ttfamily)}}
% My commands
\newcommand\cls[1]{{\normalfont\ttfamily#1}}
\newcommand\pkg[1]{{\normalfont\ttfamily#1}}
\newcommand\opt[1]{{\normalfont\ttfamily#1}}
\newcommand\env[1]{{\normalfont\ttfamily#1}}
\newcommand*\packagedependency[1]{%
  \mbox{\pkg{#1}~宏包:}\ignorespaces
}
\newcommand*\keyvalueitem[3][2.5]{%
  \item[\opt{#2}\hskip0.5\ccwd\relax\rlap{\meta{#3}}\hskip#1\ccwd\relax]%
  \hskip\z@ \@plus 0.25\ccwd \@minus 0.25\ccwd
  \ignorespaces
}
\newcommand*\usercmditem[3][3]{%
  \item[\cmd{#2}\rlap{\marg{#3}}\hskip#1\ccwd\relax]%
  \hskip\z@ \@plus 0.25\ccwd \@minus 0.25\ccwd
  \ignorespaces
}
\newcommand*\defaultleadingratio[3]{%
  \opt{#1} & $#2$ & $#3$%
}
\newcommand*\fontandsinglespaceratio[2]{%
  #1 & $#2$%
}
\newenvironment{originalpmatrix}{\left(\env@matrix}{\endmatrix\right)}
\newenvironment{originalcases}{\env@cases}{\endarray\right.}
\newcommand*\myemail{ruixizhang42@gmail.com}
\makeatother

\title{\vspace*{-26bp}\pkg{zhlineskip} 宏包}
\author{张瑞熹\thanks{\href{mailto:\myemail}{\nolinkurl{\myemail}}。}}
\date{2018/11/30\hskip\ccwd\relax v1.0d}

\begin{document}

\maketitle

\tableofcontents

\section{简介}

\pkg{zhlineskip} 宏包允许用户指定正文行距相比于正文字号的倍数(通常建议设置在
$1.5$ 至 $1.67$ 之间),以及脚注行距相比于脚注字号的倍数。另一方面,由于数学公式
主要是由西文字符构成的,\pkg{zhlineskip} 还能将数学公式的行距“恢复”成西文
较为紧凑的行距(通常为西文字号的 $1.2$~倍),使得全文的视觉密度较为均匀。最后,
本宏包还支持按照 Microsoft Word 进行“多倍行距”排版。

\subsection{宏包依赖}

本宏包是针对中日韩文的横排文档设计出来的,它依赖于下面这些宏包:
\begin{itemize}
\item \packagedependency{kvoptions}
为用户提供载入本宏包的键值选项。
\item \packagedependency{xintexpr~}
实现精确的浮点运算,属于 \pkg{xint} 宏集的一个部分。
\item \packagedependency{etoolbox~}
处理脚注行距与数学行距时需要打补丁。
\item \packagedependency{mathtools}
只有在恢复数学行距为西文行距时,才会载入这个宏包。
\end{itemize}
请确保你的 \TeX\ 发行版里已经安装好了以上这些宏包的最新版本。

\subsection{中西有别}

在西文排版里,相邻两行\emph{基线}(baseline)之间的距离称为\emph{行距}(leading,
发音为 led-ding)。这个词的词根是 lead,即\emph{铅}。早在铅字时代,每当工匠填满
一行铅字之后要开始填下一行,都会在两行之间插入铅条,从而适当地扩大行距。因为西文的
每个字母四周与其\emph{字框}(em-box,见图~\ref{fig:eng-font-size})之间有
较大的空隙,所以不需要插入很高的铅条。一般来说,西文的行距为\emph{字号}(font
size)的 $1.2$ 至 $1.45$~倍\footnote{参见
\url{https://practicaltypography.com/line-spacing.html}。}。

\begin{figure}[h]
\centering
\includegraphics{Latinmetrics}
\caption[西文字体]{西文字体。绿色方框即为 em-box,它在纸上的实际边长就是西文字号。}
\label{fig:eng-font-size}
\end{figure}

中文排版虽然没有基线的概念,但有非常相似的概念:\emph{底线}(ideographic baseline,
见图~\ref{fig:chi-font-size})。中文里相邻两行底线之间的距离,与西文里行距的
概念是一致的。另一概念是上一行底线和下一行\emph{顶线}之间的距离,即\emph{行间距}(line
gap),这与西文里插入铅条的高度是一致的。由于汉字四周与其字框间的空隙较小,所以需要
使用比西文更大的行间距。根据场合不同,行间距从字号的 $1/4$ 至 $1$~倍不等:以中文
书刊为例,行间距一般为字号的 $1/2$ 至 $2/3$~倍\footnote{参见张胜涛、王忆波著
《方正飞腾4.0实用培训教程》,第~6.1.1~节。},即行距约为字号的 $1.5$ 至 $1.67$~倍。

\begin{figure}[h]
\centering
\includegraphics{CJKmetrics}
\caption[中文字体]{中文字体。汉字字面几乎占满整个字框,字框的边长即为中文字号。}
\label{fig:chi-font-size}
\end{figure}

在一般情况下,\CTeX\ 会默认用 \opt{linespread=1.3} 这个文档类选项将中文的
行距设置为字号的 $1.56$~倍(基础行距是字号的 $1.2$~倍,而 $1.2 \times 1.3
= 1.56$)。通过这种方法扩大全文的行距,自然会影响到文章里数学公式的行距。而数学
公式主要是由西文字符构成的,把它们按照中文的行距进行排版,就会显得有些松散。
图~\ref{fig:math-leading} 左边是 \CTeX\ 默认排版效果,文本、数学看似
一紧、一松;右边是配合用 \pkg{zhlineskip} 的效果,视觉密度比较均匀。
\pkg{zhlineskip} 宏包还允许用户调整数学行距的大小。

\begin{figure}[h]
\sbox0{%
\begin{minipage}[t]{162pt}
\fontsize{9}{10.8}\linespread{1.3}\selectfont
\rule{0pt}{\ht\strutbox}\hskip2\ccwd\relax
设 $\symbf{I}_2=\begin{psmallmatrix} 1&0\\0&1 \end{psmallmatrix}$.
又设 $\symbf{A}=(a_{ij})_{m \times n}$ 为一个 $m$~行 $n$~列的实值矩阵, 即
\[
\symbf{A} = \begin{originalpmatrix}
a_{11} & a_{12} & \dotsc & a_{1n} \\
a_{21} & a_{22} & \dotsc & a_{2n} \\
\vdots & \vdots &        & \vdots \\
a_{m1} & a_{m2} & \dotsc & a_{mn}
\end{originalpmatrix},
\]
其中 $a_{ij} \in \mathbb{R}$, $i=1,\dotsc,m$, $j=1,\dotsc,n$.
又因为
\[
\sum_{\substack{i=1\\i\neq j}}^m a_{ij} = \begin{originalcases}
0, & j=1,\\
1, & j>1,
\end{originalcases}
\]
我们得到……\rule[-\dp\strutbox]{0pt}{\dp\strutbox}
\end{minipage}%
}%
\centering
\rule[\dimexpr-\dp0-0.5em\relax]{0.4pt}{\dimexpr\dp0+\ht0+1em\relax}\quad
\copy0\quad
\rule[\dimexpr-\dp0-0.5em\relax]{0.4pt}{\dimexpr\dp0+\ht0+1em\relax}\quad
\begin{minipage}[t]{162pt}
\fontsize{9}{10.8}\linespread{1.25}\selectfont
\hskip2\ccwd\relax
设 $\symbf{I}_2=\begin{psmallmatrix} 1&0\\0&1 \end{psmallmatrix}$.
又设 $\symbf{A}=(a_{ij})_{m \times n}$ 为一个 $m$~行 $n$~列的实值矩阵, 即
\[
\symbf{A} = \begin{pmatrix}
a_{11} & a_{12} & \dotsc & a_{1n} \\
a_{21} & a_{22} & \dotsc & a_{2n} \\
\vdots & \vdots &        & \vdots \\
a_{m1} & a_{m2} & \dotsc & a_{mn}
\end{pmatrix},
\]
其中 $a_{ij} \in \mathbb{R}$, $i=1,\dotsc,m$, $j=1,\dotsc,n$.
又因为
\[
\sum_{\substack{i=1\\i\neq j}}^m a_{ij} = \begin{cases}
0, & j=1,\\
1, & j>1,
\end{cases}
\]
我们得到……
\end{minipage}\quad
\rule[\dimexpr-\dp0-0.5em\relax]{0.4pt}{\dimexpr\dp0+\ht0+1em\relax}%
\llap{\rule[\dimexpr-\dp0-0.5em\relax]{\dimexpr2\wd0+4em+1.2pt\relax}{0.4pt}}%
\llap{\rule[\dimexpr\ht0+0.5em-0.4pt\relax]{\dimexpr2\wd0+4em+1.2pt\relax}{0.4pt}}
\caption[数学行距对比]{数学行距对比。在左图中,大矩阵 \env{pmatrix} 与分类
  \env{cases} 两个环境受到影响,行距都被扩大了;但第一行文本里的小矩阵与末尾
  公式里求和号的下角标却没有受到影响,行距仍然较为紧凑。在右图中,数学公式的行距
  都是西文的行距,密度比较均匀,行间公式里的大括弧、大括号也不会特别突兀。}
\label{fig:math-leading}
\end{figure}

综上所述,在进行中西文混排时,最好能够区分中文与西文的行距。在使用 \pkg{zhlineskip}
时,就可以分开处理中文文本与数学公式的行距。用户甚至还能分别指定正文行距与脚注
行距,实现灵活的排版。同时,\pkg{zhlineskip} 宏包能恢复各种“多行”数学环境
(包括矩阵、分类、多行公式推导等等)的行距,使数学公式的行距符合西文行距的规范。

最后,\pkg{zhlineskip} 宏包还支持用户在一定范围内按 Microsoft Word 的
“多倍行距”进行排版\footnote{本宏包默认假定“被要求”用的字体是中易系列字体,
这包括 Microsoft Word 里的“宋体”、“黑体”、“楷体”与“仿宋”。若改用其他字体,
可能需要调整 \opt{MSWordSinglespaceRatio} 的值。
参见第~\ref{sec:key-value}~节与第~\ref{sec:MS-Word}~节。}。
用户可以指定“多倍行距”的“倍数”,但是这只保证用 \TeX\ 排出来的文本行距与用
Microsoft Word 排的行距相同。硬要用 \TeX\ 模仿 Microsoft Word 是没有
太大意义的。

\section{功能介绍}

首先,请避免使用“多倍行距”这个概念:Microsoft Word 中“单倍行距”的值严重依赖于
字体(参见第~\ref{sec:MS-Word}~节)。在严格排版的时候,一般都会给定具体的字号
与行距,例如字号 $12$~磅、行距 $22$~磅。对于一般的用户,指定目标行距相比字号的
倍数即可——\pkg{zhlineskip} 宏包可以自动提取基础行距(即 \TeX\ 中的单倍行距)
相比字号的倍数(详见表~\ref{tab:default-leading-ratio}),再通过用户指定的
倍数来计算所需的行伸展因子。因此,不论是中日韩文还是西文的横排文档,都是可以使用
本宏包的。本宏包的缺省设置更适合中日韩文文档。
\begin{table}[h]
\centering
\caption[基础行距倍数]{\cls{ctexart} 与 \cls{article} 各个文档类选项
  设置的基础行距倍数。}
\label{tab:default-leading-ratio}
\begin{tabular}{l l l}
\toprule
文档类选项 & 正文基础行距 & 脚注基础行距 \\
\midrule
\defaultleadingratio{zihao=5}{1.2}{1.2} \\
\defaultleadingratio{zihao=-4}{1.2}{1.2} \\
\defaultleadingratio{10pt}{12/10}{9.5/8} \\
\defaultleadingratio{11pt}{13.6/10.95}{11/9} \\
\defaultleadingratio{12pt}{14.5/12}{12/10} \\
\bottomrule
\end{tabular}
\end{table}

\subsection{载入宏包时的键值选项}
\label{sec:key-value}

载入 \pkg{zhlineskip} 宏包时可以设定六个基本的键值选项,它们分别是:
\begin{description}
\keyvalueitem{bodytextleadingratio}{real}
指定正文目标行距相比于正文字号的倍数。以书刊为例,建议设置在~$1.5$ 至~$1.67$
之间。缺省值是~\opt{1.5},即 $1/2$~的行间距。
\keyvalueitem{footnoteleadingratio}{real}
指定脚注目标行距相比于脚注字号的倍数,它可以比正文的倍数稍小一些,建议设置在正文
倍数的 $98\%$ 至 $100\%$ 之间。缺省值是~\opt{1.48},即大约为正文倍数的~$98.67\%$。
\keyvalueitem{restoremathleading}{bool}
指定是否要将数学公式的行距恢复成西文基础行距。缺省值是~\opt{true},即恢复数学
行距。该选项为真时,会自动载入 \pkg{mathtools} 宏包,此时还能利用
\cmd{\SetMathEnvironmentSinglespace}\marg{real}
命令\emph{微调}数学公式的基础行距。
\keyvalueitem{UseMSWordMultipleLineSpacing}{bool}
在排版论文时,如果被要求按照 Microsoft Word 来设置“多倍行距”,那么用户可以
将该选项设置为~\opt{true},并通过设置 \opt{MSWordLineSpacingMultiple}
指定“倍数”,这会忽略用户之前指定的正文行距与脚注行距倍数,但是与数学行距的设置
独立。该选项的缺省值是~\opt{false}。
\keyvalueitem{MSWordLineSpacingMultiple}{real}
设置 Microsoft Word“多倍行距”的“倍数”,
仅在 \opt{UseMSWordMultipleLineSpacing} 为真时生效。
缺省值是~\opt{1.15},在不修改 \opt{MSWordSinglespaceRatio} 时,
相当于设置了目标行距为字号的 $1.49140625$~倍,适用于中易字体
(参见第~\ref{sec:MS-Word}~节)。
\keyvalueitem{MSWordSinglespaceRatio}{real}
设置 Microsoft Word 的“单倍行距”相比字号的倍数,
仅在 \opt{UseMSWordMultipleLineSpacing} 为真时生效。
缺省值是~\opt{1.296875},适用于中易字体(参见第~\ref{sec:MS-Word}~节)。
若改用其他字体,则需调整该选项的值。
\end{description}

\subsection{载入宏包后的用户命令}

\subsubsection{调整数学公式的行距}

当键值选项 \opt{restoremathleading} 为~\opt{true} 时,数学公式的行距被
恢复成字号的 $1.2$~倍。对于某些字面较大的数学字体(例如类似 Palatino 的字体),
这个基础行距会显得过小。此时,用户可以通过如下命令微调数学行距:
\begin{description}
\usercmditem{\SetMathEnvironmentSinglespace}{real}
如果数学字体来自 \pkg{newpxmath} 或是 TeX Gyre Pagella Math,那么
数学行距在字号 $1.2$~倍的基础上再扩大 $1.05$~倍更加合适。此时,只需指定
\verb|\SetMathEnvironmentSinglespace{1.05}| 即可。
\end{description}
本宏包恢复的多行数学环境包括:
\begin{description}
\raggedright
\item[\LaTeX\ 环境]
\env{array};
\item[\pkg{amsmath} 宏包各环境]
\env{matrix},
\env{pmatrix},
\env{bmatrix},
\env{Bmatrix},
\env{vmatrix},
\env{Vmatrix},
\env{cases},
\env{aligned},
\env{alignedat},
\env{gathered},
\env{gather},
\env{gather*},
\env{align},
\env{align*},
\env{flalign},
\env{flalign*},
\env{alignat},
\env{alignat*},
\env{xalignat},
\env{xalignat*},
\env{xxalignat},
\env{multline},
\env{multline*},
\env{split};
\item[\pkg{mathtools} 宏包各环境]
\env{matrix*},
\env{pmatrix*},
\env{bmatrix*},
\env{Bmatrix*},
\env{vmatrix*},
\env{Vmatrix*},
\env{cases*},
\env{dcases},
\env{dcases*},
\env{rcases},
\env{rcases*},
\env{drcases},
\env{drcases*},
\env{multlined},
\env{lgathered},
\env{rgathered}。
\end{description}
超出上述列表范围、用户自定义的\emph{数学}环境,可用如下命令恢复其行距:
\begin{description}
\usercmditem[6]{\RestoreMathEnvironmentLeading}{env name}
使用范例:本宏包恢复数学环境 \env{array} 的行距,通过
\verb|\RestoreMathEnvironmentLeading{array}| 实现。
\end{description}

\emph{注意,在 \opt{restoremathleading} 为~\opt{false} 时,
\cmd{\SetMathEnvironmentSinglespace}
与 \cmd{\RestoreMathEnvironmentLeading} 无效。}

\subsubsection{调整西文文本的行距}

与数学行距命令对应,本宏包还提供两个调整\emph{西文文本}行距的命令,用法类似。
\begin{description}
\usercmditem{\SetTextEnvironmentSinglespace}{real}
如果西文字体来自 \pkg{newpxtext} 或是 TeX Gyre Pagella,那么可以指定
\verb|\SetTextEnvironmentSinglespace{1.05}|。
\usercmditem[6]{\RestoreTextEnvironmentLeading}{env name}
使用范例:假设文中的表格仅含西文、数字,此时如果想要文本环境 \env{tabular} 的
行距与西文行距一致,可通过
\verb|\RestoreTextEnvironmentLeading{tabular}| 实现。
\end{description}

如果作者没有顾及到某些\emph{基本环境}(数学或文本),鼓励用户向 \pkg{zhlineskip} 的
\href{https://github.com/CTeX-org/ctex-kit/issues}{GitHub 维护页}%
提供相关信息。

\subsection{使用范例}

下面以 \CTeX\ 提供的 \cls{ctexart} 文档类为例,展示 \pkg{zhlineskip} 的
使用方法。

\subsubsection*{例:直接载入}

\begin{verbatim}
    \documentclass{ctexart}
    \usepackage{zhlineskip}
    \begin{document}
    正文测试。
    \end{document}
\end{verbatim}

\subsubsection*{例:设置正文行距为字号的 1.6~倍}

\begin{verbatim}
    \documentclass{ctexart}
    \usepackage[
        bodytextleadingratio=1.6, % 设置正文行距倍数为 1.6
        footnoteleadingratio=1.57 % 设置脚注行距倍数为 1.57
      ]{zhlineskip}               % 缺省数学行距倍数为 1.2
    \begin{document}
    正文测试。
    \end{document}
\end{verbatim}

\subsubsection*{例:按照 Microsoft Word 设置“1.62~倍行距”}

\begin{verbatim}
    \documentclass{ctexart}
    \usepackage[
        restoremathleading=false,
        UseMSWordMultipleLineSpacing,
        MSWordLineSpacingMultiple=1.62
      ]{zhlineskip}
    \begin{document}
    按照 Microsoft Word 设置 1.62~倍行距。
    \end{document}
\end{verbatim}

\subsubsection*{例:中文正文里需要插入成段的西文}

如果插入的西文是引用参考文献的段落,那么使用 \env{quote} 或 \env{quotation}
环境就比较合适。此时,可以直接在引用环境内部使用 \cmd{\linespread}\marg{real}
命令,建议将 \meta{real} 设置在正文行距倍数的 $0.7$~倍左右。例如,在载入
\pkg{zhlineskip} 宏包后,正文行距为字号的 $1.5$~倍,那么
\verb|\linespread{1.05}| 就比较合适($1.5 \times 0.7 = 1.05$)。
\begin{verbatim}
    \documentclass{ctexart}
    \usepackage{zhlineskip}
    \begin{document}
    下面引用一段出自英文文献的段落:
    \begin{quotation}
    \linespread{1.05}\selectfont % 此处数值为正文行距倍数的 0.7 倍左右
    A quotation from English literature.
    \end{quotation}
    \end{document}
\end{verbatim}

\subsection{Microsoft Word 中的“单倍行距”}
\label{sec:MS-Word}

Microsoft Word 中“单倍行距”的设置,其行距值相比字号的倍数严重依赖于字体,
甚至还可能因为操作系统的不同而迥然不同。表~\ref{tab:word-line-height} 列出
几种常见字体对应的单倍行距倍数。正是因为“单倍行距”本身随字体、操作系统而变化,
所以请尽量避免使用“多倍行距”的概念!
\begin{table}[h]
\centering
\caption[单倍行距倍数]{在 Microsoft Word 中设置“单倍行距”后,实际的行距
  依赖于字体。}
\label{tab:word-line-height}
\begin{tabular}{l l}
\toprule
字体名称 & “单倍行距”除以字号的倍数 \\
\midrule
\fontandsinglespaceratio{Arial}{2355/2048=1.14990234375} \\
\fontandsinglespaceratio{Times New Roman}{2355/2048=1.14990234375} \\
\fontandsinglespaceratio{中易系列字体}{\phantom0332/256\phantom0=1.296875} \\
\fontandsinglespaceratio{华文中宋(Windows)}{1479/1000=1.479} \\
\fontandsinglespaceratio{微软雅黑 Light(Windows)}{3400/2048=1.66015625} \\
\fontandsinglespaceratio{微软雅黑 Regular/Bold}{3513/2048=1.71533203125} \\
\fontandsinglespaceratio{华文中宋(macOS)}{1723/1000=1.723} \\
\fontandsinglespaceratio{微软雅黑 Light(macOS)}{3542/2048=1.7294921875} \\
\fontandsinglespaceratio{苹方(macOS)}{1820/1000=1.82} \\
\fontandsinglespaceratio{思源宋体~1.001}{1869/1000=1.869} \\
\fontandsinglespaceratio{思源黑体~2.000}{1882/1000=1.882} \\
\fontandsinglespaceratio{思源黑体~1.004}{1924/1000=1.924} \\
\bottomrule
\end{tabular}
\end{table}

\begin{thebibliography}{9}
\bibitem{butterick2018linespacing}
\textsc{Butterick, Matthew}.
\newblock \textit{Butterick's Practical Typography\textup:
  Line spacing}.
\newblock \url{https://practicaltypography.com/line-spacing.html},
  访问日期: 2018/10/28.

\bibitem{knuth1986tex}
\textsc{Knuth, Donald Ervin}.
\newblock \textit{The \TeX book}.
\newblock Addison--Wesley, 1986.

\bibitem{lunde2008cjkv}
\textsc{Lunde, Ken}.
\newblock \textit{CJKV Information Processing\textup:
  Chinese\textup, Japanese\textup, Korean \textup\&
  Vietnamese Computing} (2~ed.).
\newblock O'Reilly Media, Inc., 2008.

\bibitem{zhang2005fang}
\textsc{张胜涛, 王忆波}.
\newblock \textit{方正飞腾4.0实用培训教程}.
\newblock 清华大学出版社, 2005.
\end{thebibliography}

\end{document}