-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathatom.xml
577 lines (292 loc) · 448 KB
/
atom.xml
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
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>お前はどこまで見えている</title>
<subtitle>僕たちは そうやって どこまで行くのだろう、どこまで行けるのだろう</subtitle>
<link href="https://hotarugali.github.io/atom.xml" rel="self"/>
<link href="https://hotarugali.github.io/"/>
<updated>2021-04-12T07:14:08.284Z</updated>
<id>https://hotarugali.github.io/</id>
<author>
<name>hotarugali</name>
</author>
<generator uri="https://hexo.io/">Hexo</generator>
<entry>
<title>TypeScript系列资料</title>
<link href="https://hotarugali.github.io/2021/04/08/JavaScript/TypeScript/TypeScript%E7%B3%BB%E5%88%97%E8%B5%84%E6%96%99/"/>
<id>https://hotarugali.github.io/2021/04/08/JavaScript/TypeScript/TypeScript%E7%B3%BB%E5%88%97%E8%B5%84%E6%96%99/</id>
<published>2021-04-08T15:43:03.000Z</published>
<updated>2021-04-12T07:14:08.284Z</updated>
<content type="html"><![CDATA[<ul><li><a href="https://www.tslang.cn/docs/handbook/basic-types.html">官方手册</a></li><li><a href="https://liiked.github.io/VS-Code-Extension-Doc-ZH/">TypeScript 开发 VSCode 插件</a></li></ul>]]></content>
<summary type="html"><ul>
<li><a href="https://www.tslang.cn/docs/handbook/basic-types.html">官方手册</a></li>
<li><a href="https://liiked.github.io/VS-Code-Extensio</summary>
<category term="JavaScript" scheme="https://hotarugali.github.io/categories/JavaScript/"/>
<category term="TypeScript" scheme="https://hotarugali.github.io/categories/JavaScript/TypeScript/"/>
<category term="JavaScript" scheme="https://hotarugali.github.io/tags/JavaScript/"/>
<category term="TypeScript" scheme="https://hotarugali.github.io/tags/TypeScript/"/>
</entry>
<entry>
<title>XBM格式</title>
<link href="https://hotarugali.github.io/2021/04/06/ImageCompression/XBM%E6%A0%BC%E5%BC%8F/"/>
<id>https://hotarugali.github.io/2021/04/06/ImageCompression/XBM%E6%A0%BC%E5%BC%8F/</id>
<published>2021-04-06T08:42:52.000Z</published>
<updated>2021-04-12T07:14:08.324Z</updated>
<content type="html"><![CDATA[<h2 id="1-简介">1. 简介</h2><p>XBM 是一种最简单的一种图像格式,不像其他图像格式那样最终存储的二进制数据,XBM 图像格式存的是 C 源码。XBM 格式基本只在 X Windows 系统上使用,只支持两种颜色。相较于 BMP 格式,XBM 格式更像是 BMP 图像在 Windows 下的 icon 文件。</p><p>【注】XBM 格式在 X Windows 环境外几乎很少用到。</p><h2 id="2-格式">2. 格式</h2><h3 id="2-1-详解">2.1 详解</h3><p>XBM 图像格式示例如下:</p><figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">define</span> imagename_width 16</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> imagename_height 2</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> imagename_hot_x 1</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> imagename_hot_y 1</span></span><br><span class="line"><span class="keyword">static</span> <span class="keyword">unsigned</span> <span class="keyword">char</span> imagename_bits[] = {<span class="number">0x10</span>, <span class="number">0x10</span>, <span class="number">0x10</span>, <span class="number">0x10</span>};</span><br></pre></td></tr></table></figure><p>其中,<code>imagename</code> 为具体的 XBM 文件名;<code>imagename_width</code> 和 <code>imagename_height</code> 分别表示图像的宽度和高度;<code>imagename_hot_x</code> 和 <code>imagename_hot_y</code> 分别表示 hotspot 的位置(hotspot 是用来表示光标的在图像中的绝对位置);最后的一维 <code>imagename_bits</code> 数组表示图像的像素信息,每个字节表示 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn></mrow><annotation encoding="application/x-tex">8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> 个像素信息。图像的像素信息是按照从上到下、从左到右的顺序存储在 <code>imagename_bits</code> 数组中,如果图像的宽度不是 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn></mrow><annotation encoding="application/x-tex">8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> 的整数倍,则每一行最后字节中额外的比特数将不被使用。</p><ul><li>XBM 图像中像素数据实际占用的空间大小为:</li></ul><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>b</mi><mi>y</mi><mi>t</mi><mi>e</mi><mi>s</mi><mo>=</mo><mi>h</mi><mi>e</mi><mi>i</mi><mi>g</mi><mi>h</mi><mi>t</mi><mo>×</mo><mfrac><mrow><mi>w</mi><mi>i</mi><mi>d</mi><mi>t</mi><mi>h</mi><mo>+</mo><mn>7</mn></mrow><mn>8</mn></mfrac></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}bytes = height \times \frac{width + 7}{8}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.240108em;vertical-align:-0.37005399999999994em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8700540000000001em;"><span style="top:-2.9899459999999998em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">b</span><span class="mord mathnormal" style="margin-right:0.03588em;">y</span><span class="mord mathnormal">t</span><span class="mord mathnormal">e</span><span class="mord mathnormal">s</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord mathnormal">h</span><span class="mord mathnormal">e</span><span class="mord mathnormal">i</span><span class="mord mathnormal" style="margin-right:0.03588em;">g</span><span class="mord mathnormal">h</span><span class="mord mathnormal">t</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">×</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8801079999999999em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">8</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.02691em;">w</span><span class="mord mathnormal mtight">i</span><span class="mord mathnormal mtight">d</span><span class="mord mathnormal mtight">t</span><span class="mord mathnormal mtight">h</span><span class="mbin mtight">+</span><span class="mord mtight">7</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.37005399999999994em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><ul><li>XBM 图像是二值图像,不包含色彩信息。比特值 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> 表示和背景色相同,比特值 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow><annotation encoding="application/x-tex">1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span> 表示和前景色相同。</li></ul><h3 id="2-2-注意事项">2.2 注意事项</h3><p>虽然 XBM 本质上是符合 C 语言语法的源文件,但在写 XBM 文件时,需要注意以下事项,否则可能导致 XBM 文件无法被软件正常读取显示:</p><ul><li>不要使用空白行。</li><li>不要使用注释。</li><li>按照格式详解中的给出的顺序书写各个字段。</li><li><code>#define</code> 定义的数值需要写成十进制格式。</li><li>在 <code>#</code> 和 <code>define</code> 之间不能有空格。</li><li>像素数据需要使用十六进制书写。</li></ul>]]></content>
<summary type="html"><h2 id="1-简介">1. 简介</h2>
<p>XBM 是一种最简单的一种图像格式,不像其他图像格式那样最终存储的二进制数据,XBM 图像格式存的是 C 源码。XBM 格式基本只在 X Windows 系统上使用,只支持两种颜色。相较于 BMP 格式,XBM 格式更像是 </summary>
<category term="ImageCompression" scheme="https://hotarugali.github.io/categories/ImageCompression/"/>
<category term="ImageCompression" scheme="https://hotarugali.github.io/tags/ImageCompression/"/>
</entry>
<entry>
<title>LaTeX色彩</title>
<link href="https://hotarugali.github.io/2021/04/03/TeX/LaTeX/LaTeX%E8%89%B2%E5%BD%A9/"/>
<id>https://hotarugali.github.io/2021/04/03/TeX/LaTeX/LaTeX%E8%89%B2%E5%BD%A9/</id>
<published>2021-04-03T15:41:46.000Z</published>
<updated>2021-04-12T07:14:08.287Z</updated>
<content type="html"><![CDATA[<p>【注】笔记来自《LaTeX入门》——刘海洋。</p><h2 id="1-简介">1. 简介</h2><p>原始的 TeX 引擎不支持彩色,有关彩色的功能都是由输出 PS、PDF 格式的 TeX 引擎或驱动提供的,有关命令是在绘图相关的扩展宏包中定义的。基本的彩色支持工具是 <code>color</code> 宏包,它是 LaTeX 的基本组件,<code>graphics</code> 工具包的一部分。</p><h2 id="2-基础">2. 基础</h2><h3 id="2-1-预定义颜色">2.1 预定义颜色</h3><p>在标准的 <code>color</code> 宏包中只有几种原色是预定义的,分别是:</p><ul><li>黑白颜色:<code>black</code>(黑)、<code>white</code>(白)</li><li>色光三原色:<code>red</code>(红)、<code>green</code>(绿)、<code>blue</code>(蓝)</li><li>印刷三原色:<code>cyan</code>(青)、<code>magenta</code>(品红)、<code>yellow</code>(黄)</li></ul><p>这三类原色分别使用三种不同的色彩模型:gray(灰度)、rgb(红绿蓝)和 cmyk(青品红黄黑)。在使用颜色时,除了可以使用预定义的颜色外,还可以给颜色命令指定模型,然后使用色彩模型下的几个分量 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">[0,1]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">1</span><span class="mclose">]</span></span></span></span> 之间的数值来表示具体颜色。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 命令解释见下文</span></span><br><span class="line"><span class="keyword">\textcolor</span>[gray]{0.5}{50<span class="keyword">\%</span> 灰色}</span><br><span class="line"><span class="keyword">\color</span>[rgb]{0.6,0.6,0} 暗黄色</span><br></pre></td></tr></table></figure><p>还有一种由输出驱动直接支持的 <code>named</code> 名称模型,比如在 Dvips 驱动下,可以给用 <code>usenames</code> 宏包选项直接调用下图中的各种色彩名,并加以色彩强度。</p><table> <tr> <td>名称</td> <td>颜色</td> <td>数值</td> <td>名称</td> <td>颜色</td> <td>数值</td> </tr> <tr> <tr> <td>Apricot</td><td bgcolor="#FBB982"></td> <td>#FBB982</td> <td>Aquamarine</td><td bgcolor="#00B5BE"></td> <td>#00B5BE</td> </tr> <tr> <td>Bittersweet</td><td bgcolor="#C04F17"></td> <td>#C04F17</td> <td>Black</td><td bgcolor="#221E1F"></td> <td>#221E1F</td> </tr> <tr> <td>Blue</td><td bgcolor="#2D2F92"></td> <td>#2D2F92</td> <td>BlueGreen</td><td bgcolor="#00B3B8"></td> <td>#00B3B8</td> </tr> <tr> <td>BlueViolet</td><td bgcolor="#473992"></td> <td>#473992</td> <td>BrickRed</td><td bgcolor="#B6321C"></td> <td>#B6321C</td> </tr> <tr> <td>Brown</td><td bgcolor="#792500"></td> <td>#792500</td> <td>BurntOrange</td><td bgcolor="#F7921D"></td> <td>#F7921D</td> </tr> <tr> <td>CadetBlue</td><td bgcolor="#74729A"></td> <td>#74729A</td> <td>CarnationPink</td><td bgcolor="#F282B4"></td> <td>#F282B4</td> </tr> <tr> <td>Cerulean</td><td bgcolor="#00A2E3"></td> <td>#00A2E3</td> <td>CornflowerBlue</td><td bgcolor="#41B0E4"></td> <td>#41B0E4</td> </tr> <tr> <td>Cyan</td><td bgcolor="#00AEEF"></td> <td>#00AEEF</td> <td>Dandelion</td><td bgcolor="#FDBC42"></td> <td>#FDBC42</td> </tr> <tr> <td>DarkOrchid</td><td bgcolor="#A4538A"></td> <td>#A4538A</td> <td>Emerald</td><td bgcolor="#00A99D"></td> <td>#00A99D</td> </tr> <tr> <td>ForestGreen</td><td bgcolor="#009B55"></td> <td>#009B55</td> <td>Fuchsia</td><td bgcolor="#8C368C"></td> <td>#8C368C</td> </tr> <tr> <td>Goldenrod</td><td bgcolor="#FFDF42"></td> <td>#FFDF42</td> <td>Gray</td><td bgcolor="#949698"></td> <td>#949698</td> </tr> <tr> <td>Green</td><td bgcolor="#00A64F"></td> <td>#00A64F</td> <td>GreenYellow</td><td bgcolor="#DFE674"></td> <td>#DFE674</td> </tr> <tr> <td>JungleGreen</td><td bgcolor="#00A99A"></td> <td>#00A99A</td> <td>Lavender</td><td bgcolor="#F49EC4"></td> <td>#F49EC4</td> </tr> <tr> <td>LimeGreen</td><td bgcolor="#8DC73E"></td> <td>#8DC73E</td> <td>Magenta</td><td bgcolor="#EC008C"></td> <td>#EC008C</td> </tr> <tr> <td>Mahogany</td><td bgcolor="#A9341F"></td> <td>#A9341F</td> <td>Maroon</td><td bgcolor="#AF3235"></td> <td>#AF3235</td> </tr> <tr> <td>Melon</td><td bgcolor="#F89E7B"></td> <td>#F89E7B</td> <td>MidnightBlue</td><td bgcolor="#006795"></td> <td>#006795</td> </tr> <tr> <td>Mulberry</td><td bgcolor="#A93C93"></td> <td>#A93C93</td> <td>NavyBlue</td><td bgcolor="#006EB8"></td> <td>#006EB8</td> </tr> <tr> <td>OliveGreen</td><td bgcolor="#3C8031"></td> <td>#3C8031</td> <td>Orange</td><td bgcolor="#F58137"></td> <td>#F58137</td> </tr> <tr> <td>OrangeRed</td><td bgcolor="#ED135A"></td> <td>#ED135A</td> <td>Orchid</td><td bgcolor="#AF72B0"></td> <td>#AF72B0</td> </tr> <tr> <td>Peach</td><td bgcolor="#F7965A"></td> <td>#F7965A</td> <td>Periwinkle</td> <td bgcolor="#7977B8"></td> <td>#7977B8</td> </tr> <tr> <td>PineGreen</td><td bgcolor="#008B72"></td> <td>#008B72</td> <td>Plum</td><td bgcolor="#92268F"></td> <td>#92268F</td> </tr> <tr> <td>ProcessBlue</td><td bgcolor="#00B0F0"></td> <td>#00B0F0</td> <td>Purple</td><td bgcolor="#99479B"></td> <td>#99479B</td> </tr> <tr> <td>RawSienna</td><td bgcolor="#974006"></td> <td>#974006</td> <td>Red</td><td bgcolor="#ED1B23"></td> <td>#ED1B23</td> </tr> <tr> <td>RedOrange</td><td bgcolor="#F26035"></td> <td>#F26035</td> <td>RedViolet</td><td bgcolor="#A1246B"></td> <td>#A1246B</td> </tr> <tr> <td>Rhodamine</td><td bgcolor="#EF559F"></td> <td>#EF559F</td> <td>RoyalBlue</td><td bgcolor="#0071BC"></td> <td>#0071BC</td> </tr> <tr> <td>RoyalPurple</td><td bgcolor="#613F99"></td> <td>#613F99</td> <td>RubineRed</td><td bgcolor="#ED017D"></td> <td>#ED017D</td> </tr> <tr> <td>Salmon</td><td bgcolor="#F69289"></td> <td>#F69289</td> <td>SeaGreen</td><td bgcolor="#3FBC9D"></td> <td>#3FBC9D</td> </tr> <tr> <td>Sepia</td><td bgcolor="#671800"></td> <td>#671800</td> <td>SkyBlue</td><td bgcolor="#46C5DD"></td> <td>#46C5DD</td> </tr> <tr> <td>SpringGreen</td><td bgcolor="#C6DC67"></td> <td>#C6DC67</td> <td>Tan</td><td bgcolor="#DA9D76"></td> <td>#DA9D76</td> </tr> <tr> <td>TealBlue</td><td bgcolor="#00AEB3"></td> <td>#00AEB3</td> <td>Thistle</td><td bgcolor="#D883B7"></td> <td>#D883B7</td> </tr> <tr> <td>Turquoise</td><td bgcolor="#00B4CE"></td> <td>#00B4CE</td> <td>Violet</td><td bgcolor="#58429B"></td> <td>#58429B</td> </tr> <tr> <td>VioletRed</td><td bgcolor="#EF58A0"></td> <td>#EF58A0</td> <td>White</td><td bgcolor="#FFFFFF"></td> <td>#FFFFFF</td> </tr> <tr> <td>WildStrawberry</td><td bgcolor="#EE2967"></td> <td>#EE2967</td> <td>Yellow</td><td bgcolor="#FFF200"></td> <td>#FFF200</td> </tr> <tr> <td>YellowGreen</td><td bgcolor="#98CC70"></td> <td>#98CC70</td> <td>YellowOrange</td><td bgcolor="#FAA21A"></td> <td>#FAA21A</td> </tr></table><p>比如可以选定 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>60</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">60\%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.80556em;vertical-align:-0.05556em;"></span><span class="mord">6</span><span class="mord">0</span><span class="mord">%</span></span></span></span> 的淡紫色:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\uspackage</span>[usenames]{color}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="comment">% 使用 latex + dvips 编译</span></span><br><span class="line"><span class="keyword">\color</span>[named]{Purple,0.6}</span><br></pre></td></tr></table></figure><p>此外,还可以使用 <code>dvipsnames</code> 选项来获得更多的色彩名,而不必考虑使用的输出驱动。<code>dvipsnames</code> 选项调入的色彩名默认以 cmyk 色彩模型给出。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>[dvipsnames]{color}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\textcolor</span>{Purple}{紫色文字}</span><br></pre></td></tr></table></figure><p>类似的色彩名称也可以用户自己定义,其语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\definecolor</span>{<色彩名>}{<模型>}{<分量值>}</span><br><span class="line"><span class="comment">% 比如定义紫色</span></span><br><span class="line"><span class="keyword">\definecolor</span>{Purple}{cmyk}{0.45,0.86,0,0}</span><br></pre></td></tr></table></figure><h3 id="2-2-文字">2.2 文字</h3><p>在 <code>color</code> 宏包中,使用彩色的基本命令是 <code>\color</code> 和 <code>\textcolor</code>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\color</span>{<颜色>}</span><br><span class="line"><span class="keyword">\textcolor</span>{<颜色>}{<文字>}</span><br></pre></td></tr></table></figure><p>其中,<code>\color</code> 是生命式命令,它使(同一分组内)后面的内容都使用指定的颜色输出,而 <code>\textcolor</code> 则将参数 <code><文字></code> 以指定的颜色输出。</p><h3 id="2-3-背景和线框">2.3 背景和线框</h3><p><code>color</code> 宏包还提供页面背景色以及彩色盒子的命令,其语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\pagecolor</span>{<页面颜色>}</span><br><span class="line"><span class="keyword">\colorbox</span>{<盒子颜色>}{<文字>}</span><br><span class="line"><span class="keyword">\fcolorbox</span>{<线框颜色>}{<盒子颜色>}{<文字>}</span><br></pre></td></tr></table></figure><p>和 <code>\fbox</code> 类似,盒子外框的间距与线框粗细由长度变量 <code>\fboxsep</code> 和 <code>\fboxrule</code> 控制。</p><h2 id="3-扩展">3. 扩展</h2><h3 id="3-1-xcolor-宏包">3.1 <code>xcolor</code> 宏包</h3><p><code>xcolor</code> 宏包支持更多的色彩模型,诸如 rgb、cmy、cmyk、hsb、gray 等。使用这些模型可以更方便地定义各色色彩,而且将这些色彩模型作为宏包选项,则可以将整个文档的所有色彩都转换到指定的模型去,比如制作印刷稿时:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 将所有色彩转换为 cmyk 模型</span></span><br><span class="line"><span class="keyword">\usepackage</span>[cmyk]{xcolor}</span><br></pre></td></tr></table></figure><p><code>xcolor</code> 宏包比 <code>color</code> 宏包支持更多的基本色彩,下表中的颜色在调用 <code>xcolor</code> 宏包后即可任意使用:</p><table><thead><tr><th style="text-align:center">名称</th><th style="text-align:center">颜色</th></tr></thead><tbody><tr><td style="text-align:center">black</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="black"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{black}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:black;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">blue</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="blue"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{blue}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:blue;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">brown</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="brown"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{brown}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:brown;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">cyan</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="cyan"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{cyan}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:cyan;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">darkgray</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="darkgray"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{darkgray}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:darkgray;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">gray</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="gray"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{gray}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:gray;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">green</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="green"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{green}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:green;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">lightgray</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="lightgray"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{lightgray}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:lightgray;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">lime</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="lime"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{lime}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:lime;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">magenta</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="magenta"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{magenta}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:magenta;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">olive</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="olive"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{olive}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:olive;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">orange</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="orange"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{orange}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:orange;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">pink</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="pink"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{pink}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:pink;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">purple</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="purple"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{purple}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:purple;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">red</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="red"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{red}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:red;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">teal</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="teal"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{teal}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:teal;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">violet</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="violet"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{violet}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:violet;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">white</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="white"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{white}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:white;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr><tr><td style="text-align:center">yellow</td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mpadded width="+6pt" height="+6pt" lspace="3pt" voffset="3pt" mathbackground="yellow"><mrow></mrow></mpadded></mrow><annotation encoding="application/x-tex">\colorbox{yellow}{}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6em;vertical-align:-0.3em;"></span><span class="mord"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span style="top:-2.3000000000000003em;"><span class="pstrut" style="height:2.6em;"></span><span class="stretchy colorbox" style="height:0.6em;background-color:yellow;"></span></span><span style="top:-2.6em;"><span class="pstrut" style="height:2.6em;"></span><span class="mord boxpad"></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.3em;"><span></span></span></span></span></span></span></span></span></td></tr></tbody></table><p>同时除了可以使用 <code>dvipsnames</code> 选项可以访问 PostScript 预定义的色彩名称(见「2.1」节表格)外,还可以使用 <code>svgnames</code> 和 <code>x11names</code> 访问 svg 格式或者是 unix x11 库中预定义的大量色彩名称。尤其有用的是,<code>xcolor</code> 还支持颜色表达式的记法,常用的有:</p><ul><li>半色调:<code><颜色>!<百分数></code></li><li>混合色:<code><颜色>!<百分数>!<颜色></code></li><li>互补色:<code>-<颜色></code></li></ul><p>这样可以方便地表示出 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>50</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">50\%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.80556em;vertical-align:-0.05556em;"></span><span class="mord">5</span><span class="mord">0</span><span class="mord">%</span></span></span></span> 的紫色或者是更复杂的将不同颜料按比例混合的中间色调。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\textcolor</span>{purple!70}{淡紫色}</span><br><span class="line">{<span class="keyword">\color</span>{blue!60!black} 60<span class="keyword">\%</span> 蓝与 40<span class="keyword">\%</span> 黑混合的深蓝色}</span><br><span class="line"><span class="keyword">\colorbox</span>{-red}{青色与红色互补}</span><br></pre></td></tr></table></figure><p><code>xcolor</code> 宏包也提供了许多新的命令来支持更丰富的命令,比如 <code>\colorlet</code> 可以使用色彩表达式来定义新色彩名:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\colorlet</span>{darkred}{red!50!black}</span><br><span class="line"><span class="keyword">\textcolor</span>{darkred}{定义暗红色}</span><br></pre></td></tr></table></figure><p>更多相关的命令可以参见官方手册。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc xcolor</span><br></pre></td></tr></table></figure><h3 id="3-2-transparent-宏包">3.2 <code>transparent</code> 宏包</h3><p><code>color</code> 和 <code>xcolor</code> 宏包都不提供透明颜色的支持,使用 pdfTeX 引擎时,可以使用 <code>transparent</code> 宏包实现颜色透明度的支持。它提供了 <code>\transparent</code> 与 <code>\texttransparent</code> 命令,用法与 <code>\color</code> 和 <code>\textcolor</code> 类似。<code>transparent</code> 宏包不支持 pdfTeX 以外的其他图形驱动,不过 LaTeX 中更为复杂的绘图语言 PSTricks 和 TikZ 都支持透明色,如果需要可以调用它们实现。</p>]]></content>
<summary type="html"><p>【注】笔记来自《LaTeX入门》——刘海洋。</p>
<h2 id="1-简介">1. 简介</h2>
<p>原始的 TeX 引擎不支持彩色,有关彩色的功能都是由输出 PS、PDF 格式的 TeX 引擎或驱动提供的,有关命令是在绘图相关的扩展宏包中定义的。基本的彩色支持工具</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/tags/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>LaTeX标题控制</title>
<link href="https://hotarugali.github.io/2021/04/03/TeX/LaTeX/LaTeX%E6%A0%87%E9%A2%98%E6%8E%A7%E5%88%B6/"/>
<id>https://hotarugali.github.io/2021/04/03/TeX/LaTeX/LaTeX%E6%A0%87%E9%A2%98%E6%8E%A7%E5%88%B6/</id>
<published>2021-04-03T02:41:00.000Z</published>
<updated>2021-04-12T07:14:08.287Z</updated>
<content type="html"><![CDATA[<p>【注】笔记来自《LaTeX入门》——刘海洋。详细参数可参见 LaTeX 官方文档:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc caption</span><br></pre></td></tr></table></figure><h2 id="1-简介">1. 简介</h2><p>在设计文档时,我们经常需要修改<a href="/2021/03/30/LaTeX%E6%A0%87%E9%A2%98%E6%8E%A7%E5%88%B6">浮动体</a>标题的字体、间距、对齐方式等格式,然而 LaTeX 内核及标准文档并没有提供直接修改浮动标题格式的命令,这时就可以使用 <code>caption</code> 宏包来完成相关的设置。</p><h2 id="2-格式选项">2. 格式选项</h2><p>使用 <code>caption</code> 宏包设置标题格式是通过一系列键值对形式的选项完成的,这些选项既可以作为宏包的可选项,也可以作为 <code>\captionsetup</code> 命令的参数出现,修改整篇文档的浮动体标题格式:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>[font=small,labelfont=bf]{caption}</span><br><span class="line"><span class="comment">% 下面命令与之等价</span></span><br><span class="line"><span class="keyword">\usepackage</span>{caption}</span><br><span class="line"><span class="keyword">\captionsetup</span>{font=small,labelfont=bf}</span><br></pre></td></tr></table></figure><p>也可以只修改某种浮动体环境的标题格式,以 <code>figure</code> 环境为例:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{caption}</span><br><span class="line"><span class="keyword">\captionsetup</span>[figure]{font=small,labelfont=bf}</span><br></pre></td></tr></table></figure><p>此外,还可以修改某个浮动体环境的标题格式,以 <code>figure</code> 环境为例:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="comment">% ……</span></span><br><span class="line"> <span class="keyword">\captionsetup</span>{font=small,labelfont=bf}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p><code>caption</code> 宏包提供了非常多的选项,限于篇幅,这里之选择其中常用的一些。为了叙述方便,我们假定 <code>\caption</code> 放在了一个虚拟的 <code>metafloat</code> 浮动环境中。</p><h3 id="2-1-format-选项">2.1 <code>format</code> 选项</h3><p><code>format</code> 选项主要用来设置长标题格式:</p><ul><li><code>plain</code> 格式:如果标题很长,折成几行,就会像普通的正文段落一样显示。</li><li><code>hang</code> 格式:如果标题很长,标题前面的数值标签会进行悬挂,就好像 LaTeX 列表环境一样。</li></ul><h3 id="2-2-labelformat-选项">2.2 <code>labelformat</code> 选项</h3><p><code>labelformat</code> 选项则用来设置标签编号的格式:</p><table><thead><tr><th style="text-align:left">格式</th><th style="text-align:left">说明</th></tr></thead><tbody><tr><td style="text-align:left"><code>default</code></td><td style="text-align:left">同 <code>simple</code></td></tr><tr><td style="text-align:left"><code>empty</code></td><td style="text-align:left">空格式,去除标签编号部分</td></tr><tr><td style="text-align:left"><code>simple</code></td><td style="text-align:left">简单数字格式</td></tr><tr><td style="text-align:left"><code>brace</code></td><td style="text-align:left">数字右括号格式</td></tr><tr><td style="text-align:left"><code>parens</code></td><td style="text-align:left">带括号数字格式</td></tr></tbody></table><h3 id="2-3-labelsep-选项">2.3 <code>labelsep</code> 选项</h3><p><code>labelsep</code> 选项控制标签与后面标题之间的间隔:</p><table><thead><tr><th style="text-align:left">格式</th><th style="text-align:left">说明</th></tr></thead><tbody><tr><td style="text-align:left"><code>default</code></td><td style="text-align:left">同 <code>colon</code></td></tr><tr><td style="text-align:left"><code>none</code></td><td style="text-align:left">无间隔</td></tr><tr><td style="text-align:left"><code>colon</code></td><td style="text-align:left">英文分号</td></tr><tr><td style="text-align:left"><code>period</code></td><td style="text-align:left">英文句点</td></tr><tr><td style="text-align:left"><code>space</code></td><td style="text-align:left">空格</td></tr><tr><td style="text-align:left"><code>quad</code></td><td style="text-align:left">一个 em 的间隔</td></tr><tr><td style="text-align:left"><code>newline</code></td><td style="text-align:left">标题另起一行</td></tr><tr><td style="text-align:left"><code>endash</code></td><td style="text-align:left">英文 dash 连接符</td></tr></tbody></table><h3 id="2-4-justification-选项">2.4 <code>justification</code> 选项</h3><p><code>justification</code> 选项设置浮动标题的对齐方式:</p><table><thead><tr><th style="text-align:left">格式</th><th style="text-align:left">对应段落命令</th><th style="text-align:left">对齐方式</th></tr></thead><tbody><tr><td style="text-align:left"><code>justified</code></td><td style="text-align:left"><code>\justifying</code></td><td style="text-align:left">普通段落的均匀对齐(默认值)</td></tr><tr><td style="text-align:left"><code>centering</code></td><td style="text-align:left"><code>\centering</code></td><td style="text-align:left">每行居中对齐</td></tr><tr><td style="text-align:left"><code>centerlast</code></td><td style="text-align:left"><code>\centerlast</code></td><td style="text-align:left">每段的最后一行居中对齐,其他行均匀对齐</td></tr><tr><td style="text-align:left"><code>centerfirst</code></td><td style="text-align:left"><code>\centerfist</code></td><td style="text-align:left">仅标题第一行居中对齐,其他行均匀对齐</td></tr><tr><td style="text-align:left"><code>raggedright</code></td><td style="text-align:left"><code>\raggedright</code></td><td style="text-align:left">每行左对齐,段落右边界可以不对齐</td></tr><tr><td style="text-align:left"><code>RaggedRight</code></td><td style="text-align:left"><code>\RaggedRight</code></td><td style="text-align:left">改进的 <code>raggedright</code></td></tr><tr><td style="text-align:left"><code>raggedleft</code></td><td style="text-align:left"><code>\raggedleft</code></td><td style="text-align:left">每行右对齐</td></tr></tbody></table><p>【注】与标准文档一样,在默认情况下,<code>caption</code> 宏包在单行的短标题中会忽略 <code>justification</code> 选项,而将其居中排版,只有多行的标题才使用选项中的对齐方式。如果希望设置的对齐方式对单行的标题也有效,则可以使用 <code>singlelinecheck=false</code> 来关闭对单独一行标题的检测。</p><h3 id="2-5-font-选项">2.5 <code>font</code> 选项</h3><p><code>font</code> 选项用来设置浮动标题的字体,而 <code>labelfont</code> 和 <code>textfont</code> 选项则可以单独设置前面的标签和后面文字的字体:</p><table><thead><tr><th style="text-align:left">类别</th><th style="text-align:left">格式</th><th style="text-align:left">等价字体命令</th><th style="text-align:left">说明</th></tr></thead><tbody><tr><td style="text-align:left">字体</td><td style="text-align:left"><code>scriptsize</code><br><code>footnotesize</code><br><code>small</code><br><code>normalsize</code><br><code>large</code><br><code>Large</code></td><td style="text-align:left"><code>\scriptsize</code><br><code>\footnotesize</code><br><code>\small</code><br><code>normalsize</code><br><code>\large</code><br><code>\Large</code></td><td style="text-align:left">非常小<br>很小<br>较小<br>正文文字大小<br>较大<br>很大</td></tr><tr><td style="text-align:left">字体族</td><td style="text-align:left"><code>rm</code><br><code>sf</code><br><code>tt</code></td><td style="text-align:left"><code>\rmfamily</code><br><code>\sffamily</code><br><code>\ttfamily</code></td><td style="text-align:left">罗马体 Roman family<br>无衬线体 Sans Serif family<br>打字机体 Typewriter family</td></tr><tr><td style="text-align:left">字体系列</td><td style="text-align:left"><code>md</code><br><code>bf</code></td><td style="text-align:left"><code>\mdseries</code><br><code>bfseries</code></td><td style="text-align:left">中等粗细 Medium series<br>粗体 Bold series</td></tr><tr><td style="text-align:left">字体形状</td><td style="text-align:left"><code>up</code><br><code>it</code><br><code>sl</code><br><code>sc</code></td><td style="text-align:left"><code>\upshape</code><br><code>\itshape</code><br><code>\slshape</code><br><code>\scshape</code></td><td style="text-align:left">值直立体 Upright shape<br>意大利体 Italic shape<br>倾斜体 Slanted shape<br>小型大写字母 SMALL CAPS SHAPE</td></tr><tr><td style="text-align:left">行距</td><td style="text-align:left"><code>singlespacing</code><br><code>onehalfspacing</code><br><code>doublespacing</code><br><code>stretch=<倍数></code></td><td style="text-align:left"><code>\singlespacing</code><br><code>\onehalfspacing</code><br><code>\doublespacing</code><br><code>\setstretch{<倍数>}</code></td><td style="text-align:left">单倍行距<br>「1.5」倍行距<br>「双倍」行距<br>多倍行距</td></tr><tr><td style="text-align:left">颜色</td><td style="text-align:left"><code>normalcolor</code><br><code>color=<颜色></code></td><td style="text-align:left"><code>\normalcolor</code><br><code>\color{<颜色>}</code></td><td style="text-align:left">默认颜色<br>指定彩色</td></tr><tr><td style="text-align:left">选项集合</td><td style="text-align:left"><code>normalfont</code><br><code>normal</code></td><td style="text-align:left"><code>\normalfont</code><br><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo></mrow><annotation encoding="application/x-tex">-</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord">−</span></span></span></span></td><td style="text-align:left">恢复默认字体<br>恢复默认字体、行距、颜色</td></tr></tbody></table><p>多个不同的字体选项可以同时使用,只要把几个选项放在分组中:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captinosetup</span>{font={small,sf},labelfont=bf}</span><br><span class="line"><span class="keyword">\caption</span>{小号加粗无衬线字体 Caption}</span><br></pre></td></tr></table></figure><p>几个字体选项还支持 <code>+=</code> 语法,用于在现有设置上增加新设置:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captinosetup</span>{font=small}</span><br><span class="line"><span class="keyword">\captionsetup</span>{font+=bf}</span><br><span class="line"><span class="keyword">\caption</span>{小号加粗字体 Caption}</span><br></pre></td></tr></table></figure><h3 id="2-6-margin-选项和-width-选项">2.6 <code>margin</code> 选项和 <code>width</code> 选项</h3><p><code>margin</code> 选项用来设置标题距离页面左右边界的距离,<code>width</code> 则用来设置标题的最大宽度。这两个选项之间有制约关系,因而通常同时只使用其中一个:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 设定 margin</span></span><br><span class="line"><span class="keyword">\captionsetup</span>{margin=4em}</span><br><span class="line"><span class="keyword">\caption</span>{标题距离左右个 4<span class="keyword">\,</span>em 的距离}</span><br><span class="line"><span class="comment">% 或设定 width</span></span><br><span class="line"><span class="keyword">\captionsetup</span>{widith=6em}</span><br><span class="line"><span class="keyword">\caption</span>{标题最多只有 8<span class="keyword">\,</span>em 宽}</span><br></pre></td></tr></table></figure><h3 id="2-7-skip-选项">2.7 <code>skip</code> 选项</h3><p><code>skip</code> 选项控制标题与浮动环境内容的垂直间距,在标准文档类中默认值是 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>10</mn></mrow><annotation encoding="application/x-tex">10</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord">0</span></span></span></span> pt。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captionsetup</span>{skip=0pt}</span><br><span class="line"><span class="keyword">\caption</span>{与前面浮动体内容无额外间隔}</span><br></pre></td></tr></table></figure><h3 id="2-8-type-选项">2.8 <code>type</code> 选项</h3><p><code>type</code> 选项可以设置标题所对应的浮动环境类型,这就允许在非浮动环境中直接使用浮动体的标题,或者是在同一个浮动体中显示不同的几个标签。但注意标题仍然应该倍放在一个环境中或盒子中,而不是直接写在正文里。比如,可以利用 <code>type</code> 选项在同一个浮动体中完成图表的混排:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\begin</span>{minipage}[b]{.5<span class="keyword">\textwidth</span>}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>[width=.4<span class="keyword">\textwidth</span>]{picture}</span><br><span class="line"> <span class="keyword">\caption</span>{picture}</span><br><span class="line"> <span class="keyword">\end</span>{minipage}</span><br><span class="line"> <span class="keyword">\begin</span>{minipage}[b]{.5<span class="keyword">\textwidth</span>}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\begin</span>{tabular}{|*{5}{c|}}</span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 1996 <span class="built_in">&</span> 1998 <span class="built_in">&</span> 1999 <span class="built_in">&</span> 2000 <span class="built_in">&</span> 2001 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 2002 <span class="built_in">&</span> 2003 <span class="built_in">&</span> 2004 <span class="built_in">&</span> 2005 <span class="built_in">&</span> 2007 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 2008 <span class="built_in">&</span> 2009 <span class="built_in">&</span> 2010 <span class="built_in">&</span> <span class="keyword">\dots</span> <span class="built_in">&</span> <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> <span class="keyword">\end</span>{tabular}</span><br><span class="line"> <span class="keyword">\captionsetup</span>{type=table}</span><br><span class="line"> <span class="keyword">\caption</span>{table}</span><br><span class="line"> <span class="keyword">\end</span>{minipage}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><h3 id="2-9-name-选项">2.9 <code>*name</code> 选项</h3><p>在导言区使用 <code>*name</code> 选项可以用来设置标题标签的文字名称。在标准文档类中,<code>figure</code> 和 <code>table</code> 环境的名称是「Figure」和「Table」,而 <code>ctex</code> 文档类则分别是「图」和「表」。设置 <code>figurename</code> 和 <code>tablename</code> 选项等价于修改宏 <code>\figurename</code> 和 <code>tablename</code> 的值,但更为方便:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{caption}</span><br><span class="line"><span class="keyword">\captionsetup</span>{figurename=图片}</span><br></pre></td></tr></table></figure><p>也可以在浮动体环境中直接使用 <code>name</code> 选项临时性修改标签名称:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captionsetup</span>{type=figure, name=空图片}</span><br><span class="line"><span class="keyword">\caption</span>{标签名称可以修改}</span><br></pre></td></tr></table></figure><h2 id="3-功能命令">3. 功能命令</h2><p><code>caption</code> 宏包除了定义了大量的格式选项,同时也提供了一些有用的命令。</p><h3 id="3-1-caption-命令">3.1 <code>\caption</code> 命令</h3><p><code>\caption</code> 用于给浮动环境添加标题,其语法格式为:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\caption</span>{<标题>}</span><br><span class="line"><span class="keyword">\caption</span>{<短标题>}{<长标题>}</span><br></pre></td></tr></table></figure><p>可选的参数短标题用于图表目录,而交叉引用的标题 <code>\label</code> 需要放在 <code>\caption</code> 后面,或者 <code><标题></code>、<code><长标题></code> 中。在 <code>\caption</code> 的 <code><长标题></code> 中可以进行长达多段的叙述,但 <code><短标题></code> 或单独的 <code><标题></code> 中不允许分段。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"> <span class="keyword">\caption</span>[图片]{这是一张图片}<span class="keyword">\label</span>{fig:picture}</span><br><span class="line"> <span class="comment">% 或者 \caption[图片]{\label{fig:picture}这是一张图片}</span></span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><h3 id="3-2-captionof-命令">3.2 <code>\captionof</code> 命令</h3><p><code>\caption{<类型>}{<标题>}</code> 命令可以看作是先设置了 <code>type</code> 选项,然后使用普通的 <code>\caption</code>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captionof</span>{figure}{空图片标题}</span><br></pre></td></tr></table></figure><p><code>\captionof</code> 和 <code>\caption</code> 一样,都有一个带星号的形式,表示不编号、不显示标签也不进入图表目录的标题:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\captionsetup</span>{font=sf}</span><br><span class="line"><span class="keyword">\caption</span>*{无编号的标题,只保留格式}</span><br></pre></td></tr></table></figure><h3 id="3-3-ContinuedFloat-命令">3.3 <code>\ContinuedFloat</code> 命令</h3><p><code>\ContinuedFloat</code> 命令则用来放在浮动体中,阻止标题的编号增加,从而可以用一个编号表示多个浮动体。如果要产生「续图」、「续表」的功能,就可以使用类似下面的代码:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\ContinuedFloat</span></span><br><span class="line"> <span class="comment">% ……</span></span><br><span class="line"> <span class="keyword">\caption</span>{某图形}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\ContinuedFloat</span></span><br><span class="line"> <span class="comment">% ……</span></span><br><span class="line"> <span class="keyword">\caption</span>{某图形(续)}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><h3 id="3-4-其他命令">3.4 其他命令</h3><p><code>caption</code> 宏包同时也提供了许多命令来为其格式选项增加新的取值。相关的命令很多,以 <code>labelsep</code> 选项为例,可以声明一个 <code>fullcolon</code> 的取值:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\DeclareCaptionLabelSeparator</span>{fullcolon}{:} <span class="comment">% 声明中文的全角冒号分隔符</span></span><br><span class="line"><span class="keyword">\captionsetup</span>{labelsep=fullcolon} <span class="comment">% 为中文的标题设置全角冒号分隔符</span></span><br></pre></td></tr></table></figure><h2 id="4-其他宏包">4. 其他宏包</h2><h3 id="4-1-bicaption-宏包">4.1 <code>bicaption</code> 宏包</h3><p><code>bicaption</code> 宏包是 <code>caption</code> 宏包的附加宏包,它提供了双语标题的功能,其基本命令是 <code>\bicaption</code>,语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\bicaption</span>[<短标题一>]{<长标题一>}[<短标题二>]{<长标题二>}</span><br></pre></td></tr></table></figure><p>此时可以同时使用 <code>\captionsetup[bi-first]</code> 和 <code>\captionsetup[bi-second]</code> 的 <code>lang</code> 选项分别设置两个标题不同的语言。<code>bicaption</code> 宏包原本使用 <code>babel</code> 宏包或 <code>polyglossia</code> 宏包提供的语言选择机制来设置不同语言的标题,不过中文等东亚语言不使用上述宏包的翻译机制,因此需要手工设置不同语言的标题。可以使用 <code>\DeclareCaptionOption</code> 命令来声明一个新的选项,完成标签名的重定义,然后可以用 <code>\captionsetup</code> 为每种语言分别调用。比如,设置中英文两种图表标题:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 中文文档类会设定好标题的第一种语言</span></span><br><span class="line"><span class="keyword">\documentclass</span>{ctexart}</span><br><span class="line"><span class="keyword">\usepackage</span>{bicaption}</span><br><span class="line"><span class="comment">% 声明 english 选项重定义第二种语言的标签名,选项没有参数</span></span><br><span class="line"><span class="keyword">\DeclareCaptionOption</span>{english}[]{</span><br><span class="line"> <span class="keyword">\renewcommand</span><span class="keyword">\figurename</span>{Figure}</span><br><span class="line"> <span class="keyword">\renewcommand</span><span class="keyword">\tablename</span>{Table}</span><br><span class="line">}</span><br><span class="line"><span class="keyword">\captionsetup</span>[bi-second]{english}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\beign</span>{figure}</span><br><span class="line"> <span class="comment">% ……</span></span><br><span class="line"> <span class="keyword">\bicaption</span>{中文标题}{English Title}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><h3 id="4-2-subcaption-宏包">4.2 <code>subcaption</code> 宏包</h3><p><code>subcaption</code> 宏包可以给整个浮动体加一个概括性的标题,同时对浮动体内的每个子图表也都有自己的编号和标题。需要注意的是,<code>subcaption</code> 宏包依赖于 <code>caption</code> 宏包。<code>subcaption</code> 宏包提供了一组命令来完成子图表的排版输出。</p><ul><li><code>\subcaption{<子标题>}</code>:用来直接输出子标题。</li><li><code>\subcaptionbox[<目录标题>]{<标题>}[<宽度>][<盒子内位置>]{<内容>}</code>:生成一个带有子标题的子图表。其中,如果省略 <code><宽度></code> 则使用其 <code><内容></code> 的自然宽度;<code><盒子内位置></code> 确定 <code><内容></code> 在盒子中的水平对齐方式,可以是 <code>l</code>(<code>\raggedright</code>)、<code>r</code>(<code>\raggedleft</code>)、<code>c</code>(<code>\centering</code>)或 <code>s</code>(无特别格式),默认为居中的 <code>c</code>。</li><li><code>\subcaptionbox*{<标题>}[<宽度>][<盒子内位置>]{<内容>}</code>:与 <code>\subcaptionbox</code> 语法相同,但不进行编号。</li></ul><p>【注】使用 <code>\subcaptionbox</code> 时,需要给子图加引用的 <code>\label</code> 标签可以放在 <code><标题></code> 参数中。使用 <code>\ref</code> 引用标签将得到「x.y(a)」,它是外层编号「x.y」和内层编号「(a)」的混合。若只引用子标题的内层编号,可以用 <code>subcaption</code> 提供的 <code>\subref</code> 命令。</p><p>由于子图表几乎总是需要使用子段盒子来放置内容和子标题,所以 <code>subcaption</code> 宏包还同时提供了 <code>subfigure</code> 和 <code>subtable</code> 环境,它们的语法和功能与 <code>minipage</code> 完全相同。</p><h3 id="4-3-其他宏包">4.3 其他宏包</h3><p>除了以上宏包外,还可以使用 <code>subfig</code> 和 <code>floatrow</code> 宏包,它们都与 <code>caption</code> 宏包的功能兼容,同时提供额外的子图表排版功能。</p><ul><li><code>subfig</code> 宏包主要提供了 <code>\subfloat</code> 和 <code>\subref</code> 命令,功能和语法都和 <code>subcaption</code> 十分相近。</li><li><code>floatrow</code> 宏包则预定义了许多更为复杂的子图表格式。</li></ul>]]></content>
<summary type="html"><p>【注】笔记来自《LaTeX入门》——刘海洋。详细参数可参见 LaTeX 官方文档:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</spa</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/tags/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>LaTeX浮动体</title>
<link href="https://hotarugali.github.io/2021/03/30/TeX/LaTeX/LaTeX%E6%B5%AE%E5%8A%A8%E4%BD%93/"/>
<id>https://hotarugali.github.io/2021/03/30/TeX/LaTeX/LaTeX%E6%B5%AE%E5%8A%A8%E4%BD%93/</id>
<published>2021-03-30T11:21:45.000Z</published>
<updated>2021-04-12T07:14:08.287Z</updated>
<content type="html"><![CDATA[<p>【注】笔记来自《LaTeX入门》——刘海洋。</p><h2 id="1-简介">1. 简介</h2><p>图片或表格通常都占有较大的一块,直接放在文档常常会造成分页的困难,即前一页放不下,放在后一页又会造成很大的留白。其他一些大块的内容也可能有类似的问题,比如程序算法、大型公式和不宜断开的特殊形状段落。LaTeX 中通过引入浮动体来解决这类问题。</p><ul><li><p>「浮动体」是一个活动的盒子,它可以把内容放在距离浮动体代码前后不远的地方,通常就是浮动体代码所在地,也可以放在页面开头、末尾或者单独的一页中。</p></li><li><p>「浮动体」的另一个作用是给图表添加一个标题。LaTeX 的浮动体环境为图表标题提供了专门的命令进行自动编号、自动生成目录的功能,通过第三方宏包还可以对标题格式进行整体设计。</p></li></ul><h2 id="2-使用">2. 使用</h2><h3 id="2-1-环境">2.1 环境</h3><p>LaTeX 的标准文档类预定义了两种浮动体环境:<code>figure</code> 和 <code>table</code>,通常分别用于图和表的排版。<code>figure</code> 环境的语法格式为:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}[<允许位置>]</span><br><span class="line"> <任意内容></span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p><code>table</code> 环境与之类似。其中可选参数 <code><允许位置></code> 用来设定浮动环境可以出现在页面的位置,即 <code>h,t,b,p</code> 四个选项的组合(默认为 <code>tbp</code>):</p><ul><li><code>h</code>:此处(here),浮动体的内容被放在代码所在的上下文位置。</li><li><code>t</code>:页顶(top),浮动体被放在一页的顶部,这可以是代码环境所在页面或之后的页面。</li><li><code>b</code>:页底(bottom),浮动体被放在一页的底部,这可以是代码环境所在页面或之后的页面。</li><li><code>p</code>:独立一页(page),一个或多个浮动体被放在单独的页面中,这个页面被称为「浮动页」。与之对应,有正文的页面被称为「文本页」。</li></ul><p>比如用选项 <code>hbp</code> 表示允许浮动体出现在环境所在位置、页面底部或单独一页。浮动体允许位置选项的顺序并不重要,LaTeX 总是以 <code>htbp</code> 的顺序尝试放置浮动体。不过单独的一个 <code>h</code> 选项通常并不总能满足,LaTeX 会把它放宽为 <code>ht</code> 两个可能,因此以下三种浮动体环境开头是等价的:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}[ht]</span><br><span class="line"><span class="keyword">\begin</span>{figure}[th]</span><br><span class="line"><span class="keyword">\begin</span>{figure}[h]</span><br></pre></td></tr></table></figure><p>【注】如果图表较多,最好将浮动图表的位置限定设置得宽松一些,以防止浮动体积压过多,导致最后统一输出。</p><h3 id="2-2-应用">2.2 应用</h3><p>浮动体最常见的应用就是直接在 <code>table</code> 环境中放置 <code>tabular</code> 生成的表格,或者在 <code>figure</code> 环境中放置 <code>\includegraphics</code> 命令插入图片。经常还在前面使用 <code>\centering</code> 命令让图表居中放置:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}[htbp] <span class="comment">% 允许在各个位置</span></span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br><span class="line"><span class="keyword">\begin</span>{table} <span class="comment">% 默认在页面顶部、底部或单独一页</span></span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\begin</span>{tabular}{|c|c|}</span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 图形 <span class="built_in">&</span> <span class="keyword">\verb</span>=<span class="string">figure</span>= 环境 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 表格 <span class="built_in">&</span> <span class="keyword">\verb</span>=<span class="string">table</span>= 环境 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> <span class="keyword">\end</span>{tabular}</span><br><span class="line"><span class="keyword">\end</span>{table}</span><br></pre></td></tr></table></figure><p>无论是 <code>figure</code> 环境还是 <code>table</code> 环境,浮动环境的名称和内容并没有必然联系。一个浮动体只是一个与版心等宽的盒子,内容可以任意放置。<code>figure</code> 环境也可以使用 TeX 代码或者是 ASCII 字符画的图形,甚至放置算法、代码或者很长,<code>table</code> 环境中也可以是以插图形式得到的表格,甚至内容可以和名称毫无关系。</p><h3 id="2-3-标题">2.3 标题</h3><p>浮动体的另一个重要功能就是使用 <code>\caption</code> 命令加标题,其语法格式为:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\caption</span>{<标题>}</span><br><span class="line"><span class="keyword">\caption</span>{<短标题>}{<长标题>}</span><br></pre></td></tr></table></figure><p>可选的参数短标题用于图表目录,而交叉引用的标题 <code>\label</code> 需要放在 <code>\caption</code> 后面,或者 <code><标题></code>、<code><长标题></code> 中。在 <code>\caption</code> 的 <code><长标题></code> 中可以进行长达多段的叙述,但 <code><短标题></code> 或单独的 <code><标题></code> 中不允许分段。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}[htp]</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"> <span class="keyword">\caption</span>[图片]{这是一张图片}<span class="keyword">\label</span>{fig:picture}</span><br><span class="line"> <span class="comment">% 或者 \caption[图片]{\label{fig:picture}这是一张图片}</span></span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p>【注】更复杂的标题控制可参见 <a href="/2021/04/03/LaTeX%E6%B5%AE%E5%8A%A8%E4%BD%93">LaTeX标题控制</a>。</p><h3 id="2-4-双栏">2.4 双栏</h3><p>以上环境都是考虑在单栏文档中,对于双栏或多栏文档,<code>figure</code> 和 <code>table</code> 环境就成为只占一栏的浮动盒子(宽度是 <code>\columnwidth</code>),其用法与单栏环境相同。</p><p>此外,LaTeX 标准文档类还提供了跨栏排版的图表环境 <code>figure*</code> 和 <code>table*</code>,用来产生跨栏排版的浮动体。跨栏浮动体只允许排在页面的顶部(<code>t</code>)或单独的浮动页面(<code>p</code>)中,其他位置参数会被忽略。<code>figure*</code> 和 <code>table*</code> 环境的默认位置都是 <code>tp</code>。在大多数情况下,使用 <code>table*</code> 或 <code>figure*</code> 环境的效果就是把内容排在后面一页的顶部。</p><h2 id="3-详解">3. 详解</h2><p>尽管环境参数中可以设置位置,但浮动体的位置并不总能令人满意,在图表较多时这个问题尤为明显。</p><h3 id="3-1-其他参数">3.1 其他参数</h3><p>LaTeX 对每个位置的浮动体的总数和占用大小有一定限制,超出限制的浮动体会被排在较后的页面中,但可以在 <code><允许位置></code> 选项中增加一个 <code>!</code> 符号来忽略这些参数限制。因此,在 LaTeX 中最宽松的浮动体位置就是 <code>!htbp</code>。在位置选项中加上 <code>!</code> 号将使浮动体相对更靠近文字或靠前出现,如果使用这一手段浮动体仍然被排在很靠后的位置,就可能需要将浮动体适当前移一段距离。</p><p>和 <code>!</code> 位置选项相反,<code>\suppressfloats</code> 命令用于禁止浮动体出现在当前页,从而将浮动体的位置向后推。<code>\suppressfloats</code> 命令可以带一个可选参数 <code>t</code> 或 <code>b</code>,表示本页顶部或底部禁止放置浮动体。</p><ul><li>限制浮动环境数量和占用大小的参数</li></ul><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">类型</th><th style="text-align:left">默认值</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>topnumber</code></td><td style="text-align:left">计数器</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow><annotation encoding="application/x-tex">2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span></td><td style="text-align:left">文本页顶部浮动体的最大数量</td></tr><tr><td style="text-align:left"><code>bottomnumber</code></td><td style="text-align:left">计数器</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow><annotation encoding="application/x-tex">1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span></td><td style="text-align:left">文本页底部浮动体的最大数量</td></tr><tr><td style="text-align:left"><code>totalnumber</code></td><td style="text-align:left">计数器</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>3</mn></mrow><annotation encoding="application/x-tex">3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">3</span></span></span></span></td><td style="text-align:left">文本页上所有浮动体的最大数量</td></tr><tr><td style="text-align:left"><code>dbltopnumber</code></td><td style="text-align:left">计数器</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow><annotation encoding="application/x-tex">2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span></td><td style="text-align:left"><code>topnumber</code> 的跨双栏版本</td></tr><tr><td style="text-align:left"><code>\topfraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.7</mn></mrow><annotation encoding="application/x-tex">0.7</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">7</span></span></span></span></td><td style="text-align:left">文本页顶部浮动体的最大占用空间比</td></tr><tr><td style="text-align:left"><code>\bottomfraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.3</mn></mrow><annotation encoding="application/x-tex">0.3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">3</span></span></span></span></td><td style="text-align:left">文本页底部浮动体的最大占用空间比</td></tr><tr><td style="text-align:left"><code>\textfraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.2</mn></mrow><annotation encoding="application/x-tex">0.2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">2</span></span></span></span></td><td style="text-align:left">文本页中文本所占的最小空间比例</td></tr><tr><td style="text-align:left"><code>\floatpagefraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.5</mn></mrow><annotation encoding="application/x-tex">0.5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">5</span></span></span></span></td><td style="text-align:left">浮动页中浮动体所占的最小空间比例</td></tr><tr><td style="text-align:left"><code>\dbltopfraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.7</mn></mrow><annotation encoding="application/x-tex">0.7</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">7</span></span></span></span></td><td style="text-align:left"><code>\topfraction</code> 的跨双栏版本</td></tr><tr><td style="text-align:left"><code>\dblfloatfraction</code></td><td style="text-align:left">宏</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0.5</mn></mrow><annotation encoding="application/x-tex">0.5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span><span class="mord">.</span><span class="mord">5</span></span></span></span></td><td style="text-align:left"><code>\floatpagefraction</code> 的跨双栏版本</td></tr><tr><td style="text-align:left"><code>\floatsep</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn><mo>±</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">12 \pm 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">±</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span> pt</td><td style="text-align:left">文本页上,处于页顶或页底的多个浮动体之间的垂直间距</td></tr><tr><td style="text-align:left"><code>\textfloatset</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>19</mn><mo>±</mo><mn>3</mn></mrow><annotation encoding="application/x-tex">19 \pm 3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">±</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">3</span></span></span></span> pt</td><td style="text-align:left">文本页上,处于页顶或页底的浮动体与正文之间的垂直间距</td></tr><tr><td style="text-align:left"><code>\intextsep</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn><mo>±</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">12 \pm 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">±</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span> pt</td><td style="text-align:left">文本页上,使用 <code>h</code> 位置选项排在页面中间的浮动体与上下文之间的垂直间距</td></tr><tr><td style="text-align:left"><code>\dblfloatset</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>12</mn><mo>±</mo><mn>2</mn></mrow><annotation encoding="application/x-tex">12 \pm 2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">1</span><span class="mord">2</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">±</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span> pt</td><td style="text-align:left"><code>\floatsep</code> 的跨双栏版本</td></tr><tr><td style="text-align:left"><code>\dbltextfloatsep</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>19</mn><mo>±</mo><mn>3</mn></mrow><annotation encoding="application/x-tex">19 \pm 3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">1</span><span class="mord">9</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">±</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">3</span></span></span></span> pt</td><td style="text-align:left"><code>\textfloatsep</code> 的跨双栏版本</td></tr></tbody></table><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 设置「限制浮动环境数量和占用大小的参数」示例</span></span><br><span class="line"><span class="keyword">\setcounter</span>{topnumber}{4}</span><br><span class="line"><span class="keyword">\setcounter</span>{bottomnumber}{4}</span><br><span class="line"><span class="keyword">\renewcommand</span>{<span class="keyword">\textfraction</span>}{0.15}</span><br><span class="line"><span class="keyword">\renewcommand</span>{<span class="keyword">\topfraction</span>}{0.85}</span><br></pre></td></tr></table></figure><ul><li>控制浮动页面间距的内部命令(内部命令一般只在宏包或文档类中修改,如果要在正文导言区进行设置,可以在前后分别加上 <code>\makeatletter</code> 和 <code>\makeatother</code>)</li></ul><table><thead><tr><th style="text-align:left">参数</th><th style="text-align:left">类型</th><th style="text-align:left">默认值</th><th style="text-align:left">描述</th></tr></thead><tbody><tr><td style="text-align:left"><code>\@fptop</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> pt <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>+</mo></mrow><annotation encoding="application/x-tex">+</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord">+</span></span></span></span> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow><annotation encoding="application/x-tex">1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span> fil</td><td style="text-align:left">浮动页中页面顶部与浮动体的垂直间距</td></tr><tr><td style="text-align:left"><code>\@fpsep</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn></mrow><annotation encoding="application/x-tex">8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> pt <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>+</mo></mrow><annotation encoding="application/x-tex">+</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord">+</span></span></span></span> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>2</mn></mrow><annotation encoding="application/x-tex">2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">2</span></span></span></span> fil</td><td style="text-align:left">浮动页中多个浮动体之间的垂直间距</td></tr><tr><td style="text-align:left"><code>\@fpbot</code></td><td style="text-align:left">弹性长度</td><td style="text-align:left"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> pt <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>+</mo></mrow><annotation encoding="application/x-tex">+</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord">+</span></span></span></span> <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn></mrow><annotation encoding="application/x-tex">1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span></span></span></span> fil</td><td style="text-align:left">浮动页中页面底部与浮动体之间的垂直间距</td></tr></tbody></table><h3 id="3-2-浮动机制">3.2 浮动机制</h3><p>LaTeX 会把浮动环境做成一个个盒子,所有未输出的浮动体按次序放在队列中处理。LaTeX 所使用的浮动规则可描述为:</p><ul><li>浮动体会排在所有位置选项允许的位置中尽可能靠前的地方,但 <code>h</code> 选项优先于 <code>t</code> 选项。总体来说,浮动体的位置选项参数优先级按照 <code>h,t,b,p</code> 的顺序依次降低。</li><li>浮动体不会排在比浮动环境所处位置更靠前的页面中。只有在 <code>t</code> 选项生效时,浮动体会排在环境代码位置的同一页更靠前的位置。</li><li>对于相同类型的浮动环境,多个浮动体会按次序输出,即当前 <code>figure</code> 不会在更早的 <code>figure</code> 之前输出。但可以在更早的 <code>table</code> 之前输出。特别需要注意的是,双栏文档中,跨栏的 <code>figure*</code>、<code>table*</code> 环境和不跨栏的 <code>figure</code>、<code>table</code> 也没有先后制约的关系,因此在双栏环境应该避免混用。</li><li>只有浮动体 <code><允许位置></code> 可选参数中的位置才会放置浮动体。如果省略这个参数,默认位置参数为 <code>tbp</code>,双栏的跨栏浮动体则是 <code>tp</code>。当仅使用了 <code>h</code> 位置时,LaTeX 会将其扩充为 <code>ht</code> 并发出警告。双栏的跨栏浮动体只有 <code>t,p</code> 选项可以生效,其余选项默认忽略。</li><li>浮动体的输出不能造成页面的上溢出。即浮动体输出时,垂直高度不能超过版心的位置。</li><li>浮动体的输出必须遵守「3.1」节中的参数限制。但如果 <code><允许位置></code> 参数中有 <code>!</code> 号,有关文本页的限制将被忽略,只有浮动页的限制起效(<code>\floatpagefraction</code> 和 <code>\dblfloatpagefraction</code>)</li><li>LaTeX 最多保存 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>18</mn></mrow><annotation encoding="application/x-tex">18</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord">8</span></span></span></span> 个未处理的浮动体。如果有过多的浮动体积压不能及时输出,就会报错。通常遇到这种问题只要增加浮动体允许的输出位置参数,或是使用 <code>\clearpage</code> 立即输出所有的浮动体。如果确实要求保留原参数中设定的位置,则可以使用 <code>morefloats</code> 宏包增大保存未处理浮动体的限制。</li><li>脚注和边注也是特殊的浮动体,它们的输出位置与普通浮动体不同,但同样具有浮动的效果,会占用未处理的浮动体个数。对于太长而排不下的脚注和边注会排在后面的页面。</li></ul><p>上面最后三条规则在遇到 <code>\clearpage</code>、<code>\cleardoublepage</code> 或 <code>\end{document}</code> 时会被打破,此时所有队列中未处理的浮动体都会直接输出,<code><允许位置></code> 的 <code>p</code> 选项也会打开以保证可以将所有浮动体输出。</p><p>【注】由上文的浮动机制可知,双栏文档中带星号跨栏的浮动环境与不带星号的环境不能按顺序输出,这是个 BUG 。</p><blockquote><ul><li>对于使用 LaTex 2e 版本的用户,可以使用 <code>fixltx2e</code> 宏包来修正这个错误。<code>fixltx2e</code> 是对 <code>LaTeX 2e</code> 核心的修正代码,除了双栏浮动体还做了一些其他改进。</li><li>对于使用 2015 年之后的 LaTeX 版本的用户,内核已经修复这些 BUG,不再需要额外使用宏包。</li></ul></blockquote><h2 id="4-扩展">4. 扩展</h2><h3 id="4-1-float-宏包">4.1 <code>float</code> 宏包</h3><p>浮动图表的目的使用浮动的位置来避免糟糕的分页,但如果不在乎因为图表太大而产生的分页,而要求有确定的位置,即要求不使用「浮动」环境。把图表简单地放在 <code>center</code>、<code>quote</code> 等环境中就可以做到这一点。<code>float</code> 宏包为标准的浮动环境提供了一个新的 <code>H</code> 位置选项用来产生没有浮动效果的图表环境,它的使用和一般的浮动环境没有什么区别。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{float}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{figure}[H]</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>[height=1cm]{picture}</span><br><span class="line"> <span class="keyword">\caption</span>{不浮动的图片}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p>【注】<code>H</code>(Here)选项不能与 <code>h,t,b,p</code> 等其他位置选项混用。</p><p>事实上,使用了 <code>H</code> 选项的 <code>figure</code> 和 <code>table</code> 环境就不再是一个浮动体,而只是一个前后间距与内容格式都与普通浮动环境相同的一个大盒子。<code>float</code> 宏包提供的 <code>H</code> 选项比用 <code>center</code> 环境和 <code>caption</code> 宏包的 <code>\captionof</code> 命令来模拟普通浮动环境的格式要更准确,也更自然一些。</p><h4 id="4-1-1-newfloat-命令">4.1.1 <code>\newfloat</code> 命令</h4><p><code>float</code> 宏包还提供了定义新浮动环境的功能,这是由 <code>\newfloat</code> 命令完成的,其语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\newfloat</span>{<环境名>}{<位置>}{<目录文件扩展名>}[<上级计数器>]</span><br></pre></td></tr></table></figure><p>其中,<code><位置></code> 是浮动环境默认的位置选项,可以使用 <code>h,t,b,p</code> 或单独的 <code>H</code>。<code><目录文件扩展名></code> 是用于产生与图表目录类似的目录的辅助文件扩展名。而可选的 <code><上级计数器></code> 则可以让浮动环境按章节编号。使用 <code>\newfloat</code> 定义了新的浮动体后,一般还要用 <code>\floatname</code> 命令定义这个浮动体的标题标签名。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{float}</span><br><span class="line"><span class="keyword">\newfloat</span>{flowchart}{htbp}{loflow}[chapter]</span><br><span class="line"><span class="keyword">\floatname</span>{flowchart}{流程图}</span><br><span class="line"><span class="comment">% 正文</span></span><br><span class="line"><span class="keyword">\begin</span>{flowchart}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"> <span class="keyword">\caption</span>{这是新的浮动体}</span><br><span class="line"><span class="keyword">\end</span>{flowchart}</span><br></pre></td></tr></table></figure><h4 id="4-1-2-floatstyle-命令">4.1.2 <code>\floatstyle</code> 命令</h4><p><code>float</code> 宏包还提供了 <code>\floatstyle{<格式>}</code> 命令,可以使之后用 <code>\newfloat</code> 定义的所有浮动体按指定的格式输出。也可以在后面使用 <code>\restylefloat{<环境名>}</code> 来指定变换原有浮动环境的格式,可选的格式如下:</p><ul><li><code>plain</code>:默认格式,它与标准文档类 <code>figure</code>、<code>table</code> 环境的格式基本相同,只是 <code>\caption</code> 产生的标题总在浮动体环境的底部。</li><li><code>plaintop</code>:标题在顶部,其余与 <code>plain</code> 格式相同。</li><li><code>boxed</code>:浮动体内容在一个线框中,标题在线框下面。</li><li><code>ruled</code>:浮动体类似三线表的格式,标题在顶部,标题前后与浮动体后面各有一条横线。</li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\floatstyle</span>{ruled}</span><br><span class="line"><span class="keyword">\restylefloat</span>{flowchart}</span><br><span class="line"><span class="comment">% 正文</span></span><br><span class="line"><span class="keyword">\begin</span>{flowchart}</span><br><span class="line"> <span class="keyword">\fbox</span>{A} <span class="built_in">$</span><span class="keyword">\longrightarrow</span><span class="built_in">$</span> <span class="keyword">\fbox</span>{B} <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\fbox</span>{C} <span class="built_in">$</span><span class="keyword">\longrightarrow</span><span class="built_in">$</span> <span class="keyword">\fbox</span>{D}</span><br><span class="line"><span class="keyword">\caption</span>{基本流程图}</span><br><span class="line"><span class="keyword">\end</span>{flowchart}</span><br></pre></td></tr></table></figure><p>【注】使用 <code>float</code> 宏包的 <code>\newfloat</code> 或 <code>\restylefloat</code> 重定义浮动环境中只能使用一个 <code>\caption</code> 标题,标题的位置也固定为顶部或底部,这对于排版并列图表非常不便。<code>caption</code> 宏包个别功能也因此受到影响,<code>ruled</code> 格式中标题格式则完全固定。因此,如果对标题有较高要求,更高的方式是是噢能够 <code>newfloat</code> 宏包的 <code>\DeclareFloatingEnvironment</code> 命令来定义新的浮动体,其语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\DeclareFloatingEnvironment</span>[<选项表>]{<环境名>}</span><br></pre></td></tr></table></figure><p>其中,<code><选项表></code> 可以使用下面的选项:</p><ul><li><code>name=<标签名></code></li><li><code>listname=<目录名></code></li><li><code>fileext=<目录文件扩展名></code>(默认是<code>lo<环境名></code>)</li><li><code>placement=<位置参数></code></li><li><code>within=<上级计数器></code>(可以为 <code>none</code>)</li><li><code>chapterlistsgaps=on</code> 或 <code>off</code>(在目录中,设置不同章浮动体标题间是否增加额外间距)</li></ul><p>此时,定义流程图的格式可以使用如下命令:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{newfloat}</span><br><span class="line"><span class="keyword">\DeclareFloatingEnvironment</span>[fileext=loflow,placement=htbp,within=chapter,name=流程图,listname=流程图目录]{flowchart}</span><br></pre></td></tr></table></figure><p>使用这种方式定义的新浮动体环境没有标题方面的限制,可以与 <code>caption</code> 更好的结合。并且可以使用 <code>\listof<环境名>s</code> 这样的命令来输出目录,比如前面定义的流程图可以使用 <code>\listofflowcharts</code> 来输出目录。</p><h4 id="4-1-3-floatplacement-命令">4.1.3 <code>\floatplacement</code> 命令</h4><p><code>float</code> 宏包的 <code>\floatplacement</code> 可以重定义浮动环境的默认位置参数,比如让图表环境都允许 <code>h</code> 位置:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\floatplacement</span>{figure}{htbp}</span><br><span class="line"><span class="keyword">\floatplacement</span>{table}{htbp}</span><br></pre></td></tr></table></figure><h4 id="4-1-4-listof-命令">4.1.4 <code>\listof</code> 命令</h4><p><code>float</code> 中的 <code>\listof{<环境名>}{<标题>}</code> 命令的功能与命令 <code>\listoffigures</code> 和 <code>\listoftables</code> 类似,用来输出新定义的浮动环境的标题目录:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\listof</span>{flowchart}{流程图目录}</span><br></pre></td></tr></table></figure><h3 id="4-2-placeins-宏包">4.2 <code>placeins</code> 宏包</h3><p><code>placeins</code> 宏包提供了一个 <code>\FloatBarrier</code> 命令,它会在所在的位置产生一个无形的屏障,所有之前的浮动体都必须在这个屏障之前输出。<code>\FloatBarrier</code> 命令的功能类似 <code>\clearpage</code>,不过只要可能,<code>\FloatBarrier</code> 命令会避免直接分页。<code>placeins</code> 宏包有几个选项:</p><ul><li><code>section</code> 选项会在每个 <code>\section</code> 命令之前隐含地增加一个 <code>\FloatBarrier</code> 命令,使浮动体局限在一节的范围之内。</li><li><code>above</code> 和 <code>below</code> 选项可以放宽 <code>\FloatBarrier</code> 命令的位置限制,使浮动体可以出现在同一页的较前或较后的位置。</li></ul><h3 id="4-3-afterpage-宏包">4.3 <code>afterpage</code> 宏包</h3><p><code>float</code> 宏包的 <code>H</code> 选项给出了确切的「此处」位置,也可以使用 <code>afterpage</code> 宏包来得到确切的「下一页顶部」位置。<code>afterpage</code> 宏包提供了一个 <code>\afterpage</code> 命令,可以把参数中的内容放在下一页的开头,同时不影响正常的正文流向。因此,可以使用以下代码来得到下一页顶部的浮动图表环境:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{afterpage}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\afterpage</span>{<span class="keyword">\begin</span>{figure}[H]</span><br><span class="line"> <span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\end</span>{figure}}</span><br></pre></td></tr></table></figure><p>而如果使用以下代码则会产生与 <code>placeins</code> 的 <code>\FloatBarrier</code> 有类似的效果,它强制所有浮动体在下一页之前输出完毕:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{afterpage}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\afterpage</span>{<span class="keyword">\clearpage</span>}</span><br><span class="line"><span class="comment">% 或 \afterpage{\FloatBarrier}</span></span><br></pre></td></tr></table></figure><h3 id="4-4-endfloat-宏包">4.4 <code>endfloat</code> 宏包</h3><p>有些期刊会要求稿件将所有的图表放在整个文章的末尾,但把整个浮动环境挪到文档末尾却非常不方便修改,<code>endfloat</code> 宏包就解决了这个问题。引用 <code>endfloat</code> 宏包后,所有的浮动图表都会被放在文档最后。也可以使用 <code>\processdelayedfloats</code> 命令直接输出之前延迟输出的浮动图表,比如放在文档正文之后,参考文献列表之前。</p>]]></content>
<summary type="html"><p>【注】笔记来自《LaTeX入门》——刘海洋。</p>
<h2 id="1-简介">1. 简介</h2>
<p>图片或表格通常都占有较大的一块,直接放在文档常常会造成分页的困难,即前一页放不下,放在后一页又会造成很大的留白。其他一些大块的内容也可能有类似的问题,比如程序算法、</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/tags/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>LaTeX插图</title>
<link href="https://hotarugali.github.io/2021/03/29/TeX/LaTeX/LaTeX%E6%8F%92%E5%9B%BE/"/>
<id>https://hotarugali.github.io/2021/03/29/TeX/LaTeX/LaTeX%E6%8F%92%E5%9B%BE/</id>
<published>2021-03-29T06:22:03.000Z</published>
<updated>2021-04-12T07:14:08.284Z</updated>
<content type="html"><![CDATA[<p>【注】笔记来自《LaTeX入门》——刘海洋。</p><h2 id="1-简介">1. 简介</h2><p>插图功能是利用 TeX 的特定编译程序提供的机制实现的,不同的编译程序支持不同的图形方式。不同 LaTeX 编译程序对应的插图格式如下表所示:</p><table><thead><tr><th style="text-align:center">TeX 引擎命令</th><th style="text-align:center">图形驱动</th><th style="text-align:center">支持的格式</th><th style="text-align:left">说明</th></tr></thead><tbody><tr><td style="text-align:center"><code>latex</code></td><td style="text-align:center">Dvips</td><td style="text-align:center">EPS</td><td style="text-align:left">MiKTeX 还部分支持 PNG 和 JPEG</td></tr><tr><td style="text-align:center"><code>latex</code></td><td style="text-align:center">DVIPDFMx</td><td style="text-align:center">EPS,PDF,PNG,JPEG</td><td style="text-align:left">PDF、PNG、JPEG 需要使用 extractbb 程序生成 <code>.xbb</code> 文件</td></tr><tr><td style="text-align:center"><code>pdflatex</code></td><td style="text-align:center"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo></mrow><annotation encoding="application/x-tex">-</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.66666em;vertical-align:-0.08333em;"></span><span class="mord">−</span></span></span></span></td><td style="text-align:center">MPS、PDF、PNG、JPEG</td><td style="text-align:left">MPS 是 METAPOST 的输出格式,TeXLive 2010 以后还能自动将 EPS 转换为 PDF 文件产插入</td></tr><tr><td style="text-align:center"><code>xelatex</code></td><td style="text-align:center">xdvipdfmx</td><td style="text-align:center">EPS、PDF、PNG、JPEG、BMP</td><td style="text-align:left">驱动是自动调用的,MAC 系统下的旧驱动 xdv2pdf 还支持其他一些格式</td></tr></tbody></table><p>由上表可知,除非使用传统的 Dvips 程序作为图形驱动,一般编译程序支持的图形格式都有好几种,实际插入图形格式也就有不同的选择。对于 pdfLaTeX、XeLaTeX 这些现代的常用编译程序来说,PDF、PNG、JPEG 这三种格式是更为常用的,它们的用途也各自不同:</p><ul><li>PDF图片通常用来作为矢量图形的标准格式。矢量图形可以以任意比例放缩而不影响输出效果,在表现固定图案或数据产生的图形时很有优势。在以前 LaTeX 更多使用 EPS 格式的矢量图形,不过由于现在支持输出 PDF 的作图软件变得更加普及,而且 PDF 格式的文件通常比相同内容的 EPS 图形体积小,功能(如透明色)也更多。一般的矢量图设计软件(如 Illustrator、CorelDraw、Inkscape)、专业数学软件(如 MatLab、Maple、Mathematica)、计算或作图语言(如 R、GNUplot)、图论或流程图工具(如 Visio、Dia、Graphviz)、物理化学或工程图工具(如 JaxoDraw、ChemDraw、AutoCAD)等,都可以保存或打印为 PDF 格式的图片共 LaTeX 使用。</li><li>PNG 图片是无损压缩的像素图格式。通常用来显示计算机制作的非自然图形,如复杂数据可视化结果。一般能输出矢量图的软件也都可以输出 PNG 格式的像素图,也有一些科技作图软件不支持矢量图的。通常数据可视化的图形最好使用矢量图格式,不多对于一些特殊情形,如逐点产生的动力系统图像、3D CG 图,还是更适合使用 PNG 格式。</li><li>JPEG 图片是有损压缩的像素图格式。通常用作照片的格式。计算机产生的非自然图像最好不要使用这种有损压缩格式。</li></ul><h2 id="2-基础">2. 基础</h2><p>在 LaTeX 中,插图是由 <code>graphics</code> 或 <code>graphicx</code> 宏包所使用的 <code>\includegraphics</code> 命令完成的。<code>graphics</code> 宏包和 <code>graphicx</code> 宏包在功能上并没有什么差别。<code>graphicx</code> 宏包支持 <code><项目>=<值></code> 的语法,使用起来更为方便,功能也更为强大。</p><p><code>graphicx</code> 宏包可以使用 <code>draft</code> 和 <code>final</code> 选项,用来表示是否实际插图。当宏包使用 <code>draft</code> 选项,或是文档使用全局的 <code>draft</code> 选项时,<code>\includegraphics</code> 命令并不会实际插入图形,而只是得到一个与图形大小相同的带有文件名的方框,这个选项对于未完成的草稿可以在一定程度上加快编译,并减小文件大小。当文档完成时,就可以更改 <code>draft</code> 选项为 <code>final</code> 选项,得到最终的文档。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>[draft]{graphicx}</span><br><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\includegraphics</span>{picture}</span><br></pre></td></tr></table></figure><p><code>graphicx</code> 宏包还有一个特别有用的命令 <code>\graphicspath</code>,它可以指定图形文件的搜索目录列表,不同的目录用分组隔开:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\graphicspath</span>{{figures/}} <span class="comment">% 指定图片路径</span></span><br><span class="line"><span class="keyword">\graphicspath</span>{{pdf/}{png/}{jpg/}} <span class="comment">% 指定不同类型图片路径</span></span><br></pre></td></tr></table></figure><h3 id="2-1-格式">2.1 格式</h3><p>插图的核心命令是 <code>\includegraphics</code>,其语法格式为:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\includegraphics</span>[<选项>]{<文件名>}</span><br></pre></td></tr></table></figure><p>其中,<code><文件名></code> 是图形文件的文件名,一般的扩展名可以省略不写,LaTeX 会自动查找它支持的文件格式,为了明确也可以加上扩展名。</p><h3 id="2-2-大小、位置">2.2 大小、位置</h3><p>插入的图形一般都有一个自然比例,对于 EPS、PDF 图形就是制作的尺寸,对于 JPG、PNG、BMP 等像素图的尺寸则是点阵数除以图形打印度(一般用每英寸点数 DPI 表示)。可以给 <code>\includegraphics</code> 命令加一些可选项来调整图形的大小、位置等:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\includegraphics</span>[width=2em]{picture} <span class="comment">% 宽度</span></span><br><span class="line"><span class="keyword">\includegraphics</span>[height=1cm]{picture} <span class="comment">% 高度</span></span><br><span class="line"><span class="keyword">\includegraphics</span>[scale=0.5]{picture} <span class="comment">% 缩放比例</span></span><br></pre></td></tr></table></figure><h3 id="2-3-旋转">2.3 旋转</h3><p>使用 <code>angle</code> 选项可以让图形逆时针旋转一定角度,旋转中心可以用 <code>origin</code> 选项确定。<code>origin</code> 的值可以用字符 <code>l,r,c,t,b,B</code> 中的一个或两个,分别表示左、右、中、上、下和基线(默认值为 <code>lb</code>)。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\includegraphics</span>[angle=90]{picture} <span class="comment">% 以左下角为原点逆时针旋转 90 度</span></span><br><span class="line"><span class="keyword">\includegraphics</span>[angle=-45,origin=c]{picture} <span class="comment">% 以中心点为原点顺时针旋转 45 度</span></span><br></pre></td></tr></table></figure><p>插入图形的基线就在图片的底部,因而图片盒子的深度为零。但图片旋转时,基线和深度会随 <code>origin</code> 不同而变化,此时要对图片进行放缩,就要用 <code>totalheight</code> 代替 <code>height</code> 选项,表示规定图片深度和高度之和:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\includegraphics</span>[angle=90,origin=b,totalheight=1.5cm]{picture}</span><br></pre></td></tr></table></figure><h3 id="2-4-其他">2.4 其他</h3><p><code>includegraphics</code> 除了以上介绍的参数选项外,还有一些其他的参数选项,诸如:</p><ul><li><code>draft</code>、<code>final</code>:同宏包选项相同,仅针对当前插图</li><li><code>keepaspectratio</code>:布尔值,决定缩放时是否保持图片原有的长宽比。如果只设置了 <code>width</code>、<code>height</code> 或 <code>totalheight</code> 中的一个,则默认为真。</li></ul><p>对于更多的参数选项,可参见 <code>graphicx</code> 宏包官方文档。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc graphicx</span><br></pre></td></tr></table></figure><h2 id="3-进阶">3. 进阶</h2><h3 id="3-1-几何变换">3.1 几何变换</h3><p><code>graphicx/graphics</code> 宏包不仅提供了插图的功能,也提供了对任意对象(即盒子)进行几何变换的功能。除了平移,TeX 本身并没有几何变换的功能,这些功能同样是依赖具体的编译程序。</p><ul><li><code>\scalebox</code> 命令用来按比例对内容进行放缩,其语法格式为:</li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\scalebox</span>{<水平因子>}[<垂直因子>]{<内容>} <span class="comment">% <垂直因子> 省略时,与 <水平因子> 相同。</span></span><br></pre></td></tr></table></figure><ul><li><code>\reflectbox</code> 命令用来对内容做水平镜像反射,其语法格式为:</li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\reflectbox</span>{<内容>} <span class="comment">% 相当于 \scalebox{-1}[-1]{<内容>}</span></span><br></pre></td></tr></table></figure><ul><li><code>\resizebox</code> 命令用来把内容放缩到指定的宽度和高度,其语法格式为:</li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\resizebox</span>{<宽度>}{<高度>}{<内容>} <span class="comment">% <宽度> 和 <高度> 可以使用 ! 表示按比例随另一个分量放缩</span></span><br></pre></td></tr></table></figure><ul><li><p><code>\resizebox*</code> 命令和 <code>\resizebox</code> 功能相同,只是第二个参数表示盒子高度和深度之和。</p></li><li><p><code>\rotatebox</code> 命令用来对内容进行旋转,其语法格式为:</p></li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\rotatebox</span>[<选项>]{<角度>}{<内容>} <span class="comment">% <选项> 是 graphicx 宏包才有</span></span><br></pre></td></tr></table></figure><p><code>\rotatebox</code> 命令在选项中可以使用 <code>origin</code> 选项表示旋转原点,值与 <code>\includegraphics</code> 中的选项相同,使用 <code>lrctbB</code> 中的一个或两个;也可以使用 <code>x=2mm,y=5mm</code> 这样的选项准确指定旋转原点。此外,还可以使用 <code>units</code> 选项,其表示旋转的单位,默认值为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msup><mn>1</mn><mo>∘</mo></msup></mrow><annotation encoding="application/x-tex">1^\circ</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.674115em;vertical-align:0em;"></span><span class="mord"><span class="mord">1</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.674115em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∘</span></span></span></span></span></span></span></span></span></span></span>,设置 <code>units=6.283185</code> 就相当于使用弧度制。</p><p>【注】<code>graphicx</code> 宏包并不提供错切变换的功能,如有需要,可以使用 <code>PSTricks</code>、<code>tikz</code> 等绘图宏包。</p><h3 id="3-2-页面旋转">3.2 页面旋转</h3><p>在 LaTeX 中,不仅可以对盒子进行旋转,也可以对整个页面的内容进行旋转。<code>lscape</code> 宏包的 <code>landscape</code> 环境就可以把整个页面逆时针旋转 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>9</mn><msup><mn>0</mn><mo>∘</mo></msup></mrow><annotation encoding="application/x-tex">90^\circ</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.674115em;vertical-align:0em;"></span><span class="mord">9</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.674115em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∘</span></span></span></span></span></span></span></span></span></span></span>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{lscape}</span><br><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{landscape}</span><br><span class="line"> <span class="keyword">\subsection</span>{页面旋转}</span><br><span class="line"> ……</span><br><span class="line"><span class="keyword">\end</span>{landscape}</span><br></pre></td></tr></table></figure><p>在生成 PDF 文件的情况下,可以使用 <code>pdflscape</code> 宏包代替 <code>lscape</code> 宏包,它可以在旋转页面的同时,让输出的 PDF 文件的页面在阅读器中显示时同时顺时针旋转 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>9</mn><msup><mn>0</mn><mo>∘</mo></msup></mrow><annotation encoding="application/x-tex">90^\circ</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.674115em;vertical-align:0em;"></span><span class="mord">9</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.674115em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mbin mtight">∘</span></span></span></span></span></span></span></span></span></span></span>。</p><p><code>landscape</code> 环境旋转的页面不会影响版心外面页眉页脚的输出,它通常用来表示过宽的内容,如大幅的图片或宽大的表格。不过,<code>landscape</code> 环境会在前后造成额外的分页,这对于只想单纯插入一张图片的情形往往并不适合。理想的办法是产生旋转的浮动环境,可以使用 <code>rotfloat</code> 宏包提供的 <code>sidewapsfigure</code> 来插入浮动的图形,同时不会影响浮动页前后的内容。<code>rotfloat</code> 宏包基于 <code>rotating</code> 宏包和 <code>float</code> 宏包,它会将所有浮动环境增加一个 <code>sideways</code> 开头的旋转环境(比如表格有 <code>sidewapstable</code> 环境)。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{rotfloat}</span><br><span class="line"><span class="keyword">\begin</span>{sidewaysfigure}[p]</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>[width=7in]{figure}</span><br><span class="line"> <span class="keyword">\caption</span>{这是一张旋转的图片}</span><br><span class="line"><span class="keyword">\end</span>{sidewaysfigure}</span><br></pre></td></tr></table></figure><p>此外,可以给 <code>rotfloat</code> 宏包加上旋转方向选项(默认逆时针旋转):</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>[figureleft]{rotfloat} <span class="comment">% 顺时针旋转</span></span><br><span class="line"><span class="keyword">\usepackage</span>[figureright]{rotfloat} <span class="comment">% 逆时针旋转</span></span><br></pre></td></tr></table></figure><h3 id="3-3-浮动体">3.3 浮动体</h3><p>详情参见 <a href="/2021/03/30/LaTeX%E6%8F%92%E5%9B%BE">LaTeX浮动体</a>。</p><h3 id="3-4-标题控制">3.4 标题控制</h3><p>详情参见 <a href="/2021/04/03/LaTeX%E6%8F%92%E5%9B%BE">LaTeX标题控制</a>。</p><h3 id="3-5-并排与子图">3.5 并排与子图</h3><p>在实际中,经常需要把好几个图表并列放在一起输出。由于 LaTeX 的浮动环境并不对环境内容加以限制,所以可以直接把多个图表放在一个浮动体里。又因为 <code>tabular</code> 环境生成的表格和 <code>\includegraphics</code> 插入的图形都是一个大盒子,因此可以直接并排放在一起。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\caption</span>{并排的图片}</span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture1}</span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture2}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p>如果是和一段文字并排放在一起,则可以使用 <code>\parbox</code> 命令或 <code>minipage</code> 环境生成一个子段盒子:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"> <span class="keyword">\qquad</span></span><br><span class="line"> <span class="keyword">\parbox</span>[b]{0.4<span class="keyword">\textwidth</span>}{这是一段和图片并排的文字内容。}</span><br><span class="line"> <span class="keyword">\caption</span>{picture}</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><p>使用并排的图表或文字时,需要注意其对齐方式。</p><ul><li><code>tabular</code> 环境和 <code>\parbox</code> 生成的子段盒子,默认都是在盒子中央对齐,盒子的基准点是中线左端。</li><li><code>\includegraphics</code> 插入的图形其基准点在左下角。</li></ul><p>因此上面例子中 <code>\parbox</code> 使用了 <code>b</code> 选项使文字与前面的图形对齐,即「底部对齐」。如果需要让插入垂直「居中对齐」,则可以把它放进子段盒子中。对于「顶部对齐」,需要注意的是如果直接把插图放进 <code>t</code> 选项的子段盒子中,并不能使图片在顶部对齐,这是因为 <code>t</code> 选项只能让第一行按基线对齐;此时可以在盒子中先使用 <code>\vspace{0pt}</code> 增加一个高度为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> 的空行,然后按这个空行对齐。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\parbox</span>[t]{0.4<span class="keyword">\textwidth</span>}{</span><br><span class="line"> <span class="keyword">\vspace</span>{0pt}</span><br><span class="line"> <span class="keyword">\includegraphics</span>{picture}</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">\qquad</span></span><br><span class="line"> <span class="keyword">\parbox</span>[t]{0.4<span class="keyword">\textwidth</span>}{</span><br><span class="line"> <span class="keyword">\vspace</span>{0pt} </span><br><span class="line"> 这是一段和图片并排的文字内容。</span><br><span class="line"> }</span><br><span class="line"><span class="keyword">\end</span>{figure}</span><br></pre></td></tr></table></figure><h3 id="3-6-文字绕排">3.6 文字绕排</h3><p>对于小幅的图表,使用绕排的方式可以得到更为紧凑的页面,在篇幅紧张或注重行文的场合,效果往往比浮动环境更有吸引力。由于 TeX 固有的限制,文字绕排的效果还无法做到尽善尽美,对绕排图表的位置、形状、使用都有一些限制。因此在使用绕排工具时,往往需要仔细的调整,或者另寻它途。</p><ul><li>在 TeX 内部,绕排工具都是使用 <code>\parshape</code> 命令的功能配合复杂的盒子操作与计算完成的,这也是为什么在列表环境中无法正常使用绕排功能(因为列表项也是由 <code>\parshape</code> 实现的)。</li><li>可以使用 <code>\parshape</code> 命令产生复杂形状的绕排效果,下面所介绍的 <code>picinpar</code>、<code>wrapfig</code> 和 <code>floatflt</code> 宏包都只能产生矩形的空洞,而 <code>shapepar</code> 和 <code>cutwin</code> 宏包则部分实现了复杂绕排的功能。</li></ul><h4 id="3-6-1-picinpar-宏包">3.6.1 <code>picinpar</code> 宏包</h4><p><code>picinpar</code> 宏包提供了 <code>\figwindow</code> 和 <code>\tabwindow</code> 来实现绕排功能。它们的语法格式如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 下面四个参数都是必选的</span></span><br><span class="line"><span class="keyword">\begin</span>{figwindow}[<下降行数>,<水平位置>,<图内容>,<图标题>]</span><br><span class="line"> <绕排文字></span><br><span class="line"><span class="keyword">\end</span>{figwindow}</span><br><span class="line"><span class="keyword">\begin</span>{tabwindow}[<下降行数>,<水平位置>,<表内容>,<表标题>]</span><br><span class="line"> <绕排文字></span><br><span class="line"><span class="keyword">\end</span>{tabwindow}</span><br></pre></td></tr></table></figure><p><code>figwindow</code> 和 <code>tabwindow</code> 环境会在 <code><绕排文字></code> 的段落中开一个窗口,用来放置图表。图表的位置由前两个参数确定,<code><下降行数></code> 是一个整数,确定被绕排图表的垂直位置,图表将在这么多行文字下方显示;<code><水平位置></code> 可以是 <code>l,c,r</code>,表示窗口开在段落左、中、右的位置。后面两个参数分别是图表的内容和标题。标题可以留空,但需要保留标题前的逗号,此时就没有标题和编号。如果标题的编号需要引用,可以把标签放在标题内。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{picinpar}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{figwindow}[2,c,<span class="keyword">\includegraphics</span>{picture},picture<span class="keyword">\label</span>{fig:picture}]</span><br><span class="line"><span class="keyword">\lipsum</span>*[1] <span class="comment">% 该命令产生足够长的虚拟文本段落,需要使用 lipsum 宏包</span></span><br></pre></td></tr></table></figure><p><code>picinpar</code> 能够自动计算图表内容的大小,在环境中文本段落指定的位置开窗口放置此图表。不过,<code>picinpar</code> 也有一个缺点,即它要求环境中的段落在页面上必须有足够的空白,如果段落文字恰好在一页的末尾,就会在页面上留下大片的空白,这与使用 <code>float</code> 提供的不浮动的图表环境(<code>H</code> 选项)是一样的。此外,<code>picinpar</code> 在图表外面加的间距很小,不方便调整,<code>figwindow</code> 与 <code>tabwindow</code> 环境的语法也与一般的 LaTeX 环境不同。当图形大小或环境中文本内容在页面中位置不合适时,<code>picinpar</code> 偶尔还会造成错误的段落形状,需要在使用中小心调整。</p><h4 id="3-6-2-wrapfig-宏包">3.6.2 <code>wrapfig</code> 宏包</h4><p><code>wrapfig</code> 宏包提供了 <code>wrapfigure</code> 和 <code>wraptable</code> 环境,在语法格式上更接近标准的 <code>figure</code> 和 <code>table</code> 环境:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 中括号参数是可选的</span></span><br><span class="line"><span class="keyword">\begin</span>{wrapfigure}[<行数>]{<位置>}[<外伸长度>]{<宽度>}</span><br><span class="line"> <图内容></span><br><span class="line"><span class="keyword">\end</span>{wrapfigure}</span><br><span class="line"><span class="keyword">\begin</span>{wraptable}[<行数>]{<位置>}[<外伸长度>]{<宽度>}</span><br><span class="line"> <表内容></span><br><span class="line"><span class="keyword">\end</span>{wraptable}</span><br></pre></td></tr></table></figure><p>在使用时,<code><图内容></code> 及 <code><表内容></code> 与普通 <code>figure</code>、<code>table</code> 环境的内容相同,可以是任意代码产生的图表,也可以使用 <code>\caption</code> 命令生成标题。在环境后面的段落内容江辉沿图表绕排。在这里,<code><位置></code> 参数不区分大小写,可以是 <code>l,r</code>,即左右两侧;也可以用 <code>o,i</code>,表示双页页面的装订内侧和外侧。<code><宽度></code> 则指定图表环境所占用的宽度。可选的 <code><行数></code> 可以指定图表占用的行数,如果留空则会按照内容高度自动计算(不过自动计算的结果有时偏大)。<code><外伸长度></code> 如果大于 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> pt,则图表会向左右侧面伸出版心指定的长度,产生特殊的效果。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\usepackage</span>{wrapfig}</span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{wraptable}[4]{r}[1.5cm]{4.5cm}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\caption</span>{向右伸出的绕排表格}<span class="keyword">\label</span>{tag:wraptable}</span><br><span class="line"> <span class="keyword">\begin</span>{tabular}{|c|c|c|c|}</span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> 甲 <span class="built_in">&</span> 乙 <span class="built_in">&</span> 丙 <span class="built_in">&</span> 丁 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\hline</span></span><br><span class="line"> <span class="keyword">\end</span>{tabular}</span><br><span class="line"><span class="keyword">\end</span>{wraptable}</span><br></pre></td></tr></table></figure><p><code>wrapfig</code> 在使用时可以不必指定把多少文字包含进绕排的范围,但它同样也有与 <code>picinpar</code> 类似的问题,即本页中剩下的空间必须足够放下被绕排的图表,否则也将造成难看的分页。在功能上,<code>wrapfig</code> 可以让图伸出版心之外,不过不能把图表放在中间或跳过前几行,因而与 <code>picinpar</code> 有互补的效果。</p><h4 id="3-6-3-floatflt-宏包">3.6.3 <code>floatflt</code> 宏包</h4><p><code>floatflt</code> 宏包与 <code>wrapfig</code> 类似,它提供了 <code>floatingfigure</code> 和 <code>floatingtable</code> 的浮动环境,可以把浮动体放在一段开头的左侧或右侧。<code>floatflt</code> 的独特功能是提供了 <code>\fltitem</code> 命令,试图解决与列表环境共用时产生的问题。</p><h4 id="3-6-4-shapepar-宏包">3.6.4 <code>shapepar</code> 宏包</h4><p><code>shapepar</code> 宏包的 <code>\cutout</code> 命令部分实现了复杂形状绕排功能,其基本语法格式为:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\cutout</span>{<side>}(<h<span class="built_in">_</span>offset>,<v<span class="built_in">_</span>offset>)<settings> <span class="keyword">\shapepar</span> <文字内容></span><br></pre></td></tr></table></figure><p>其中,必选的 <code><side></code> 参数只能为 <code>l,r</code>。图表的默认的位置为盒子的中心位置,可选的 <code><h_offset></code>、<code><v_offset></code> 分别表示图表由默认位置上在水平、垂直方向上的偏移,正值分别表示往右、下偏移,负值分别表示往左、上。</p><p><code>shapepar</code> 宏包提供了许多预定义的绕排形状,详细参见官方文档:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc shapepar</span><br></pre></td></tr></table></figure><h4 id="3-6-5-cutwin-宏包">3.6.5 <code>cutwin</code> 宏包</h4><p><code>cutwin</code> 宏包也提供了类似 <code>picinpar</code>、<code>wrapfig</code> 的绕排功能,同时与 <code>shapepar</code> 一样还支持自定义挖洞的形状。虽然没有 <code>shaperpar</code> 一样丰富的预定义形状,不过在处理绕排时其语法相对自然。<code>cutwin</code> 与 <code>shapepar</code> 宏包有命名冲突,具体用法参见官方文档:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc cutwin</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><p>【注】笔记来自《LaTeX入门》——刘海洋。</p>
<h2 id="1-简介">1. 简介</h2>
<p>插图功能是利用 TeX 的特定编译程序提供的机制实现的,不同的编译程序支持不同的图形方式。不同 LaTeX 编译程序对应的插图格式如下表所示:</p>
<table</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/tags/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>LaTeX幻灯片提纲</title>
<link href="https://hotarugali.github.io/2021/03/26/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/"/>
<id>https://hotarugali.github.io/2021/03/26/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/</id>
<published>2021-03-26T12:49:47.000Z</published>
<updated>2021-04-12T07:14:08.291Z</updated>
<content type="html"><![CDATA[<p>【注】笔记来自《LaTeX入门》——刘海洋。更多细节内容可以参考官方用户手册。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc beamer</span><br></pre></td></tr></table></figure><h2 id="1-简介">1. 简介</h2><p>由于现代的 LaTeX 系统主要以 pdf 文件为输出方式,因此它可以用来生成各种专门的电子文档,诸如书籍、文章、幻灯片等。</p><h3 id="1-1-工具">1.1 工具</h3><p>LaTeX 中专门用来制作幻灯片的工具有很多,诸如:</p><ul><li><code>beamer</code> 文档类</li><li><code>powerdot</code> 文档类</li><li><code>prosper</code> 文档类</li><li><code>pdfslide</code> 宏包</li><li><code>ppower4</code> 宏包</li><li><code>pdfscreen</code> 宏包</li></ul><h3 id="1-2-beamer-文档类">1.2 <code>beamer</code> 文档类</h3><p>目前最流行的 LaTeX 幻灯片工具为 <code>beamer</code> 文档类,它以页面(被称为「帧」)为基本组织单位,提供丰富的功能选项和许多预定义的风格主题,支持各种编译程序。因此,本文也使用 <code>beamer</code> 文档类来制作幻灯片提纲。</p><h2 id="2-幻灯片提纲">2. 幻灯片提纲</h2><h3 id="2-1-代码框架">2.1 代码框架</h3><p>使用 <code>beamer</code> 文档类与编写一般的 LaTeX 文档的代码框架是一样的:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\documentclass</span>{beamer}</span><br><span class="line"><span class="keyword">\begin</span>{document}</span><br><span class="line"><span class="comment">% ...</span></span><br><span class="line"><span class="keyword">\end</span>{document}</span><br></pre></td></tr></table></figure><p>如果要在 <code>beamer</code> 文档类中使用中文,则可以使用 <code>ctex</code> 或 <code>ctexcap</code> 宏包,前者只引入必要的中文,后者还会翻译图表等环境名称。为了方便起见,本文使用 <code>ctexcap</code> 宏包。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>[UTF8,noindent]{ctexcap}</span><br></pre></td></tr></table></figure><p>【注】引入 <code>ctexcap</code> 宏包时使用 <code>noindent</code> 参数表示取消段前缩进,因为与一般文档不同,在幻灯片的段落中通常不使用首行缩进。</p><h3 id="2-2-幻灯片风格">2.2 幻灯片风格</h3><p>修改 <code>beamer</code> 幻灯片格式的基本方式是使用主题。<code>beamer</code> 提供了 20 多种不同的幻灯片风格,可以在导言区使用 <code>\usetheme</code> 命令自主选择:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usetheme</span>{PaloAlto}</span><br></pre></td></tr></table></figure><p><code>beamer</code> 提供的官方预定义主题风格可参考<a href="https://hartwork.org/beamer-theme-matrix/">此处</a>,对于更多非官方预定义主题风格可参考<a href="https://github.com/martinbjeldbak/ultimate-beamer-theme-list">此处</a>。</p><p>【注】有趣的是,<code>beamer</code> 文档类提供的官方预定义主题风格大多是以作者游历的一些地点命名的。</p><p>实际上,<code>beamer</code> 的主题是由不同的内部主题、外部主题、色彩主题、字体主题等组合而成的,因此可以分别使用各自对应命令来选择各自的主题:</p><ul><li><code>\useinnertheme</code>:选择内部主题</li><li><code>\useoutertheme</code>:选择外部主题</li><li><code>\usecolortheme</code>:选择色彩主题</li><li><code>\usecolortheme</code>:选择字体主题</li></ul><h4 id="2-2-1-内部主题">2.2.1 内部主题</h4><p>内部主题主要控制的是标题页、列表项目、定理环境、图表环境、脚注等一帧以内的内容格式。预定义的内部主题有:</p><ul><li><code>default</code></li><li><code>circles</code></li><li><code>rectangles</code></li><li><code>rounded</code></li><li><code>inmargin</code></li></ul><h4 id="2-2-2-外部主题">2.2.2 外部主题</h4><p>外部主题主要控制的是幻灯片顶部尾部的信息栏、边栏、图表、帧标题等一帧以外的内功格式。预定义的外部主题有:</p><ul><li><code>default</code></li><li><code>infolines</code></li><li><code>miniframes</code></li><li><code>smoothbars</code></li><li><code>sidebar</code></li><li><code>split</code></li><li><code>shadow</code></li><li><code>tree</code></li><li><code>smoothtree</code></li></ul><h4 id="2-2-3-色彩主题">2.2.3 色彩主题</h4><p>色彩主题控制各个部分的色彩。预定义的色彩主题有:</p><ul><li><code>default</code></li><li><code>albatross</code></li><li><code>beaver</code></li><li><code>beetle</code></li><li><code>crane</code></li><li><code>dolphin</code></li><li><code>dove</code></li><li><code>fly</code></li><li><code>lily</code></li><li><code>orchid</code></li><li><code>rose</code></li><li><code>seagull</code></li><li><code>seahorse</code></li><li><code>sidebartab</code></li><li><code>structure</code></li><li><code>whale</code></li><li><code>wolverine</code></li></ul><h4 id="2-2-4-字体主题">2.2.4 字体主题</h4><p>字体主题则控制幻灯片的整体字体风格。预定义的字体主题有:</p><ul><li><code>default</code>:无衬线字体</li><li><code>professionalfonts</code>:不对字体有特别的设置,需要使用另外专门的宏包进行设置</li><li><code>serif</code>:衬线字体,此时最好选择较大的字号和较粗的字体</li><li><code>structurebold</code></li><li><code>structureitalicserif</code></li><li><code>structuresmallcapsserif</code></li></ul><p>【注】<code>structure</code> 开头的几个字体主题主要是对 <code>beamer</code> 文档类中的几个结构有特别设置。</p><h4 id="2-2-5-自定义风格">2.2.5 自定义风格</h4><p><code>beamer</code> 使用一种模板机制,将幻灯片的不同内容组件格式抽象为模板代码、模板字体、模板色彩,模板代码是实现组件的具体代码。在 <code>beamer</code> 中,提供了许多自定义的设置命令让用户自定义幻灯片风格:</p><ul><li><code>setbeamercolor</code>:设置组件的色彩</li><li><code>setbeamerfont</code>:设置组件字体</li><li><code>setbeamertemplate</code>:设置组件模板的具体实现代码</li></ul><p>比如对于 <code>itemize</code> 列表,可以设置:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\setbeamertemplate</span>{itemize items}[circle]</span><br><span class="line"><span class="keyword">\setbeamercolor</span>{itemize item}{fg=black}</span><br><span class="line"><span class="keyword">\setbeamercolor</span>{itemize/enumerate body}{fg=gray}</span><br><span class="line"><span class="keyword">\setbeamerfont</span>{itemize/enumerate body}{family=<span class="keyword">\rmfamily</span>}</span><br></pre></td></tr></table></figure><p>这样就设置了列表项的符号是一个黑色的圆形,同时类标得内容是 <code>\rmfamily</code> 的灰色文字。</p><p>对于简单的样式修改通过组合现有的主题和背景插图来完成,但对 <code>beamer</code> 进行更详细的样式定制时,字体、色彩、模板名目繁多,可能需要参考在安装目录下 <code>theme/</code> 目录中的模板源代码。<code>beamer</code> 的每一个主题对应一个后缀为 <code>.sty</code> 的主题文件,使用命令 <code>\usetheme</code> 或 <code>\useinnertheme</code> 等切换主题,其实就是在载入主题文件。可以查看官方手册,定制自己的主题文件:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">texdoc beamer</span><br></pre></td></tr></table></figure><h3 id="2-3-幻灯片内容">2.3 幻灯片内容</h3><h4 id="2-3-1-帧">2.3.1 帧</h4><p>在 <code>beamer</code> 中,帧用 <code>frame</code> 环境得到。一帧里面的内容可以使用各种常见的 LaTeX 命令和环境。在每一帧当中,内容有一定的水平边距,并且整体垂直居中显示。幻灯片每一帧通常都有标题,甚至还有小标题:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{标题}</span><br><span class="line"> <span class="keyword">\framesubtitle</span>{小标题}</span><br><span class="line"> 这是简单的一帧</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br><span class="line"><span class="comment">% 标题和小标题还可以有下面更简洁的方式</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}{标题}{小标题}</span><br><span class="line"> 这是简单的一帧</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>beamer</code> 重定义了大量 LaTeX 环境,使它们的格式更适合在幻灯片中显示,比如列表环境和定理类环境,但它们的使用方式和一般的文档没有区别。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{古中国数学}</span><br><span class="line"> <span class="keyword">\framesubtitle</span>{定理发现}</span><br><span class="line"> 中国在 3000 多年前就知道勾股数的概念,比古希腊更早一些。</span><br><span class="line"></span><br><span class="line"> 《周髀算经》的记载:</span><br><span class="line"> <span class="keyword">\begin</span>{itemize}</span><br><span class="line"> <span class="keyword">\item</span> 公元前 11 世纪,商高答周公问:</span><br><span class="line"> <span class="keyword">\begin</span>{quote}</span><br><span class="line"> 勾广三,股修四,径隅五。</span><br><span class="line"> <span class="keyword">\end</span>{quote}</span><br><span class="line"> <span class="keyword">\item</span> 又载公元前 7--6 世纪陈子答荣方问,表述了勾股定理的一般形式:</span><br><span class="line"> <span class="keyword">\begin</span>{quote}</span><br><span class="line"> 若求邪至日者,以日下为勾,日高为股,勾股各自乘,并而开方除之,得邪至日。</span><br><span class="line"> <span class="keyword">\end</span>{quote}</span><br><span class="line"> <span class="keyword">\end</span>{itemize}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><h4 id="2-3-2-首页">2.3.2 首页</h4><p>幻灯片首页也是 <code>beamer</code> 中的一帧,其显示内容也是要在帧环境中设置。但首页又往往和其它页不一样,需要显示整个幻灯的标题、小标题、作者、学院、日期、标题图形等。<code>beamer</code> 在导言区为首页提供了显示相对应内容的命令,在首页帧中需要通过使用 <code>\maketitle</code> 或者 <code>\titlepage</code> 使得这些内容显示到首页帧中。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\title</span>{杂谈勾股定理}</span><br><span class="line"><span class="keyword">\subtitle</span>{数学史讲座之一}</span><br><span class="line"><span class="keyword">\author</span>{BlueHeart} </span><br><span class="line"><span class="keyword">\institute</span>{九章学堂}</span><br><span class="line"><span class="keyword">\date</span>{<span class="keyword">\today</span>}</span><br><span class="line"><span class="keyword">\begin</span>{document}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\maketitle</span> <span class="comment">% 等价于 \titlepage</span></span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"> <span class="comment">% ...</span></span><br><span class="line"><span class="keyword">\end</span>{document}</span><br></pre></td></tr></table></figure><h4 id="2-3-3-分节">2.3.3 分节</h4><p>和一般文档类一样,在 <code>beamer</code> 中可以使用 <code>section</code>、<code>subsection</code>、<code>subsubsection</code> 以及 <code>\part</code> 命令对幻灯片分节,然后使用 <code>\tableofcontents</code> 命令产生目录。目录页也是帧,需要在目录帧中通过使用 <code>\tableofcontents</code> 才能产生目录并将其显示到目录帧中。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{目录}</span><br><span class="line"> <span class="keyword">\tableofcontents</span></span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>\part</code> 命令本身不产生标题,但 <code>beamer</code> 提供了一个 <code>\partpage</code> 命令,它和 <code>\titlepage</code> 命令类似,可以在一帧中产生文档某部分的标题。一个完整的演讲报告 <code>beamer</code> 文档一般控制在几十帧的篇幅,使用 <code>\part</code> 和 <code>\section</code> 至 <code>\subsubsection</code> 的命令进行分节足以。但如果希望将所有很多次的演讲报告内容放进同一个单独的文件,则可以使用 <code>\lecture</code> 命令进行更高一层的内容划分。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\lecture</span>{杂谈勾股定理}{gougu} <span class="comment">% 两个参数分别表示「讲座标题」和「讲座标签」</span></span><br></pre></td></tr></table></figure><p><code>\lecture</code> 命令本身并不产生任何标题和效果,<code>beamer</code> 提供 <code>\insertlecture</code> 命令向文档中插入 <code>\lecture</code> 的标题。还可以通过 <code>\AtBeginLecture</code> 命令在每一讲前面都添加一帧,代替 <code>\maketitle</code>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\AtBeginLecture</span>{</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\Large</span></span><br><span class="line"> 本周论题:<span class="keyword">\insertlecture</span></span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line">}</span><br></pre></td></tr></table></figure><p>此外,<code>\lecture</code> 的另一个用途是使用 <code>\includeonlylecture{<标签>}</code> 来使文档编译时只输出选定标签的那一讲,这样通过修改标签就可以只使用一个文件来分别生成单独的幻灯片了。</p><h4 id="2-3-4-目录">2.3.4 目录</h4><p><code>beamer</code> 中的 <code>\tableofcontents</code> 可以在可选参数中使用许多参数控制其格式:</p><ul><li><code>\tableofcontents[currentsection]</code>:只显示当前一节的目录结构</li><li><code>\tableofcontents[currentsubsection]</code>:只显示当前一小节的目录结构</li></ul><p>【注】以上参数设置在某些情况下是非常有用的,因为演讲时可能需要在每一节的开头都显示一下即将讲到的内容结构,因而每一节前面都应该有一个小目录,特别是缺少导航条显示分节标题的格式更是如此。</p><p>为了方便在每一节前面添加一个目录,<code>beamer</code> 还提供了 <code>\AtBeginSection</code>、<code>\AtBeginSubsection</code> 命令,它们的用法与 LaTeX 原有的 <code>\AtBeginDocument</code> 命令功能类似,用来给每一节或每一小节前面增加一段代码(<code>\AtBeginDocument</code> 命令在整个文档前面添加一段内容,主要用在宏包制作):</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="keyword">\AtBeginSection</span>[]{ <span class="comment">% 空选项[]表示 \section* 前不加目录</span></span><br><span class="line"> <span class="keyword">\begin</span>{frame}{本节概要}</span><br><span class="line"> <span class="keyword">\tableofcontents</span>[currentsection]</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line">}</span><br></pre></td></tr></table></figure><h4 id="2-4-5-定理">2.4.5 定理</h4><p>在 <code>beamer</code> 文档类,已经与定义了许多定理类环境:</p><ul><li><code>definition</code>、<code>definitions</code>:定义</li><li><code>theorem</code>:定理</li><li><code>corollary</code>:推论</li><li><code>proof</code>:证明</li><li><code>fact</code>:事实</li><li><code>example</code>:例子</li></ul><p>除了上述预定义的定理类环境,还可以自定义定理环境:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\newtheorem</span>{thm}{定理}</span><br><span class="line"><span class="keyword">\begin</span>{frame}{现代叙述}</span><br><span class="line"> <span class="keyword">\begin</span>{thm}[勾股定理]</span><br><span class="line"> 直角三角形斜边的平方等于两直角边的平方和。</span><br><span class="line"> <span class="keyword">\end</span>{thm}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><h4 id="2-4-6-区块">2.4.6 区块</h4><p>类似定理环境的彩色框效果,<code>beamer</code> 还提供了其他的区块环境,可以用于强调一部分内容。<code>beamer</code> 提供了三种区块环境:</p><ul><li><code>block</code></li><li><code>alertblock</code></li><li><code>exampleblock</code></li></ul><p>它们除了使用的配色不同之外,用法和结果都大致相同:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\begin</span>{block}{块标题}</span><br><span class="line"> 这是一个区块</span><br><span class="line"> <span class="keyword">\end</span>{block}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><h4 id="2-4-7-图表">2.4.7 图表</h4><p>在 <code>beamer</code> 中使用图表和在一般文档中的语法并无区别。不过由于 <code>beamer</code> 是按帧组织内容的,位置固定,因此 <code>figure</code> 和 <code>table</code> 环境不再是浮动的环境。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}{古中国数学}{定理证明}</span><br><span class="line"> 有论者认为早在公元前 11 世纪商高即已证明勾股定理。完整的证明见于三国时(公元 3 世纪)赵爽对《周髀算经》的注释。</span><br><span class="line"> <span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>[height=0.4<span class="keyword">\textheight</span>]{xiantu.pdf}</span><br><span class="line"> <span class="keyword">\caption</span>{赵爽的弦图可给出勾股定理的一个富于对称美的证明}</span><br><span class="line"> <span class="keyword">\end</span>{figure}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>除了标准的图表环境,<code>beamer</code> 还提供了一个 <code>\logo</code> 命令,用于把一个较小的图表放在幻灯片的左上角落里,可以用它来放置校徽、公司商标等内容。<code>\logo</code> 命令一般放在导言区:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\logo</span>{<span class="keyword">\includegraphics</span>{logo.pdf}}</span><br></pre></td></tr></table></figure><p><code>beamer</code> 内部使用 <code>pgf</code> 宏包绘制定理边框、幻灯片按钮等图形。对于一些简单的数学图形,使用基于 <code>pdf</code> 的 <code>tikz</code> 宏包直接画图是最方便的,比如在绘制直角三角形:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\begin</span>{center}</span><br><span class="line"> <span class="keyword">\begin</span>{tikzpicture}[scale=0.5,font=<span class="keyword">\small</span>]</span><br><span class="line"> <span class="keyword">\draw</span>[thick] (0,0) node[left] {<span class="built_in">$</span>A<span class="built_in">$</span>}</span><br><span class="line"> -- (4,0) node[right] {<span class="built_in">$</span>C<span class="built_in">$</span>}</span><br><span class="line"> -- (4,3) node[above right] {<span class="built_in">$</span>B<span class="built_in">$</span>} -- cycle;</span><br><span class="line"> <span class="keyword">\draw</span> (3.5,0) |- (4,0.5);</span><br><span class="line"> <span class="keyword">\end</span>{tikzpicture}</span><br><span class="line"> <span class="keyword">\end</span>{center}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>幻灯片中的表格务求简明清晰,可以考虑使用行色彩相间的彩色表格。<code>xcolor</code> 宏包通过加上 <code>table</code> 选项就可以实现给表格行加上颜色。由于 <code>beamer</code> 本身就会载入 <code>xcolor</code> 宏包,因此可以直接在 <code>beamer</code> 参数中设置:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\documentclass</span>[xcolor=table]{beamer}</span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\rowcolors</span>{2}{blue!25}{blue!50}</span><br><span class="line"> <span class="keyword">\begin</span>{tabular}{ccc}</span><br><span class="line"> <span class="keyword">\rowcolor</span>{green}x <span class="built_in">&</span> y <span class="built_in">&</span> z <span class="keyword">\\</span></span><br><span class="line"> 3 <span class="built_in">&</span> 4 <span class="built_in">&</span> 5 <span class="keyword">\\</span></span><br><span class="line"> 5 <span class="built_in">&</span> 12 <span class="built_in">&</span> 13 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\end</span>{tabular}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>其中,<code>\rowcolors{n}{color}...{color}</code> 命令使用来表格除去首行外,连续 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">n</span></span></span></span> 行的背景颜色设定,并以 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">n</span></span></span></span> 为周期循环。而 <code>\rowcolor{color}</code> 命令用来在表格中单独设置一行的背景颜色。</p><h4 id="2-4-8-参考文献">2.4.8 参考文献</h4><p>在 <code>beamer</code> 中添加参考文献列表与一般文档的语法没有区别,不过与书面的文稿不同,在幻灯片中通常并不适合特别冗长的文献列表,列出的条目不宜过多,也不需要文献编号。因此,<code>beamer</code> 中的文献列表,文字排版比较宽松,列表前没有标题,默认格式也是没有编号的(因为幻灯片很难前后跳跃翻页,因此编号引用用途不大)。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}{参考文献}</span><br><span class="line"> <span class="keyword">\notice</span>{Shiye}</span><br><span class="line"> <span class="keyword">\bibliography</span>{math}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>如果确实需要对文献进行引用,那么最好使用「作者,年代」的引用格式,避免完全不直观的数字编号可能造成的问题。</p><p>【注】<code>beamer</code> 的文献格式比较特殊,它并不支持 <code>natbib</code> 宏包及其对应的 <code>.bst</code> 文献格式。可以使用相对简单的 <code>apalike</code> 文献格式,它按照 APA 的格式,提供了基本的作者年代引用方式。<code>biblatex</code> 宏包与 <code>beamer</code> 没有明显的冲突,也可以使用。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 提供简单的作者年代引用格式</span></span><br><span class="line"><span class="keyword">\bibliographystyle</span>{apalike}</span><br></pre></td></tr></table></figure><h3 id="2-4-幻灯片动态">2.4 幻灯片动态</h3><h4 id="2-4-1-覆盖">2.4.1 覆盖</h4><p>覆盖是最为基本的一种幻灯片效果,它是把同一帧幻灯片的不同内容按一定次序拆分成几页显示出来。利用覆盖可以让内容逐步显示,也可以让不同内容依次替代,产生类似动画的效果。</p><p>逐条显示是最为常用的覆盖效果,其基本命令是 <code>\pause</code>,表示幻灯片在此处会停顿一下,在 <code>\pause</code> 后面的所有内容会在 pdf 文件的下一页显示。对于目录帧,可以给目录命令加上选项使得目录在一项后面暂停。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}{目录}</span><br><span class="line"> <span class="keyword">\tableofcontents</span>[pausesections]</span><br><span class="line"><span class="keyword">\end</span></span><br></pre></td></tr></table></figure><p>更为一般的是 <code>\onslide</code>,它可以指定内容在一帧中的第几步显示,使用 <code>\onslide</code> 时「不显示的内容还占用原来的位置」。在 <code>\onslide</code> 后面的尖括号中的内容就是覆盖步骤的设置。覆盖语法支持单个的步骤,也支持多个步骤和区间。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\onslide</span><1>{只有第一步}</span><br><span class="line"> <span class="keyword">\onslide</span><2->{第二步之后}</span><br><span class="line"> <span class="keyword">\onslide</span><1,3>{第一、三两步}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>\only</code> 命令与 <code>\onslide</code> 命令类似,不过 <code>\only</code> 命令「在不显示的步骤没有额外的占位」,可以得到内容代替的效果。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> 计数:<span class="keyword">\only</span><1>{1}<span class="keyword">\only</span><2>{2}<span class="keyword">\only</span><3>{3}<span class="keyword">\only</span><4->{4}</span><br><span class="line"></span><br><span class="line"> <span class="keyword">\onslide</span><5>数完了</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>\onslide</code> 和 <code>\only</code> 命令还有许多变种,它们的效果都大同小异。</p><ul><li><code>\uncover</code> 和 <code>\visible</code> 与 <code>\onslide</code> 大体相同,只是用不同的方式隐藏文字。</li><li><code>\invisible</code> 和 <code>\visible</code> 具有相反的效果。</li><li><code>\alt</code> 可以分别设置在指定步骤和步骤外的内容。</li><li><code>\temporal</code> 可以分别指定步骤与此步骤前后的内容。</li></ul><p>【注】这种使用尖括号表示步骤的覆盖语法,实际上在 <code>beamer</code> 的很多命令和环境后面都可以使用,比如:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">% 加粗</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\textbf</span><3>{只在第三步加粗}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br><span class="line"><span class="comment">% 定理</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\begin</span>{theorem}<2-></span><br><span class="line"> 第二步以后显示定理</span><br><span class="line"> <span class="keyword">\end</span>{theorem}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br><span class="line"><span class="comment">% 列表</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\begin</span>{itemize}</span><br><span class="line"> <span class="keyword">\item</span><1-> 开始显示</span><br><span class="line"> <span class="keyword">\item</span><3-> 最后显示</span><br><span class="line"> <span class="keyword">\item</span><2-> 然后显示</span><br><span class="line"> <span class="keyword">\end</span>{itemize}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>在覆盖语法中,使用 <code>+</code> 号就类似使用了 <code>\pause</code>,这可以避免手工计数。连续使用多个 <code>\item<+-></code> 就可以表示 <code>\item<1-></code>、<code>\item<2-></code>、<code>\item<3-></code> …… 的效果。此外,还可以在整个 <code>enumerate</code> 和 <code>itemize</code> 环境后面加上 <code>[<+->]</code> 的可选项,相当于对每个 <code>\item</code> 后面都使用了 <code><+-></code>,非常方便:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\begin</span>{itemize}[<+->]</span><br><span class="line"> <span class="keyword">\item</span> 开始显示</span><br><span class="line"> <span class="keyword">\item</span> 其次显示</span><br><span class="line"> <span class="keyword">\item</span> 最后显示</span><br><span class="line"> <span class="keyword">\end</span>{itemize}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>\structure</code> 和 <code>\alert</code> 命令用于在指定的步骤设置高亮,前者使用幻灯片中结构的色彩,后者使用更鲜明的警告色彩(一般是红色)。它们也可以带上覆盖的语法:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\alert</span><2>{在第二步强调重要的内容}</span><br></pre></td></tr></table></figure><p>此外,高亮命令可以作为覆盖语法的一部分,用在 <code>\item</code> 等命令后面,这样既能控制条目何时显示,可以控制条目高亮:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{itemize}</span><br><span class="line"> <span class="keyword">\item</span><+-| alert@+> 公元前 6 世纪,毕达哥拉斯学派发现一个法则,可以构造直角三角形的边长;</span><br><span class="line"> <span class="keyword">\item</span><+-| alert@+> 公元前 3 世纪,欧几里得《几何原本》使用面积法证明勾股定理。</span><br><span class="line"><span class="keyword">\end</span>{itemize}</span><br><span class="line"><span class="comment">% 更简洁表达为</span></span><br><span class="line"><span class="keyword">\begin</span>{itemize}[<+-| alert@+>]</span><br><span class="line"> <span class="keyword">\item</span> 公元前 6 世纪,毕达哥拉斯学派发现一个法则,可以构造直角三角形的边长;</span><br><span class="line"> <span class="keyword">\item</span> 公元前 3 世纪,欧几里得《几何原本》使用面积法证明勾股定理。</span><br></pre></td></tr></table></figure><h4 id="2-4-2-活动对象和多媒体">2.4.2 活动对象和多媒体</h4><p>在 <code>beamer</code> 中可以使用一些真正的动态演示功能,包括 pdf 动画、javascript 表单、多媒体对象等内容。不过,并非所有的 pdf 阅读器都支持这些动态功能。</p><p>pdf 动画是把动画内容分别画在许多页中,再通过 pdf 文件中自动快速翻页产生的效果。<code>beamer</code> 提供了 <code>\animate</code> 和 <code>\animatevalue</code> 命令生成动画。</p><ul><li><code>\animate<自动步进的步数></code>:定义自动步进的步数,指定的几步会迅速翻页。</li><li><code>\animatevalue<起步,止步>{寄存器,起始值,终止值}</code>:设置动画变量,变量是整数或长度寄存器,可以用于控制画面。</li></ul><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\newdimen</span><span class="keyword">\xoffset</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="comment">% 第一步是静止的,之后自动运动</span></span><br><span class="line"> <span class="keyword">\animate</span><2-10></span><br><span class="line"> <span class="keyword">\animatevalue</span><1-10>{<span class="keyword">\xoffset</span>}{0cm}{5cm}</span><br><span class="line"> <span class="keyword">\hspace</span>{<span class="keyword">\xoffset</span>}从左到右</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>beamer</code> 本身的动画功能比较简单,如果要求更高,可以使用 <code>animate</code> 宏包在幻灯片中画出 pdf 动画来。<code>animate</code> 宏包的动画是嵌入在一个 pdf 页面内的,不需要自动翻页,并且通过 javascript 代码提供了更丰富的控制功能。</p><p><code>beamer</code> 还支持 pdf 页面的动画切换效果,这些效果只在 pdf 文件全屏观看是时有效。比如,可以设置一帧中的第二步为页面从左边飞入:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\begin</span>{frame}{动画切换}</span><br><span class="line"> <span class="keyword">\only</span><1>{旧内容}</span><br><span class="line"> <span class="keyword">\only</span><2>{新内容}</span><br><span class="line"> <span class="keyword">\transcover</span><2></span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p><code>beamer</code> 支持的 pdf 页面切换效果如下表:</p><table><thead><tr><th style="text-align:left">命令</th><th style="text-align:left">效果</th></tr></thead><tbody><tr><td style="text-align:left"><code>\transblindshorizontal</code></td><td style="text-align:left">水平百叶窗</td></tr><tr><td style="text-align:left"><code>\transblindsvertical</code></td><td style="text-align:left">垂直百叶窗</td></tr><tr><td style="text-align:left"><code>\transboxin</code></td><td style="text-align:left">盒状收缩</td></tr><tr><td style="text-align:left"><code>\transboxout</code></td><td style="text-align:left">盒装展开</td></tr><tr><td style="text-align:left"><code>\transcover</code></td><td style="text-align:left">新页面飞入,覆盖旧页面</td></tr><tr><td style="text-align:left"><code>\transdissolve</code></td><td style="text-align:left">溶解</td></tr><tr><td style="text-align:left"><code>\transfade</code></td><td style="text-align:left">渐显</td></tr><tr><td style="text-align:left"><code>\transglitter</code></td><td style="text-align:left">闪烁(与溶解类似)</td></tr><tr><td style="text-align:left"><code>\transpush</code></td><td style="text-align:left">新页面推进,推走旧页面</td></tr><tr><td style="text-align:left"><code>\transsplitverticalin</code></td><td style="text-align:left">垂直收缩</td></tr><tr><td style="text-align:left"><code>\transsplitverticalout</code></td><td style="text-align:left">垂直展开</td></tr><tr><td style="text-align:left"><code>\transsplithorizontalin</code></td><td style="text-align:left">水平收缩</td></tr><tr><td style="text-align:left"><code>\transsplithorizontalout</code></td><td style="text-align:left">水平展开</td></tr><tr><td style="text-align:left"><code>\transuncover</code></td><td style="text-align:left">旧页面飞走,揭开新页面</td></tr><tr><td style="text-align:left"><code>\transwipe</code></td><td style="text-align:left">沿直线消除旧页面</td></tr></tbody></table><p><code>beamer</code> 的一个附属包 <code>multimedia</code> 可以用来在 pdf 幻灯片中嵌入视频、音频等多媒体信息。<code>multimedia</code> 提供视频的基本命令是 <code>\movie</code>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\movie</span>[可选项]{文字}{多媒体文件名}</span><br></pre></td></tr></table></figure><p>比如,下面的代码可以用来播放 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>4</mn><mo>:</mo><mn>3</mn></mrow><annotation encoding="application/x-tex">4:3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">4</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">:</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">3</span></span></span></span> 的 AVI 视频 <code>foo.avi</code>:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{multimedia}</span><br><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="comment">% 自动播放,无显示内容</span></span><br><span class="line"> <span class="keyword">\movie</span>[width=4cm,height=3cm]{Click to play}{foo.avi}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>类似地,<code>\sound</code> 命令用来在 pdf 幻灯片中插入音频:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{multimedia}</span><br><span class="line"><span class="comment">% 导言区</span></span><br><span class="line"><span class="comment">% ……</span></span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="comment">% 自动播放,无显示内容</span></span><br><span class="line"> <span class="keyword">\sound</span>[autostart]{}{foo.au}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>【注】<code>multimedia</code> 的多媒体功能必须使用 pdfLaTeX 进行编译,无法使用 xeLaTeX 处理中文。</p><p><code>media9</code> 宏包(其前身为 <code>movie15</code>,仅支持 pdfLaTeX)提供了比 <code>multimedia</code> 宏包更为强大的多媒体功能,可以嵌入 Adobe Reader 9 所支持的各类媒体和 3D 对象,并支持各种编译引擎和输出驱动,使用 xeLaTeX 可以用它来代替 <code>multimedia</code>。</p><p>除了动画和多媒体信息,使用第三方宏包,还可以在 <code>beamer</code> 中添加更多的动态内容。<code>tdclock</code> 宏包使用 javascript 代码和 pdf 表单,可以在幻灯片中插入日期和时间,可以用来在演讲中计时:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{tdclock}</span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> 当前时间:<span class="keyword">\tdtime</span>;已经过去时间:<span class="keyword">\crono</span></span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><p>不过 <code>tdclock</code> 宏包对 pdfTeX 支持最好,使用 xeLaTeX 会出现一些问题。</p><p><code>ocgtools</code> 宏包提供了所谓可选内容块的功能,可以在幻灯片中添加一个可弹出的可选内容块。<code>ocgtools</code> 要求使用 pdfTeX,且同时要求安装 <code>acrotex</code> 包组件。</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\usepackage</span>{ocgtools}</span><br><span class="line"><span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="comment">% 点击公式会显示定理名称</span></span><br><span class="line"> <span class="keyword">\ocgminitext</span>{<span class="built_in">$</span>a<span class="built_in">^</span>+b<span class="built_in">^</span>2=c<span class="built_in">^</span>2<span class="built_in">$</span>}{Pythagoras Theorem}</span><br><span class="line"><span class="keyword">\end</span>{frame}</span><br></pre></td></tr></table></figure><h2 id="3-附录">3. 附录</h2><h3 id="3-1-学习资料">3.1 学习资料</h3><ul><li>《LaTeX入门》——刘海洋</li><li>《The beamer class User Guide》——Tantau et al.</li><li>《The beamer class User Guide》中译本——黄旭华</li></ul><h3 id="3-2-幻灯片实例">3.2 幻灯片实例</h3><p>效果展示如下:</p><table><thead><tr><th style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/0.jpg" alt=""></th><th style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/1.jpg" alt=""></th></tr></thead><tbody><tr><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/2.jpg" alt=""></td><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/3.jpg" alt=""></td></tr><tr><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/4.jpg" alt=""></td><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/5.jpg" alt=""></td></tr><tr><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/6.jpg" alt=""></td><td style="text-align:center"><img src="/images/TeX/LaTeX/LaTeX%E5%B9%BB%E7%81%AF%E7%89%87%E6%8F%90%E7%BA%B2/7.jpg" alt=""></td></tr></tbody></table><p>代码实现如下:</p><figure class="highlight latex"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">\documentclass</span>[xcolor=table,hideothersubsections]{beamer}</span><br><span class="line"><span class="keyword">\usetheme</span>{PaloAlto}</span><br><span class="line"><span class="keyword">\useinnertheme</span>{circles}</span><br><span class="line"><span class="keyword">\useoutertheme</span>{smoothbars}</span><br><span class="line"><span class="keyword">\usecolortheme</span>{default}</span><br><span class="line"><span class="keyword">\usefonttheme</span>{default}</span><br><span class="line"></span><br><span class="line"><span class="keyword">\setbeamertemplate</span>{itemize items}[circle]</span><br><span class="line"><span class="keyword">\setbeamercolor</span>{itemize item}{fg=black}</span><br><span class="line"><span class="keyword">\setbeamercolor</span>{itemize/enumerate body}{fg=gray}</span><br><span class="line"><span class="keyword">\setbeamerfont</span>{itemize/enumerate body}{family=<span class="keyword">\rmfamily</span>}</span><br><span class="line"></span><br><span class="line"><span class="keyword">\usepackage</span>[UTF8,noindent]{ctexcap}</span><br><span class="line"><span class="keyword">\usepackage</span>{tikz}</span><br><span class="line"></span><br><span class="line"><span class="keyword">\title</span>{杂谈勾股定理}</span><br><span class="line"><span class="keyword">\subtitle</span>{数学史讲座之一}</span><br><span class="line"><span class="keyword">\author</span>{BlueHeart0621}</span><br><span class="line"><span class="keyword">\institute</span>{九章学堂}</span><br><span class="line"><span class="keyword">\date</span>{<span class="keyword">\today</span>}</span><br><span class="line"><span class="keyword">\begin</span>{document}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\maketitle</span></span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"></span><br><span class="line"> <span class="keyword">\section</span>{目录}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{目录}</span><br><span class="line"> <span class="keyword">\tableofcontents</span></span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"></span><br><span class="line"> <span class="keyword">\section</span>{勾股定理在古代}</span><br><span class="line"> <span class="keyword">\subsection</span>{古希腊数学}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{古希腊数学}</span><br><span class="line"> 勾股定理在西方称为毕达哥拉斯定理,古希腊数学家在 2000 多年前就已经发现并证明了它<span class="keyword">\footnote</span>{克莱因(2002).古今数学思想.上海科学技术出版社}。</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">\subsection</span>{古中国数学}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{古中国数学}</span><br><span class="line"> <span class="keyword">\framesubtitle</span>{定理发现}</span><br><span class="line"> 中国在 3000 多年前就知道勾股数的概念,比古希腊更早一些。</span><br><span class="line"></span><br><span class="line"> 《周髀算经》的记载:</span><br><span class="line"> <span class="keyword">\begin</span>{itemize}</span><br><span class="line"> <span class="keyword">\item</span> 公元前 11 世纪,商高答周公问:</span><br><span class="line"> <span class="keyword">\begin</span>{quote}</span><br><span class="line"> 勾广三,股修四,径隅五。</span><br><span class="line"> <span class="keyword">\end</span>{quote}</span><br><span class="line"> <span class="keyword">\item</span> 又载公元前 7--6 世纪陈子答荣方问,表述了勾股定理的一般形式:</span><br><span class="line"> <span class="keyword">\begin</span>{quote}</span><br><span class="line"> 若求邪至日者,以日下为勾,日高为股,勾股各自乘,并而开方除之,得邪至日。</span><br><span class="line"> <span class="keyword">\end</span>{quote}</span><br><span class="line"> <span class="keyword">\end</span>{itemize}</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"></span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{古中国数学}</span><br><span class="line"> <span class="keyword">\framesubtitle</span>{定理证明}</span><br><span class="line"> 有论者认为早在公元前 <span class="built_in">$</span>11<span class="built_in">$</span> 世纪商高即已证明勾股定理<span class="keyword">\footnote</span>{曲安京(1998).商高、赵爽与刘徽关于勾股定理的证明.数学传播,20(3)}。完整的证明见于三国时(公元 <span class="built_in">$</span>3<span class="built_in">$</span> 世纪)赵爽对《周髀算经》的注释。</span><br><span class="line"> <span class="keyword">\begin</span>{figure}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\includegraphics</span>[scale=0.45]{xiantu.pdf}</span><br><span class="line"> <span class="keyword">\caption</span>{赵爽的弦图可以给出勾股定理的一个富于对称美的证明}</span><br><span class="line"> <span class="keyword">\end</span>{figure}</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"> </span><br><span class="line"> <span class="keyword">\section</span>{勾股定理在现代}</span><br><span class="line"> <span class="keyword">\subsection</span>{现代叙述}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{现代叙述}</span><br><span class="line"> <span class="keyword">\begin</span>{theorem}{(勾股定理)}</span><br><span class="line"> 直角三角形谢别的平方等于量直角边的平方和。</span><br><span class="line"> 可以用符号语言表述为:设直角三角形 <span class="built_in">$</span>ABC<span class="built_in">$</span>,其中 <span class="built_in">$</span><span class="keyword">\angle</span>{C} = 90<span class="built_in">^</span><span class="keyword">\circ</span><span class="built_in">$</span>,则有</span><br><span class="line"> <span class="keyword">\begin</span>{equation}</span><br><span class="line"> AB<span class="built_in">^</span>2 = BC<span class="built_in">^</span>2 + AC<span class="built_in">^</span>2</span><br><span class="line"> <span class="keyword">\label</span>{eq:pythagorean}</span><br><span class="line"> <span class="keyword">\end</span>{equation}</span><br><span class="line"> <span class="keyword">\begin</span>{center}</span><br><span class="line"> <span class="keyword">\begin</span>{tikzpicture}[scale=0.5,font=<span class="keyword">\small</span>]</span><br><span class="line"> <span class="keyword">\draw</span>[thick] (0,0) node[left] {<span class="built_in">$</span>A<span class="built_in">$</span>}</span><br><span class="line"> -- (4,0) node[right] {<span class="built_in">$</span>C<span class="built_in">$</span>}</span><br><span class="line"> -- (4,3) node[above right] {<span class="built_in">$</span>B<span class="built_in">$</span>} -- cycle;</span><br><span class="line"> <span class="keyword">\draw</span> (3.5,0) |- (4,0.5);</span><br><span class="line"> <span class="keyword">\end</span>{tikzpicture}</span><br><span class="line"> <span class="keyword">\end</span>{center}</span><br><span class="line"> <span class="keyword">\end</span>{theorem}</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"> <span class="keyword">\subsection</span>{勾股数}</span><br><span class="line"> <span class="keyword">\begin</span>{frame}</span><br><span class="line"> <span class="keyword">\frametitle</span>{勾股数}</span><br><span class="line"> 满足式<span class="keyword">\ref</span>{eq:pythagorean}的整数称为勾股数。前面所说毕达哥拉斯学派得到的三元数就是勾股数。常见的勾股数如下表所示。</span><br><span class="line"></span><br><span class="line"> <span class="keyword">\rowcolors</span>{2}{green!25}{green!50}</span><br><span class="line"> <span class="keyword">\begin</span>{table}</span><br><span class="line"> <span class="keyword">\centering</span></span><br><span class="line"> <span class="keyword">\begin</span>{tabular}{rrr}</span><br><span class="line"> <span class="keyword">\rowcolor</span>{blue!50} 直角边 <span class="built_in">$</span>a<span class="built_in">$</span> <span class="built_in">&</span> 直角边 <span class="built_in">$</span>b<span class="built_in">$</span> <span class="built_in">&</span> 斜边 <span class="built_in">$</span>c<span class="built_in">$</span> <span class="keyword">\\</span></span><br><span class="line"> 3 <span class="built_in">&</span> 4 <span class="built_in">&</span> 5 <span class="keyword">\\</span></span><br><span class="line"> 5 <span class="built_in">&</span> 12 <span class="built_in">&</span> 13 <span class="keyword">\\</span></span><br><span class="line"> 7 <span class="built_in">&</span> 24 <span class="built_in">&</span> 25 <span class="keyword">\\</span></span><br><span class="line"> 8 <span class="built_in">&</span> 15 <span class="built_in">&</span> 17 <span class="keyword">\\</span></span><br><span class="line"> <span class="keyword">\end</span>{tabular}</span><br><span class="line"> <span class="keyword">\caption</span>{较小的几组勾股数}</span><br><span class="line"> <span class="keyword">\label</span>{tb:pythagorean}</span><br><span class="line"> <span class="keyword">\end</span>{table}</span><br><span class="line"> <span class="keyword">\end</span>{frame}</span><br><span class="line"><span class="keyword">\end</span>{document}</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><p>【注】笔记来自《LaTeX入门》——刘海洋。更多细节内容可以参考官方用户手册。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span></summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/tags/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>稀疏矩阵存储格式</title>
<link href="https://hotarugali.github.io/2021/03/17/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/"/>
<id>https://hotarugali.github.io/2021/03/17/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/</id>
<published>2021-03-17T13:50:48.000Z</published>
<updated>2021-04-12T07:14:08.261Z</updated>
<content type="html"><![CDATA[<p>【注】参考自:</p><ul><li><a href="https://blog.csdn.net/stark_summer/article/details/49050079">稀疏矩阵存储格式总结+存储效率对比:COO,CSR,DIA,ELL,HYB</a>。</li><li><a href="http://www.bu.edu/pasi/files/2011/01/NathanBell1-10-1000.pdf">Sparse Matrix Representations & Iterative Solvers, Lesson 1 by Nathan Bell.</a></li></ul><h2 id="1-简介">1. 简介</h2><p>稀疏矩阵是指矩阵中大多数元素为 0 的矩阵。多数情况下,实际问题中的大规模矩阵基本上都是稀疏矩阵,而且很多稀疏矩阵的稀疏度在 90% 甚至 99% 以上。</p><h2 id="2-存储格式">2. 存储格式</h2><p>相较于一般的矩阵存储格式,即保存矩阵所有元素,稀疏矩阵由于其高度的稀疏性,因此需要更高效的存储格式。</p><h3 id="2-1-Coordinate-COO">2.1 Coordinate(COO)</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/COO.png" alt="COO"></p><p>每个非 0 元素使用一个三元组来表示——<code>(行号,列号,数值)</code>。实际存储分三个数组存储,分别表示行索引、列索引、数值。这种格式最简单,每个三元组自己可以定位,空间效率不是最优。</p><h3 id="2-2-Compressed-Sparse-Row-CSR">2.2 Compressed Sparse Row(CSR)</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/CSR.png" alt="CSR"></p><p>CSR 格式是比较标准的一种格式,其同样需要三类数据来表示——数值、列号、行偏移。CSR 不是三元组,而是整体的编码方式。其中,数值和列号和 COO 格式中的一致,某一行的行偏移表示该行的第一个元素在数值数组中的索引。实际存储分三个数组存储,分别表示数值、列号、行偏移。</p><h3 id="2-3-ELLPACK-ELL">2.3 ELLPACK(ELL)</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/ELL.png" alt="ELL"></p><p>【注】上图中间矩阵有误,第三行应为 <code>0 2 3</code>。</p><p>ELL 格式用两个和原始矩阵相同行数的矩阵来分别存储列号和数值,行号用自身所在的行来表示。这两个矩阵每一行都是从头开始放,如果没有元素了就用标志符号 * 结束。</p><ul><li>如果原稀疏矩阵某一行有很多元素,那么这两个矩阵就会很宽,其他行结尾的 * 标志很多,浪费存储空间。一种解决方法是存成数组:</li></ul><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">0 1 * 1 2 * 0 2 3 * 1 3 *</span><br><span class="line">1 7 * 2 8 * 5 3 9 * 6 4 *</span><br></pre></td></tr></table></figure><p>但这样要取一行就不太方便。</p><h3 id="2-4-Diagonal-DIA">2.4 Diagonal(DIA)</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/DIA.png" alt="DIA"></p><p>DIA 格式沿原稀疏矩阵对角线来存储,省略全零的对角线,存储矩阵的列代表对角线,行代表行。对角线从左下往右上开始,行对应原矩阵行存储。</p><ul><li>DIA 格式对于对角性很好的矩阵的压缩率很高,但对角性不好的就比较糟糕。</li></ul><h3 id="2-5-Hybrid-HYB">2.5 Hybrid(HYB)</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/HYB.png" alt="HYB"></p><p>HYB = ELL + COO 格式主要是为了解决 ELL 的问题。HYB 格式是对 ELL 格式的一种修正,如果原稀疏矩阵中某一行特别多,造成其他行的浪费,就把这些多出来的元素用 COO 单独存储。</p><h2 id="3-对比">3. 对比</h2><h3 id="3-1-优缺点概述">3.1 优缺点概述</h3><table><thead><tr><th style="text-align:left">存储格式</th><th style="text-align:left">优点</th><th style="text-align:left">缺点</th></tr></thead><tbody><tr><td style="text-align:left">COO</td><td style="text-align:left">灵活、简单</td><td style="text-align:left">压缩、稀疏矩阵矢量乘积效率低</td></tr><tr><td style="text-align:left">CSR</td><td style="text-align:left">灵活、简单</td><td style="text-align:left">稀疏矩阵矢量乘积效率低</td></tr><tr><td style="text-align:left">ELL</td><td style="text-align:left">稀疏矩阵矢量乘积效率高</td><td style="text-align:left">压缩效率不稳定</td></tr><tr><td style="text-align:left">DIA</td><td style="text-align:left">稀疏矩阵矢量乘积效率高</td><td style="text-align:left">压缩效率不稳定</td></tr></tbody></table><ul><li>COO 格式常用于从文件中进行稀疏矩阵的读写,而 CSR 格式常用于读入数据后进行稀疏矩阵的计算。</li></ul><h3 id="3-2-存储效率">3.2 存储效率</h3><p>CSR 格式在存储稀疏矩阵时非零元素平均使用的字节数最为稳定;DIA 格式存储稀疏矩阵时非零元素平均使用的字节数与矩阵类型关联较大,该格式更适合 Structured Mesh 结构的稀疏矩阵,对于 Unstructured Mesh 和 Random Matrix,DIA 格式使用的字节数是 CSR 的十几倍。</p><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/StructuredMesh.png" alt="StructuredMesh"></p><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/UnstructuredMesh.png" alt="UnstructuredMesh"></p><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/RandomMatrix.png" alt="RandomMatrix"></p><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/PowerLawGraph.png" alt="PowerLawGraph"></p><h3 id="3-3-适用性">3.3 适用性</h3><p><img src="/images/MachineLearning/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8%E6%A0%BC%E5%BC%8F/StorageFormatComparison.png" alt="StorageFormatComparison"></p><h2 id="4-附录">4. 附录</h2><p>除了上述常见的存储格式外,还有一些其他的存储格式,诸如:</p><ul><li>Skyline Storage Format(SKS)</li><li>Block Compressed Sparse Row Format(BSR)</li></ul>]]></content>
<summary type="html"><p>【注】参考自:</p>
<ul>
<li><a href="https://blog.csdn.net/stark_summer/article/details/49050079">稀疏矩阵存储格式总结+存储效率对比:COO,CSR,DIA,ELL,HYB</a>。</li</summary>
<category term="MachineLearning" scheme="https://hotarugali.github.io/categories/MachineLearning/"/>
<category term="MachineLearning" scheme="https://hotarugali.github.io/tags/MachineLearning/"/>
<category term="稀疏矩阵存储" scheme="https://hotarugali.github.io/tags/%E7%A8%80%E7%96%8F%E7%9F%A9%E9%98%B5%E5%AD%98%E5%82%A8/"/>
</entry>
<entry>
<title>实用工具集合</title>
<link href="https://hotarugali.github.io/2021/03/08/Tools/%E5%AE%9E%E7%94%A8%E5%B7%A5%E5%85%B7%E9%9B%86%E5%90%88/"/>
<id>https://hotarugali.github.io/2021/03/08/Tools/%E5%AE%9E%E7%94%A8%E5%B7%A5%E5%85%B7%E9%9B%86%E5%90%88/</id>
<published>2021-03-08T06:51:25.000Z</published>
<updated>2021-04-12T07:14:08.297Z</updated>
<content type="html"><![CDATA[<h4 id="1-when2meet">1. when2meet</h4><p><a href="https://www.when2meet.com/">when2meet</a> 是一个用来规划集体空闲时间段的实时网页工具,使用它可以很方便地统计大家的空闲时间段。</p><h4 id="2-pdf24">2. pdf24</h4><p><a href="https://zh.pdf24.org/">pdf24</a> 提供了很多关于 pdf 的工具,诸如「pdf 分割」、「pdf 合并」、「pdf 转图像」、「图像转 pdf」等。它不仅提供网页版工具,还提供可下载到本地的离线工具。</p><h4 id="3-flameshot">3. flameshot</h4><p><a href="https://github.com/flameshot-org/flameshot">flameshot</a> 是一款优秀的跨平台截屏工具,适配了 Windows、Linux 等主流操作系统。</p><h4 id="4-free-download-manager">4. free download manager</h4><p><a href="https://www.freedownloadmanager.org/zh/">free download manager</a> 是一款优秀的跨平台下载加速器,适配了 Windows、Linux 等主流操作系统。</p><h4 id="5-drawio">5. drawio</h4><p><a href="https://github.com/jgraph/drawio">drawio</a> 是一款优秀的跨平台绘图工具,提供绘制流程图、类图、关系图等各种图,同时支持 LaTeX 数学公式,并且支持多种格式导出,诸如 jpg、png、svg 等。</p>]]></content>
<summary type="html"><h4 id="1-when2meet">1. when2meet</h4>
<p><a href="https://www.when2meet.com/">when2meet</a> 是一个用来规划集体空闲时间段的实时网页工具,使用它可以很方便地统计大家的空闲时间段。</p>
</summary>
<category term="Tools" scheme="https://hotarugali.github.io/categories/Tools/"/>
<category term="Tools" scheme="https://hotarugali.github.io/tags/Tools/"/>
<category term="实用工具" scheme="https://hotarugali.github.io/tags/%E5%AE%9E%E7%94%A8%E5%B7%A5%E5%85%B7/"/>
</entry>
<entry>
<title>Ubuntu20.04开机运行自定义脚本</title>
<link href="https://hotarugali.github.io/2021/03/02/Linux/Ubuntu20.04%E5%BC%80%E6%9C%BA%E8%BF%90%E8%A1%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E8%84%9A%E6%9C%AC/"/>
<id>https://hotarugali.github.io/2021/03/02/Linux/Ubuntu20.04%E5%BC%80%E6%9C%BA%E8%BF%90%E8%A1%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E8%84%9A%E6%9C%AC/</id>
<published>2021-03-02T07:20:01.000Z</published>
<updated>2021-04-12T07:14:08.311Z</updated>
<content type="html"><![CDATA[<h2 id="1-简介">1. 简介</h2><p>基于 Debian 的 Linux 系统默认支持 <code>rc-local.service</code> 服务,这个服务主要用来在系统启动时运行用户自定义的脚本命令等。</p><h2 id="2-配置">2. 配置</h2><p>要想使用 <code>rc-local.service</code> 服务在系统启动时运行用户自定义的脚本命令,首先需要在 <code>/etc</code> 目录下创建 <code>rc.local</code> 文件(若已创建则跳过创建)并修改可执行权限,然后设置该服务开机自启:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo touch /etc/rc.local</span><br><span class="line">sudo chmod 755 /etc/rc.local</span><br><span class="line">sudo systemctl <span class="built_in">enable</span> rc-local.service</span><br></pre></td></tr></table></figure><h2 id="3-添加开机自启脚本">3. 添加开机自启脚本</h2><p>打开 <code>/etc/rc.local</code> 文件,往其中添加运行自定义脚本的命令即可。</p><p>【注】<code>/etc/rc.local</code> 以及自定义脚本中都不能使用系统变量(比如 <code>$HOME</code>,原因在于其执行自定义脚本时并没有继承系统变量)。</p><h2 id="4-查看脚本执行结果">4. 查看脚本执行结果</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl status rc-local.service</span><br></pre></td></tr></table></figure><p>此时会显示开机自启执行脚本的输出结果。</p>]]></content>
<summary type="html"><h2 id="1-简介">1. 简介</h2>
<p>基于 Debian 的 Linux 系统默认支持 <code>rc-local.service</code> 服务,这个服务主要用来在系统启动时运行用户自定义的脚本命令等。</p>
<h2 id="2-配置">2. 配置</</summary>
<category term="Linux" scheme="https://hotarugali.github.io/categories/Linux/"/>
<category term="Linux" scheme="https://hotarugali.github.io/tags/Linux/"/>
</entry>
<entry>
<title>Manjaro20.2开机运行自定义脚本</title>
<link href="https://hotarugali.github.io/2021/03/02/Linux/Manjaro20.2%E5%BC%80%E6%9C%BA%E8%BF%90%E8%A1%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E8%84%9A%E6%9C%AC/"/>
<id>https://hotarugali.github.io/2021/03/02/Linux/Manjaro20.2%E5%BC%80%E6%9C%BA%E8%BF%90%E8%A1%8C%E8%87%AA%E5%AE%9A%E4%B9%89%E8%84%9A%E6%9C%AC/</id>
<published>2021-03-02T06:32:19.000Z</published>
<updated>2021-04-12T07:14:08.317Z</updated>
<content type="html"><![CDATA[<h2 id="1-简介">1. 简介</h2><p>Manjaro 是一款 Arch Linux 发行版,不同于基于 Debian 的 Linux 系统,Manjaro 并不默认支持 <code>rc-local.service</code> 服务,这个服务主要用来在系统启动时运行用户自定义的脚本命令等。</p><h2 id="2-安装">2. 安装</h2><p>虽然 Arch Linux 没有默认支持 <code>rc-local.service</code> 服务,但是我们可以手动安装这个服务并设置开机启动:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -Sy systemd-rc-local</span><br><span class="line">sudo systemctl <span class="built_in">enable</span> rc-local.service</span><br></pre></td></tr></table></figure><h2 id="3-配置">3. 配置</h2><p>要想使用 <code>rc-local.service</code> 服务在系统启动时运行用户自定义的脚本命令,首先需要在 <code>/etc</code> 目录下创建 <code>rc.local</code> 文件并修改可执行权限:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo touch /etc/rc.local</span><br><span class="line">sudo chmod 755 /etc/rc.local</span><br></pre></td></tr></table></figure><h2 id="4-添加开机自启脚本">4. 添加开机自启脚本</h2><p>打开 <code>/etc/rc.local</code> 文件,往其中添加运行自定义脚本的命令即可。</p><p>【注】<code>/etc/rc.local</code> 以及自定义脚本中都不能使用系统变量(比如 <code>$HOME</code>,原因在于其执行自定义脚本时并没有继承系统变量)。</p><h2 id="5-查看脚本执行结果">5. 查看脚本执行结果</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl status rc-local.service</span><br></pre></td></tr></table></figure><p>此时会显示开机自启执行脚本的输出结果。</p>]]></content>
<summary type="html"><h2 id="1-简介">1. 简介</h2>
<p>Manjaro 是一款 Arch Linux 发行版,不同于基于 Debian 的 Linux 系统,Manjaro 并不默认支持 <code>rc-local.service</code> 服务,这个服务主要用来在系统启动</summary>
<category term="Linux" scheme="https://hotarugali.github.io/categories/Linux/"/>
<category term="Linux" scheme="https://hotarugali.github.io/tags/Linux/"/>
</entry>
<entry>
<title>多系统共享蓝牙设备</title>
<link href="https://hotarugali.github.io/2021/02/28/OperationSystem/%E5%A4%9A%E7%B3%BB%E7%BB%9F%E5%85%B1%E4%BA%AB%E8%93%9D%E7%89%99%E8%AE%BE%E5%A4%87/"/>
<id>https://hotarugali.github.io/2021/02/28/OperationSystem/%E5%A4%9A%E7%B3%BB%E7%BB%9F%E5%85%B1%E4%BA%AB%E8%93%9D%E7%89%99%E8%AE%BE%E5%A4%87/</id>
<published>2021-02-28T15:03:20.000Z</published>
<updated>2021-04-12T07:14:08.257Z</updated>
<content type="html"><![CDATA[<h2 id="1-简介">1. 简介</h2><p>当我们在一台电脑上安装了多个操作系统,且电脑只有一个蓝牙适配器时,如果此时使用蓝牙设备(比如蓝牙鼠标),且希望切换系统时能自动连接,则会发现问题:</p><ul><li>如果在当前系统配对后,然后跑到另一个系统下配对,再回到当前系统下会发现蓝牙无法自动连接,只能删除配对并再次配对。然而这样导致的结果就是在另一个系统下同样无法自动连接。</li><li>如此往复,永远无法实现能够在两个操作系统共享蓝牙设备。</li></ul><p>这种情况下你可能认为是系统的蓝牙驱动有问题,然而并非如此。</p><h2 id="2-原理">2. 原理</h2><p>蓝牙适配器、蓝牙设备在实际通信过程中,都是靠其唯一的 MAC 地址来匹配的。当系统和蓝牙设备配对时:</p><ul><li>系统会保留蓝牙设备的 MAC 地址和配对 Key。</li><li>蓝牙设备也会保留系统的蓝牙适配器的 MAC 地址和配对 Key。</li></ul><p>当同一台电脑上的多个系统分别和同一个蓝牙设备进行配对时,蓝牙设备中保留的系统蓝牙适配器的信息会被覆盖,即此次配对信息会覆盖上一次的配对信息。因为蓝牙设备是根据 MAC 地址来标识不同的蓝牙适配器的,同一 MAC 地址的蓝牙适配器在蓝牙设备里只会有一个配对 Key。</p><p>【注】Mac 地址为 48 位长度,其一般格式为 <code>xx:xx:xx:xx:xx:xx</code> 。</p><h2 id="3-解决">3. 解决</h2><p>解决思路很简单,就是将当前系统下配对好的 Key 值覆盖其他已经配对的系统上的 Key 值。</p><h3 id="3-1-Windows-10">3.1 Windows 10</h3><ul><li><p>查找 Windows 上蓝牙适配器和蓝牙设备的 Mac 地址:<strong>「开始菜单右键 -> 设备管理器 -> 蓝牙」</strong>,分别找到系统的蓝牙适配器和蓝牙设备,<strong>「右键属性 -> 高级」</strong>,记录下它们各自对应的 Mac 地址。</p></li><li><p>定位 Windows 上配对的 Key 值:</p></li></ul><blockquote><ol><li>首先需要安装 <code>psexec</code> 工具,其一般在 Windows 上没有安装,<a href="https://docs.microsoft.com/en-us/sysinternals/downloads/psexec">点此跳转下载</a>。</li><li>然后以管理员权限运行 <code>CMD</code>(具体做法:组合键 <code>Win+R</code>,输入 <code>cmd</code>,最后 <code>Ctrl+Shift+Enter</code>)。</li><li>接着在 <code>CMD</code> 下以运行以下命令:</li></ol><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">psexec -s -i regedit.exe</span><br></pre></td></tr></table></figure><ol start="4"><li>在打开的注册表中查找 <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\BTHPORT\Parameters\Keys\[bth ada MAC]\[bth dev MAC]</code>(其中,<code>[bth ada MAC]</code> 为蓝牙适配器的 MAC 地址,<code>[bth dev MAC]</code> 为蓝牙设备的 MAC 地址)<br>【注】如果在 <code>[bth ada MAC]</code> 下没有找到 <code>[bth dev MAC]</code>(比如蓝牙耳机),则直接在 <code>[bth ada MAC]</code> 查找对应的 Key 值。</li><li>最后找到 <code>LTK</code> 项,其对应的数据值即为配对的 Key 值,只需要修改覆盖掉该项即可。</li></ol></blockquote><h3 id="3-2-Linux(Ubuntu-20-04、LinuxMint-20-0、Manjaro-20-2)">3.2 Linux(Ubuntu 20.04、LinuxMint 20.0、Manjaro 20.2)</h3><ul><li>查找 Linux 上蓝牙适配器的 MAC 地址:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bdaddr</span><br></pre></td></tr></table></figure><ul><li><p>查找 Linux 上蓝牙设备的 Mac 地址:利用 <code>bluetoothctl</code> 工具查找,具体参考 <a href="/2020/05/26/%E5%A4%9A%E7%B3%BB%E7%BB%9F%E5%85%B1%E4%BA%AB%E8%93%9D%E7%89%99%E8%AE%BE%E5%A4%87">Deepin15.11下蓝牙配对和连接</a>。</p></li><li><p>定位 Linux 上配对的 Key 值:</p></li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">su</span><br><span class="line"><span class="built_in">cd</span> /var/lib/bluetooth/[bth ada MAC]/[bth dev MAC]</span><br><span class="line">vim info</span><br></pre></td></tr></table></figure><p>其中,<code>[bth ada MAC]</code> 为蓝牙适配器的 MAC 地址,<code>[bth dev MAC]</code> 为蓝牙设备的 MAC 地址。在打开的 <code>info</code> 文件中找到:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[LongTermKey] <span class="comment"># 有的是 [LinkKey]</span></span><br><span class="line">Key=C10C22EB648541239C3A3857784A6130</span><br></pre></td></tr></table></figure><p>其中的 <code>Key</code> 对应的即为配对的 Key 值,只需要修改覆盖掉该项即可。</p><p>【注】如果是 Linux 多系统,其实最简便的方法就是将已经配对好的系统上的 <code>/var/lib/bluetooth/[bth ada MAC]/[bth dev MAC]</code> 直接复制到其他 Linux 系统的 <code>/var/lib/bluetooth/[bth ada MAC]</code> 中,这样其他 Linux 系统都不需要事先和蓝牙设备进行配对就能使用蓝牙设备。如果是 Windows 和 Linux 多系统,由于 Windows 系统增删改注册表比较麻烦,所以最好就是解决顺序是:</p><blockquote><ol><li>先在一个 Linux 系统上配对。</li><li>接着到所以 Windows 系统上依次配对。</li><li>然后记录下最后一个配对的 Windows 系统的 Key 值。</li><li>接着覆盖之前配对的 Windows 系统的 Key 值,以及最初的 Linux 系统的 Key 值。</li><li>最后将最初的 Linux 系统上的配对信息文件夹 <code>/var/lib/bluetooth/[bth ada MAC]/[bth dev MAC]</code> 直接拷贝到其他 Linux 系统的蓝牙适配器文件夹 <code>/var/lib/bluetooth/[bth ada MAC]</code> 下。</li><li>这样就完成了多 Windows 和 Linux 系统共享蓝牙设备。</li></ol></blockquote><h2 id="4-参考">4. 参考</h2><ul><li><p>Arch Linux 平台更多内容可参考<a href="https://wiki.archlinux.org/index.php/Bluetooth_mouse">官方 Wiki</a>。</p></li><li><p><a href="https://unix.stackexchange.com/questions/402488/dual-boot-bluetooth-le-low-energy-device-pairing/413831#413831">Dual Boot Bluetooth LE (low energy) device pairing</a></p></li><li><p><a href="https://unix.stackexchange.com/questions/255509/bluetooth-pairing-on-dual-boot-of-windows-linux-mint-ubuntu-stop-having-to-p">Bluetooth Pairing on Dual Boot of Windows & Linux Mint/Ubuntu - Stop having to Pair Devices</a></p></li></ul>]]></content>
<summary type="html"><h2 id="1-简介">1. 简介</h2>
<p>当我们在一台电脑上安装了多个操作系统,且电脑只有一个蓝牙适配器时,如果此时使用蓝牙设备(比如蓝牙鼠标),且希望切换系统时能自动连接,则会发现问题:</p>
<ul>
<li>如果在当前系统配对后,然后跑到另一个系统下配对,再</summary>
<category term="OperationSystem" scheme="https://hotarugali.github.io/categories/OperationSystem/"/>
<category term="OperationSystem" scheme="https://hotarugali.github.io/tags/OperationSystem/"/>
</entry>
<entry>
<title>LinuxShell多命令执行</title>
<link href="https://hotarugali.github.io/2021/02/28/Linux/LinuxShell%E5%A4%9A%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C/"/>
<id>https://hotarugali.github.io/2021/02/28/Linux/LinuxShell%E5%A4%9A%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C/</id>
<published>2021-02-28T14:49:04.000Z</published>
<updated>2021-04-12T07:14:08.311Z</updated>
<content type="html"><![CDATA[<p>在 Linux 终端下,一行多命令顺序执行主要有三种方式,其基本格式和区别如下:</p><table><thead><tr><th style="text-align:center">多命令执行符</th><th style="text-align:center">基本格式</th><th style="text-align:center">作用</th></tr></thead><tbody><tr><td style="text-align:center"><code>;</code></td><td style="text-align:center"><code>command1 ; command2</code></td><td style="text-align:center">多个命令按照先后顺序执行,命令之间没有逻辑制约关系</td></tr><tr><td style="text-align:center"><code>&&</code></td><td style="text-align:center"><code>command1 && command2</code></td><td style="text-align:center">两个命令为逻辑与制约关系,只有当 <code>command1</code> 执行正确后,<code>command2</code> 才会执行</td></tr><tr><td style="text-align:center"><code>||</code></td><td style="text-align:center"><code>command1 || command2</code></td><td style="text-align:center">两个命令为逻辑或制约关系,只有当 <code>command1</code> 执行错误后,<code>command2</code> 才会执行</td></tr></tbody></table>]]></content>
<summary type="html"><p>在 Linux 终端下,一行多命令顺序执行主要有三种方式,其基本格式和区别如下:</p>
<table>
<thead>
<tr>
<th style="text-align:center">多命令执行符</th>
<th style="text-align:center"</summary>
<category term="Linux" scheme="https://hotarugali.github.io/categories/Linux/"/>
<category term="Linux" scheme="https://hotarugali.github.io/tags/Linux/"/>
</entry>
<entry>
<title>2006-IEEE-Recovering DC coefficients in block-based DCT</title>
<link href="https://hotarugali.github.io/2021/02/23/Research/2006-IEEE-Recovering%20DC%20coefficients%20in%20block-based%20DCT/2006-IEEE-Recovering%20DC%20coefficients%20in%20block-based%20DCT/"/>
<id>https://hotarugali.github.io/2021/02/23/Research/2006-IEEE-Recovering%20DC%20coefficients%20in%20block-based%20DCT/2006-IEEE-Recovering%20DC%20coefficients%20in%20block-based%20DCT/</id>
<published>2021-02-23T12:28:00.000Z</published>
<updated>2021-04-12T07:14:08.324Z</updated>
<content type="html"><![CDATA[<p>【注】此论文中谈论的图像均为像素值在 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>255</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(0,255)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mord">5</span><span class="mord">5</span><span class="mclose">)</span></span></span></span> 范围内的 RGB 图像,定义点 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(i,j)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span></span></span></span> 处<strong>像素值</strong>为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">f(i,j)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span></span></span></span>。</p><h2 id="1-拉普拉斯分布特性">1. 拉普拉斯分布特性</h2><p>对于<strong>自然图像</strong>而言,点 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(i,j)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span></span></span></span> 处的<strong>相邻像素点</strong>为</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mo stretchy="false">{</mo><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo separator="true">,</mo><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo stretchy="false">}</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}\{(i-1,j-1),(i-1,j),(i-1,j+1),(i,j-1),(i,j+1),(i+1,j-1),(i+1,j),(i+1,j+1)\}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2000000000000002em;vertical-align:-0.35000000000000003em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8500000000000001em;"><span style="top:-3.01em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mopen">{</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mclose">}</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.35000000000000003em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><p>对应的<strong>相邻像素点值</strong>为</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>Q</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo>=</mo><mo stretchy="false">{</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>−</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo separator="true">,</mo><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo separator="true">,</mo><mi>j</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo><mo stretchy="false">}</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}Q(i,j)=\{f(i-1,j-1),f(i-1,j),f(i-1,j+1),f(i,j-1),f(i,j+1),f(i+1,j-1),f(i+1,j),f(i+1,j+1)\}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2000000000000002em;vertical-align:-0.35000000000000003em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8500000000000001em;"><span style="top:-3.01em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal">Q</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mopen">{</span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord">1</span><span class="mclose">)</span><span class="mclose">}</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.35000000000000003em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><p>定义<strong>序列</strong></p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo>−</mo><mi>q</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi mathvariant="normal">∀</mi><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo separator="true">,</mo><mi>q</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo>∈</mo><mi>Q</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}f(i,j) - q(i,j) & \forall i, j, q(i,j) \in Q(i,j)\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.2000000000000002em;vertical-align:-0.35000000000000003em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8500000000000001em;"><span style="top:-3.01em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.35000000000000003em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.8500000000000001em;"><span style="top:-3.01em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">∀</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">q</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">∈</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord mathnormal">Q</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.35000000000000003em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><p>则该序列基本符合均值为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>0</mn></mrow><annotation encoding="application/x-tex">0</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">0</span></span></span></span> ,方差很小的拉普拉斯分布。此即为自然图像相邻像素值的<strong>拉普拉斯分布特性</strong>。</p><h2 id="2-JPEG-中的-DCT-和-IDCT-公式">2. JPEG 中的 DCT 和 IDCT 公式</h2><p>JPEG 中采用的是 DCT-II 公式。其中</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>C</mi><mo stretchy="false">(</mo><mi>x</mi><mo stretchy="false">)</mo><mo>=</mo><mrow><mo fence="true">{</mo><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><msqrt><mfrac><mn>1</mn><mn>8</mn></mfrac></msqrt></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>x</mi><mo>=</mo><mn>0</mn></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mfrac><mn>1</mn><mn>2</mn></mfrac></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>x</mi><mo mathvariant="normal">≠</mo><mn>0</mn></mrow></mstyle></mtd></mtr></mtable></mrow></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}C(x) = \left\{ \begin{array}{c} \sqrt{\frac{1}{8}} & x = 0 \\ \frac{1}{2} & x \neq 0 \end{array}\right.\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:3.045108em;vertical-align:-1.272554em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.772554em;"><span style="top:-3.772554em;"><span class="pstrut" style="height:3.772554em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mopen">(</span><span class="mord mathnormal">x</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="minner"><span class="mopen delimcenter" style="top:0em;"><span class="delimsizing size4">{</span></span><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.772554em;"><span style="top:-3.7725539999999995em;"><span class="pstrut" style="height:3.235054em;"></span><span class="mord"><span class="mord sqrt"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.235054em;"><span class="svg-align" style="top:-3.8em;"><span class="pstrut" style="height:3.8em;"></span><span class="mord" style="padding-left:1em;"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">8</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span><span style="top:-3.195054em;"><span class="pstrut" style="height:3.8em;"></span><span class="hide-tail" style="min-width:1.02em;height:1.8800000000000001em;"><svg width='400em' height='1.8800000000000001em' viewBox='0 0 400000 1944' preserveAspectRatio='xMinYMin slice'><path d='M983 90l0 -0c4,-6.7,10,-10,18,-10 H400000v40H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5c53.7,-170.3,84.5,-266.8,92.5,-289.5zM1001 80h400000v40h-400000z'/></svg></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.604946em;"><span></span></span></span></span></span></span></span><span style="top:-2.3225em;"><span class="pstrut" style="height:3.235054em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.272554em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.772554em;"><span style="top:-3.7725539999999995em;"><span class="pstrut" style="height:3.235054em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord">0</span></span></span><span style="top:-2.3225em;"><span class="pstrut" style="height:3.235054em;"></span><span class="mord"><span class="mord mathnormal">x</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel"><span class="mrel"><span class="mord vbox"><span class="thinbox"><span class="rlap"><span class="strut" style="height:0.8888799999999999em;vertical-align:-0.19444em;"></span><span class="inner"><span class="mrel"></span></span><span class="fix"></span></span></span></span></span><span class="mrel">=</span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord">0</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.272554em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.272554em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><h3 id="2-1-DCT-公式">2.1 DCT 公式</h3><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mi>F</mi><mo stretchy="false">(</mo><mi>u</mi><mo separator="true">,</mo><mi>v</mi><mo stretchy="false">)</mo><mo>=</mo><mi>C</mi><mo stretchy="false">(</mo><mi>u</mi><mo stretchy="false">)</mo><mi>C</mi><mo stretchy="false">(</mo><mi>v</mi><mo stretchy="false">)</mo><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>0</mn></mrow><mn>7</mn></msubsup><msubsup><mo>∑</mo><mrow><mi>j</mi><mo>=</mo><mn>0</mn></mrow><mn>7</mn></msubsup><mi>f</mi><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo>⋅</mo><mi>cos</mi><mo></mo><mrow><mfrac><mrow><mn>2</mn><mi>i</mi><mo>+</mo><mn>1</mn></mrow><mn>16</mn></mfrac><mi>u</mi><mi>π</mi></mrow><mi>cos</mi><mo></mo><mrow><mfrac><mrow><mn>2</mn><mi>j</mi><mo>+</mo><mn>1</mn></mrow><mn>16</mn></mfrac><mi>v</mi><mi>π</mi></mrow></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}F(u,v) = C(u) C(v) \sum_{i=0}^7 \sum_{j=0}^7 f(i,j) \cdot \cos{\frac{2i+1}{16} u \pi} \cos{\frac{2j+1}{16} v \pi}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.389826em;vertical-align:-0.444913em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.944913em;"><span style="top:-2.9909049999999997em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">F</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mclose">)</span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.954008em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mrel mtight">=</span><span class="mord mtight">0</span></span></span></span><span style="top:-3.2029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">7</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.29971000000000003em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.954008em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span><span class="mrel mtight">=</span><span class="mord mtight">0</span></span></span></span><span style="top:-3.2029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">7</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.43581800000000004em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.10764em;">f</span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">⋅</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mop">cos</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.855664em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mord mtight">6</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mord mathnormal mtight">i</span><span class="mbin mtight">+</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop">cos</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.907772em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mord mtight">6</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.446108em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span><span class="mbin mtight">+</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.444913em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><h3 id="2-2-IDCT-公式">2.2 IDCT 公式</h3><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><mover accent="true"><mi>f</mi><mo>^</mo></mover><mo stretchy="false">(</mo><mi>i</mi><mo separator="true">,</mo><mi>j</mi><mo stretchy="false">)</mo><mo>=</mo><msubsup><mo>∑</mo><mrow><mi>u</mi><mo>=</mo><mn>0</mn></mrow><mn>7</mn></msubsup><msubsup><mo>∑</mo><mrow><mi>v</mi><mo>=</mo><mn>0</mn></mrow><mn>7</mn></msubsup><mi>C</mi><mo stretchy="false">(</mo><mi>u</mi><mo stretchy="false">)</mo><mi>C</mi><mo stretchy="false">(</mo><mi>v</mi><mo stretchy="false">)</mo><mi>F</mi><mo stretchy="false">(</mo><mi>u</mi><mo separator="true">,</mo><mi>v</mi><mo stretchy="false">)</mo><mo>⋅</mo><mi>cos</mi><mo></mo><mrow><mfrac><mrow><mn>2</mn><mi>i</mi><mo>+</mo><mn>1</mn></mrow><mn>16</mn></mfrac><mi>u</mi><mi>π</mi></mrow><mi>cos</mi><mo></mo><mrow><mfrac><mrow><mn>2</mn><mi>j</mi><mo>+</mo><mn>1</mn></mrow><mn>16</mn></mfrac><mi>v</mi><mi>π</mi></mrow></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}\hat{f}(i,j) = \sum_{u=0}^7 \sum_{v=0}^7 C(u) C(v) F(u,v) \cdot \cos{\frac{2i+1}{16} u \pi} \cos{\frac{2j+1}{16} v \pi}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.31788em;vertical-align:-0.4089399999999999em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9089400000000001em;"><span style="top:-2.95106em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord accent"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9578799999999998em;"><span style="top:-3em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.10764em;">f</span></span></span><span style="top:-3.26344em;"><span class="pstrut" style="height:3em;"></span><span class="accent-body" style="left:-0.08332999999999999em;"><span class="mord">^</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.19444em;"><span></span></span></span></span></span><span class="mopen">(</span><span class="mord mathnormal">i</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.05724em;">j</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.954008em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">u</span><span class="mrel mtight">=</span><span class="mord mtight">0</span></span></span></span><span style="top:-3.2029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">7</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.29971000000000003em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.954008em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.03588em;">v</span><span class="mrel mtight">=</span><span class="mord mtight">0</span></span></span></span><span style="top:-3.2029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">7</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.29971000000000003em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mclose">)</span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span><span class="mopen">(</span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mclose">)</span><span class="mord mathnormal" style="margin-right:0.13889em;">F</span><span class="mopen">(</span><span class="mord mathnormal">u</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mclose">)</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">⋅</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mop">cos</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.855664em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mord mtight">6</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mord mathnormal mtight">i</span><span class="mbin mtight">+</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal">u</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop">cos</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.907772em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mord mtight">6</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.446108em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">2</span><span class="mord mathnormal mtight" style="margin-right:0.05724em;">j</span><span class="mbin mtight">+</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord mathnormal" style="margin-right:0.03588em;">v</span><span class="mord mathnormal" style="margin-right:0.03588em;">π</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4089399999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><h2 id="3-AC-系数预测-DC-系数">3. AC 系数预测 DC 系数</h2><h3 id="3-1-原理">3.1 原理</h3><p>相邻图像块边界的图像像素值满足拉普拉斯分布,因此可以用来预测相邻块的 DC 分量。假设已知相邻两个 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn><mo>×</mo><mn>8</mn></mrow><annotation encoding="application/x-tex">8 \times 8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">8</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">×</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> 图像块边缘相邻的两个图像点像素值:</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msup><mi>p</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msup><mo>=</mo><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msup><mo>+</mo><mfrac><mn>1</mn><msup><mi>N</mi><mn>2</mn></msup></mfrac><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msubsup></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msup><mi>p</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msup><mo>=</mo><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msup><mo>+</mo><mfrac><mn>1</mn><msup><mi>N</mi><mn>2</mn></msup></mfrac><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msubsup></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}p^{(k)} = \rho^{(k)} + \frac{1}{N^2} c_{1,1}^{(k)} \\p^{(k+1)} = \rho^{(k+1)} + \frac{1}{N^2} c_{1,1}^{(k+1)}\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:2.8944319999999992em;vertical-align:-1.1972159999999996em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.6972159999999996em;"><span style="top:-3.697215999999999em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463142857142857em;"><span style="top:-2.786em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span></span></span><span style="top:-2.25em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463142857142857em;"><span style="top:-2.786em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.1972159999999996em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><p>其中,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>ρ</mi></mrow><annotation encoding="application/x-tex">\rho</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.19444em;"></span><span class="mord mathnormal">ρ</span></span></span></span> 表示组成像素值 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>p</mi></mrow><annotation encoding="application/x-tex">p</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.625em;vertical-align:-0.19444em;"></span><span class="mord mathnormal">p</span></span></span></span> 的所有 AC 分量部分,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow></msub></mrow><annotation encoding="application/x-tex">c_{1,1}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.716668em;vertical-align:-0.286108em;"></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.301108em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span></span></span></span> 表示当前块的 DC 分量(本质上为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mrow><mi>F</mi><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>0</mn><mo stretchy="false">)</mo></mrow><mrow><mi>C</mi><mo stretchy="false">(</mo><mn>0</mn><mo stretchy="false">)</mo><mi>C</mi><mo stretchy="false">(</mo><mn>0</mn><mo stretchy="false">)</mo></mrow></mfrac></mrow><annotation encoding="application/x-tex">\frac{F(0,0)}{C(0)C(0)}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.53em;vertical-align:-0.52em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.01em;"><span style="top:-2.655em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.07153em;">C</span><span class="mopen mtight">(</span><span class="mord mtight">0</span><span class="mclose mtight">)</span><span class="mord mathnormal mtight" style="margin-right:0.07153em;">C</span><span class="mopen mtight">(</span><span class="mord mtight">0</span><span class="mclose mtight">)</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.485em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.13889em;">F</span><span class="mopen mtight">(</span><span class="mord mtight">0</span><span class="mpunct mtight">,</span><span class="mord mtight">0</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.52em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span>)。则根据拉普拉斯特性有:</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msup><mi>p</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msup></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">≈</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msup><mi>p</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msup></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⇒</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msup><mo>+</mo><mfrac><mn>1</mn><msup><mi>N</mi><mn>2</mn></msup></mfrac><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msubsup></mrow></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">≈</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msup><mo>+</mo><mfrac><mn>1</mn><msup><mi>N</mi><mn>2</mn></msup></mfrac><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msubsup></mrow></mstyle></mtd></mtr><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">⇒</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msubsup></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mo lspace="0em" rspace="0em">≈</mo></mstyle></mtd><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msubsup><mo>+</mo><msup><mi>N</mi><mn>2</mn></msup><mo stretchy="false">(</mo><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msup><mo>−</mo><msup><mi>ρ</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msup><mo stretchy="false">)</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}& p^{(k+1)} & \approx & p^{(k)} \\\Rightarrow & \rho^{(k+1)} + \frac{1}{N^2} c_{1,1}^{(k+1)} & \approx & \rho^{(k)} + \frac{1}{N^2} c_{1,1}^{(k)} \\\Rightarrow & c_{1,1}^{(k+1)} & \approx & c_{1,1}^{(k)} + N^2 (\rho^{(k)} - \rho^{(k+1)})\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:4.142431999999999em;vertical-align:-1.821215999999999em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.3212159999999997em;"><span style="top:-4.478016em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"></span></span><span style="top:-3.0732160000000004em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mrel">⇒</span></span></span><span style="top:-1.6260000000000008em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mrel">⇒</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.821215999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.3212159999999997em;"><span style="top:-4.478016em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.0732160000000004em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463142857142857em;"><span style="top:-2.786em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span></span></span><span style="top:-1.6260000000000008em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.821215999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.3212159999999997em;"><span style="top:-4.478016em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mrel">≈</span></span></span><span style="top:-3.0732160000000004em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mrel">≈</span></span></span><span style="top:-1.6260000000000008em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mrel">≈</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.821215999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:2.3212159999999997em;"><span style="top:-4.478016em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">p</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.0732160000000004em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463142857142857em;"><span style="top:-2.786em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span></span></span><span style="top:-1.6260000000000008em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8879999999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:1.821215999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><p>因此,如果当前图像块的 DC 分量缺失,其实是可以用相邻块来进行预测。其主要思想就是用未缺失的 AC 分量结合相邻块的 DC 分量来预测当前块的 DC 分量。</p><h3 id="3-2-方式">3.2 方式</h3><p>![相邻块DC系数预测方式](/images/Research/2006-IEEE-Recovering DC coefficients in block-based DCT/相邻块DC系数预测方式.png)</p><p>因为 JPEG 是以 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn><mo>×</mo><mn>8</mn></mrow><annotation encoding="application/x-tex">8 \times 8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">8</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">×</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> 大小划分图像块的,以第一种方式为例,预测得到的当前块的 DC 系数为:</p><p><span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mtable rowspacing="0.15999999999999992em" columnalign="center" columnspacing="1em"><mtr><mtd><mstyle scriptlevel="0" displaystyle="false"><mrow><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msubsup><mo>≈</mo><msubsup><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msubsup><mo>+</mo><mfrac><msup><mi>N</mi><mn>2</mn></msup><mn>8</mn></mfrac><msubsup><mo>∑</mo><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mn>8</mn></msubsup><mo stretchy="false">(</mo><msubsup><mi>ρ</mi><mi>i</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo stretchy="false">)</mo></mrow></msubsup><mo>−</mo><msubsup><mi>ρ</mi><mi>i</mi><mrow><mo stretchy="false">(</mo><mi>k</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow></msubsup><mo stretchy="false">)</mo></mrow></mstyle></mtd></mtr></mtable><annotation encoding="application/x-tex">{\begin{array}{c}c_{1,1}^{(k+1)} \approx c_{1,1}^{(k)} + \frac{N^2}{8} \sum_{i=1}^8 (\rho^{(k)}_i - \rho^{(k+1)}_i)\end{array}}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.4472159999999998em;vertical-align:-0.4736079999999999em;"></span><span class="mord"><span class="mord"><span class="mtable"><span class="arraycolsep" style="width:0.5em;"></span><span class="col-align-c"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.9736079999999999em;"><span style="top:-2.9736079999999996em;"><span class="pstrut" style="height:3.0448em;"></span><span class="mord"><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">≈</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4336920000000006em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4024159999999999em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">+</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.01792em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">8</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8913142857142857em;"><span style="top:-2.931em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop"><span class="mop op-symbol small-op" style="position:relative;top:-0.0000050000000000050004em;">∑</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.954008em;"><span style="top:-2.40029em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mathnormal mtight">i</span><span class="mrel mtight">=</span><span class="mord mtight">1</span></span></span></span><span style="top:-3.2029em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">8</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.29971000000000003em;"><span></span></span></span></span></span></span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4231360000000004em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.27686399999999994em;"><span></span></span></span></span></span></span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">−</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mord"><span class="mord mathnormal">ρ</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.0448em;"><span style="top:-2.4231360000000004em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mathnormal mtight">i</span></span></span><span style="top:-3.2198em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mopen mtight">(</span><span class="mord mathnormal mtight" style="margin-right:0.03148em;">k</span><span class="mbin mtight">+</span><span class="mord mtight">1</span><span class="mclose mtight">)</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.27686399999999994em;"><span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.4736079999999999em;"><span></span></span></span></span></span><span class="arraycolsep" style="width:0.5em;"></span></span></span></span></span></span></span></span></p><h2 id="4-JPEG-压缩中-DC-系数与-AC-系数之间的制约关系">4. JPEG 压缩中 DC 系数与 AC 系数之间的制约关系</h2><p>由于 DC 系数(<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mfrac><mn>1</mn><msup><mi>N</mi><mn>2</mn></msup></mfrac><msub><mi>c</mi><mrow><mn>1</mn><mo separator="true">,</mo><mn>1</mn></mrow></msub></mrow><annotation encoding="application/x-tex">\frac{1}{N^2} c_{1,1}</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.190108em;vertical-align:-0.345em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.845108em;"><span style="top:-2.6550000000000002em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight"><span class="mord mathnormal mtight" style="margin-right:0.10903em;">N</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.7463142857142857em;"><span style="top:-2.786em;margin-right:0.07142857142857144em;"><span class="pstrut" style="height:2.5em;"></span><span class="sizing reset-size3 size1 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.394em;"><span class="pstrut" style="height:3em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.345em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span><span class="mord"><span class="mord mathnormal">c</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.301108em;"><span style="top:-2.5500000000000003em;margin-left:0em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight"><span class="mord mtight">1</span><span class="mpunct mtight">,</span><span class="mord mtight">1</span></span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.286108em;"><span></span></span></span></span></span></span></span></span></span>)是 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>8</mn><mo>×</mo><mn>8</mn></mrow><annotation encoding="application/x-tex">8 \times 8</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.72777em;vertical-align:-0.08333em;"></span><span class="mord">8</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span><span class="mbin">×</span><span class="mspace" style="margin-right:0.2222222222222222em;"></span></span><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">8</span></span></span></span> 图像块像素值的均值,且像素值的范围为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>255</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">(0,255)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">(</span><span class="mord">0</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mord">5</span><span class="mord">5</span><span class="mclose">)</span></span></span></span>,故 DC 系数与 AC 系数之间会相互制约:</p><ul><li>若 AC 系数的可变化范围大,则说明 DC 系数较小。</li><li>若 DC 系数较大,则说明 AC 系数的可变化范围小。</li></ul><p>DC 系数和 AC 系数的取值范围不同,且最值不能同时取到。比如:</p><ul><li>DC 系数的取值范围为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mo>−</mo><mn>1024</mn><mo separator="true">,</mo><mn>1024</mn><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">[-1024, 1024]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">−</span><span class="mord">1</span><span class="mord">0</span><span class="mord">2</span><span class="mord">4</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">1</span><span class="mord">0</span><span class="mord">2</span><span class="mord">4</span><span class="mclose">]</span></span></span></span>。</li><li>某些 AC 系数的取值范围为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo stretchy="false">[</mo><mo>−</mo><mn>420.3863</mn><mo separator="true">,</mo><mn>420.3863</mn><mo stretchy="false">]</mo></mrow><annotation encoding="application/x-tex">[-420.3863, 420.3863]</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mopen">[</span><span class="mord">−</span><span class="mord">4</span><span class="mord">2</span><span class="mord">0</span><span class="mord">.</span><span class="mord">3</span><span class="mord">8</span><span class="mord">6</span><span class="mord">3</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">4</span><span class="mord">2</span><span class="mord">0</span><span class="mord">.</span><span class="mord">3</span><span class="mord">8</span><span class="mord">6</span><span class="mord">3</span><span class="mclose">]</span></span></span></span>。</li></ul>]]></content>
<summary type="html"><p>【注】此论文中谈论的图像均为像素值在 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo s</summary>
<category term="Research" scheme="https://hotarugali.github.io/categories/Research/"/>
<category term="Research" scheme="https://hotarugali.github.io/tags/Research/"/>
<category term="CV" scheme="https://hotarugali.github.io/tags/CV/"/>
<category term="DC系数恢复" scheme="https://hotarugali.github.io/tags/DC%E7%B3%BB%E6%95%B0%E6%81%A2%E5%A4%8D/"/>
</entry>
<entry>
<title>Linux下查看工具官方文档</title>
<link href="https://hotarugali.github.io/2021/02/22/Linux/Linux%E4%B8%8B%E6%9F%A5%E7%9C%8B%E5%B7%A5%E5%85%B7%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3/"/>
<id>https://hotarugali.github.io/2021/02/22/Linux/Linux%E4%B8%8B%E6%9F%A5%E7%9C%8B%E5%B7%A5%E5%85%B7%E5%AE%98%E6%96%B9%E6%96%87%E6%A1%A3/</id>
<published>2021-02-22T10:57:00.000Z</published>
<updated>2021-04-12T07:14:08.317Z</updated>
<content type="html"><![CDATA[<h2 id="1-简介">1. 简介</h2><p>Linux 系统包含大量开源工具,大部分开源工具在安装时都自带手册,而手册又分为使用手册、技术手册和帮助文档等。</p><h2 id="2-使用手册">2. 使用手册</h2><p>Linux 下非内建工具的使用手册一般都集成在 <code>man</code> 或 <code>info</code> 工具中,内建工具的使用手册集成在 <code>help</code> 工具。查看工具 <code>xxx</code> 的使用手册直接在终端运行以下命令中对应的那个即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">man xxx</span><br><span class="line">info xxx</span><br><span class="line"><span class="built_in">help</span> xxx</span><br></pre></td></tr></table></figure><h2 id="3-技术手册">3. 技术手册</h2><p>技术手册往往包含详细的技术实现细节,Linux 下一般存在于目录 <code>\usr\share\doc</code> 下面,想要查看工具的技术手册可以到该目录下查看。</p><h2 id="4-帮助文档">4. 帮助文档</h2><p>有些大型的工具可能有自己的一套规则,在使用它们时就需要查看相应的帮助文档。这些帮助文档往往由它们自带的命令提供,比如 TeXLive 提供 <code>texdoc</code> 工具用于查找对应宏包的帮助文档、Python 提供 <code>pydoc</code> 工具用于查找方法\函数\类等。</p>]]></content>
<summary type="html"><h2 id="1-简介">1. 简介</h2>
<p>Linux 系统包含大量开源工具,大部分开源工具在安装时都自带手册,而手册又分为使用手册、技术手册和帮助文档等。</p>
<h2 id="2-使用手册">2. 使用手册</h2>
<p>Linux 下非内建工具的使用手册一般</summary>
<category term="Linux" scheme="https://hotarugali.github.io/categories/Linux/"/>
<category term="Linux" scheme="https://hotarugali.github.io/tags/Linux/"/>
</entry>
<entry>
<title>Linux修改grub菜单</title>
<link href="https://hotarugali.github.io/2021/02/11/Linux/Linux%E4%BF%AE%E6%94%B9grub%E8%8F%9C%E5%8D%95/"/>
<id>https://hotarugali.github.io/2021/02/11/Linux/Linux%E4%BF%AE%E6%94%B9grub%E8%8F%9C%E5%8D%95/</id>
<published>2021-02-11T02:12:00.000Z</published>
<updated>2021-04-12T07:14:08.311Z</updated>
<content type="html"><![CDATA[<p>【注】参考自 <a href="https://www.gnu.org/software/grub/manual/grub/grub.html">grub 官方手册</a>。</p><h2 id="1-保留上一次-grub-菜单选项">1. 保留上一次 grub 菜单选项</h2><h3 id="1-1-问题">1.1 问题</h3><p>每次开机时,大部分 Linux 发行版的 grub 菜单都是定位在首选项位置(即当前系统选项位置)。这就导致如果我们电脑安装了多个系统,那么每次开机进入其他系统都要重新选择 grub 菜单选项。而我们一般都是一段时间固定使用一个系统,因此如果 grub 菜单能够记住上一次的菜单选项,我们平常使用就不需要手动切换 grub 菜单选项(除非需要更换开机系统)。这样可以让我们免去每次开机都需要手动查看更改 grub 菜单选项,特别是 Winddows 系统,每次更新后基本都要重启,每次都需要盯着重启那一刻重新选择进入 Windows 系统,不胜其烦。</p><h3 id="1-2-解决">1.2 解决</h3><p>修改 Linux 的 <code>/etc/default/grub</code> 文件,添加以下内容:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">GRUB_DEFAULT=saved</span><br><span class="line">GRUB_SAVEDEFAULT=<span class="literal">true</span></span><br></pre></td></tr></table></figure><p><code>GRUB_DEFAULT</code> 可取值为<strong>选项 ID、选项名称字符串以及 saved</strong>,选项 ID 是从 0 开始计数的。</p><ul><li><p><strong>选项 ID 和选项名称字符串</strong>都是指定 grub 默认菜单选项。</p></li><li><p><strong>saved</strong> 使用 <code>GRUB_SAVEDEFAULT</code> 变量保存的或 <code>grub-set-default</code> 命令设定的选项作为 grub 默认菜单选项。</p></li></ul><p><code>GRUB_SAVEDEFAULT</code> 变量若设置为 <strong>true</strong>,则会保留上一次的 grub 菜单选项,默认没有设置该变量。</p><h2 id="2-修改-grub-菜单等待时间">2. 修改 grub 菜单等待时间</h2><h3 id="2-1-问题">2.1 问题</h3><p>有些 Linux 发行版开机进入 grub 菜单后等待时间很短,因此每次都需要抓住 grub 菜单出来的那一刻手动按键终止 grub 菜单等待时间倒计时。有时甚至来不及修改 grub 菜单选项,就进入了默认的系统。</p><h3 id="2-2-解决">2.2 解决</h3><p>修改 Linux 的 <code>/etc/default/grub</code> 文件中的 <code>GRUB_TIMEOUT</code> 变量值,单位为秒:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">GRUB_TIMEOUT=<span class="string">"30"</span> <span class="comment"># 比如修改为 30 秒的等待时间</span></span><br></pre></td></tr></table></figure><p><code>GRUB_TIMEOUT</code> 可取值为:</p><ul><li><p><strong>正整数</strong>:grub 等待指定秒数。</p></li><li><p><strong>0</strong>:grub 不等待直接进入默认系统。</p></li><li><p><strong>-1</strong>:grub 永久等待,不会自动进入默认系统。</p></li></ul>]]></content>
<summary type="html"><p>【注】参考自 <a href="https://www.gnu.org/software/grub/manual/grub/grub.html">grub 官方手册</a>。</p>
<h2 id="1-保留上一次-grub-菜单选项">1. 保留上一次 grub 菜单选项</summary>
<category term="Linux" scheme="https://hotarugali.github.io/categories/Linux/"/>
<category term="Linux" scheme="https://hotarugali.github.io/tags/Linux/"/>
</entry>
<entry>
<title>P1439「【模板】最长公共子序列」</title>
<link href="https://hotarugali.github.io/2021/01/26/ACM/%E9%A2%98%E8%A7%A3/P1439%E3%80%8C%E3%80%90%E6%A8%A1%E6%9D%BF%E3%80%91%E6%9C%80%E9%95%BF%E5%85%AC%E5%85%B1%E5%AD%90%E5%BA%8F%E5%88%97%E3%80%8D/"/>
<id>https://hotarugali.github.io/2021/01/26/ACM/%E9%A2%98%E8%A7%A3/P1439%E3%80%8C%E3%80%90%E6%A8%A1%E6%9D%BF%E3%80%91%E6%9C%80%E9%95%BF%E5%85%AC%E5%85%B1%E5%AD%90%E5%BA%8F%E5%88%97%E3%80%8D/</id>
<published>2021-01-25T17:19:00.000Z</published>
<updated>2021-04-12T07:14:08.267Z</updated>
<content type="html"><![CDATA[<h2 id="1-题目">1. 题目</h2><p>题目链接:<a href="https://www.luogu.com.cn/problem/P1439">P1439「【模板】最长公共子序列」</a> 。</p><h3 id="题目描述">题目描述</h3><p>给出 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo separator="true">,</mo><mn>2</mn><mo separator="true">,</mo><mo>…</mo><mo separator="true">,</mo><mi>n</mi></mrow><annotation encoding="application/x-tex">1,2,\ldots,n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8388800000000001em;vertical-align:-0.19444em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="minner">…</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal">n</span></span></span></span> 的两个排列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>P</mi><mn>1</mn></msub></mrow><annotation encoding="application/x-tex">P_1</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.83333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:-0.13889em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">1</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span> 和 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><msub><mi>P</mi><mn>2</mn></msub></mrow><annotation encoding="application/x-tex">P_2</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.83333em;vertical-align:-0.15em;"></span><span class="mord"><span class="mord mathnormal" style="margin-right:0.13889em;">P</span><span class="msupsub"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.30110799999999993em;"><span style="top:-2.5500000000000003em;margin-left:-0.13889em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.15em;"><span></span></span></span></span></span></span></span></span></span>,求它们的最长公共子序列。</p><h3 id="输入格式">输入格式</h3><p>第一行是一个数 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">n</span></span></span></span>。</p><p>接下来两行,每行为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">n</span></span></span></span> 个数,为自然数 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo separator="true">,</mo><mn>2</mn><mo separator="true">,</mo><mo>…</mo><mo separator="true">,</mo><mi>n</mi></mrow><annotation encoding="application/x-tex">1,2,\ldots,n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8388800000000001em;vertical-align:-0.19444em;"></span><span class="mord">1</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord">2</span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="minner">…</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mpunct">,</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal">n</span></span></span></span> 的一个排列。</p><h3 id="输出格式">输出格式</h3><p>一个数,即最长公共子序列的长度。</p><h3 id="输入输出样例">输入输出样例</h3><h4 id="输入-1">输入 #1</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">5 </span><br><span class="line">3 2 1 4 5</span><br><span class="line">1 2 3 4 5</span><br></pre></td></tr></table></figure><h4 id="输出-1">输出 #1</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">3</span><br></pre></td></tr></table></figure><h3 id="说明-提示">说明/提示</h3><ul><li><p>对于 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>50</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">50\%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.80556em;vertical-align:-0.05556em;"></span><span class="mord">5</span><span class="mord">0</span><span class="mord">%</span></span></span></span> 的数据,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo>≤</mo><mn>1</mn><msup><mn>0</mn><mn>3</mn></msup></mrow><annotation encoding="application/x-tex">n \le 10^3</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7719400000000001em;vertical-align:-0.13597em;"></span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8141079999999999em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">3</span></span></span></span></span></span></span></span></span></span></span>;</p></li><li><p>对于 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>100</mn><mi mathvariant="normal">%</mi></mrow><annotation encoding="application/x-tex">100\%</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.80556em;vertical-align:-0.05556em;"></span><span class="mord">1</span><span class="mord">0</span><span class="mord">0</span><span class="mord">%</span></span></span></span> 的数据,<span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi><mo>≤</mo><mn>1</mn><msup><mn>0</mn><mn>5</mn></msup></mrow><annotation encoding="application/x-tex">n \le 10^5</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.7719400000000001em;vertical-align:-0.13597em;"></span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span><span class="mrel">≤</span><span class="mspace" style="margin-right:0.2777777777777778em;"></span></span><span class="base"><span class="strut" style="height:0.8141079999999999em;vertical-align:0em;"></span><span class="mord">1</span><span class="mord"><span class="mord">0</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">5</span></span></span></span></span></span></span></span></span></span></span>。</p></li></ul><h2 id="2-题解">2. 题解</h2><h3 id="分析">分析</h3><p>这是一道 LCS 的模板题,但是如果只用朴素的动态规划来解,复杂度是 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>O</mi><mo stretchy="false">(</mo><msup><mi>n</mi><mn>2</mn></msup><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">O(n^2)</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1.064108em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord"><span class="mord mathnormal">n</span><span class="msupsub"><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.8141079999999999em;"><span style="top:-3.063em;margin-right:0.05em;"><span class="pstrut" style="height:2.7em;"></span><span class="sizing reset-size6 size3 mtight"><span class="mord mtight">2</span></span></span></span></span></span></span></span><span class="mclose">)</span></span></span></span>,结果终究会 TLE。和 LCS 类似的是 LIS,然而 LIS 有 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>O</mi><mo stretchy="false">(</mo><mi>n</mi><mi>log</mi><mo></mo><mi>n</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">O(n \log{n})</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord mathnormal" style="margin-right:0.02778em;">O</span><span class="mopen">(</span><span class="mord mathnormal">n</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mop">lo<span style="margin-right:0.01389em;">g</span></span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord"><span class="mord mathnormal">n</span></span><span class="mclose">)</span></span></span></span> 的解法,幸运的是部分 LCS 问题可以用 LIS 来解。</p><ul><li><p>在 LCS 中,两个序列中的元素仅表示一种符号,用来判定是否相等的符号,对于符号背后具体的数值对 LCS 的结果并没有影响。</p></li><li><p>在 LIS 中,是需要考虑序列元素的数值大小关系的。</p></li></ul><p>若 LCS 的两个序列中的其中一个元素互异,则可以用 LIS 来解。在此类 LCS 中,不防假设序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 中元素是互异的,设序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 的长度为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">n</span></span></span></span>,则我们可以考虑将 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 的元素按照出现顺序依次映射到 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>…</mo><mi>n</mi></mrow><annotation encoding="application/x-tex">1 \ldots n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="minner">…</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal">n</span></span></span></span> 上,从而得到 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 中元素与数值的一一对应关系。然后根据 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 元素的映射表,来计算序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> 元素对应的映射值;对于在 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> 中存在而不在 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 中存在的元素,直接舍弃即可,因为它们必然不会出现在 LCS 中。如此,映射完 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>B</mi></mrow><annotation encoding="application/x-tex">B</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.05017em;">B</span></span></span></span> 得到的数值序列设为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>C</mi></mrow><annotation encoding="application/x-tex">C</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span></span></span></span>,其长度为 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>m</mi></mrow><annotation encoding="application/x-tex">m</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.43056em;vertical-align:0em;"></span><span class="mord mathnormal">m</span></span></span></span>。则此时只需要计算序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>C</mi></mrow><annotation encoding="application/x-tex">C</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span></span></span></span> 的 LIS 即可。这是因为序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 映射后的序列是一个递增的数值序列,因此 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>A</mi></mrow><annotation encoding="application/x-tex">A</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal">A</span></span></span></span> 和 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>C</mi></mrow><annotation encoding="application/x-tex">C</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span></span></span></span> 的公共子序列也是递增子序列,最长公共子序列也是最长递增子序列,即序列 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>C</mi></mrow><annotation encoding="application/x-tex">C</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.68333em;vertical-align:0em;"></span><span class="mord mathnormal" style="margin-right:0.07153em;">C</span></span></span></span> 的最长递增子序列。</p><p>针对这道题而言,由于两个序列都是 <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1</mn><mo>…</mo><mi>n</mi></mrow><annotation encoding="application/x-tex">1 \ldots n</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.64444em;vertical-align:0em;"></span><span class="mord">1</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="minner">…</span><span class="mspace" style="margin-right:0.16666666666666666em;"></span><span class="mord mathnormal">n</span></span></span></span> 的排列,因此可以转为 LIS 问题来求解。</p><h3 id="代码">代码</h3><figure class="highlight c++"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string"><bits/stdc++.h></span></span></span><br><span class="line"><span class="keyword">using</span> <span class="keyword">namespace</span> <span class="built_in">std</span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 最长递增子序列</span></span><br><span class="line"><span class="class"><span class="keyword">struct</span> <span class="title">LIS</span>{</span></span><br><span class="line"> <span class="meta">#<span class="meta-keyword">ifndef</span> _LIS_</span></span><br><span class="line"> <span class="meta">#<span class="meta-keyword">define</span> ll int </span></span><br><span class="line"> <span class="meta">#<span class="meta-keyword">define</span> MAXN 100005</span></span><br><span class="line"> <span class="meta">#<span class="meta-keyword">endif</span> </span></span><br><span class="line"> ll n;</span><br><span class="line"> ll A[MAXN];</span><br><span class="line"> LIS(): n(<span class="number">0</span>) {}</span><br><span class="line"> <span class="comment">// 二分+栈求 LIS 长度</span></span><br><span class="line"> <span class="comment">// 复杂度 O(nlogn)</span></span><br><span class="line"> <span class="function">ll <span class="title">length</span><span class="params">()</span> </span>{</span><br><span class="line"> ll cntn = n;</span><br><span class="line"> ll *seqa = A;</span><br><span class="line"> <span class="built_in">vector</span> <ll> lis;</span><br><span class="line"> lis.push_back(seqa[<span class="number">0</span>]);</span><br><span class="line"> <span class="keyword">for</span>(ll i = <span class="number">1</span>; i < cntn; ++i) {</span><br><span class="line"> <span class="keyword">if</span>(seqa[i] > lis.back()) {</span><br><span class="line"> lis.push_back(seqa[i]);</span><br><span class="line"> } <span class="keyword">else</span> {</span><br><span class="line"> ll pos = lower_bound(lis.begin(), lis.end(), seqa[i]) - lis.begin();</span><br><span class="line"> lis[pos] = min(lis[pos], seqa[i]);</span><br><span class="line"> }</span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">return</span> lis.size();</span><br><span class="line"> }</span><br><span class="line">};</span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>{</span><br><span class="line"> <span class="keyword">int</span> n;</span><br><span class="line"> <span class="keyword">int</span> P[MAXN];</span><br><span class="line"> LIS lis;</span><br><span class="line"> <span class="built_in">scanf</span>(<span class="string">"%d"</span>, &n);</span><br><span class="line"> lis.n = n;</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>; i < n; ++i) {</span><br><span class="line"> <span class="keyword">int</span> a;</span><br><span class="line"> <span class="built_in">scanf</span>(<span class="string">"%d"</span>, &a);</span><br><span class="line"> P[a] = i; </span><br><span class="line"> }</span><br><span class="line"> <span class="keyword">for</span>(<span class="keyword">int</span> i = <span class="number">0</span>; i < n; ++i) {</span><br><span class="line"> <span class="keyword">int</span> b;</span><br><span class="line"> <span class="built_in">scanf</span>(<span class="string">"%d"</span>, &b);</span><br><span class="line"> lis.A[i] = P[b];</span><br><span class="line"> }</span><br><span class="line"> <span class="built_in">printf</span>(<span class="string">"%d\n"</span>, lis.length());</span><br><span class="line"> <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>]]></content>
<summary type="html"><h2 id="1-题目">1. 题目</h2>
<p>题目链接:<a href="https://www.luogu.com.cn/problem/P1439">P1439「【模板】最长公共子序列」</a> 。</p>
<h3 id="题目描述">题目描述</h3>
<p>给出</summary>
<category term="ACM" scheme="https://hotarugali.github.io/categories/ACM/"/>
<category term="题解" scheme="https://hotarugali.github.io/categories/ACM/%E9%A2%98%E8%A7%A3/"/>
<category term="题解" scheme="https://hotarugali.github.io/tags/%E9%A2%98%E8%A7%A3/"/>
</entry>
<entry>
<title>计算机英语</title>
<link href="https://hotarugali.github.io/2021/01/23/English/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%8B%B1%E8%AF%AD/"/>
<id>https://hotarugali.github.io/2021/01/23/English/%E8%AE%A1%E7%AE%97%E6%9C%BA%E8%8B%B1%E8%AF%AD/</id>
<published>2021-01-23T11:30:00.000Z</published>
<updated>2021-04-12T07:14:08.321Z</updated>
<content type="html"><![CDATA[<h3 id="2020-07-24">2020-07-24</h3><ul><li>in itself : 本身、实质上</li><li>It is up to sb. to do sth. : 由某人来做某事</li><li>nothing but = nothing else than : 只、不过</li></ul><h3 id="2020-08-24">2020-08-24</h3><ul><li>feel a nagging tension :感到紧张</li><li>tactic :策略</li><li>polymorphic :多态的</li><li>noninvasively :非侵袭性地</li><li>on the fly :动态地</li><li>adverse :不利的</li><li>pivot :n 枢轴;vt 以…为中心旋转;adj 关键的,枢轴的</li><li>quadratic :二次的,二次方程式</li><li>lopsided :不平衡的,倾向一方的</li><li>afresh :重新地,再度</li><li>heuristic :启发式的</li><li>thereof :由此,在其中,将它,它的,关于…</li><li>interleave :交替</li><li>optimum :最适宜的,最佳效果</li><li>referee :vi 仲裁,担任裁判;vt 为…担任裁判,调停;n 裁判员</li><li>dilemma :困境,进退两难</li><li>deterioration :恶化,退化</li></ul><h3 id="2020-08-26">2020-08-26</h3><ul><li>having a bad hair day :糟糕的一天,不顺心的一天</li></ul><h3 id="2020-09-19">2020-09-19</h3><ul><li>the standard deviation :标准差</li><li>Chebyshev’s inequality :切比雪夫不等式</li><li>refine :改善,精炼,提纯</li><li>probabilistic :概率性的</li><li>It is tempting to …… :很容易……</li><li>venerable :庄严的,值得尊敬的</li><li>tinker :n 补锅匠,修补匠; vt 修补;vi 做焊锅匠</li><li>offset :n 抵消,补偿,偏移;v 抵消,补偿</li><li>side effects :副作用</li><li>cutoff :n 切掉,中断,捷径;adj 截止的,中断的</li><li>accordingly :因此,于是,相应地</li><li>it pays to …… :……是值得的/是有好处的</li><li>entropy :熵</li><li>personnel :n 人事部门,全体成员;adj 人员的</li><li>solely :单独地,唯一地</li><li>nature :性质</li><li>straightforward :adj 简单的,坦率的,明确的;adv 直截了当地</li><li>fall out of favor :失宠</li><li>asymptotically :渐近的</li><li>lower bound :下界</li><li>conservative :保守的</li><li>notion :概念</li></ul><h3 id="2020-09-20">2020-09-20</h3><ul><li>derive :推导出,衍生出</li><li>optimum :最优效果</li><li>proportional :比例的,成比例的</li><li>immaterial :非物质的,无形的,不重要的</li><li>tune :n 曲调,和谐;vt 调整,使一致;vi 协调</li><li>outperform :胜出</li><li>stump :vt 困扰;n 树桩</li><li>tantamount :同等的,相当于……的</li><li>overlook :vt|n 忽视,远眺</li></ul><h3 id="2020-09-21">2020-09-21</h3><ul><li>integral :n 积分;adj 积分的</li><li>imporper integral :反常积分</li><li>singularity :n 奇异,奇点</li><li>integrand :n 被积函数</li><li>simultaneously :同时地</li><li>contour :n 轮廓,等高线;vt 画轮廓</li></ul><h3 id="2020-09-24">2020-09-24</h3><ul><li>fine-tuned :n 有调整的,有提高的</li><li>distortion :n 变形,扭曲</li><li>conditioning :n 调节;条件作用</li><li>knob :n 把手</li><li>codec :n 编码解码器</li><li>artifact :n 手工制品,人工制品</li><li>amenable :有责任的,有义务的,顺从的,经得起检验的</li><li>sparse :稀疏的,稀少的</li><li>wavelet :微波,小浪</li><li>Lagrangian :拉格朗日算符</li><li>Lagrange multiplier :拉格朗日乘子</li><li>has advanced to :已经先进到……</li><li>PSNR :Peak Signal to Noise Ratio,峰值信噪比</li><li>resemblance :相似之处</li><li>faintest :一点也不的(用于否定句),极小的</li><li>resolution :分辨率</li><li>super-resolution :超分</li><li>conditional autoencoder</li><li>latent presentation</li><li>Universal Quantization</li><li>to the best of our knowledge :据我们所知</li><li>recurrent neural networks (RNNs)</li><li>perceptual :感知的,有知觉的</li><li>multi-scale structural similarity (MS-SSIM)</li><li>Preliminary :n 初始工作,准备工作;adj 初始的</li><li>probability mass function :概率质量函数</li><li>Probability density function :概率密度函数</li><li>scalar factor :比例因子</li><li>stochastic :随机的</li><li>dither :v 犹豫不决;n 犹豫不决,紧张,颤抖</li><li>intactable :棘手的,难治的,倔强的</li><li>tactable :易于管教的,易于处理的</li><li>differentiable :可微分的</li><li>divergence :n 差异,分歧,发散</li><li>defer :vi 推迟,延期;vt 使推迟,使延期</li><li>posterior :n 后部;adj 其次的</li><li>convolution :卷积</li><li>transpose :vt 转置,调换;vi 使进行变换;n 转置阵</li><li>marginal :边缘的,微不足道的</li><li>batch :n 一批;vt 分批次处理</li><li>gradient descent :梯度下降</li><li>retrieve :vt 检索,恢复;n 检索,恢复</li></ul><h3 id="2020-09-26">2020-09-26</h3><ul><li>Bernoulli distribution :伯努利分布(0-1 分布)</li><li>Binomial distribution :二项分布(n 重伯努利分布)</li><li>Multinomial distribution :多项式分布</li><li>Exponential distribution :指数分布</li><li>Normal distribution :正态分布</li><li>Uniform distribution :均匀分布</li><li>Dirac delta function :狄利克雷函数</li><li>Empirical distribution :经验分布</li><li>Mixture distribution :混合分布</li><li>prior probability :先验概率</li><li>posterior probability :后验概率</li><li>positive part function :正部函数</li><li>negative part functino :负部函数</li><li>we will cut to the chase :我们就开门见山吧</li><li>Kullback-Leibler divergence :KL 散度(相对熵)</li></ul><h3 id="2020-09-27">2020-09-27</h3><ul><li>Rectified Linear Unit :整流线性单位函数</li><li>objective function :目标函数</li><li>cost function :代价函数</li><li>loss function :损失函数</li><li>error function :误差函数</li><li>gradient descent :梯度下降</li><li>second derivative test :二阶导数测试</li><li>isometry :n 等距,等容,等高</li><li>provided that :如果,条件是,倘若</li><li>calculus :微积分学</li><li>supremum :上确界,最小上界</li><li>condition number :条件数</li><li>constrained optimization :约束优化</li><li>singular value :奇异值</li><li>singular vector :奇异向量</li><li>pseudoinverse :伪逆矩阵</li><li>scale-invariant feature transform :尺度不变特征转换</li><li>mean squared error :均方误差</li><li>cross entropy error :交叉熵误差</li></ul><h3 id="2020-09-28">2020-09-28</h3><ul><li>homogeneous :均匀的,齐次的,同类的</li><li>numerical differentiation :数值微分</li><li>rounding error :舍入误差</li><li>numerical differentiation :数值微分</li><li>enumerate :枚举</li><li>stochastic :随机的</li><li>stochastic gradient descent :随机梯度下降法</li><li>notably :显著地,尤其</li><li>be meant to do :打算做……</li><li>nested :嵌套的</li><li>tensor :张量</li><li>axes :n 轴线,座标轴(axis 复数);斧头(axe 复数)</li><li>a range of evenly spaced intervals.</li><li>concatenate :v 连接;adj 连接的</li></ul><h3 id="2020-09-29">2020-09-29</h3><ul><li>computational graph :计算图</li><li>forward propagation :正向传播</li><li>backward propagation :反向传播</li><li>chain rule :链式法则</li><li>parvasive :普遍的,流行的</li><li>compression artifacts :压缩失真</li><li>intractable :棘手的,难治的</li><li>elaborate :adj 精心制作的;v 精心制作,详细阐述</li><li>deluge :n 洪水,泛滥;vt 泛滥,压倒</li><li>Consequently 因此,所以,结果</li><li>impose :vi 利用,欺骗;vt 强加,征税</li><li>assess :vt 评定,估价,对……征税</li><li>efficacy :n 功效,效力</li><li>pioneer :n 先锋;vt 开辟,倡导;vi 作先驱</li><li>alleviate :vt 减轻,缓和</li><li>proposition :n 命题,主题;vt 向……提议</li><li>conform :vi 符合,遵照;vt 使遵守;adj 一致的,顺从的</li><li>notation :n 符号;注释;记号法</li><li>convolutional :卷积的</li><li>compact :adj 袖珍的,紧凑的,简洁的;n 小汽车,契约;v 把……压实;使紧密,使简洁,压缩,订立(协定)</li><li>up-sample :上采样(放大图像)</li><li>down-sample :下采样(缩小图像)</li><li>ablate :vt 烧蚀,切除,使脱落;vi 脱落</li><li>textured :起纹理的</li><li>blur :n 模糊不清的事物;v 使……模糊不清,变模糊,玷污</li><li>patch :n 碎片;vt 修补;解决</li><li>monomial :adj 单项的;n 单项式</li><li>simultaneous :adj 同时的,联立的;n 同时译员</li><li>crop :n 产量,农作物;vt 种植,收割,修剪,剪短;vi 收获</li><li>FLOPS :FLoating-point OPerations per Second,每秒所运行的浮点运算次数</li><li>FLOPs :FLoating point OPerations,浮点运算数</li><li>MACS :Multiply Accumulate operations per Second,每秒执行的定点乘累加操作次数</li><li>MACs :Multiply-Accumulation operations,定点乘累加操作次数(GFLOPs = 2 * GMACs)</li><li>outermost :最远的,最外面的</li><li>preliminary :adj 初步的,开始的;n 初步行动</li><li>HPL :High Performance Linpack(线性系统软件包:linear system package)</li><li>CPU :Central Process Unit</li><li>GPU :Graphics Process Unit</li></ul><h3 id="2020-09-30">2020-09-30</h3><ul><li>normal equation :正规方程</li><li>generalization :泛化</li><li>underfitting :欠拟合</li><li>overfitting :过拟合</li><li>hypothesis space :假设空间</li><li>representation capacity :表示容量</li><li>non-parametric :非参数的</li><li>nearest neighbor regression :最近邻回归</li><li>regime :n 政权,管理体制,社会制度</li><li>weight decay :权重衰减</li><li>regularizer :正则化项</li><li>validation set :验证集</li><li>unbiased :无偏的</li><li>asymptotically unbiased :渐进无偏</li><li>sample variance :样本方差</li><li>consistency :一致性</li><li>almost sure convergence :几乎必然收敛</li><li>deep feedforward network = feedforward neural network = multilayer perceptron(MLP) :深度前馈网络 = 前馈神经网络 = 多层感知机</li><li>recurrent neural network :循环神经网络</li><li>support vector :支持向量</li><li>convex quadratic programming :凸二次优化</li><li>dual problem :对偶问题</li><li>superior :adj 上级的,优秀的,出众的;n 上级,长官,高手,优胜者</li><li>inferior :adj 差的,自卑的,下级的,下等的;n 下级,次品</li><li>consistent :始终如一的,一致的,坚持的</li><li>comparable :类似的,可比较的,同等的,相当的</li><li>demonstrate :vt 论证,展示,证明;vi 示威</li><li>turnkey :n 狱吏,总控钥匙(turnkey success:总的成功)</li><li>instrumental :起作用的,有帮助的</li><li>grayscale :灰度图,灰度模式</li><li>to name a few. :举几个来说</li><li>advent :n 到来,降临</li><li>spatial :空间的,存在于空间的,受空间条件限制的</li><li>methodology :方法学,方法论</li><li>let alone :更不必说,听任,不打扰</li><li>stretch :v 伸展,拉紧,足够,大量要求,延续;adj 延续的,可拉伸的</li><li>coefficient :系数</li><li>sparse representation :稀疏表示(也称为稀疏编码:sparse coding)</li><li>sparsity :n 稀疏,稀少,贫乏</li><li>intensive :adj 加强的,集中的,透彻的;n 加强器</li><li>computationally intensive. :计算密集型</li><li>adversarial :对抗的,对手的,敌手的</li><li>violate :vt 违反,妨碍,亵渎</li><li>pre-determined :v 预先决定,命中注定;adj 预先确定的</li><li>degraded :adj 退化的,堕落的,被降级的</li><li>in mind :考虑到</li><li>denoise :降噪,消除干扰</li><li>additive :n 添加剂;adj 累加的</li><li>luminance :n 亮度</li><li>chrominance :n 色度,色差,彩色信号</li><li>clearly :adv 清晰地,明显地,无疑地,明净地</li><li>monochrome :n 黑白照片,单色照片;adj 黑白的,单色的</li><li>likewise :同样地,也</li><li>ground-truth :真实的</li><li>In what follows :在下文中</li><li>quotients :商</li></ul><h3 id="2020-10-02">2020-10-02</h3><ul><li>outset :n 开始,开端</li><li>scalar :adj 标量的,数量的,梯状的,分等级的;n 数量,标量</li><li>scalar-valued :adj 标量值的</li><li>tile :n 瓷砖,瓦片;vt 铺以瓷砖</li><li>align :vt 使结盟,使成一行,匹配;vi 排列,排成一行</li><li>scaler layer :</li><li>weight decay :权重衰减</li><li>aggregate :v 聚合,聚集;adj 聚合的;n 聚合</li><li>pooling :池化</li><li>flip :翻转</li><li>cross-correlation :互相关</li><li>commutative:可交换的</li><li>sparse interactions :稀疏交互</li><li>parameter sharing :参数共享</li><li>equivariant representation :等变表示</li><li>receptive field :接受域</li><li>ensemble learning :集成学习</li><li>heterogenous :adj 异质的,异源的,异种的</li><li>momentum :动量,冲力,势头</li><li>anisotropic :adj 各向异性的,非均质的</li><li>hyper-parameter :超参数</li></ul><h3 id="2020-10-03">2020-10-03</h3><ul><li>piecewise :adj 分段的;adv 分段地</li><li>matrix calculus :矩阵微分</li><li>Numerator Layout :分子布局</li><li>Denominator Layout :分母布局</li><li>Discrete Optimization :离散优化</li><li>Combinatorial Optimization :组合优化</li><li>Integer Programming :整数优化</li><li>Integer Linear Programming(ILP):整数线性规划</li><li>Credit Assignment Problem(CAP):贡献度分配问题</li><li>feature map :特征图</li><li>Data Augmentation :数据扩充</li><li>receptive field :感受野</li><li>fine tuning :微调</li><li>reinforcement learning :强化学习</li><li>open domain :开放环境</li><li>ontoloty/knowledge graph :知识图库</li></ul><h3 id="2020-10-06">2020-10-06</h3><ul><li>Atrous Convolution :空洞卷积</li><li>Dilated Convolution :膨胀卷积</li><li>dynamical system :动力系统</li><li>stochestic dynamical system :随机动力系统</li><li>Partition Function :配分函数</li></ul><h3 id="2020-10-08">2020-10-08</h3><ul><li>compact :adj 紧凑的,简洁的;n 合同,契约;vt 使简洁,使紧密结合</li><li>provenance :n 出处,起源</li><li>indispensable :adj 不可缺少的,绝对必要的,责无旁贷的;n 不可缺少之物,不可缺少之人</li><li>withstand :vt 反抗,抵挡,禁得起;vi 抵挡</li><li>sequentially :adv 继续地;从而;循序地</li><li>intensity :n 强度,亮度,紧张</li><li>variance :方差</li><li>Linear Programming :线性规划</li><li>ubiquitous :adj 普遍存在的,无所不在的</li><li>intensive :adj 加强的,集中的;n 加强器</li></ul><h3 id="2020-10-09">2020-10-09</h3><ul><li>rectified :改正的,整流的,精馏过的;v 调整,精馏</li><li>spectral :光谱的,鬼怪的,幽灵的</li><li>surveillance :监视,监督</li><li>feasibility :可行性,可能性</li><li>dispersion :n 散布,离散,驱散</li><li>disperse :v 分散,传播</li><li>contaminate :vt 污染,弄脏</li><li>leverage :n 手段,影响力,杠杆作用;v 利用,举债经营</li><li>intuitive :adj 直觉的,凭直觉获知的</li><li>orthogonal :adj 正交的,直角的;n 正交直线</li><li>invariant :adj 不变的;n 不变量</li><li>manuscript :n 手稿,原稿;adj 手写的</li><li>order :n [数]阶</li><li>recurrence relation :递推关系</li><li>innovation :n 革新,创新</li><li>brand-new :adj 崭新的</li><li>vanilla :adj 原始的,普通的</li></ul><h3 id="2020-10-11">2020-10-11</h3><ul><li>dominant :显著的</li><li>separable :可分离的</li><li>incorporate :合并到</li></ul><h3 id="2020-10-12">2020-10-12</h3><ul><li>acylic :非周期性的</li><li>freed :v 使自由,解放;adj 解放的</li><li>scalar :adj 标量的,数量的,梯状的,分等级的;n 标量,数量</li></ul><h3 id="2020-10-13">2020-10-13</h3><ul><li>in terms of :依据,按照,在……方面,以……措词</li></ul><h3 id="2020-10-15">2020-10-15</h3><ul><li>planar :平面的,二维的,平坦的</li><li>algebraic :代数的</li><li>parallel projection :平行投影</li><li>squeeze :v 压榨,挤</li><li>modest :适度的,谦逊的,端庄的</li><li>exhibit :vt 展览,显示;n 展览会</li><li>curious :好奇的,古怪的</li><li>mutation :突变,变化</li><li>detriment :n 损坏,伤害</li><li>prune :v 减少,削减</li><li>hunch :n 预感 v 耸肩</li><li>delve :v 钻研,深挖;n 洞穴</li><li>compelling :adj 引人注目的,非常强烈的</li><li>To the extent :在某种程度上</li><li>truncation :n 截断</li><li>mimic :v 模仿;n 效颦者</li><li>mutate :v & n 改变</li></ul><h3 id="2020-10-17">2020-10-17</h3><ul><li>Numerical Differentiation :数值微分</li><li>Symbolic Differentiation :符号微分</li><li>Automatic Differentiation :自动微分</li><li>Vanishing Gradient Problem :梯度消失问题</li></ul><h3 id="2020-10-23">2020-10-23</h3><ul><li>Sequence Labeling :序列标注</li><li>Time Delay Neural Network :(TDNN)延时神经网络</li><li>AutoRegressive Model :(AR)自回归模型</li><li>Nonliner AutoRegressive with Exogenous Inputs Model :(NARX)有外部输入的非线性自回归模型</li><li>Recurrent Neural Network :(RNN)循环神经网络</li><li>Recursive Neural Network :(RecNN)递归神经网络</li><li>exogenous :外生的,外因的,外成的</li></ul><h3 id="2020-10-25">2020-10-25</h3><ul><li>persymmetric :广对称的</li><li>centrosymmetric :中心对称的</li><li>bisymmetric :两侧对称的</li><li>instance segmentation :实例分割</li><li>prioritize :vt 把……区分优先次序;vi 把事情按优先顺序排好</li><li>throughput :生产量,生产能力</li><li>fidelity :n 保真度,忠诚,精确,尽责</li><li>prune :v 删除,减少,修剪;n 深紫红色,傻瓜</li><li>conjecture :推测,揣摩</li><li>acknowledge :vt 承认,答谢,报偿,告知已收到</li></ul><h3 id="2020-10-26">2020-10-26</h3><ul><li>postulate :vt 假定,要求,视……为理所当然;n 基本条件,假定</li><li>canonical :adj 依教规的,权威的,牧师的;n 牧师礼服</li><li>codomain :上域</li><li>surjective :满射</li><li>injective :单射</li><li>sharp :清晰的</li><li>deblur :解模糊,使变清晰</li><li>discriminator :鉴别器</li><li>plausible :貌似可信的,花言巧语的,貌似真实的</li><li>Ablation Study :消融实验</li></ul><h3 id="2020-10-29">2020-10-29</h3><ul><li>hackathon :黑客马拉松</li><li>foster :培养,培育</li><li>preliminary :预赛</li><li>notification :通知,公告</li><li>elusive :难懂的,易忘的,逃避的,难捉摸的</li><li>long-standing :长期存在的</li><li>cloze :完形的,填充测验的</li><li>placeholder :占位符</li><li>forfeit :n 罚金,没收物;adj 被没收的;vt 丧失</li><li>rudimentary :adj 基本的,初步的,退化的,残遗的,未发展的</li></ul><h3 id="2020-12-05">2020-12-05</h3><ul><li>surrogate :n 代理,代用品;vt 代理;adj 代理的,替代的</li><li>favourably :adv 顺利地,有利地,好意地</li><li>necessitate :vt 使称为必需,需要,迫使</li><li>dedicated :adj 专用的,专注的,献身的</li><li>culminate :vi 使绝顶,达到高潮,达到顶点;vt 使结束,使达到高潮</li><li>gear :n 齿轮,装置,工具,传动装置;vi 适合,搭上齿轮,开始工作;vt 开动,搭上齿轮,使……适合,使……准备好;adj 好极了</li></ul><blockquote><ul><li>gear up :促进,增加,使换快档,准备好</li></ul></blockquote><ul><li>with all its bells and whistles :具有所有花哨功能</li><li>imagery :n 像,意象,比喻,形象化</li><li>several orders of magnitude :几个数量级</li><li>feasible :adj 可行的,可能的,可实行的</li><li>siphon :n 虹吸管;vi 用虹吸管吸;vt 用虹吸管吸出,抽取</li><li>crisp :adj 脆的,新鲜的,易碎的;vt 使卷曲,使发脆;vi 卷曲,发脆;n 松脆物</li></ul><blockquote><ul><li>crispness :n 易碎,清新,酥脆</li></ul></blockquote><ul><li>emulate :vt 仿真,模仿,尽力赶上,同……竞争;n 仿真,仿效</li><li>granularity :n 粒度,间隔尺度</li><li>imitate :vt 模仿,仿效,仿造,仿制</li><li>as opposed to :而不是,与……截然相反</li><li>divisive :adj 分裂的,区分的,造成不和的</li><li>transcend :vt 胜过,超越</li><li>irrelevant :adj 不相干的,不切题的</li><li>indistinguishably :adv 不能识别地,无差别地</li><li>on the downside :缺点是,不利的地方在于</li><li>abbreviation :n 缩写</li><li>e.g. :for example</li><li>i.e. :in other words</li><li>fine-grained :adj 细粒的,有细密纹理的;adj 详细的,深入的</li><li>In the context of :在……环境中</li><li>compliance :n 顺从,服从,承诺</li><li>constructive :adj 建设性的,推定的,有助益的</li><li>out-of-the-box :adj 拆盒即可使用的,开箱即用的</li><li>disciplinary :adj 规律的,训练的,训诫的</li><li>interdisciplinary :adj 各学科间的,跨学科的</li><li>dismissive :adj 表示轻视的,解雇的</li><li>vague :adj 模糊的,含糊的,不明确的,暧昧的</li><li>concrete :adj 混凝土的,实在的,具体的,有形的;vi 凝结;vt 使凝固,用混凝土修筑;n 具体物,凝结物</li><li>unsubstantiated :adj 未经证实的,无事实根据的</li><li>reproducible :adj 可再生的,可繁殖的,可复写的</li><li>effcacy :n 功效,效力</li><li>groundbreaking :adj 开创性的;n 动工</li><li>in the long run :长远,终究</li><li>albeit :虽然,即使</li><li>typos :n 打字错误</li><li>superscript :adj 标在上方的;n 上标</li><li>merit :n 优点,价值,功绩,功过;vt 值得;vi 应受报答</li><li>borderline :n 边界线,边界,界限;adj 边界的,暧昧的</li><li>substantiate :vt 证实,使实体化</li><li>convincing :adj 令人信服的</li><li>sparing :adj 节约的,贫乏的,保守的;n 抽出,宽恕;免去;给予</li><li>confidential :adj 机密的,表示信任的,获信任的</li><li>humanitarian :adj 人道主义的,博爱的,基督凡人论的;n 人道主义者,慈善家;博爱主义者,基督凡人论者</li><li>harassment :n 骚扰,烦恼</li><li>bullying :n 恃强欺弱的行为</li><li>retaliation :n 报复,反击,回敬</li><li>ethnicity :n 种族划分</li><li>intimidation :n 恐吓,威胁</li><li>stalk :v 追踪,潜进</li><li>diminutive :adj 小的,小型的,微小的;n 爱称,身材极小的人</li><li>sanction :n 制裁,处罚,认可,支持;vt 制裁,处罚,批准,鼓励</li><li>engage :vt 吸引,占用,使参加,雇佣,使订婚,预定;vi 从事,答应,保证,交战,啮合</li><li>sceptical :adj 怀疑的,怀疑论的,习惯怀疑的</li><li>neutralise :vt 中和,使中立,使无效;vi 中和</li><li>spotlight :n 聚光灯;反光灯;公众注意的中心;vt 聚光照明;使公众注意</li><li>corpora :n 任何事物之主体;全集</li><li>rebuttal :n 反驳;辩驳;反证</li><li>poster :n 海报,广告;招贴</li><li>overshoot :vt 超越,打过头,把……做过头;vi 射击目标,(飞机)滑出跑道,行动过火;n 超越目标,行动过火</li><li>holomorphic :adj 全纯的,正则的</li><li>uncomment :vt 取消注解</li><li>planar :adj 平面的,二维的,平坦的</li><li>angular :adj 有角的,生硬的,笨拙的,瘦削的</li><li>calibration :n 校准,刻度,标度</li><li>hardwired :adj 基本固定的</li><li>raster :n 光栅,试映图</li><li>overly :过度地,极度地</li><li>screen :vt 筛,拍摄,放映,掩蔽;vi 拍电影</li><li>leap :n 飞跃,跳跃;vi 跳,跳跃;vt 跳跃,跳过,使跃过</li><li>schematic :adj 图解的,概要的;n 原理图,图解视图</li></ul><h3 id="2020-12-09">2020-12-09</h3><ul><li>and vice versa :反之亦然,反过来也一样</li><li>sake :n 理由,缘故</li></ul><blockquote><ul><li>for the sake of :为了……的利益,由于……的理由</li></ul></blockquote><ul><li>per se :adv 本身,自身</li><li>ancestral :adj 祖先的,祖传的</li></ul><h3 id="2020-12-12">2020-12-12</h3><ul><li>make …… the brunt of jokes :总是把……当作笑谈</li><li>in the long run :长久,终究</li><li>sequel :n 续集,结局,继续,后果</li><li>verbose :adj 冗长的,啰嗦的</li><li>vs. :(=versus)对比,与……相对</li><li>antimate :adj 活泼的;vt 使有生气;使活泼;鼓舞;推动</li><li>immediately above :正上方</li><li>make-shift :尽力设法应对</li><li>succinctly :adv 简洁地,简便地</li><li>predate :vt 在日期上早于,先于</li></ul><h3 id="2020-12-13">2020-12-13</h3><ul><li>impute :vt 归罪于,归咎于,嫁祸于</li><li>flash :vt 使闪光,反射;n 闪光,闪现,一瞬间;vi 闪光,闪现,反射;adj 闪光的,火速的</li><li>apart from :除……之外,且不说,并且</li><li>exotic :adj 异国的,外来的,异国情调的</li><li>striking :adj 显著的,突出的,惊人的,打击的,罢工的</li><li>genuine :adj 真实的,真正的,诚恳的</li><li>qualitatively :adv 定性地</li><li>corroborate :vt 证实,使坚固</li><li>as soon as :一……就……</li><li>resonate :vt & vi 共鸣;共振</li><li>hourglass :n 沙漏,水漏</li><li>occlude :v 阻塞,闭塞,遮盖,使看不见,吸收,咬合</li><li>perturb :vt 扰乱,使……混乱,使……心绪不宁</li><li>impedance :n 阻抗</li><li>trajectory :n 轨道,轨线,弹道</li><li>scramble :vt 攀登,使混杂,仓促凑成,扰乱;n 抢夺,争夺,混乱,爬行,攀登;vi 爬行,攀登,不规则地生长,仓促行动</li><li>inertia :n 惯性,惰性,迟钝,不活动</li><li>reluctant :不情愿的,勉强的,顽抗的</li><li>revert :vi 回复,重提,返祖遗传,归还;vt 使恢复原状;n 恢复原状者</li><li>ill-posed :不适定的</li><li>surjective :adj 满射的</li><li>plausible :adj 貌似可信的,花言巧语的,貌似真实的,貌似有理的</li><li>hallucinate :vt 使产生幻觉;vi 出现幻觉</li><li>tease :vt 取笑,戏弄,梳理,欺负,强求;n 戏弄,爱纠缠的小孩,挑逗者</li></ul><blockquote><p>tease apart :梳理</p></blockquote><ul><li>magnify :vt 放大,赞美,夸大;vi 放大,有放大能力</li><li>negligible :adj 微不足道的,可以忽略的</li><li>ill-posed :adj 病态的</li><li>prune :vi 删除,减少;vt 修剪,删除,剪去;n 深紫红色,傻瓜,李子干</li><li>cardinal :adj 主要的,基本的,深红色的;n 红衣教主,鲜红色</li><li>suppress :vt 抑制,镇压,废止</li><li>impose :vi 利用,欺骗,施加影响;vt 强加,征税,以……欺骗</li><li>hyperbolic :adj 双曲线的,夸张的</li><li>noticeable :adj 显而易见的,显著的,值得注意的</li><li>Relaxed soft restrictions are more friendly to gradient-based training. :宽松的限制有利于基于梯度的训练。</li><li>cardinal dimension :基数维</li><li>inversely proportional to :与……成反比</li></ul><h3 id="2020-12-20">2020-12-20</h3><ul><li>synthetic :adj 合成的,综合的,人造的;n 合成物</li><li>resonance :n 共振,共鸣,反响</li><li>subtle :adj 敏感的,微秒的,精细的,狡猾的,稀薄的</li><li>decimate :vt 十中抽一,取十分之一,大批杀害</li><li>plausible :adj 貌似可信的,花言巧语的,貌似真实的,貌似有理的</li><li>manifold :vt 复写,复印,增多,使……多样化;adj 多方面的,有许多部分的,各式各样的;n 多种,复印本</li><li>photon :n 光子,辐射量子,见光度</li><li>drawn from :从……中得到,从……提取</li><li>conditional expected values :条件期望值</li><li>consistent with :符合,与……一致</li><li>equation hold :方程成立</li><li>strenuous :adj 紧张的,费力的,奋发的,艰苦的,热烈的</li><li>intrigue :n 阴谋,诡计,复杂的事,私通;vt 用诡计取得,激起……的兴趣;vi 私通,密谋</li><li>intriguing :adj 有趣的,迷人的</li><li>aka :又叫做,亦称(also known as)</li><li>spike :n 长钉,道钉,钉鞋,细高跟;vt 阻止,以大钉钉牢,用尖物刺穿</li><li>unimodal :adj 单峰的,用单峰分布描述的</li><li>multimodal :adj 多峰的,多模式的;n 多峰</li><li>anneal :vt 使退火,韧练,锻炼</li><li>caustic :adj 腐蚀性的,苛性的,刻薄的,焦散的</li><li>auxiliary :n 助动词,辅助者,辅助物,附属机构;adj 辅助的,副的,附加的</li><li>albedo :n 反射率,星体反照率</li></ul><h3 id="2020-12-23">2020-12-23</h3><ul><li>monotone :n 单调,单音调;adj 单调的;vt 单调地读</li><li>hypothesize :vt&vi 假定,猜想</li><li>evenly :adv 均匀地,平衡的,平坦地</li></ul><h3 id="2021-01-09">2021-01-09</h3><ul><li>syndication :n 企业联合组织</li><li>extrapolate :vt&vi 外推,推断</li><li>plead :v 辩护</li></ul><blockquote><p>pleading:n 恳求,答辩,辩论,诉状;adj 恳求的</p></blockquote><ul><li>incapable :adj 不能的,无能离得,不能胜任的</li><li>out of :由于,缺乏,自……离开,用……</li><li>for clarity :为了清晰起见</li><li>regardless of :不管,不顾</li><li>warrant :n&vt 证明,保证,担保</li><li>susceptible :adj 易受影响的,易感动的,容许……的;n 易得病的人</li><li>detrimental :adj 不利的,有害的;n 有害的人,不受欢迎的求婚者</li><li>mitigate :vt 使缓和,使减轻;vi 减轻,缓和下来</li><li>impacted :adj 压紧的,结实的,嵌入的,稠密的</li><li>impact :vt 挤入,压紧,撞击,对……产生影响;vi 影响,撞击,冲突,压紧</li><li>ego :n 自我,自负,自我意识</li><li>drastic :adj 激烈的,猛烈的;n 烈性泻药</li><li>resemble :vt 类似,像</li><li>root cause :根源</li><li>impair :vt 损害,削弱,减少</li><li>emergence :n 出现,浮现,发生,露头</li><li>annotate :vi&vt 注释,给……作注释或评注</li><li>frame:vt 设计,建造,陷害,使……结合;vi 有成功希望;adj 有木架的,有架构的;n 框架,结构,画面</li></ul><h3 id="2021-01-11">2021-01-11</h3><ul><li>permalink :n 永久链接</li><li>front-matter :前页(扉页、版权页、目次等)</li></ul><h3 id="2021-01-16">2021-01-16</h3><ul><li>compact:n 合同,契约,小粉盒;adj 紧凑的,紧密的,简洁地;vt 使简洁,使紧密结合</li><li>contrarily:adv 相反地,反之,反对地</li><li>erosion:n 侵蚀,腐蚀</li><li>neatly:adv 整洁地,熟练地,灵巧地</li><li>stagnate:vi 停滞,淤塞,变萧条;vt 使淤塞,使沉滞,使萧条</li><li>intricate:adj 复杂的,错综的,缠结的</li><li>atrous:adj 深黑色的</li><li>deformable:adj 可变形的</li><li>obscure:adj 昏暗的,朦胧的,不清楚的,晦涩的,隐蔽的,不著名的,无名的;vt 使……模糊不清,掩盖,隐蔽,使难理解;n 某种模糊的或者不清楚的东西</li><li>foveation:n 凹形,成凹</li><li>radiance field:辐射场</li><li>pedestal:n 基架,基础,基座;vt 搁在台上,支持</li><li>long-standing:adj 长期存在的,存在已久的</li><li>opacity:n 不透明,不传导,暧昧</li><li>regress:vi 逆行,倒退,复归;vt 使……倒退;n 回归,退回</li><li>curtain:n 幕,窗帘;vt 遮蔽,装上门帘</li><li>mechinery:n 机械,机器,机构,机械装置</li><li>rasterization:n 光栅化</li><li>revise:vi&vt 修正,校订,复习;n 修订,校订</li><li>endeavor:vi&vt&n 努力,尽力</li><li>informal:adj 非正式的,不拘礼节的,随便的,通俗的,日常使用的</li><li>evocative:adj 唤起的,唤出的</li><li>glorious:adj 光荣的,辉煌的,极好的</li><li>syllabus:n 教学大纲,摘要,课程表</li><li>practitioner:n 开业者,从业者,执业医生</li><li>ubiquitous:adj 普遍存在的,无处不在的</li><li>composite:n 复合材料,合成物,菊科;adj 符合的,合成的,菊科的;vt 使合成,使混合</li><li>volumetric:adj 体积的,容积的,测定体积的</li><li>adequately:adv 充分地,足够地,适当地</li><li>crucially:adv 关键地,至关重要地</li><li>prohibitive:adj 禁止的,禁止性的,抑制的,(费用,价格等)过高的,类同禁止的</li><li>discretize:v 离散</li><li>hierarchical:adj 分层的,等级体系的</li><li>illumination:n 照明,照度,启发,灯饰(需复数),阐明</li><li>photorealistic:adj 照相写实主义的,超级现实主义的</li><li>diffuse:adj 弥漫的,散开的;vi&vt 扩散,传播,漫射</li><li>minima:n(minimum 的复数)极小值,最小数</li><li>distract:vt 转移,分心</li><li>finer:adj 出色的,好的</li><li>circumvent:v 包围,智取,绕行,规避</li><li>specularity:n 高光,镜面反射,单向反射性</li><li>inset:n 插图,插页,插入物;vt 嵌入,插入</li><li>visualize:vi 显现;vt 形象,形象化,想象,设想</li><li>bulldozer:n 推土机,欺凌者,威吓者</li><li>tread:n 踏,胎面,步态,鞋底,踏板,梯级;vt 踏,踩,践踏,跳,踩出;vi 踏,踩,行走,交尾</li><li>infinitesimal:adj 无穷小的,无限小的,极小的;n 无限小,极微量</li><li>particle:n 颗粒,质点,极小量,小品词</li><li>transmittance:n 透射比,透明度</li><li>quadrature:n 正交,求积,弦</li><li>stratify:vi&vt 分层,成层,使形成阶层,阶层化</li><li>approximator:n 接近者,近似者</li><li>occlude:v 阻塞,闭塞,遮盖(一只眼睛)使看不见,(固体)吸收(气体、杂质),(上下齿)咬合</li></ul><h3 id="2021-01-17">2021-01-17</h3><ul><li>prelude:n 前奏,序幕,前奏曲;vi 作为序曲,奏序曲;vt 成为……的序幕,演奏……作为前奏曲</li><li>upheaval:n 剧变,隆起,举起</li><li>intent:n 意图,目的,含义;adj 专心的,急切的,坚决的</li><li>integral:n 积分,部分,完整;adj 积分的,完整地,整体的,构成整体所必须的</li><li>curate:n 助理牧师,副牧师;vt 当(博物馆、美术馆、图书馆)馆长</li><li>precursor:n 先驱,前导</li><li>deformable:adj 可变形的</li><li>subsequent:adj 后来的,随后的</li><li>derivative:n 衍生物,排生物,导数;adj 派生的,引出的</li><li>course:n 科目,课程,过程,进程,道路,路线,航向,一道菜;vi 指引航线,快跑;vt 追赶,跑过</li><li>reduce to:迫使,使处于,使变弱,归纳为</li><li>sufficient:adj 足够的,充分的</li><li>insufficient:adj 不足的,不能胜任的,缺乏能力的</li><li>composition:n 作文,作曲,作品,构成,合成物,成分</li><li>concurrent:adj 并发的,一致的,同时发生地;n 共点,同时发生的事件</li><li>disparity:n 不同,不一致,不等</li><li>interpretability:n 可解释性,解释能力</li><li>frustum:n 截头锥体,平截头体</li><li>informed:adj 消息灵通的,见多识广的;v 通知,使了解,提供资料</li><li>perceptual:adj 知觉的,感知的,有知觉的</li><li>calibrate:vt 校正,调整,测定口径</li><li>effortless:adj 容易的,不费力气的</li><li>shallow:adj 浅的,肤浅的</li><li>nuance:n 细微差别</li><li>emergent:adj 紧急的,以外的,自然发生的</li><li>indistinguishable:adj 不能区分的,不能辨别的,不易察觉的</li><li>irrespective:adj 无关的,不考虑的,不顾的</li><li>crux:n 关键,难题,十字架形,坩埚</li><li>ambiguity:n 含糊,不明确,暧昧,模棱两可的话</li><li>puzzle:vi 迷惑,冥思苦想;vt 使……困惑,使……为难,苦思而得出;n 谜,难题,迷惑</li><li>newly:adv 最近,重新,以新的方式</li><li>in the wild:在野外,野生的,在自然环境下</li><li>aesthetic:adj 美的,美学的,审美的,具有审美趣味的</li><li>aesthetics:美学,美的哲学</li></ul><h3 id="2020-01-09">2020-01-09</h3><ul><li>amount:vi 总计,合计,相当于,共计,产生……结果;n 数量,总额,总数</li><li>expose:vt 揭露,揭发,使曝光,显示</li><li>convey:vt 传达,运输,让与</li><li>impose:vi 利用,欺骗,施加影响;vt 强加,征税,以……欺骗</li><li>per se.:adv 本身,自身</li><li>implement:vt 实施,执行,实现,使生效;n 工具,器具,手段</li></ul><h3 id="2020-01-20">2020-01-20</h3><ul><li>disentangle:vi 解决,松开,解开纠结,解决(纠纷);vt 解开,松开,使解脱</li></ul><h3 id="2020-01-21">2020-01-21</h3><ul><li>pedantry:n 迂腐,卖弄学问,假装学者</li><li>lounge:n 休息室,闲逛,躺椅,(英)酒吧间;vi 闲逛,懒洋洋地躺卧,闲混;vt 虚度光阴</li><li>atheist:n 无神论者</li><li>upvote:vt (线上)赞同,点赞;n (线上)有利的投票</li><li>prep:n 预备,预习,准备功课;vi 上预备学校,做好准备;vt 使准备好,使(病人)准备接受手术</li><li>perpendicular:adj 垂直的,直立的,垂直线</li><li>kern:vi 使铅字上下突出,将……做平;n 仁,核,颗粒,(铅字面之)上下的突出部分</li><li>markup:n 涨价,利润,审定</li><li>typeset:vt 排版;adj 已排版字的</li><li>ameliorate:vi 变得更好;vt 改善,减轻(痛苦等),改良</li></ul><h3 id="2021-01-23">2021-01-23</h3><ul><li>toggle:vt 栓牢,系紧;n 开关,触发器,拴扣,套索钉</li><li>swag:n 赃物,掠夺品,摇摆,大量;vi 垂下,摇晃,倾斜;vt 使……摇摆,用垂挂物装饰</li><li>meetup:n 恳谈会,小聚会</li><li>outreach:vi 拓广,延伸;vt 超越,伸出,超出……的范围;n 延伸,拓广,扩大服务范围;adj 扩大服务的</li><li>cater:vt 投合,迎合,满足需要,提供饮食及服务</li><li>underprivilege:n 相对贫困,生活水平低下</li><li>hooked:adj 钩状的,吸毒成瘾的,入迷的</li><li>ongoing:adj 不间断的,进行的,前进的;n 前进,行为,举止</li><li>daring:adj 大胆的,勇敢的;n 胆量,胆气</li></ul><h3 id="2021-02-07">2021-02-07</h3><ul><li>contestant:n 竞争者,争辩者</li><li>rater:n 估价者,评定等级的人</li><li>preferred:adj 优先的,首选的</li></ul><h3 id="2021-02-22">2021-02-22</h3><ul><li>facsimile:n 传真,复写;adj 复制的;vt 传真,临摹</li><li>commonplace:n 老生常谈,司空见惯的事,普通的东西;adj 平凡的,陈腐的</li><li>with the exception of:除了</li><li>ubiquitous:adj 普遍存在的,无所不在的</li><li>dramatic:adj 戏剧的,急剧的,引人注目的,激动人心的</li><li>acronym:n 首字母缩略词</li><li>scramble:vt 攀登,使混杂,仓促凑成,扰乱;vi 爬行,攀登,不规则地生长,仓促行动;n 抢夺,争夺,混乱,混乱的一团,爬行,攀登</li><li>decimate:vt 十中抽一,取十分之一,大批杀害</li></ul><h3 id="2021-02-23">2021-02-23</h3><ul><li>in essence:本质上,其实,大体上</li><li>allude:vi 暗指,转弯抹角的说到,略为提及,顺便提到</li><li>sequel:n 续集,结局,继续,后果</li></ul><blockquote><p>in the sequel</p></blockquote><ul><li>monochrome:单色的</li></ul><h3 id="2021-02-25">2021-02-25</h3><ul><li>showcase:n 陈列橱,陈列柜,显式优点的东西;vt 使展现,在玻璃橱窗陈列</li><li>nether:下面的,下方的,地下的,下界的</li></ul><h3 id="2021-03-04">2021-03-04</h3><ul><li>expedite:vt 加快,促进,发出;adj 畅通的,迅速的,方便的</li></ul><h3 id="2021-03-08">2021-03-08</h3><ul><li>thumbnail:n 拇指指甲,极小的东西,短文;adj 极小的,极短的</li><li>conceal:vt 隐藏,隐瞒</li></ul><h3 id="2021-04-04">2021-04-04</h3><ul><li>superposition:n 叠加,重合</li><li>jewel:n 宝石,珠宝;vt 镶以宝石,饰以宝石</li><li>archaeological:adj 考古学的,考古学上的</li><li>polarize:vt (使)极化,(使)偏振,(使)两极分化;vi 极化,偏振,两极分化</li><li>flash:vt 使闪光,反射;n 闪光,闪现,一瞬间;vi 闪光,闪现,反射;adj 闪光的,火速的</li><li>polygon:n 多边形</li><li>kurtosis:n 曲线的峰态,峭度</li><li>crucial:adj 决定性的,关键的</li><li>contrast:n 对比,差别,对照物;v 对比,成对照;n 反差,对比度</li><li>ghosting:n 重像</li><li>superimposed:adj 成阶层的,有层理的,叠加的</li><li>saturated:adj 饱和的,渗透的,深颜色的</li><li>draft:n 草稿</li></ul><h3 id="2021-04-05">2021-04-05</h3><ul><li>pitfall:n 误区,陷阱</li><li>compliance:n 顺从,服从,屈服,柔度,灵活性</li><li>amendment:n 修正,修正案</li><li>initiate:vt 开始,创始,启蒙,介绍加入;adj 新加入的,启蒙的;n 创始人</li><li>conformance:n 顺应,一致</li><li>virtue:n 美德,德行,优点,贞操</li><li>rival:v 竞争,与……相匹敌</li><li>proprietary:adj 专利的,所有权的;n 所有权,所有人</li><li>spin off:作为副产品产生</li><li>bogus:adj 假的,伪造的</li><li>emulation:n 竞争,效法,努力追上并超越</li><li>necessitate:v 使……称为必需,迫使</li><li>peruse:v 攻读,精读,阅读</li><li>suite:n 套房,一套物件,随员,一组程序</li><li>trademark:n 商标,特点</li><li>warranty:n 保单,根据,保修期</li></ul><blockquote><p>make no expressed or implied warranty of:不做任何明示或暗示的保证</p></blockquote><ul><li>liability:n 责任,债务,可能性,不利因素</li><li>consequential:adj 重要的,间接的,随之发生的,自高自大的</li><li>herein:adv 在此处,此中</li><li>as opposed to:与……形成对照,而不是</li><li>decipher:vt 译解,辨认</li><li>interchangeability:n 可交换性,互换性,可替代性</li><li>accompanying:adj 陪伴的,附随的</li><li>for the sake of:为了</li><li>jagged:adj 参差不齐的</li><li>dramatically:adv 戏剧地,引人注目地</li><li>analogous:adj 类似的</li><li>ellipse:n 椭圆,椭圆形</li><li>monumental:adj 不朽的,纪念碑的,非常的,极大的</li><li>perspective:n 观点,远景,透视图;adj 透视的</li><li>phosphor:n 磷光体,磷光剂</li><li>emitter:n 发射器,发射体</li><li>mimic:vt 模仿,模拟;n 善于模仿的人;adj 模仿的,假装的</li><li>hue:n 色彩,色度,色调,叫声</li><li>saturation:n 饱和,色饱和度,浸透,磁化饱和</li><li>concentrate:vi 集中,浓缩,全神贯注,聚集;vt 集中,浓缩;n 浓缩,精选,浓缩液</li><li>absorb:vt 吸收,吸引,承受,理解,使……全神贯注</li><li>palette:n 调色板</li><li>notably:adv 显著地,尤其</li><li>exclusive:adj 独有的,排外的,专一的;n 独家新闻,排外者</li><li>tailor:n 裁缝;v 专门制作,订做,调整,迎合</li><li>subscript:adj 下标的,写在下方的,脚注的;n 下标,脚注</li><li>advance to:使提升到,朝……前进,向……挺进</li></ul><h3 id="2021-04-06">2021-04-06</h3><ul><li>bijective:adj 双射的</li><li>tractable:adj 易驾驭的,易于管教的,驯良的,易处理的</li></ul><h3 id="2021-04-08">2021-04-08</h3><ul><li>compelling:adj 引人注目的,令人信服的,非常强烈的,不可抗拒的;v 强迫,以强力获得</li><li>exacerbate:vt 使加剧,使恶化,激怒</li><li>circulate:vi 传播,流传,循环,流通;vt 使循环,使流通,使传播</li><li>sprawling:adj 蔓延的,杂乱延伸的;v 伸开四肢坐、躺或倒下;蔓延,杂乱无序地拓展</li><li>abhor:vt 痛恨,憎恶</li><li>vacuum:n 真空,空缺,空白,真空吸尘器;adj 真空的,利用真空的,产生真空的;vt 用真空吸尘器清扫</li><li>synonymous:adj 同义的,同义词的</li><li>invariably:adv 总是,不变地,一定地</li><li>analog:n 模拟,类似物;adj 模拟的,有长短针的</li><li>interleaved:adj 交错的</li><li>by convention:adv 按照惯例</li><li>predetermined:adj 预先确定的</li></ul><h3 id="2021-04-11">2021-04-11</h3><ul><li>discretize:vt 使离散化,离散化</li><li>refer to as:把……称作……</li><li>mitigate:vt 使缓和,使减轻;vi 减轻,缓和下来</li><li>sweep over:向……扩展,扫过</li><li>sufficient:adj 足够的,充分的</li><li>vein:n 血管,叶脉,纹理,性情;vt 使成脉络,像脉络般分布于</li><li>amortization:n 分期偿还</li><li>stem:n 干,茎,船首,血统;vt 阻止,除去……的茎,给……装柄;vi 阻止,起源于某事物,逆行</li><li>take up:拿起,开始从事,占据(时间、地方)</li><li>upfront:adj 预付的,在前面的,正直的,坦率的;adv 在前面,提前支付(工资)</li><li>sidestep:vt 回避,横跨一步躲避;vi 回避问题,侧向跨步;n 台阶,横跨的一步</li><li>conceivable:adj 可想象的,可相信的</li><li></li></ul>]]></content>
<summary type="html"><h3 id="2020-07-24">2020-07-24</h3>
<ul>
<li>in itself : 本身、实质上</li>
<li>It is up to sb. to do sth. : 由某人来做某事</li>
<li>nothing but = nothing</summary>
<category term="English" scheme="https://hotarugali.github.io/categories/English/"/>
<category term="English" scheme="https://hotarugali.github.io/tags/English/"/>
</entry>
<entry>
<title>LaTeX修饰符号</title>
<link href="https://hotarugali.github.io/2021/01/23/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/"/>
<id>https://hotarugali.github.io/2021/01/23/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/</id>
<published>2021-01-23T05:28:00.000Z</published>
<updated>2021-04-12T07:14:08.287Z</updated>
<content type="html"><![CDATA[<p>【注】摘自 <em>Scott Pakin</em> 的 <strong>《The Comprehensive LaTeX Symbol List》</strong> 。</p><p><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/1.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/2.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/3.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/4.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/5.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/6.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/7.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/8.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/9.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/10.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E9%A5%B0%E7%AC%A6%E5%8F%B7/11.png" alt=""></p>]]></content>
<summary type="html"><p>【注】摘自 <em>Scott Pakin</em> 的 <strong>《The Comprehensive LaTeX Symbol List》</strong> 。</p>
<p><img src="/images/TeX/LaTeX/LaTeX%E4%BF%AE%E</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
<entry>
<title>LaTeX其他符号</title>
<link href="https://hotarugali.github.io/2021/01/23/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/"/>
<id>https://hotarugali.github.io/2021/01/23/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/</id>
<published>2021-01-23T05:28:00.000Z</published>
<updated>2021-04-12T07:14:08.291Z</updated>
<content type="html"><![CDATA[<p>【注】摘自 <em>Scott Pakin</em> 的 <strong>《The Comprehensive LaTeX Symbol List》</strong> 。</p><p><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/1.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/2.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/3.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/4.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/5.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/6.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/7.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/8.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/9.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/10.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/11.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/12.png" alt=""><br><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E4%BB%96%E7%AC%A6%E5%8F%B7/13.png" alt=""></p>]]></content>
<summary type="html"><p>【注】摘自 <em>Scott Pakin</em> 的 <strong>《The Comprehensive LaTeX Symbol List》</strong> 。</p>
<p><img src="/images/TeX/LaTeX/LaTeX%E5%85%B6%E</summary>
<category term="TeX" scheme="https://hotarugali.github.io/categories/TeX/"/>
<category term="LaTeX" scheme="https://hotarugali.github.io/categories/TeX/LaTeX/"/>
<category term="TeX" scheme="https://hotarugali.github.io/tags/TeX/"/>
</entry>
</feed>