7/25/2019 A LaTeX Tutorial
1/197
2010 3
LATEX N
v2.0
7/25/2019 A LaTeX Tutorial
2/197
7/25/2019 A LaTeX Tutorial
3/197
LATEX N
v2.0
2010 3
A C E
7/25/2019 A LaTeX Tutorial
4/197
20082012 Alpha Huang
Alpha Culture & Education
All right reserved. No part of this book may be reproduced, in any form or by any
means, without permission in writing from the publisher, except by a.
e author and publisher of this book have used their best efforts in preparing this
book. ese efforts include the development, research, and testing of the theories,technologies and programs to determine their effectiveness. e author and publisher
make no warranty of any kind, express or implied, with regard to these techniques orprograms contained in this book. e author and publisher shall not be liable in any
event of incidental or consequential damages in connection with, or arising out of, the
furnishing, performance, or use of these techniques or programs.
Printed in the United States of America
7/25/2019 A LaTeX Tutorial
5/197
To: Anna and Bella
7/25/2019 A LaTeX Tutorial
6/197
7/25/2019 A LaTeX Tutorial
7/197
xv
xvi
xviii
xx
1 1
1.1 . . . . . . . 11.1.1 21.1.2 . . . 4
1.1.3 TEX . . . 71.1.4 . . . . . 11
1.2 . . . . . . . 111.3 . . . . . . . 121.4 . . . . . . . 13
2 15
2.1 Hello, World! . . . . . 15
2.2 . . . . . . 162.2.1 . . . . . 162.2.2 . . . 16
2.2.3 . . . 172.3 . . . . . . . . . . 19
2.3.1 . . . 192.3.2
. . . . . 202.3.3
. . . . 212.4 . . . . . . . . . . 222.5 . . . . . . 22
2.5.1 . . . 22
2.5.2 23
2.5.3 . . . . 23
2.6 . . . . . . . 24
2.6.1 . . . . . 24
2.6.2 . . . 25
2.6.3 . . . . . 25
2.6.4 . . . . . 26
2.6.5 . . . . . 26
2.7 . . . . . . . . . . 27
2.7.1 . . . 27
2.7.2 . . . 27
2.7.3 . . . 28
2.8 . . . . . . . . . . 29
2.8.1 . . . 29
2.8.2 . . . 29
2.8.3 . . . 30
2.9 . . . . . . . 30
3 33
3.1 . . . . 33
3.2 . . . . . . . 35
3.2.1 . . . . . 35
3.2.2 35
3.2.3 . . . 36
3.3 . . . . . . . 37
3.4 . . . . . . 37
3.4.1 . . . 37
3.4.2 XeTeX . . . . . 38
3.5 . . . . 39
v
7/25/2019 A LaTeX Tutorial
8/197
vi
4 43
4.1 . . . . . . . 434.2 . . . . . . . 44
4.2.1 . . . 444.2.2 454.2.3 . . . . . 454.2.4 . . . . 454.2.5 . . . . . 474.2.6 . 474.2.7 . . . . 484.2.8 . . . . 494.2.9 . . . 49
4.3 . . . . . . . . . . 494.4 . . . . . . . 50
4.4.1 . . . . 504.4.2 . . . . 514.4.3 . . . 51
4.5 . . . . . . 514.6 . . . . . . . 53
5 55
5.1 . . . . . . . 555.1.1 . . . 55
5.1.2 Driver 565.1.3 . . . 575.1.4
. . . . . 615.2 . . . . . . . 63
5.2.1 . . . . 635.2.2 . . . 645.2.3 . . . 645.2.4 665.2.5 gure . . 675.2.6 67
5.3 . . . . . . . 705.3.1 . . . 705.3.2 73
6 Metapost 75
6.1 . . . . . . . 756.2 . . . . 76
6.2.1 . . . 766.2.2 . 776.2.3 . . . . . 77
6.3 . . . . . . . 78
6.3.1 . . . . . 786.3.2 . . . . . 786.3.3 . 78
6.4 . . . . . . . 796.5 . . . . . . . . . . 806.6 . . . . . . . . . . 82
6.6.1 . . . . . 82
6.6.2 . . . 836.6.3 . . . . . 83
7 PSTricks 857.1 . . . . . . . 857.2 . . . . 87
7.2.1 . . . 877.2.2 877.2.3
. 887.2.4 . . . . . 887.2.5 89
7.3 . . . . . . . 907.3.1 . 90
7.3.2 . . . . . 907.3.3 . 907.3.4 . . . 91
7.4 . . . . . . . 917.5 . . . . . . . . . . 92
8 PGF 95
8.1 . . . . . . . 958.2 . . . . 96
8.2.1 . 968.2.2 97
8.2.3 . . . . . 978.2.4 . . . . . 98
8.3 . . . . . . . 988.3.1 . . . . . 988.3.2 . 988.3.3 . 998.3.4 . 998.3.5 . . . . . 99
8.4 . . . . . . . 1008.5 . . . . . . . . 101
7/25/2019 A LaTeX Tutorial
9/197
vii
8.5.1 . . . . . 101
8.5.2 . . . . 1018.5.3 . . . . . . . 1028.5.4
. . . . . 1028.6 . . . . . . . . . . 104
8.6.1 . . . 1048.6.2 . . . . 104
9 107
9.1 . . . . . . . 1079.2 . . . . . . . 108
9.3 . . . . . . . 1109.4 . . . . . . . 1119.5 . . . . . . . . 1129.6 . . . . . . . . 1149.7 . . . . . . . 117
10 121
10.1 . . . . . . . . 12110.2 . . . . . . . . . . 12210.3 . . . . . . . . . . 12210.4 . . . . . . . 124
10.4.1thebibliography12410.4.2 BibTeX . . . . 125
10.4.3 Natbib. . . . . 128
10.5 . . . . . . . . . . 12910.6 . . . . . . . . 13010.7 . . . . . . . . 131
11 133
11.1 . . . . . . . 13311.1.1 . . . 13311.1.2 . . . 134
11.1.3 . . . 13511.2 . . . . . . . 137
11.3 . . . . . . . . . . 141
11.4 . . . . . . . . . . 143
12 14512.1 . . . . . . . . . . 14512.2 . . . . . . . . . . 14512.3 . . . . . . . . . . 14512.4 . . . . . . . . . . 14512.5 . . . . . . . . . . 145
A 147
B 149
B.1 . . . . . . . 149B.1.1 . . . 150B.1.2 . . . 152B.1.3 . . . 153B.1.4 . . . 154
B.2 . . . . . . . 155B.2.1 . . . 155B.2.2 . . . 155B.2.3 . . . 156
B.3 . . . . . . . 157B.3.1 . 158B.3.2 . 158B.3.3 159B.3.4 . 160B.3.5 . . . . 160
B.4 . . . . . . . 160
162
163
164
. . . . . . . . . . 165 . . . . . . . 168
7/25/2019 A LaTeX Tutorial
10/197
2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 575.2 . . . . . . . . . . . . . . . . . . . . . . . . . 575.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.6 . . . . . . . . . . . . . . . . . . . . . . . . . . 595.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695.12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705.13 RGB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715.14 CMYK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
10.1 BTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . 12710.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
11.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
B.1 868 . . . . . . . . . . . . . . . . . . . . . 151B.2 Gutenberg Bible, letterpress, 1455 . . . . . . . . . . . . . . . . . . 151B.3 St. Christopher, engraving by Drer, 1521. . . . . . . . . . . . . . 152
B.4 Woman in Cafe, drypoint by Lesser Ury . . . . . . . . . . . . . . . 152
B.5 e Soldier and his Wife, etching by Hopfer, 1500 . . . . . . . . . 153B.6 Georgiana Cavendish, Duchess of Devonshire, mezzotint . . . . . . 153
B.7 Sleep of Reason Produces Monsters, etching, aquatint, and drypoint
by Goya, 1799 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154B.8 e Bath, drypoint and aquatint by Cassatt, 1890 . . . . . . . . . . 154
viii
7/25/2019 A LaTeX Tutorial
11/197
1.1 . . . . . . . . . . . . . . . . . . 21.2 TEX . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 172.2 . . . . . . . . . . . . . . . . . . . . . 202.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.7 . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.1 . . . . . . . . . . . . . . . . . . . . . . . 444.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
6.1 label . . . . . . . . . . . . . . . . . . . . . . . . . 806.2 METAPOST . . . . . . . . . . . . . . . . . . . . . . . 84
7.1 PSTricks . . . . . . . . . . . . . . . . . . . . . . . . . 857.2 rput . . . . . . . . . . . . . . . . . . . . . . . . 927.3 uput . . . . . . . . . . . . . . . . . . . . . . 93
9.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1139.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.1 . . . . . . . . . . . . . . . . . . . . . . 128
ix
7/25/2019 A LaTeX Tutorial
12/197
x
11.1 LATEX . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
11.2 . . . . . . . . . . . . . . . . . . . . . . 138
A.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7/25/2019 A LaTeX Tutorial
13/197
2.1 Hello, Wolrd! . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.4 . . . . . . . . . . . . . . . . . . . . . . . . . 222.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.16mbox fbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292.17makebox framebox . . . . . . . . . . . . . . . . . . . . . . . 302.18parbox minipage . . . . . . . . . . . . . . . . . . . . . . . . 302.19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.1 X ELATEX . . . . . . . . . . . . . . . . . . . . . . . . . . 393.2 xeCJK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484.10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
xi
7/25/2019 A LaTeX Tutorial
14/197
xii
4.12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504.14 . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.16 . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514.18 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.19 . . . . . . . . . . . . . . . . . . . . . . . . . . 524.20 . . . . . . . . . . . . . . . . . . . . . . . . . . 524.21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.1 ImageMagick . . . . . . . . . . . . . . . . . . . . . . . 615.2 ImageMagick . . . . . . . . . . . . . . . . . . . . . . . 62
5.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 655.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665.5 . . . . . . . . . . . . . . . . . . . . . . . . . 675.6 figure . . . . . . . . . . . . . . . . . . . . . . . . . . . . 675.7 . . . . . . . . . . . . . . . . . . . . . . . 685.8 . . . . . . . . . . . . . . . . . . . . . . . 685.9 . . . . . . . . . . . . . . . 695.10 . . . . . . . . . . . . . . . . . . . . . . . . . . 705.11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725.12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735.13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
6.1 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . 766.2 METAPOST . . . . . . . . . . . . . . . . . . . . . . . 776.3 METAPOST . . . . . . . . . . . . . . . . . . . . . . 786.4 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 796.5 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 806.6 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 806.7 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 816.8 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 816.9 METAPOST . . . . . . . . . . . . . . . . . . . . . . . 826.10 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 836.11 METAPOST . . . . . . . . . . . . . . . . . . . . . . . . . . 84
7.1 pst-pdf . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867.2 preview . . . . . . . . . . . . . . . . . . . . . . . . . . . . 867.3 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . 877.4 PStricks . . . . . . . . . . . . . . . . . . . . . . . 877.5 PStricks . . . . . . . . . . . . . . . . . . 887.6 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 887.7 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.8 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . 897.9 PStricks . . . . . . . . . . . . . . . . . . . . . . . . 907.10 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
7/25/2019 A LaTeX Tutorial
15/197
xiii
7.11 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
7.12 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 917.13 PStricks . . . . . . . . . . . . . . . . . . . . . . . . 927.14 PStricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 938.1 PGF . . . . . . . . . . . . . . . . . . . . 968.2 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . 968.3 PGF . . . . . . . . . . . . . . . . . . . . . . . . . 978.4 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 978.5 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988.6 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 988.7 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . 998.8 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . 99
8.9 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.10 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.11 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . 1008.12 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . 1018.13 PGFbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1018.14 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1028.15 PGF . . . . . . . . . . . . . . . . . . . . . . . . . 1028.16 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . 1038.17 PGF . . . . . . . . . . . . . . . . . . . . . . . 1038.18 PGF . . . . . . . . . . . . . . . . . . . . . 1048.19 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
8.20 PGF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1059.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1079.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1089.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.4 . . . . . . . . . . . . . . . . . . . . . . . 1109.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1119.7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1129.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1179.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11810.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
10.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12310.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12310.4 . . . . . . . . . . . . . . . . . . . . . . . . . . 12410.5thebibliography . . . . . . . . . . . . . . . . . . . . . . 12410.6 BTEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12610.7 . . . . . . . . . . . . . . . . . . . . . . 12810.8 . . . . . . . . . . . . . . . . . 12910.9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12910.10hyperref . . . . . . . . . . . . . . . . . . . . . . . . . . 13010.11url href . . . . . . . . . . . . . . . . . . . . . . . . 130
7/25/2019 A LaTeX Tutorial
16/197
xiv
10.12 . . . . . . . . . . . . . . . . . . . . . 131
10.13hyperref . . . . . . . . . . . . . . . . . . . 13211.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 13811.2headings . . . . . . . . . . . . . . . . . . . . . . . . . . . 13911.3myheadings . . . . . . . . . . . . . . . . . . . . . . . . . 13911.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . 14011.5fancyhdr . . . . . . . . . . . . . . . . . . . . . . . . . . . 14011.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . 14111.7multicol . . . . . . . . . . . . . . . . . . . . . . . . . . . 14211.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
7/25/2019 A LaTeX Tutorial
17/197
LXJX
xv
7/25/2019 A LaTeX Tutorial
18/197
lnotes LATEX
lnotes
1. 2.
3.
4.
1.
2.
3.
4.
LATEX X ETEX
X ETEX
xvi
7/25/2019 A LaTeX Tutorial
19/197
xvii
5.
6.
7. METAPOST, PSTricks, PGF
8.
9.
10.
11.
12. A
13. B
14.
1.
2.
MIT, IBM, ISO
3.
4.
5. LATEX
7/25/2019 A LaTeX Tutorial
20/197
1
LATEX 2002
2 Microsoft Word Visio
Linux LATEX
2005 lshort LATEX
HTMLJavaFrontPageDreamweaverJBuilder
LATEX
Word Word
Word
EndNote
LATEX
LATEX
LATEX
1
2
xviii
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
21/197
xix
LATEX
3
4
mailto:[email protected]://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
22/197
5
TV TV
CCTV
BBS TEX CTEX
hkkhhk
Hongdong Ji
Kov Chai
Xiao Zigang
4.806Jonny BBS Leeward
52010 3 12 6166.111.4.80 FTP
xx
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
23/197
xxi
LATEX
7/25/2019 A LaTeX Tutorial
24/197
7/25/2019 A LaTeX Tutorial
25/197
1.1
(raster image processor, RIP) RIP
B
RIP (page description
language, PDL)
RIP RIP 1976
(Monotype Corp.) Lasercomp RIP
RIP PostScript (PS)
RIP 1985 LaserWriter RIP 1986
Ghostscript
1
7/25/2019 A LaTeX Tutorial
26/197
2 :
(markup language)
TEX
1.1
TEX
1.1:
PDL RIP troff PS RIP
SGML PDF RIP TEX DVI RIP
1.1.1
PostScript
1969
1975 Robert F. Sproull 1 Press
Xerox Star () Press
InterPress
1976 (Evans & Sutherland) John E. Warnock
(1940) 2 PostScript1978
David C. Evans (19241998) 3 Ivan E.
Sutherland (1938) 4 Warnock
11967 1970 1977
Sun2 1961 1964 1969 3 1949 1953 (Bendix Corp.) 1962
1965 41959 1960 1963 MIT
1963 (National Security Agency, NSA) 1964
http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
27/197
1.1: 3
1980 Sutherland
Sproull (Sutherland, Sproulland Associates) 1990 Sun Sun
Warnock Martin NewellJaM (John
and Martin) InterPress
MaJ
1982 Warnock Charles M. Geschke (1939)5
AdobeNewell Adobe InterPress
1984 Adobe PostScript (Steve Jobs, 1955)
PS LaserWriter Adobe 1991 1997 PostScript 2
PostScript 3 PostScript 1980 Adobe
PS
1990 PostScript
PS PostScript
1993 Adobe portable document format (PDF)
2008 ISO 32000PDF PostScript
PDF PostScript
Acrobat Adobe Acrobat Reader ( AdobeReader) PDF PostScript
(Defense Advanced Research Projects AgencyDARPA) 1966
1968 Sproull 1968
Evans 1974 1988 (Turing Award)
1998 (IEEE John von Neumann Medal) 5 (Xavier University) 1962 1963 1972
http://-/?-7/25/2019 A LaTeX Tutorial
28/197
4 :
(Epson standard code for printers, ESC/P)
(printer command language, PCL)
(HP graphics language, HPGL)
TEX (device independent le format, DVI)
1.1.3
XML (XML paper specication, XPS) 2009 XPS Open XPS (European Computer
Manufacturers Association) ECMA
1.1.2
troff
1964 MIT Jerome H. Saltzer (1939) 6
compatible time-sharing system (CTSS)
RUNOFF
Robert H. Morris7 RUNOFF GE 635
roff1969 Malcolm D. McIlroy (1932) 8 roff BCPL
DEC PDP-7
1971 Unix PDP-11
AT&T
Joseph F. Ossanna (19281977) 9 roff nroff
(Wang Laboratories) WANG Graphic Systems CAT
Ossanna nroff PDP-11 troff6MIT 1961 1963 1966 1995
7 1957 1958 1960 1986 NSA
NSA1995 Unix1988
Robert T. Morris (1965) MIT
400 81954 1959 MIT 1958
1997 91952 (Wayne State Univesrity)
http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
29/197
1.1: 5
C Ossanna
C 7000 CAT 21 Ossanna
49
Brian W. Kernighan (1942) 10
troff ditroffA Typesetter-
independent TROFF
troff
Unix troff
1990 Unix Novell
troff
Sun Bill N. Joy (1954) 11 GNU groff
troff Unix
LATEX
SGML
1969 IBM Charles F. Goldfarb 12 Edward Mosher, Raymond
Lorie (generalized markup language, GML) GML
GML
(prole)
1978 Goldfarb GML1986 (stan-
dard generalized markup language, SGML) ISO 8879SGML
101964 1969 2000
1977 Alfred V. Aho (1941) , Peter J. WeinbergerAWK
1978 C Dennis M. Ritchie (1941) e C Programming Language
1990 Robert Fourer, David M. GayAMPL 111975 1979 vi C Shell
(csh) BSD Unix (Network File System, NFS) 121960 1964 1967
IBM IBM
http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
30/197
6 :
SGML
1989 (European Organization for Nuclear Research,
CERN) Tim J. Berners-Lee (1955) 13 (HyperText
Markup Language, HTML) HTML
SGML Berners-Lee (world wide web) 1994
Berners-Lee DARPA MIT
(World Wide Web Consortium, W3C)
1993 HTML (Internet Engineering Task Force,
IETF) 1995 IETF HTML 2.01997 HTML 3.2
W3C 4.0 4.01
HTML
1990 1998 W3C
SGML (Extensible Markup Language, XML)
2004 XML 1.1
XML
1998 W3C (mathematical markup
language, MathML) 2003 MathML 2.0
1991 (Hal Computer Systems) (OReilly Media) DocBook SGML
XML 2009 5.0
HTML, PDF, CHM 14
Scribe
1980 Brian K. Reid (1949) 15
Scribe: A Document Specication Language and its Compiler1981 Reid
Goldfarb Goldfarb Scribe SGML
131976 1980 CERN 1984 2004
14Compiled HTML Help HTML 151970 1980 1987
DEC1999 2001 2002
Google2004 Google (IPO) too old IPO
1000
http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
31/197
1.1: 7
Reid Scribe Michael I. Shamos (1947) 16
(Unilogic) Shamos Scribe Richard M. Stallman (1953) 17
Scribe
1.1.3 TEX
SGML
troff SGML
PDL
DocBook Scribe
AMSSIAM TUG
TEX Donald E. Knuth (1938)181962 Knuth
12 Knuth
1965 3000
2000
e Art of Computer Programming 19
161968 1970 (Vassar College) 1972
(American University) 1973, 74 1978
1981 (Duquesne University) 1975
2001 171971 Math 55
(1955) 1974
MIT 1970 Emacs, 1983
GNU1985 (Free Software Foundation, FSF)181960
X1963 1968 1974
1992 1995 19Fundamental Algorithms,Seminumerical Algorithms,Sorting and Searching
Combinatorial Algorithms Syntactic Algorithms 2015
eory of Context-free Languages Compiler Techniques
http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
32/197
8 :
1976 Knuth
Knuth
TEX
1978 TEXKnuth 1982
1989 TEX 3.0 7 8 Knuth
TEX
2008 3.1415926 METAFONT
e 2.718281Knuth TEX METAFONT
Knuth
1970
GOTO Knuth
GOTO
Knuth
(literate programming)
Nobel Zhuangbility Prize
1981 Knuth WEB
Pascal TEX1987 Silvio Levy
(1959) 20 CWEB C
TEX (engine)
TEX
300 (primitive)
201979 (IMPA) 1985
1986 1988 1995 (19112004)
(Mathematical Sciences Research Institute, MSRI)
http://-/?-7/25/2019 A LaTeX Tutorial
33/197
1.1: 9
Knuth (format) TEX
Plain TEX 600
1980 (Stanford Research Institute, SRI) Leslie
Lamport (1941)21 LATEX1992 LATEX 2.09
Lamport Frank Mittelbach 22
1994 LATEX 2LATEX 3
LATEX (package) (American Mathematical SocietyAMS) TEX
Michael D. Spivak (1940) 23 Plain TEX AMS-TEX (19831985) AMS LATEX
Mittelbach Rainer Schpf24 new font selection
scheme for LATEX(NFSS) AMS AMSFonts
LATEX 1989 AMS-LATEX AMS-LATEX A
MS
Knuth TEX (Xerox graphic printer,
XGP) PDP-6 1979 David R.
Fuchs25 TEX DVI
DVI
(driver)
PostScript PDF
211960 MIT (Brandeis University) 1963 1972
1970 (Massachusetts Computer Associates, MCA) 1977
SRI1985 DEC2001 22 (Johannes-Gutenberg University) 1989
(Electronic Data Systems, EDS) 231964 24LATEX3 251978 Knuth
TEXAdobe Red Diaper Baby
Haiku Tunnel
http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
34/197
10 :
1985 Tomas Rokicki 26 Funch Knuth
dvips DVI PostScript TeX (TeXUsers Group, TUG) Karl Berry27
1996 (Institute for High Energy Physics)
Sergey Lesenkodvipdf DVI PDF (Ket-
tering University) Mark A. Wicks dvipdfm
2001 dvipdfm
(Shunsaku Hirata) (Jin-Hwan Cho, 1968)28 dvipdfm-jpn dvipdfm-kor2002
dvipdfmx
1990 Knuth Ji Zlatuka (1957) 29 Philip Taylor (1947)30
TEX Knuth TEX1992
new typesetting
system (NTS) Karel Skoup
TEXJava
-TEX TEX 256 32768
1994 Zlatuka Hn Th Thnh (1972) 31 TEX
PDF pdfTeX1996 Knuth
HnTEX
261985 1999
271980 Stallman FSF
(Interleaf) (Intuit) 2003 TUG 281999 2001 2004
29 (Masaryk University) 3016 (General Post Office, GPO) 1970
(Molins Tobacco Machinery) 1972 1997
(Royal Holloway) TeX311991 1996 2001
(Ho Chi Minh City University of Pedagogy) 2006 (River
Valley Technologies)
http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
35/197
1.2: 11
Hn pdfTeX2009
pdfTeXLuaTEX LuaTEX
TEX pdfTeX2004 Jonathan Kew32
X ETEX Unicode AAT Mac OS X
2005 OpenType 2006 Linux Microsoft
Windows2007 TeX Live 2007 MikTeX 2.7
X ETEXExtended DVI (xdv)
xdv PDF
PDFxdv
xdvX ETEX xdvipdfmx
dvipdfmx Mac OS X xdv2pdf
1990 Hans Hagen 33 ConTEXt
TEX, pdfTeX, LuaTEX
LATEXConTEXt
LATEXConTEXt LATEXConTEXt
LATEXConTEXt
1.1.4
TEX
TEX
X ETEX LA
TEX
1.2
TEX
(WYSIWYG)
321985 SIL331986 (Pragma) NTS, pdfTeX, LuaTEX
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
36/197
12 :
WordWord (eld code)
TEX
(parse)
TEX
TEX
HTMLXML
2000 Lamport
TEX 34Dark Side
35
1.3
(utilities) TEX
(distribution) (implementation)
Java Linux SunIBMBEA 36
34TEX
Knuth 35361995 Sun BEA2008 Oracle2009 Oracle
Sun
http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
37/197
1.4: 13
JavaJava Linux Red Hat/Fedora
UbuntuSUSE TEX
TEX 1.2 TEX
1.2: TEX
TeX Live TeXworks
Windows MikTeX TeXstudioMac OS MacTeX TeXShop
Emacs Vim
PSPadTeXstudio TeXnicCenter
Eclipse TeXlipse Eclipse
1.4
Tobias Oetiker (1969) 37 lshort[1] LATEX
Mittelbach LATEXCompanion[2]
Comprehensive TeX Archive Network (CTAN) TUG
TeX Catalogue TeX
(UK TUG) TeX Frequently Asked Questions
LATEX[3]lshort (1975)
38 39 TEX BBS TeXCTeX
CTeX FAQ[4]
whatwhyhow
37 (Kantonsschule Olten) (Swiss Federal Institute of Tech-
nology Zurich) 1995 381997 2002
2007 39
http://bbs.ctex.org/http://www.smth.org/bbsdoc.php?board=TeXhttp://-/?-http://-/?-http://www.tex.ac.uk/faq/http://www.ctan.org/tex-archive/help/Catalogue/catalogue.htmlhttp://www.tug.org/http://www.ctan.org/http://-/?-7/25/2019 A LaTeX Tutorial
38/197
14 :
[1] Tobias Oetiker. A (Not So) Short Introduction to LaTeX2e, 2009. URLhttp:
//www.ctan.org/tex-archive/info/lshort/ .
[2] Frank Mittelbach, Michel Goossens, Johannes Braams, David P. Carlisle, and
Chris Rowley. e LaTeX Companion (Tools and Techniques for Computer Type-
setting). Addison-Wesley, 2nd edition, 2004. URLhttp://www.amazon.com/
dp/0201362996/.
[3] . LaTeX, 2004. URLhttp://edt1023.sayya.org/tex/
latex123/.
[4] TeX. CTeX, 2005. URLhttp://www.ctan.org/
tex-archive/info/ctex-faq/.
http://www.ctan.org/tex-archive/info/ctex-faq/http://www.ctan.org/tex-archive/info/ctex-faq/http://edt1023.sayya.org/tex/latex123/http://edt1023.sayya.org/tex/latex123/http://www.amazon.com/dp/0201362996/http://www.amazon.com/dp/0201362996/http://www.ctan.org/tex-archive/info/lshort/http://www.ctan.org/tex-archive/info/lshort/7/25/2019 A LaTeX Tutorial
39/197
2.1 Hello, World!
%hello_world.tex
2 \documentclass{article}\begin{document}
4 Hello, World!\end{document}
2.1: Hello, Wolrd!
2.1 hello_world.tex
LATEX xelatex PDF
LATEX .tex
xelatex hello_world(.tex)
.log ! LaTeX Error:
2 ...
! Emergency stop.
4 ...
No pages of output.
6 Transcript written on hello_world.log.
15
7/25/2019 A LaTeX Tutorial
40/197
16 :
Output written on hello_world.pdf (1 page).
Transcript written on hello_world.log.
TEX
plain TEX
texpdftexxetex TEX, pdfTeX, X ETEX LATEX
latex, pdflatex, xelatex 1
2.1
.tex .pdf
.ps.dvilat
ex
dvipsdvipdfmx ps2pdf
xelatex
pdflatex
2.1:
2.2
2.2.1
LATEX (command)
(comment) (environment) \
%
2.1
2.2.2
LATEX
(preamble)
1 pdfTeX latex pdfTeX
TEX
http://-/?-7/25/2019 A LaTeX Tutorial
41/197
2.2: 17
\documentclass[options]{class} %
\usepackage[options]{package} %
...
\begin{document} %
...
\end{document}
(documentclass) articlereportbook
2.1
2.1:
10pt, 11pt, 12pt 10ptLATEX
letterpaper, a4paper letterpapernotitlepage, titlepage article notitlepage
report book titlepage
onecolumn, twocolumn oneside, twoside article report book
landscape openany, openright report book report
openanybook openrightdraft draft
LATEX
C/C++ includeJava import
2.2.3
\maketitle
7/25/2019 A LaTeX Tutorial
42/197
18 :
\title{LaTeX Notes}
\author{Alpha Huang}
\date{\today}
\maketitle
article report book
\begin{abstract}
...
\end{abstract}
LATEX
article chapter report book
\part{...} % L ev e l - 1
2 \chapter{...} % L ev e l 0 \section{...} % L ev e l 1
4 \subsection{...} % L ev e l 2 \subsubsection{...} % L ev e l 3
6 \paragraph{...} % L ev e l 4\subparagraph{...} % L ev e l 5
2.2:
\tableofcontents
2 subsection
\setcounter{tocdepth}{2} %
\tableofcontents %
LA
TEX
2.2
\chapter*{...}
\section*{...}
\subsection*{...}
\subsubsection*{...}
7/25/2019 A LaTeX Tutorial
43/197
2.3: 19
\listoffigures
\listoftables
2.3
2.3.1
( # $ % & _ { } ) \ \
\textbackslash \\ 2
\# \$ \^ \& \_ \{ \} \~ \textbackslash\%
2.2 \XeTeX
\XeLaTeX metalogo \MF\MP mflogo \AmS
texnames 2.3 Scott
Pakin 3 [1]
LATEX (hypen) (en-dash) (em-dash)
2 C \n TEX Pascal3UIUC 1995 2001 (Los Alamos
National Laboratory)
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
44/197
20 :
2.2:
\textcopyright January 17, 2012 \today
\textregistered TEX \TeX \texttrademark LATEX \LaTeX \textyen LATEX 2 \LaTeXe
\texteuro X ETEX \XeTeX
\pounds X ELATEX \XeLaTeX \dots METAFONT \MF
\P METAPOST \MP
\S AMS \AmS
2.3:
A \.{A} \"{A} \={A} \`{A} \'{A} \^{A} \v{A} \~{A} \d{A} A \b{A} \r{A} A \textcircled{A}
2.3.2
(roman, serif) (sans
serif) 4 (monospace, typewriter)
(bold) (italic) (oblique, slanted)
(small caps) TEX
(medium weight)
2.4
LATEX \emph
\underline
ulem
ulem \emph
\usepackage[normalem]{ulem}
4Sans
http://-/?-7/25/2019 A LaTeX Tutorial
45/197
2.3: 21
computer-aided\\
1840--2010\\to be---or not to be\\
$1-1=0$
computer-aided
18402010to beor not to be
1 1 = 0
2.3:
2.4:
roman \textrm{...} bold face \textbf{...}
sans serif \textsf{...} medium weight \textmd{...}
typewriter \texttt{...} italic \textit{...}S C \textsc{...} slanted \textsl{...}
LATEX
2.5
10pt11pt12pt tiny 5pt6pt6pt
2.5:
10pt 11pt 12pt
sample \tiny 5pt 6pt 6ptsample \scriptsize 7pt 8pt 8pt
sample \footnotesize 8pt 9pt 10pt
sample \small 9pt 10pt 11pt
sample \normalsize 10pt 11pt 12pt
sample \large 12pt 12pt 14ptsample \Large 14pt 14pt 17ptsample \LARGE 17pt 17pt 20ptsample \huge 20pt 20pt 25ptsample \Huge 25pt 25pt 25pt
2.3.3
LATEX \\ \newline
\newpage
LATEX (hyphenate)
BASIC
7/25/2019 A LaTeX Tutorial
46/197
22 :
\emph{emphasis}\\
\uline{underline}\\\uwave{waveline}\\
\sout{strike-out}
emphasis
underline
waveline
strike-out
2.4:
blar-blar-blar -
\hyphenation{BASIC blar-blar-blar}
2.4
LATEX
2.6 point big point
Adobe PostScript em
11pt 1em 11ptex mu
2.6:
in
pt point, 1/72.27 in em
M
cm bp big point, 1/72 in ex xmm pc pica, 12 pt mu math unit1/18 em
LATEX
\setlength{} %
\addtolength{} %
\newlength{} %
2.5
2.5.1
LATEX (fully justied)
(\raggedright,\centering,
\raggedleft)
7/25/2019 A LaTeX Tutorial
47/197
2.5: 23
\begin{flushleft}
\\\end{flushleft}
\begin{flushright}
\\\end{flushright}
\begin{center}
\\\end{center}
2.5:
2.5.2
LATEX identfirst
\parindent
\parskip
\usepackage{identfirst}
...
\setlength{\parindent}{2em}
\addtolength{\parskip}{3pt}
2.5.3
LATEX
\linespread
\linespread{1.3} %
\linespread{1.6} %
\linespread
setspace
2.6
setspace
singlespacing, onehalfspacing, doublespacing, spacing
2.7
7/25/2019 A LaTeX Tutorial
48/197
24 :
\usepackage{setspace}
...\singlespacing %\onehalfspacing %\doublespacing %\setstretch{1.25} %
2.6:
\begin{doublespacing}
double\\spacing
\end{doublespacing}
double
spacing
\begin{spacing}{1.25}
any\\spacing
\end{spacing}
any
spacing
2.7:
2.6
2.6.1
LATEXquotequotationversequote
quotation quote verse quote
\begin{quote}
\\\end{quote}
\begin{quotation}\end{quotation}
\begin{verse}
\end{verse}
2.8:
7/25/2019 A LaTeX Tutorial
49/197
2.6: 25
2.6.2
\verb verbatim
\verb|command| 2 \begin{verbatim}
printf("Hello, world!");
4 \end{verbatim}\begin{verbatim*}
6 printf("Hello, world!");
\end{verbatim*}
command
printf("Hello, world!");
printf("Hello,world!");
2.9:
Timothy van Zandt 5 fancyvrb [2] Brooks Moses 6
listings [3]
2.6.3
\footnote 2.10 footnote (counter)
( 2.7) \thefootnote
\footnote{}a
a
\renewcommand{\thefootnote}{\roman{footnote}} % i, ii , i ii
2.10:
\thecounter
\texttt
fancyvrb \VerbatimFootnotes
5 1985 1989 1990 1998
61997 2007
(CodeSourcery)
http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
50/197
26 :
2.7:
\arabic{counter} 1, 2, 3 \alph{counter} a, b, c \Alph{counter} A, B, C \roman{counter} i, ii, iii \Roman{counter} I, II, III
\footnote
2.6.4
\marginpar
\reversemarginpar \normalmarginpar
\marginpar (oat) 7
marginnote \marginnote
\marginnote{}\reversemarginpar
\marginnote{}\normalmarginpar
2.11:
2.6.5
8 verbatim comment
\begin{comment}
...
\end{comment}
78 TeXNicCenter
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
51/197
2.7: 27
2.7
2.7.1
LATEX
\begin{itemize}
2 \itemC++\itemJava
4 \itemHTML\end{itemize}
C++
Java
HTML
(a)
\begin{enumerate}
2 \itemC++\itemJava
4 \itemHTML\end{enumerate}
1. C++
2. Java
3. HTML
(b)
\begin{description}
2 \item[C++] \item[Java]
4 \item[HTML] \end{description}
C++
Java
HTML
(c)
2.12:
2.7.2
Bernd Schandl 9
paralist
91997 (Kaiserslautern University of Technology) 1999
http://-/?-7/25/2019 A LaTeX Tutorial
52/197
28 :
\begin{compactitem}
2 \itemC++\itemJava
4 \itemHTML\end{compactitem}
C++ Java HTML
\begin{compactenum}
2 \itemC++\itemJava
4 \itemHTML\end{compactenum}
1. C++2. Java
3. HTML
\begin{compactdesc}2 \item[C++]
\item[Java] 4 \item[HTML]
\end{compactdesc}
C++ Java HTML
2.13:
\begin{inparaitem}
2 \itemC++\itemJava
4 \itemHTML\end{inparaitem}
C++ Java HTML
\begin{inparaenum}
2 \itemC++\itemJava
4 \itemHTML\end{inparaenum}
1. C++ 2. Java 3. HTML
\begin{inparadesc}
2 \item[C++] \item[Java]
4 \item[HTML] \end{inparadesc}
C++ Java
HTML
2.14:
2.7.3
2.15
7/25/2019 A LaTeX Tutorial
53/197
2.8: 29
\renewcommand{\labelitemi}{-}
\renewcommand{\theenumi}{\alph{enumi}}
\begin{itemize}
2 \itemC++\itemJava
4 \itemHTML\end{itemize}
- C++
- Java
- HTML
\begin{enumerate}
2 \itemC++
\itemJava4 \itemHTML
\end{enumerate}
a. C++
b. Java
c. HTML
2.15:
2.8
LATEX ()
(box) HTML CSS
2.8.1
\mbox \fbox
\mbox {010 6278 5001}
\fbox{010 6278 5001} 010 6278 5001 010 6278 5001
2.16:mbox fbox
2.8.2
\makebox \framebox
() clr
s
7/25/2019 A LaTeX Tutorial
54/197
30 :
%[][]{}
\makebox[100pt][c]{}\framebox[100pt][s]{}
2.17:makebox framebox
2.8.3
\parbox minipage
tcb
[][][]{}{}
\fbox{%
2 \parbox[c][36pt][t]{170pt}{
4 }%
}
6 \hfill
\fbox{%8 \begin{minipage}[c][36pt][b]{170pt}
10 \end{minipage}%
}
2.18:parbox minipage
2.9
LATEX
() (cross reference)
2.19 marker
7/25/2019 A LaTeX Tutorial
55/197
31
\label{marker}
...\pageref{marker}\ref{marker}
... 30 2.9
2.19:
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to getcross-references right.
[1] Scott Pakin. e Comprehensive LaTeX Symbol List, 2008. URLhttp://www.
ctan.org/tex-archive/info/symbols/comprehensive/ .
[2] Timothy van Zandt.Fancy Verbatims in LaTeX, 2008. URL http://www.ctan.
org/tex-archive/macros/latex/contrib/fancyvrb/ .
[3] Carsten Heinz and Brooks Moses.e listings Package, 2007. URL http://www.
ctan.org/tex-archive/macros/latex/contrib/listings/ .
http://www.ctan.org/tex-archive/macros/latex/contrib/listings/http://www.ctan.org/tex-archive/macros/latex/contrib/listings/http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/http://www.ctan.org/tex-archive/info/symbols/comprehensive/http://www.ctan.org/tex-archive/info/symbols/comprehensive/7/25/2019 A LaTeX Tutorial
56/197
7/25/2019 A LaTeX Tutorial
57/197
typeface font typeface font
1. ()
(character set) (character encoding)
2. (glyph)
3.
Microsoft Word
HTML
LATEX
LATEXKnuth TEX Unicode
UTF-8 TrueType OpenType
X ETEX
3.1
1963 ANSI ASCII
7 (bit) 27 = 128
8 (byte)
28 = 256
33
7/25/2019 A LaTeX Tutorial
58/197
34 :
ISO 1980 ISO 8859256
8859 8859-1 () 8859-2 () 8859-16 ()
ISO IBM
(code page) 437 ( ASCII) 850 () 852 (
) IBM (console) MS-DOS Unix
Shell
IBM OEM ANSI
1252 () 1250 () 936 (GBK) 950 (Big5) 932 (SJIS ) 949 (EUC-KR)
1981 GB2312
9494 7445 GB2312 EUC-CN
GB2312 GB2312
HZ
GB2312 1993 GBK
21886 GBK2000 GB18030 70244
GB18030 GB13000
1990 ISO (universal character setUCS) ISO
10646
UCS UCS-2 UCS-4
ISO (e Unicode Consor-
tium) 1991 Unicode 1.0
Unicode 2.0
ISO 10646-1
Unicode UTF-8UTF-16UTF-32UTF-8
8 UTF-16 16 UCS-2
ASCII UTF-32 32 UCS-4
IETF UTF-8 (Internet
Mail ConsortiumIMC) UTF-8
7/25/2019 A LaTeX Tutorial
59/197
3.2: 35
3.2
3.2.1
(bitmap) (out-
line) (stroke-based)
(Bzier curves) (
) (font
hinting)
3.2.2
Type 1TrueTypeOpenType
1984 Adobe PostScript Type 1
Type 3Type 1
PostScript Type 3 PostScript
1991 Apple TrueType
TrueType Type 1
1994 Apple TrueType TrueType GXApple advanced typography (AAT)
1996 Adobe OpenType Type 1
TrueType TrueType
AAT
1984 Knuth METAFONT TrueType OpenType
7/25/2019 A LaTeX Tutorial
60/197
36 :
METAFONTMETAFONT Knuth
60
Type 1 Type 3 (metrics) (glyph)
AFM (Adobe font metrics) PFM (printer font metrics)
PFA (printer font ASCII) PFB (printer font binary) LATEX
TFM (TeX font metrics)
TrueType OpenType
.ttf.otfMETAFONTPK (packed raster)
OpenTypeTrue-
TypeType 1Type 3PK OpenType TrueType
PostScript Type 1 Type 3 PDF
TrueType OpenType
3.2.3
Adobe Type 1 Type 3
Type 1 Type 3
Apple TrueType1991 TrueType Adobe
Type 1
1980 Adobe PostScript
Apple PostScript
TrueImage AppleApple TrueType
AAT Apple
Adobe 1996 OpenTypeAdobe 2002
OpenType
7/25/2019 A LaTeX Tutorial
61/197
3.3: 37
3.3
2.3.2
3.1 TEX Knuth
METAFONT Computer ModernX ETEX 1997 AMS Latin Modern Computer Modern
Type 1 OpenType
3.1:
Windows
Times New Roman Tahoma Courier New
Georgia Verdana Lucida ConsolePalatino Linotype Arial Consolas
Mac OS
Times Helvetica Monaco
Georgia Lucida Grande CourierTimes New Roman Geneva Courier New
3.4
TFMTEX
TEX METAFONTLATEX 2 NFSS
Type 1 Type 3 LATEX X ETEX
TrueType OpenType Unicode
latexpdflatexxelatex dvips dvipdfmx DVI
X ELATEX
3.4.1
latexDVI
latex DVI TFM DVI
DVI DVI PK
.pk METAFONT
7/25/2019 A LaTeX Tutorial
62/197
38 :
dvips
dvips .pk METAFONT
PK Type 3 -D
ps2pdf Type 3 PostScript
Type 3 PDF
GSview Type 3Adobe Reader Acrobat
Adobe Type Manager PostScript
Type 3 Type 3 PDF
dvips -Ppdf Type 1 PostScript
ps2pdf Type 1 PDF
dvips (native) TrueType TrueType PK
Type 1
dvips [1]
dvipdfm(x) pdatex
dvipdfm PK Type 1 t1fonts.map PK
Type 1 PDF Type 1dvipdfm
TrueTypedvipdfmx TrueType
lnotes [2]
pdatex Type 1TrueType OpenType
[3]
3.4.2 XeTeX
X ETEX TFM
X ETEX XML MikTeXlocalfonts.confTeXlive fonts.conf
fc-list myfonts.txt
fc-list > myfonts.txt
X ETEX
7/25/2019 A LaTeX Tutorial
63/197
3.5: 39
(cache)
fc-cache
fc-cache -r
fc-list fc-cache
Michel Goossens (1951)1 XeTeX Companion [4]
X ETEX Will Robertson (1981) 2
fontspec X ELATEX
fontspec [5]
\usepackage{fontspec}\setmainfont[Mapping=tex-text]{Times New Roman}
\setsansfont[Mapping=tex-text]{Tahoma}
\setmonofont{Courier New}
3.1: X ELATEX
3.1
2.3.1 2.3 -- ---
TEXX ETEX 3.1
Mapping TEX
3.5
LATEX3 CCT Werner Lem-
berg (1968) 4 CJK CCT CJK CCT
CJK
LATEX CTeX5 ChinaTeX
1 (Free University of Brussels) 1972 1978 1979
CERN LaTeX CompanionLaTeX Graphics CompanionLaTeX Web Companion
TUG 2 (University of Adelaide) 80 34 (University of Music and Performing Arts, Vienna)
5 1997 2003 2003 2005
2007 (Distance University of Hagen) 2008
(University of Konstanz)
http://-/?-http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
64/197
40 :
(1952) 6 7 cwTeX
8 PUTeX MikTeXCCTCJKWinEdt
X ETEX (1970)9 xeCJK
CCT
CJK
3.2 CJKchecksingle
CJKnumber CJKnumber
\CJKnumber
\setCJKmainfont BoldFont
ItalicFont \setCJKsansfont
\setCJKmonofont
\usepackage[CJKaddspaces,CJKchecksingle,CJKnumber]{xeCJK}
2 \setCJKmainfont[BoldFont={Adobe Heiti Std},ItalicFont={Adobe Kaiti Std}]{Adobe Song Std}
4 \setCJKsansfont{Adobe Heiti Std}\setCJKmonofont{Adobe Fangsong Std}
6 \punctstyle{hangmobanjiao}
3.2: xeCJK
3.1 3.2
xeCJK[6]Yin Dian zhspacing
[7]
[1] Tomas Rokicki.Dvips: A DVI-to-PostScript Translator, 2005. URL http://www.
tug.org/dvips/.
6789 1993 1998 2000
2002
http://www.tug.org/dvips/http://www.tug.org/dvips/http://-/?-http://-/?-http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
65/197
41
[2] . LaTeX Notes, 2008. URLhttp://www.ctan.org/tex-archive/
info/latex-notes-zh-cn/.
[3] nh Hn, Sebastian Rahtz, Hans Hagen, Hartmut Henkel, Pawe Jack-
owski, and Martin Schrder. e pdfTeX User Manual, 2007. URLhttp:
//www.tug.org/applications/pdftex/ .
[4] Michel Goossens.e XeTeX Companion, 2010. URLhttp://xml.web.cern.
ch/XML/lgc2/xetexmain.pdf .
[5] Will Robertson. e fontspec Package, 2008. URLhttp://www.ctan.org/
tex-archive/macros/xetex/latex/fontspec/ .
[6] . xeCJK, 2009. URLhttp://www.ctan.org/tex-archive/
macros/xetex/latex/xecjk/.
[7] Dian Yin. Typesetting Chinese in XeTeX: zhspacing Users Manual, 2007. URL
http://code.google.com/p/zhspacing/ .
http://code.google.com/p/zhspacing/http://www.ctan.org/tex-archive/macros/xetex/latex/xecjk/http://www.ctan.org/tex-archive/macros/xetex/latex/xecjk/http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/http://www.ctan.org/tex-archive/macros/xetex/latex/fontspec/http://xml.web.cern.ch/XML/lgc2/xetexmain.pdfhttp://xml.web.cern.ch/XML/lgc2/xetexmain.pdfhttp://www.tug.org/applications/pdftex/http://www.tug.org/applications/pdftex/http://www.ctan.org/tex-archive/info/latex-notes-zh-cn/http://www.ctan.org/tex-archive/info/latex-notes-zh-cn/7/25/2019 A LaTeX Tutorial
66/197
7/25/2019 A LaTeX Tutorial
67/197
3x+ 2y+z = 39
2x+ 3y+z = 34
x+ 2y+ 3z= 26
AMS-LATEX amsmath [1]
George Grtzer 1 More Math into LATEX[2]
\usepackage{amsmath}
4.1
LATEX (inline) (display)
4.1
$...$
\[...\] $$...$$ AMS-LATEXamsmath equation ( 4.4.1 )
1 (Etvs Lornd University) 1960
(University of Manitoba) John von Neumann
43
http://-/?-7/25/2019 A LaTeX Tutorial
68/197
44 :
4.1:
TEX LATEX LATEX amsmath
$...$ \(...\) math $$...$$ \[...\] displaymath equation* equation equation
2.8 \fbox
\boxed
Einstein's $E=mc^2$2 \[ E=mc^2 \]\[ \boxed{E=mc^2} \]
4 \begin{equation}E=mc^2
6 \end{equation}
EinsteinsE= mc2
E= mc2
E= mc2
E= mc2 (4.1)
4.1:
4.2
4.2.1
4.2
4.2:
\alpha \theta o o \tau
\beta \vartheta \pi \upsilon
\gamma \iota \varpi \phi \delta \kappa \rho \varphi
\epsilon \lambda \varrho \chi
\varepsilon \mu \sigma \psi
\zeta \nu \varsigma \omega
\eta \xi
\Gamma \Lambda \Sigma \Psi \Delta \Xi \Upsilon \Omega \Theta \Pi \Phi
7/25/2019 A LaTeX Tutorial
69/197
4.2: 45
4.2.2
^ _ \sqrt
{}
\[ x_{ij}^2\quad\sqrt{x}\quad\sqrt[3]{x} \]
x2ij
x 3
x
4.2:
4.2.3
\frac
\dfrac \tfrac
$ \frac{1}{2} \dfrac{1}{2} $
\[ \frac{1}{2}
\tfrac{1}{2} \]
1
2
1
21
2
1
2
4.3:
4.2.4
+ - * / =
( 4.4) Scott Pakin [3]
\[ \pm\; \times\; \div\; \cdot\; \cap\; \cup\;
\geq\; \leq\; \neq\; \approx\; \equiv\]
=
4.4:
\sum \prod \lim \int
( 4.5)
\limits \nolimits
7/25/2019 A LaTeX Tutorial
70/197
46 :
$ \sum_{i=1}^n i\quad\prod_{i=1}^n\quad
2 \lim_{x\to0}x^2\quad\int_a^b x^2 dx $\\$ \sum\limits_{i=1}^n i\quad\prod\limits_{i=1}^n\quad
4 \lim\limits_{x\to0}x^2\quad\int\limits_a^b x^2 dx $\[ \sum_{i=1}^n i\quad\prod_{i=1}^n\quad
6 \lim_{x\to0}x^2\quad\int_a^b x^2 dx \]\[ \sum\nolimits_{i=1}^n i\quad
8 \prod\nolimits_{i=1}^n\quad\lim\nolimits_{x\to0}x^2\quad
10 \int\nolimits_a^b x^2 dx \]
ni=1i
ni=1 limx0x
2
b
ax2dx
ni=1
in
i=1
limx0
x2b
a
x2dx
ni=1
i
ni=1
limx0
x2 b
a
x2dx
ni=1
in
i=1limx0x
2
ba
x2dx
4.5:
dx dx
4.6
\newcommand{\myd}{\;\mathrm{d}}
\[ \intx dx\quad\intx \myd x \]
xdx xdx 4.6:
\int
\iint \iiint \iiiint \idotsint 4.7
7/25/2019 A LaTeX Tutorial
71/197
4.2: 47
\[ \int\int\quad\int\int\int\quad
\int\int\int\int\quad\int\dots\int\]\[ \iint\quad\iiint\quad\iiiint\quad\idotsint \]
. . .
4.7:
4.2.5
4.3 \xleftarrow \xrightarrow
4.8
4.3:
\leftarrow \longleftarrow \rightarrow \longrightarrow \leftrightarrow \longleftrightarrow \Leftarrow = \Longleftarrow
\Rightarrow = \Longrightarrow \Leftrightarrow \Longleftrightarrow
\[ \xleftarrow{x+y+z}\quad
\xrightarrow[x
7/25/2019 A LaTeX Tutorial
72/197
48 :
4.5:
xxx \overline{xxx} xxx \overleftrightarrow{xxx}xxx \underline{xxx} xxx \underleftrightarrow{xxx}xxx \overleftarrow{xxx} xxx \overbrace{xxx}xxx \underleftarrow{xxx} xxx \underbrace{xxx}xxx \overrightarrow{xxx} xxx \widehat{xxx}xxx \underrightarrow{xxx} xxx \widetilde{xxx}
4.2.7
() [] \{\} \langle\rangle
\
LATEX |\| amsmath \lvert\rvert
\lVert\rVert
\big \Big \bigg \Bigg
LATEX \left \right
amsmath
\[ \Bigg(\bigg(\Big(\big((x)\big)\Big)\bigg)\ Bigg)\quad
2 \Bigg[\bigg[\Big[\big[[x]\big]\Big]\bigg]\Bigg]\quad\Bigg\{\bigg\{\Big\{\big\{\{x\}\big\}\Big\}\bigg\}\Bigg\}
4 \]\[\Bigg\langle\bigg\langle\Big\langle\big\langle\langlex
6 \rangle\big\rangle\Big\rangle\bigg\rangle\Bigg\rangle\quad\Bigg\lvert\bigg\lvert\Big\lvert\big\lvert\lvert x
8 \rvert\big\rvert\Big\rvert\bigg\rvert\Bigg\rvert\quad\Bigg\lVert\bigg\lVert\Big\lVert\big\lVert\lVert x
10 \rVert\big\rVert\Big\rVert\bigg\rVert\Bigg\rVert \]
((x))
[x] {{x}}
x|x|
x
4.9:
7/25/2019 A LaTeX Tutorial
73/197
4.3: 49
4.2.8
\dots \cdots \vdots \ddots \dots \cdots
\[ x_1,x_2,\dots,x_n\quad1,2,\cdots,n\quad
\vdots\quad\ddots\]
x1, x2, . . . , xn 1, 2, , n...
. . .
4.10:
4.2.9
4.6
\!
4.6:
\, 3/18em | | \quad 1em | |\: 4/18em | | \qquad 2em | |\; 5/18em
| | \! -3/18em
||
4.3
array 4.11
() tcb
lcr \\ &
\begin{array}[]{}
\end{array}
amsmath pmatrixbmatrixBmatrixvmatrixVmatrix
4.12
7/25/2019 A LaTeX Tutorial
74/197
50 :
\[ \begin{array}{ccc}
2 x_1 & x_2 & \dots\\x_3 & x_4 & \dots\\
4 \vdots& \vdots& \ddots\end{array} \]
x1 x2 . . .x3 x4 . . ....
... . . .
4.11:
\[ \begin{pmatrix} a&b\\c&d \end{pmatrix} \quad
2 \begin{bmatrix} a&b\\c&d \end{bmatrix} \quad\begin{Bmatrix} a&b\\c&d \end{Bmatrix} \quad
4 \begin{vmatrix} a&b\\c&d \end{vmatrix} \quad
\begin{Vmatrix} a&b\\c&d \end{Vmatrix} \]a b
c d
a b
c d
a b
c d
a bc d a bc d
4.12:
\smallmatrix 4.13
Marry has a little matrix $ ( \begin{smallmatrix}
a&b\\c&d \end{smallmatrix} ) $.
Marry has a little matrix( a bc d ).
4.13:
4.4
amsmath
4.4.1
multline 4.14
split 4.15
\\ &
7/25/2019 A LaTeX Tutorial
75/197
4.5: 51
\begin{multline}
x = a+b+c+{} \\d+e+f+g
\end{multline}
x= a+b+c+
d+e+f+ g (4.2)
4.14:
\[ \begin{split}
x ={} &a+b+c+{} \\
&d+e+f+g
\end{split} \]
x= a+b+c+
d+e+f+ g
4.15:
4.4.2
gather 4.16
align 4.17
\begin{gather}
a = b+c+d \\
x = y+z
\end{gather}
a= b+c+d (4.3)
x= y +z (4.4)
4.16:
\begin{align}
a &= b+c+d \\
x &= y+z
\end{align}
a= b+c+d (4.5)
x= y +z (4.6)
4.17:
multlinegatheralign *
4.4.3
cases 4.18
4.5
\newtheorem
7/25/2019 A LaTeX Tutorial
76/197
52 :
\[ y=\begin{cases}
-x,\quadx\leq0 \\x,\quadx>0
\end{cases} \]
y= x, x 0x, x >0
4.18:
{}[]{}[]
section 4.19
4.20
\newtheorem{definition}{}[section]\newtheorem{theorem}{}[section]\newtheorem{lemma}[theorem]{}\newtheorem{corollary}[theorem]{}
4.19:
\begin{definition}
Java
\end{definition}
4.5.1. Java
\begin{theorem}
\end{theorem}
4.5.1.
\begin{lemma}
\end{lemma}
4.5.2.
\begin{corollary}\end{corollary}
4.5.3.
4.20:
amsthm proof 4.21
QED 2
2 quod erat demonstrandum
http://-/?-7/25/2019 A LaTeX Tutorial
77/197
4.6: 53
\begin{proof}[]
\end{proof}
.
4.21:
4.6
( 4.7) \mathbb \mathfrak amsfonts \mathscr
mathrsfs
4.7:
ABCXY Z \mathbf ABCXYZ\mathrm ABCXYZ \mathit ABCXYZ\mathsf ABCXYZ \mathbb ABCXYZ
\mathtt ABCXYZ \mathfrak ABCXYZ
\mathcal
ABCXYZ \mathscr ABCXY Z
[1] AMS. amsmath Users Guide, 2002. URLhttp://www.ams.org/tex/
amslatex.html.
[2] George Grtzer.More Math into LaTeX. Springer, 4th edition, 2007. URLhttp:
//www.amazon.com/dp/0387322892/ .
[3] Scott Pakin. e Comprehensive LaTeX Symbol List, 2008. URLhttp://www.
ctan.org/tex-archive/info/symbols/comprehensive/ .
http://www.ctan.org/tex-archive/info/symbols/comprehensive/http://www.ctan.org/tex-archive/info/symbols/comprehensive/http://www.amazon.com/dp/0387322892/http://www.amazon.com/dp/0387322892/http://www.ams.org/tex/amslatex.htmlhttp://www.ams.org/tex/amslatex.html7/25/2019 A LaTeX Tutorial
78/197
7/25/2019 A LaTeX Tutorial
79/197
A picture says more than a thousand words.
Shakespeare
Knuth TEXGIFJPEGPNGEPS
DVI Knuth TEX
\special
DOS
5.1 LATEX
5.2 5.3 68
METAPOST, PSTricks PGF
5.1
5.1.1
LATEXJPEG PNG EPS PDF1
()
JPEG PNG
1980 PostScript
PostScript Encapsulated PostScript (EPS)
1EPS PDF
55
http://-/?-7/25/2019 A LaTeX Tutorial
80/197
56 :
HTML ActiveXJava AppletJavaScript
DVI PostScript EPS LATEX
5.1.2 Driver
dvips
dvips PostScript EPSMiKTeX
dvips JPEG PNG
72 PPI
EPS
pdatex
pdflatex 2 JPEGPNG PDF EPS EPS
PostScript
1997 pdfTeX PostScript PDF Adobe PostScript
LATEX epstopdf pst-pdf (on the y) EPS
PDF3
EPS PDF
dvipdfm(x)
dvipdfm JPEGPNG PDF EPS
Ghostscript EPS PDFdvipdfmx
BMP
xdvipdfmx
X ELATEX xdvipdfmx BMPJPEGPNGEPS
PDFxdvipdfmx dvipspdflatex
dvipdfmx xdv2pdf GIFPICTPSDSGATGA
TIFF Mac OS X
2pdflatex 3 on the y
real time user
transparent black box
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
81/197
5.1: 57
5.1.3
(pixel)
(resolution) / (pixels per inchPPI)
PPI / (dots per inch, DPI) PPI
DPI ()
100 x 150 ( 5.1) 100 PPI
1in x 1.5in 2in x
3in ( 5.2) 50 PPI
5.1: 5.2:
100 DPI
7/25/2019 A LaTeX Tutorial
82/197
58 :
300 DPI 3 x 3 50 DPI
2 x 2 (resam-
pling) (downsampling)
(upsampling) (interpolation)
(nearest neighbor) (bilinear) (bicubic)
(Lanczos)
Lanczos
72 PPI 150 PPI 300 PPI
LATEX
4.85.4in ()
400px 800px 1600px
(crop)
(resize)
1. 5.1
2048 x 1536
5.3 4in x 3in
2.
5.1resize 200 x 300 100
PPI 2in x 3in ( 5.4)
3.
5.1 200 PPI 100 x 150
0.5 x 0.75in ( 5.5)
4. 5.1 200 x 300
200 PPI 1in x 1.5in ( 5.6)
7/25/2019 A LaTeX Tutorial
83/197
5.1: 59
5.3:
5.4: 5.5: 5.6:
7/25/2019 A LaTeX Tutorial
84/197
60 :
ImageMagick resize Adobe PhotoShop resample
ImageMagick density PhotoShop resize ImageMagick resample
(color depth)
CGA
16 EGA 256 VGA16 65,536 24 16,777,216 3048
24
5.7
PNG
24 34 KB 8 256 23.4 KB 8 18.7 KB
4 16 15.6 KB 2 4 13.5 KB 1 12 KB
5.7:
7/25/2019 A LaTeX Tutorial
85/197
5.1: 61
5.1.4
X ELATEX
garbage in, garbage out
Ghostscript RIP PostScriptEPS
PDF Ghostscript
GSview
ImageMagick Paint.NET
GIMP
ImageMagick
ImageMagick convert
BMP PNG ImageMagick 100
convert fig.bmp fig.png
Windows Windows
ImageMagick PATH ImageMagick
system32
5.1
(10,10) 300 x 200
300 x 200
300 PPI
300 PPI
convert fig.bmp -crop 300x200+10+10 fig.jpg
2 convert fig.jpg -crop 300x200+10+10 -resize 30x20 fig1.jpgconvert fig.jpg -resize 300x200 fig1.jpg
4 convert fig.jpg -resize !300x200 fig1.jpgconvert fig.jpg -density 300 fig1.jpg
6 convert fig.jpg -resample 300 fig1.jpg
5.1: ImageMagick
7/25/2019 A LaTeX Tutorial
86/197
62 :
5.2 8 256
8 4 16 2 4 1
convert fig.jpg -colors 256 png8:fig8.png
2 convert fig.jpg -colorspace gray png8:fig8g.pngconvert fig.jpg -colors 16 png8:fig4.png
4 convert fig.jpg -colors 4 png8:fig2.pngconvert fig.jpg -monochrome fig1.png
5.2: ImageMagick
ImageMagick
ACDSee
EPS
EPS ImageMagick GIMP
a2ping/sam2p
bmeps
jpeg2ps
sam2p
PostScript Level 2
EPS Level 2 3 EPS
ImageMagick EPS BMP
JPEG PNG EPS EPS EPS
JPEG PNG
convert fig.png eps3:fig.eps
EPS
EPS Bullzip PDF Printer
PSEPSPDFBMPJPEGPCXPNGTIFF
Bullzip PDF Printer General
Format EPS Save EPS
PostScript EPS
PS GSview EPS
lnotes [1]4.1.3
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=dvipsgraphics7/25/2019 A LaTeX Tutorial
87/197
5.2: 63
EPS Ghostscript ps2pdf
ps2pdf -dEPSCrop fig.eps fig.pdf
PDF PDF
ImageMagick LATEX epstopdf 4 EPS
5.2
5.2.1
latex JPEGPNG
(bounding box)
pdflatex xelatex
EPS EPS
LATEX
EPS (
) bp EPS
(0,0)
%!PS-Adobe-3.0 EPSF -3.0
% % Bo un di ng Bo x : 5 5 1 05 1 05
latex DVI
latex
! LaTeX Error: Cannot determine size of graphic in fig.png
(no BoundingBox).
4 epstopdf
http://-/?-7/25/2019 A LaTeX Tutorial
88/197
64 :
latex
dvipdfm ebb JPEG PNG
fig.bb
ebb fig.png
ebb 100
PPI
bp = / 72
5.2.2
Knuth \special
LATEXv2.09 epsf psfig David P. Carlisle
(1961) 5 Rahtz LATEX 2 graphics graphicx
\usepackage[dvipdfm]{graphicx}
\includegraphics[bb=0 0 300 200]{fig.png}
graphicx latex dvips
dvipdfm(x) dvipdfmpdflatex xelatex pdftex xetex
latex .bb
pdflatex xelatex
5.2.3
\includegraphics ( 5.1)
latex dvipdfm(x) pdflatex PPI
72 PPI
51995 1998 (Numerical
Algorithms Group)
http://-/?-7/25/2019 A LaTeX Tutorial
89/197
5.2: 65
scale PPI
X ETEX
5.1:
width=x,height=y scale=s
keepaspectratio
angle=a origin=hv
lcr tcb
totalheight=h viewport=x1 y1 x2 y2 bptrim=l b r t bpclip viewport trim
page=n
\includegraphics[width=60pt]{homer.pdf}
\includegraphics[width=80pt]{homer.pdf}
\includegraphics[width=80pt,height=100pt]{homer.pdf}
\includegraphics[width=80pt,height=100pt,keepaspectratio]{
homer.pdf}
5.3:
7/25/2019 A LaTeX Tutorial
90/197
66 :
5.3
5.4
\includegraphics[angle=90]{homer.pdf}
2 \includegraphics[angle=180]{homer.pdf}\includegraphics[angle=270]{homer.pdf} \\
4 \includegraphics[angle=90,origin=c]{homer.pdf}\includegraphics[angle=180,origin=c]{homer.pdf}
6 \includegraphics[angle=270,origin=c]{homer.pdf} \\
5.4:
5.2.4
5.5 EPS
/
/
7/25/2019 A LaTeX Tutorial
91/197
5.2: 67
\DeclareGraphicsExtensions{.eps,.mps,.pdf,.jpg,.png}
2 \DeclareGraphicsRule{*}{eps}{*}{}\graphicspath{{c:/secret_garden/}}
4 \graphicspath{{./img/}}\graphicspath{{one_little/}{two_little/}{three_little_
indians/}}
5.5:
5.2.5 gure
figure
(oat)
5.6 htbp
here, top, bottom, oat page (
)
\begin{figure}[htbp]
2 \centering\includegraphics{myphoto.jpg}
4 \caption{
}\label{fig:myphoto}
6 \end{figure}
5.6:figure
h LATEX
\centering \caption LATEX
\label
5.2.6
figure
\includegraphics ( 5.7)
7/25/2019 A LaTeX Tutorial
92/197
68 :
\begin{figure}[htbp]
2 \centering\includegraphics{left.pdf}
4 \includegraphics{right.pdf}\caption{}
6 \end{figure}
5.8:
5.7:
figure minipage ( 5.8) minipage
\begin{figure}[htbp]
2 \centering\begin{minipage}{60pt}
4 \centering\includegraphics{left.pdf}
6 \caption{}\end{minipage}
8 \hspace{10pt}%\begin{minipage}{60pt}
10 \centering\includegraphics{right.pdf}
12 \caption{}\end{minipage}
14 \end{figure}
5.9:
5.10:
5.8:
\caption minipage figure
2411 \centering minipage
minipage 14 \hspace
minipage
7/25/2019 A LaTeX Tutorial
93/197
5.2: 69
Steven D. Cochran 6 subfig \subfloat
5.9
\begin{figure}[htbp]
2 \centering\subfloat[]{
4 \label{fig:subfig_a}\includegraphics{left.pdf}
6 }\hspace{10pt}%
8 \subfloat[]{\label{fig:subfig_b}
10 \includegraphics{right.pdf}}
12 \caption{}\label{fig:subfig}
14 \end{figure}
(a)
(b)
5.11:
5.9:
\subfloat
\subfloat
minipage 5.10
subfig [2] LATEX
Keith Reckdahl epslatex[3]
6
http://-/?-7/25/2019 A LaTeX Tutorial
94/197
70 :
\begin{figure}[htbp]
2 \centering\subfloat[]{
4 \label{fig:improved_subfig_a}\begin{minipage}[t]{60pt}
6 \centering\includegraphics{left.pdf}
8 \end{minipage}}
10 \subfloat[]{\label{fig:improved_subfig_b}
12 \begin{minipage}[t]{60pt}\centering
14 \includegraphics{right.pdf}\end{minipage}
16 }\caption{}
18 \label{fig:improved_subfig}\end{figure}
(a)
(b)
5.12:
5.10:
5.3
5.3.1
RGB 5.13
CMYK 5.14
RGB
24 8 0 255
7/25/2019 A LaTeX Tutorial
95/197
5.3: 71
5.13: RGB 5.14: CMYK
(255,0,0)(0,255,0)(0,0,255)(0,0,0)(255,255,255) HTML 16 FF0000
00FF000000FF000000FFFFFF
RGB
HSL HSV
5.15
5.15:
CMYK
CMYK K key black
LATEX RGB
10 RGB 16 HTML [0, 1] rgb
7/25/2019 A LaTeX Tutorial
96/197
72 :
color
Uwe Kern 7 xcolor 12 (rgb, cmy, cmyk, hsb, Hsb, tHsb, gray, RGB, HTML, HSB, Gray, wave)
xcolor 19 68 dvips 151
SVG 317 Unix/X11
\usepackage[dvipsnames]{xcolor}
\usepackage[svgnames]{xcolor}
\usepackage[x11names]{xcolor}
\definecolor
: \definecolor{}{}{}
\definecolor{myred}{RGB}{255,0,0}
\definecolor{mygreen}{HTML}{00FF00}\definecolor{myblue}{rgb}{0,0,1}
5.11:
\textcolor 5.12 24
57
: \textcolor{}|[]{}{}
xcolor
71993 (University of Wrzburg)
http://-/?-7/25/2019 A LaTeX Tutorial
97/197
5.3: 73
\textcolor{Red}{}
2 \textcolor{Green}{}\textcolor{Blue}{}
4 \textcolor[RGB]{255,0,0}{}\textcolor[HTML]{00FF00}{}
6 \textcolor[rgb]{0,0,1}{}
5.12:
\colorbox \textcolor
\fcolorbox
5.13 svgnames
\colorbox{Lavender}{}
2 \colorbox{SkyBlue}{}\colorbox{Wheat}{}
4 \fcolorbox{Silver}{Lavender}{}\fcolorbox{RoyalBlue}{SkyBlue}{}
6 \fcolorbox{SandyBrown}{Wheat}{}
5.13:
xcolor [4]
5.3.2
LATEX META-POST, PSTricks, PGF
METAPOST, PSTricks, PGF
METAPOST MPS ( EPS) PSTricks PGF LATEX
METAPOST MPS PDF pdflatex
7/25/2019 A LaTeX Tutorial
98/197
74 :
PSTricks EPS pdflatexPGF
PSTricks PostScript METAPOSTPGF
Asymptote
milksea
LATEX
Dia Ipe gnuplot Inkscape
[1] . LaTeX Notes, 2008. URLhttp://www.ctan.org/tex-archive/
info/latex-notes-zh-cn/.
[2] Steven D. Cochran. e Subg Package, 2005. URLhttp://www.ctan.org/
tex-archive/macros/latex/contrib/subfig/ .
[3] Keith Reckdahl. Using Imported Graphics in LaTeX and pdfLaTeX, 2006. URL
http://www.ctan.org/tex-archive/info/epslatex/ .
[4] Uwe Kern. Extending LaTeXs Color Facilities: e xcolor Package. CTAN, 2007.
URLhttp://www.ukern.de/tex/xcolor.html.
http://www.ukern.de/tex/xcolor.htmlhttp://www.ctan.org/tex-archive/info/epslatex/http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/http://www.ctan.org/tex-archive/macros/latex/contrib/subfig/http://www.ctan.org/tex-archive/info/latex-notes-zh-cn/http://www.ctan.org/tex-archive/info/latex-notes-zh-cn/http://bbs.ctex.org/viewthread.php?tid=47893&extra=page%3D1http://asymptote.sourceforge.net/7/25/2019 A LaTeX Tutorial
99/197
Metapost
Knuth METAFONT PK1980 John D. Hobby 1
METAPOST METAFONT
METAPOST EPSMETAFONT
METAPOST
TEX METAFONT
4096 PostScript
Asymptote METAPOST
1994 Taco Hoekwater 2 Hagen METAPOST
[1]
6.1
METAPOST bp 2.6
:= =
METAPOST (.mp) 6.1
mpost METAPOST
EPS MPS MPS LATEX
11985 Knuth21992
(Kluwer Academic Publishers) 2000 (Elvenkind) LuaTeX
ConTEXt
75
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
100/197
76 : Metapost
u := 10pt; %
2 beginfig(1); %... %
4 endfig; %
6 beginfig(2);...
8 endfig;...
10 end %
6.1: METAPOST
fig.mp
mpost fig(.mp)
g.1g.2
METAPOST
g-01.mpsg-02.mps
outputtemplate "% j-%2 c. mps "; %
outputtemplate "flowchart.mps" %
xelatex MPS .eps
\DeclareGraphicsRule .mps EPS
\DeclareGraphicsRule{.mps}{eps}{.mps}{}
6.2
6.2.1
METAPOST 0.5bp 0.5bp
0.5bp withpen
pickup
7/25/2019 A LaTeX Tutorial
101/197
6.2: 77
6.2 draw drawdot
filenametemplate "line.eps";
2 beginfig(1);draw (0,0)--(4u,0)--(2u,2u)--(0,0) withpen pencircle
scaled .8pt;
4 pickup pencircle scaled .8pt;draw (5u,0)--(9u,0)--(7u,2u)--cycle;
6 pickup pencircle scaled 3pt;drawdot (10u,0);
8 drawdot (14u,0);drawdot (12u,2u);
10 endfig;
6.2: METAPOST
(path) cycle
(closed path)
6.2.2
fullcircle
halfcirclequartercircleunitsquare
6.3
xscaled yscaled
6.2.3
-- ..
METAPOST
(direction) (tension) (curl) 6.4
() (
) ()
( 1112 )
7/25/2019 A LaTeX Tutorial
102/197
78 : Metapost
filenametemplate "predefined.eps";
2 beginfig(3);pickup pencircle scaled .8pt;
4 draw fullcircle scaled 2u;draw halfcircle scaled 2u shifted (3u,0);
6 draw quartercircle scaled 2u shifted (5u,0);draw fullcircle xscaled 4u yscaled 2u shifted (9u,0);
8 draw unitsquare scaled 2u shifted (12u,-u);draw unitsquare xscaled 4u yscaled 2u shifted (15u,-u);
10 endfig;
6.3: METAPOST
6.3
6.3.1
6.3.2
6.3.3
METAPOST xcolor rgb cmyk
color c[];
c1 := .9red + .6green + .3blue;
c2 := (.9,.6,.3);
withcolor
fill 6.8
path filldraw fill+draw
7/25/2019 A LaTeX Tutorial
103/197
6.4: 79
filenametemplate "curve.eps";
2 beginfig(3);pickup pencircle scaled .8pt;
4 draw (0,0)..(4u,1u)..(8u,0);draw (9u,0){up}..(13u,1u){right}..(17u,0){down};
6 draw (18u,0){up}...(22u,1u){right}...(26u,0){down};draw (0,2u)..(2u,3u)..(6u,3u)..(8u,2u);
8 draw (9u,2u)..(11u,3u)..tension 1.5..(15u,3u)..(17u,2u);draw (18u,2u)..(20u,3u)..tension 1.5 and 1..(24u,3u)..(26u
,2u);
10 draw (0,4u)..(4u,5u)..(8u,4u);draw (9u,4u){curl 0}..(13u,5u)..{curl 0}(17u,4u);
12 draw (18u,4u){curl 100}..(22u,5u)..{curl 100}(26u,4u);
pickup pencircle scaled 3pt;14 drawdot (0,0); drawdot (4u,1u); drawdot (8u,0);drawdot (9u,0); drawdot (13u,1u); drawdot (17u,0);
16 drawdot (18u,0); drawdot (22u,1u); drawdot (26u,0);drawdot (0,2u); drawdot (2u,3u); drawdot (6u,3u); drawdot
(8u,2u);
18 drawdot (9u,2u); drawdot (11u,3u); drawdot (15u,3u);drawdot (17u,2u);
drawdot (18u,2u); drawdot (20u,3u); drawdot (24u,3u);
drawdot (26u,2u);
20 drawdot (0,4u); drawdot (4u,5u); drawdot (8u,4u);drawdot (9u,4u); drawdot (13u,5u); drawdot (17u,4u);
22 drawdot (18u,4u); drawdot (22u,5u); drawdot (26u,4u);
6.4: METAPOST
drawoption
drawoption(withcolor blue);
6.4
(shifted)
(rotated) (rotatedaround) (reflectedabout)
(slanted)
7/25/2019 A LaTeX Tutorial
104/197
80 : Metapost
filenametemplate "dashed.eps";
2 beginfig(4);pickup pencircle scaled .8pt;
4 draw (0,0)--(10u,0) dashed withdots;draw (0,1u)--(10u,1u) dashed withdots scaled 2;
6 draw (0,2u)--(10u,2u) dashed evenly;draw (0,3u)--(10u,3u) dashed evenly scaled 2;
8 endfig;
6.5: METAPOST
filenametemplate "arrow.eps";
2 beginfig(5);pickup pencircle scaled .8pt;
4 drawarrow (0,0)--(10u,0);drawarrow reverse ((0,1u)--(10u,1u));
6 drawdblarrow (0,2u)--(10u,2u);endfig;
6.6: METAPOST
6.9 6.8
6.5
label
( 6.1) dotlabel
6.1:label
top bottom lft rt ulft urt llft lrt
7/25/2019 A LaTeX Tutorial
105/197
6.5: 81
filenametemplate "color.eps";
2 beginfig(6);pickup pencircle scaled .8pt;
4 draw (0,0)--(10u,0) withcolor red;draw (0,1u)--(10u,1u) withcolor green;
6 draw (0,2u)--(10u,2u) withcolor blue;endfig;
6.7: METAPOST
filenametemplate "fill.eps";
2 beginfig(7)path p;
4 p := (0,0)--(2,0)--(1,1.732)--cycle;fill p scaled u;
6 fill p scaled u shifted (3u,0) withcolor red;fill p scaled u shifted (6u,0) withcolor green;
8 fill p scaled u shifted (9u,0) withcolor blue;endfig;
6.8: METAPOST
btex etex TEX
( 6.10 141819 ) mpost TEX
tex DVImpost DVI METAPOST
.mpx MPS
METAPOST LATEX
verbatimtex etex
METAPOST
X ELATEX
MPS GSview
MPS PDF
MPS
( 6.10 )
mpost \prologues:=3; input fig.mp
7/25/2019 A LaTeX Tutorial
106/197
82 : Metapost
filenametemplate "transform.eps";
2 beginfig(8);pickup pencircle scaled .8pt;
4 draw p scaled u;draw p scaled u shifted (3u,0) rotated 30;
6 draw p scaled u rotated 30 shifted (5u,0);draw p scaled u rotatedaround ((2u,0),30) shifted (7u,0) ;
8 draw p scaled u slanted 1 shifted (10u,0);draw p scaled u reflectedabout ((0,0),(2u,0)) shifted (13u
,0);
10 draw p xscaled 2u yscaled u shifted (16u,0);endfig;
6.9: METAPOST
6.6
6.6.1
METAPOST numericpairpathpen
colorcmykcolortransformstringbooleanpicture
u numericpair
pathpencircle pen color
scaledshiftedrotated transform
numeric 1/65536 4096
32768
4096
numeric
()
numeric x,y,z; %
numeric x1,x2,x3; %
numeric x[]; %
7/25/2019 A LaTeX Tutorial
107/197
6.6: 83
prologues:=3;
2 filenametemplate "label.eps";beginfig(9);
4 pickup pencircle scaled .8pt;draw unitsquare xscaled 8u yscaled 4u;
6 label.top ("top", (4u,4u));label.bot ("bottom", (4u,0));
8 label.lft ("left", (0,2u));label.rt ("right", (8u,2u));
10 label.ulft ("upper left", (0,4u));label.urt ("upper right", (8u,4u));
12 label.llft ("lower left", (0,0));label.lrt ("lower right", (8u,0));
14 label.rt (btex $E=mc^2$ etex, (2u,2u));drawarrow (16u,0)--(22u,0);16 drawarrow (16u,0)--(16u,4u);
dotlabel.bot ("(0,0)", (16u,0));
18 label.bot (btex $x$ etex, (22u,0));label.lft (btex $y$ etex, (16u,4u));
20 endfig;
top
bottom
left right
upperleft upperright
lowerleft lowerright
E= mc2
(0,0) x
y
6.10: METAPOST
6.6.2
METAPOST + - * /
a++b
a2 +b2a+-+b
a2 b2 6.2
6.6.3
( 6.11)
1upto
step 1 until
for x=1 step .5 until 3:
7/25/2019 A LaTeX Tutorial
108/197
84 : Metapost
6.2: METAPOST
abs mexp round mlog ceiling sind floor cosd mod normaldeviate sqrt uniformdeviate
filenametemplate "loop.eps";
2 beginfig(10);pickup pencircle scaled .8pt;
4 drawarrow (0,0)--(10u,0);drawarrow (0,0)--(0,4u);
6 draw (0,0) %for x=1 upto 3: ..(x*x,x)*u endfor;
8 endfig;
6.11: METAPOST
[1] John D. Hobby, Taco Hoekwater, and Hans Hagen. MetaPost: A Users Manual,
2010. URLhttp://www.tug.org/metapost/.
http://www.tug.org/metapost/7/25/2019 A LaTeX Tutorial
109/197
PSTricks
PSTricks PostScript LATEXPSTricks van Zandt
1997 Denis Girou 1 Herbert Vo 2
7.1 PSTricks
7.1: PSTricks
multido pst-3dplot pst-node pst-solides3d pst-tree pst-circ pst-plot pst-labo
pst-func pst-geo pst-eucl pstricks-add
7.1
PSTricks 1cm
pspicture
LATEX
\psset{unit=10pt}
\begin{pspicture}(0,0)(4,2)
...
\end{pspicture}
1 (National Centre for Scientic Research, CNSR) 2 (Free University of Berlin)
LATEX 3
85
http://-/?-http://-/?-7/25/2019 A LaTeX Tutorial
110/197
86 : PSTricks
LATEX PSTricks PostScriptdvips
xdvipdfmx dvipdfm pdflatex EPS PDF
pst-eps PSTricks EPS
LATEX EPS dvipdfmx pst-eps
EPS \rput\uput\psaxes
%fig.tex
2 \documentclass{article}\usepackage{pst-pdf}
4 \begin{document}
\begin{pspicture}(0,0)(4,2)6 ...
\end{pspicture}
8 \end{document}
7.1:pst-pdf
pst-pdf PSTricks EPS
PDF pspicture