├── .gitignore ├── LICENSE.md ├── README.md ├── build.txt ├── ctex.cmd ├── graph ├── arrow.mps ├── beamer-warsaw.pdf ├── beamer.pdf ├── color.mps ├── curve.mps ├── cv-banking.pdf ├── cv-casual.pdf ├── cv-classic.pdf ├── cv-old.pdf ├── dashed.mps ├── fill.mps ├── label.mps ├── letter-bus.pdf ├── letter-env.pdf ├── letter-fullmemo.pdf ├── letter-memo.pdf ├── letter-pr.pdf ├── letter-std.pdf ├── line.mps ├── loop.mps ├── mini.pdf ├── pgf.pdf ├── predefined.mps ├── pst.pdf ├── src │ ├── beamer-warsaw.tex │ ├── beamer.tex │ ├── cv-banking.tex │ ├── cv-base.tex │ ├── cv-casual.tex │ ├── cv-classic.tex │ ├── cv-old.tex │ ├── fig.mp │ ├── letter-bus.tex │ ├── letter-env.tex │ ├── letter-fullmemo.tex │ ├── letter-memo.tex │ ├── letter-pr.tex │ ├── letter-std.tex │ ├── mini.tex │ ├── pgf.tex │ ├── picture.eps │ └── pst.tex └── transform.mps ├── history.txt ├── img ├── 599px-movable_type.png ├── anna.jpg ├── anna.png ├── anna1.png ├── anna2.png ├── anna4.png ├── anna8.png ├── anna8g.png ├── anna_density.jpg ├── anna_gray.jpg ├── anna_resample.jpg ├── anna_resize.jpg ├── cassatt_bath.jpg ├── chinese_movable_type1.png ├── chinese_type.jpg ├── color.png ├── convert.txt ├── dscf6030.jpg ├── durer_st_christopher.jpg ├── gainsborough_georgiana_duchess.jpg ├── goya_sleep_of_reason.jpg ├── goya_sleep_of_reason_sm.jpg ├── gutenberg_bible.jpg ├── gutenberg_bible_sm.jpg ├── hopfer_soldier_wife.jpg ├── hopfer_soldier_wife_sm.jpg ├── ilsted_sunshinev.jpg ├── jingangjing.jpg ├── jingangjing_sm.jpg ├── leftfoot.jpg ├── leftfoot.png ├── movable_type.png ├── movable_type_transparent.png ├── pattern.png ├── rightfoot.jpg ├── rightfoot.png ├── siegen_portrait_of_hessen.jpg ├── ury_woman_in_cafe.jpg └── vaillerant_young_man_reading.jpg ├── lnotes2.pdf ├── mtex.cmd └── src ├── acknowledgements.tex ├── apps.tex ├── back.tex ├── basics.tex ├── copyright.tex ├── dedication.tex ├── fonts.tex ├── forward.tex ├── front.tex ├── gra-mp.tex ├── gra-pgf.tex ├── gra-pst.tex ├── graphics.tex ├── index.tex ├── introduction.tex ├── lang.tex ├── layout.tex ├── ldemo.sty ├── lnotes2.bib ├── lnotes2.tex ├── math.tex ├── multind.sty ├── postscript-old.tex ├── postscript.tex ├── preface-fan.tex ├── preface-old.tex ├── preface.tex ├── printing.tex ├── software.tex ├── structure.tex ├── tables.tex └── texlet ├── big-ops.tex ├── box-make-esc.tex ├── box-make.tex ├── box-par-esc.tex ├── box-par.tex ├── color-text-esc.tex ├── color-text.tex ├── delimiters.tex ├── fig-better-subfig-esc.tex ├── fig-better-subfig.tex ├── fig-rotate-esc.tex ├── fig-rotate.tex ├── fig-subfig-esc.tex ├── fig-subfig.tex ├── fig-title-esc.tex ├── fig-title.tex ├── fig-titles-esc.tex ├── fig-titles.tex ├── fig-zoom-esc.tex ├── fig-zoom.tex ├── hello-world.tex ├── href-esc.tex ├── href.tex ├── hyperref-esc.tex ├── hyperref.tex ├── layout-chaptermark-a.tex ├── layout-chaptermark-esc.tex ├── layout-chaptermark.tex ├── layout-cols-esc.tex ├── layout-cols.tex ├── layout-fancyhdr-esc.tex ├── layout-fancyhdr.tex ├── layout-macro.tex ├── layout-markboth-a.tex ├── layout-markboth-esc.tex ├── layout-markboth.tex ├── layout-pagestyle-a.tex ├── layout-pagestyle-esc.tex ├── layout-pagestyle.tex ├── list-description.tex ├── list-enumerate.tex ├── list-itemize.tex ├── matrix.tex ├── note-footnote-esc.tex ├── note-footnote.tex ├── par-center-esc.tex ├── par-center.tex ├── par-left-esc.tex ├── par-left.tex ├── par-right-esc.tex ├── par-right.tex ├── quote-quotation-esc.tex ├── quote-quotation.tex ├── quote-quote-esc.tex ├── quote-quote.tex ├── quote-verse-esc.tex ├── quote-verse.tex ├── ref-esc.tex ├── ref.tex ├── tab-base-cross.tex ├── tab-base-header.tex ├── tab-base-mac.tex ├── tab-base-unix.tex ├── tab-base-win.tex ├── tab-color-alt-esc.tex ├── tab-color-alt.tex ├── tab-color-esc.tex ├── tab-color.tex ├── tab-long-esc.tex ├── tab-long.tex ├── tab-multicol-esc.tex ├── tab-multicol.tex ├── tab-multirow-esc.tex ├── tab-multirow.tex ├── tab-num-esc.tex ├── tab-num.tex ├── tab-rotate-esc.tex ├── tab-rotate.tex ├── tab-simple-esc.tex ├── tab-simple.tex ├── tab-tabularx-esc.tex ├── tab-tabularx.tex ├── tab-threesome-esc.tex ├── tab-threesome.tex ├── tab-width-aligned-esc.tex ├── tab-width-aligned.tex ├── tab-width-esc.tex ├── tab-width.tex ├── theorem-cor-esc.tex ├── theorem-cor.tex ├── theorem-def-esc.tex ├── theorem-def.tex ├── theorem-lem-esc.tex ├── theorem-lem.tex ├── theorem-proof-esc.tex ├── theorem-proof.tex ├── theorem-the-esc.tex └── theorem-the.tex /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | misc/ 3 | tmp/ 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaTeX Notes v2.101 2 | 雷太赫排版系统简介 An introduction to TeX/LaTeX typesetting system 3 | 4 | ## 内容纲要 topics 5 | 1. 简介 Brief history of typesetting systems 6 | 2. 入门 Basic text typesetting 7 | 3. 字体 Chinese language and fonts 8 | 4. 数学 Mathematics 9 | 5. 图形 Graphics 10 | 6. Metapost 11 | 7. PSTricks 12 | 8. PGF 13 | 9. 表格 Tables 14 | 10. 结构 Structures 15 | 11. 布局 Page layouts 16 | 12. 应用 Applications 17 | 18 | ## 根目录文件 19 | * README.md 项目说明 20 | * LICENSE.md 许可证 21 | * history.txt 版本历史 22 | * build.txt 编译说明 23 | * ctex.cmd 视窗命令行脚本,编译单个文件 24 | * mtex.cmd 视窗命令行脚本,编译部分或整个项目 25 | -------------------------------------------------------------------------------- /build.txt: -------------------------------------------------------------------------------- 1 | 1. 简介 2 | 3 | 根目录相关文件 4 | build.txt 编译说明 5 | ctex.cmd 视窗命令行脚本,编译单个文件 6 | mtex.cmd 视窗命令行脚本,编译部分或整个项目 7 | 8 | 子目录结构: 9 | ├─graph 矢量图形 10 | │ ├─src 图形源文件 11 | │ └─tmp 临时目录,编译图形用 12 | ├─img 点阵图像 13 | ├─src 主文档源文件 14 | │ └─texlet 一些示例的 LaTeX 片段 15 | └─tmp 临时目录,编译主文档用 16 | 17 | 2. 系统要求 18 | 19 | 2.1 MikTeX 2.9 http://miktex.org/ 20 | 2.8 版应该也行,可能需要改动若干配置。本源码包附带的 mtex.cmd 脚本调用了 texify.exe,TeX Live 不含此程序,编译时需要更多的手工操作。 21 | 22 | 2.2 字体 23 | 源码中不包含字体,读者请自行准备,酌情修改 src/lang.tex 文件中字体配置。 24 | 25 | 26 | 2.3 Simpsons Package https://ctan.org/tex-archive/usergrps/uktug/baskervi/4_4/ 27 | 最新版 MikTeX 能够自动下载该宏包;或者也可用以下方法, 28 | 1) 下载 simpsons.sty,放到 MIKTEX-ROOT/tex/latex/simpsons目录. 29 | 2) MikTeX -> Maintainence -> Settings -> General -> Refresh FNDB 或在命令行下执行 initexmf --update-fndb. 30 | 31 | 3. 编译方法 32 | 3.1 编译 33 | 编译全部 34 | mtex -build all 35 | 36 | 编译图形 37 | mtex -build graph 38 | 39 | 编译主文档 40 | mtex -build main 41 | 42 | 删除全部临时文件 43 | mtex -clean all 44 | 45 | 删除图形临时文件 46 | mtex -clean graph 47 | 48 | 删除主文档临时文件 49 | mtex -clean main 50 | 51 | 3.2 排错 52 | 编译时可能会遇到下面的错误信息。 53 | 54 | 1) ** WARNING ** Image format conversion for PSTricks failed. 55 | 用下面命令打开dvipdfmx配置文件, 56 | initexmf --edit-config-file dvipdfmx 57 | 58 | 从 miktex\root\dvipdfm\config\dvipdfmx.cfg 里复制下面带 D 参数的那行,粘贴到上面那个文件里。那行一般是这样的, 59 | 60 | D "mgs.exe -q -dNOPAUSE -dBATCH -sPAPERSIZE=a0 -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dUseFlateCompression=true -sOutputFile=\"%o\" \"%i\" -c quit" 61 | 62 | 2) ** WARNING ** Failed to convert input string to UTF16. 63 | 64 | \usepackage[pdfencoding=auto]{hyperref} % unicode option causes the warning 65 | 66 | 3) ** WARNING ** Version of PDF file (1.5) is newer than version limit specification. 67 | 68 | xelatex -output-driver="xdvipdfmx -V 5" 69 | 70 | 或者在 dvipdfmx.cfg 里加上如下版本设置, 71 | V 5 72 | -------------------------------------------------------------------------------- /ctex.cmd: -------------------------------------------------------------------------------- 1 | :VARIABLES 2 | @SET AUXDIR=tmp 3 | @SET SRCDIR=src 4 | @SET INTERACTION=nonstopmode 5 | @SET DRIVER="xdvipdfmx -V 5" 6 | 7 | @IF "%1"=="" GOTO USAGE 8 | @IF "%2"=="" GOTO USAGE 9 | 10 | @IF "%1"=="-x" GOTO XELATEX 11 | @IF "%1"=="-p" GOTO PDFLATEX 12 | @IF "%1"=="-b" GOTO BIBTEX 13 | @IF "%1"=="-m" GOTO METAPOST 14 | @ECHO Invalid option. 15 | 16 | :USAGE 17 | @ECHO TeX Compiler 0.5 (2019-04-09) by Alpha Huang 18 | @ECHO Compile a LaTeX or MetaPost file with xelatex, pdflatex, bibtex or mpost. 19 | @ECHO. 20 | @ECHO Usage: ctex OPTION FILE 21 | @ECHO -x xelatex. 22 | @ECHO -p pdflatex. 23 | @ECHO -b bibtex. 24 | @ECHO -m mpost. 25 | 26 | @GOTO :EOF 27 | 28 | :XELATEX 29 | @REM xelatex -aux-directory=%AUXDIR% -include-directory=%SRCDIR% -interaction=%INTERACTION% -output-driver=%DRIVER% -quiet %2 30 | xelatex -aux-directory=%AUXDIR% -include-directory=%SRCDIR% -interaction=%INTERACTION% -quiet %2 31 | @GOTO :EOF 32 | 33 | :PDFLATEX 34 | pdflatex -aux-directory=%AUXDIR% -include-directory=%SRCDIR% -interaction=%INTERACTION% %2 35 | @GOTO :EOF 36 | 37 | :BIBTEX 38 | bibtex -include-directory=%SRCDIR% %2 39 | @GOTO :EOF 40 | 41 | :METAPOST 42 | @SET MPINPUTS=%SRCDIR% 43 | mpost -interaction=%INTERACTION% %2 44 | @MOVE fig.log %AUXDIR% 45 | @MOVE fig.mpx %AUXDIR% 46 | @GOTO :EOF 47 | -------------------------------------------------------------------------------- /graph/arrow.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -2 101 22 3 | %%HiResBoundingBox: -0.39851 -1.92911 100.02467 21.85434 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinecap 11 | 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 99.62616 0 lineto stroke 14 | newpath 95.93106 -1.5306 moveto 15 | 99.62616 0 lineto 16 | 95.93106 1.5306 lineto 17 | closepath 18 | gsave fill grestore stroke 19 | newpath 99.62616 9.96262 moveto 20 | 0 9.96262 lineto stroke 21 | newpath 3.6951 11.49321 moveto 22 | 0 9.96262 lineto 23 | 3.6951 8.43202 lineto 24 | closepath 25 | gsave fill grestore stroke 26 | newpath 0 19.92523 moveto 27 | 99.62616 19.92523 lineto stroke 28 | newpath 95.93106 18.39464 moveto 29 | 99.62616 19.92523 lineto 30 | 95.93106 21.45583 lineto 31 | closepath 32 | gsave fill grestore stroke 33 | newpath 3.6951 21.45583 moveto 34 | 0 19.92523 lineto 35 | 3.6951 18.39464 lineto 36 | closepath 37 | gsave fill grestore stroke 38 | showpage 39 | %%EOF 40 | -------------------------------------------------------------------------------- /graph/beamer-warsaw.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/beamer-warsaw.pdf -------------------------------------------------------------------------------- /graph/beamer.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/beamer.pdf -------------------------------------------------------------------------------- /graph/color.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 21 3 | %%HiResBoundingBox: -0.39851 -0.39851 100.02467 20.32375 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 1 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinecap 11 | 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 99.62616 0 lineto stroke 14 | 0 1 0 setrgbcolor 15 | newpath 0 9.96262 moveto 16 | 99.62616 9.96262 lineto stroke 17 | 0 0 1 setrgbcolor 18 | newpath 0 19.92523 moveto 19 | 99.62616 19.92523 lineto stroke 20 | showpage 21 | %%EOF 22 | -------------------------------------------------------------------------------- /graph/cv-banking.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/cv-banking.pdf -------------------------------------------------------------------------------- /graph/cv-casual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/cv-casual.pdf -------------------------------------------------------------------------------- /graph/cv-classic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/cv-classic.pdf -------------------------------------------------------------------------------- /graph/cv-old.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/cv-old.pdf -------------------------------------------------------------------------------- /graph/dashed.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 31 3 | %%HiResBoundingBox: -0.39851 -0.39851 100.02467 30.28636 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop 11 | [0 5 ] 2.5 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 99.62616 0 lineto stroke 14 | [0 10 ] 5 setdash 15 | newpath 0 9.96262 moveto 16 | 99.62616 9.96262 lineto stroke 17 | [3 3 ] 0 setdash 18 | newpath 0 19.92523 moveto 19 | 99.62616 19.92523 lineto stroke 20 | [6 6 ] 0 setdash 21 | newpath 0 29.88785 moveto 22 | 99.62616 29.88785 lineto stroke 23 | showpage 24 | %%EOF 25 | -------------------------------------------------------------------------------- /graph/fill.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: 0 0 110 18 3 | %%HiResBoundingBox: 0 0 109.58878 17.2552 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 11 | newpath 0 0 moveto 12 | 19.92523 0 lineto 13 | 9.96262 17.2552 lineto 14 | closepath fill 15 | 1 0 0 setrgbcolor 16 | newpath 29.88785 0 moveto 17 | 49.81308 0 lineto 18 | 39.85046 17.2552 lineto 19 | closepath fill 20 | 0 1 0 setrgbcolor 21 | newpath 59.7757 0 moveto 22 | 79.70093 0 lineto 23 | 69.73831 17.2552 lineto 24 | closepath fill 25 | 0 0 1 setrgbcolor 26 | newpath 89.66354 0 moveto 27 | 109.58878 0 lineto 28 | 99.62616 17.2552 lineto 29 | closepath fill 30 | showpage 31 | %%EOF 32 | -------------------------------------------------------------------------------- /graph/letter-bus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-bus.pdf -------------------------------------------------------------------------------- /graph/letter-env.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-env.pdf -------------------------------------------------------------------------------- /graph/letter-fullmemo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-fullmemo.pdf -------------------------------------------------------------------------------- /graph/letter-memo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-memo.pdf -------------------------------------------------------------------------------- /graph/letter-pr.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-pr.pdf -------------------------------------------------------------------------------- /graph/letter-std.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/letter-std.pdf -------------------------------------------------------------------------------- /graph/line.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -2 141 22 3 | %%HiResBoundingBox: -0.39851 -1.4944 140.97102 21.41963 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinecap 11 | 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 39.85046 0 lineto 14 | 19.92523 19.92523 lineto 15 | 0 0 lineto stroke 16 | newpath 49.81308 0 moveto 17 | 89.66354 0 lineto 18 | 69.73831 19.92523 lineto 19 | closepath stroke 20 | newpath 101.12056 0 moveto 21 | 101.12056 0.39633 100.96312 0.77644 100.68286 1.0567 curveto 22 | 100.4026 1.33696 100.02249 1.4944 99.62616 1.4944 curveto 23 | 99.22983 1.4944 98.84972 1.33696 98.56946 1.0567 curveto 24 | 98.2892 0.77644 98.13176 0.39633 98.13176 0 curveto 25 | 98.13176 -0.39633 98.2892 -0.77644 98.56946 -1.0567 curveto 26 | 98.84972 -1.33696 99.22983 -1.4944 99.62616 -1.4944 curveto 27 | 100.02249 -1.4944 100.4026 -1.33696 100.68286 -1.0567 curveto 28 | 100.96312 -0.77644 101.12056 -0.39633 101.12056 0 curveto closepath fill 29 | newpath 140.97102 0 moveto 30 | 140.97102 0.39633 140.81358 0.77644 140.53333 1.0567 curveto 31 | 140.25307 1.33696 139.87296 1.4944 139.47662 1.4944 curveto 32 | 139.08029 1.4944 138.70018 1.33696 138.41992 1.0567 curveto 33 | 138.13966 0.77644 137.98222 0.39633 137.98222 0 curveto 34 | 137.98222 -0.39633 138.13966 -0.77644 138.41992 -1.0567 curveto 35 | 138.70018 -1.33696 139.08029 -1.4944 139.47662 -1.4944 curveto 36 | 139.87296 -1.4944 140.25307 -1.33696 140.53333 -1.0567 curveto 37 | 140.81358 -0.77644 140.97102 -0.39633 140.97102 0 curveto closepath fill 38 | newpath 121.04579 19.92523 moveto 39 | 121.04579 20.32156 120.88835 20.70168 120.6081 20.98193 curveto 40 | 120.32784 21.26219 119.94772 21.41963 119.55139 21.41963 curveto 41 | 119.15506 21.41963 118.77495 21.26219 118.49469 20.98193 curveto 42 | 118.21443 20.70168 118.05699 20.32156 118.05699 19.92523 curveto 43 | 118.05699 19.5289 118.21443 19.14879 118.49469 18.86853 curveto 44 | 118.77495 18.58827 119.15506 18.43083 119.55139 18.43083 curveto 45 | 119.94772 18.43083 120.32784 18.58827 120.6081 18.86853 curveto 46 | 120.88835 19.14879 121.04579 19.5289 121.04579 19.92523 curveto closepath fill 47 | showpage 48 | %%EOF 49 | -------------------------------------------------------------------------------- /graph/loop.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -2 -2 101 41 3 | %%HiResBoundingBox: -1.92923 -1.92911 100.02467 40.24898 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinecap 11 | 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 99.62616 0 lineto stroke 14 | newpath 95.93106 -1.5306 moveto 15 | 99.62616 0 lineto 16 | 95.93106 1.5306 lineto 17 | closepath 18 | gsave fill grestore stroke 19 | 0.79701 0 dtransform exch truncate exch idtransform pop setlinewidth 20 | newpath 0 0 moveto 21 | 0 39.85046 lineto stroke 22 | 0 0.79701 dtransform truncate idtransform setlinewidth pop 23 | newpath 1.53072 36.15506 moveto 24 | 0 39.85046 lineto 25 | -1.53072 36.15506 lineto 26 | closepath 27 | gsave fill grestore stroke 28 | newpath 0 0 moveto 29 | 2.66872 3.9146 6.04802 7.2939 9.96262 9.96262 curveto 30 | 18.7526 15.95508 29.4199 17.9544 39.85046 19.92523 curveto 31 | 56.48972 23.06918 73.09502 26.39024 89.66354 29.88785 curveto stroke 32 | showpage 33 | %%EOF 34 | -------------------------------------------------------------------------------- /graph/mini.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/mini.pdf -------------------------------------------------------------------------------- /graph/pgf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/pgf.pdf -------------------------------------------------------------------------------- /graph/predefined.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -11 -11 190 11 3 | %%HiResBoundingBox: -10.36113 -10.36113 189.68822 10.36113 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinejoin 11 | 10 setmiterlimit 12 | newpath 9.96262 0 moveto 13 | 9.96262 2.64236 8.91278 5.1762 7.0445 7.0445 curveto 14 | 5.1762 8.91278 2.64236 9.96262 0 9.96262 curveto 15 | -2.64236 9.96262 -5.1762 8.91278 -7.0445 7.0445 curveto 16 | -8.91278 5.1762 -9.96262 2.64236 -9.96262 0 curveto 17 | -9.96262 -2.64236 -8.91278 -5.1762 -7.0445 -7.0445 curveto 18 | -5.1762 -8.91278 -2.64236 -9.96262 0 -9.96262 curveto 19 | 2.64236 -9.96262 5.1762 -8.91278 7.0445 -7.0445 curveto 20 | 8.91278 -5.1762 9.96262 -2.64236 9.96262 0 curveto closepath stroke 21 | 1 setlinecap 22 | newpath 39.85046 0 moveto 23 | 39.85046 2.64236 38.80063 5.1762 36.93234 7.0445 curveto 24 | 35.06404 8.91278 32.53021 9.96262 29.88785 9.96262 curveto 25 | 27.24548 9.96262 24.71165 8.91278 22.84335 7.0445 curveto 26 | 20.97507 5.1762 19.92523 2.64236 19.92523 0 curveto stroke 27 | newpath 59.7757 0 moveto 28 | 59.7757 2.64236 58.72586 5.1762 56.85757 7.0445 curveto 29 | 54.98927 8.91278 52.45544 9.96262 49.81308 9.96262 curveto stroke 30 | newpath 109.58878 0 moveto 31 | 109.58878 2.64236 107.4891 5.1762 103.75252 7.0445 curveto 32 | 100.01593 8.91278 94.94827 9.96262 89.66354 9.96262 curveto 33 | 84.37881 9.96262 79.31116 8.91278 75.57457 7.0445 curveto 34 | 71.83798 5.1762 69.73831 2.64236 69.73831 0 curveto 35 | 69.73831 -2.64236 71.83798 -5.1762 75.57457 -7.0445 curveto 36 | 79.31116 -8.91278 84.37881 -9.96262 89.66354 -9.96262 curveto 37 | 94.94827 -9.96262 100.01593 -8.91278 103.75252 -7.0445 curveto 38 | 107.4891 -5.1762 109.58878 -2.64236 109.58878 0 curveto closepath stroke 39 | newpath 119.55139 -9.96262 moveto 40 | 139.47662 -9.96262 lineto 41 | 139.47662 9.96262 lineto 42 | 119.55139 9.96262 lineto 43 | closepath stroke 44 | newpath 149.43924 -9.96262 moveto 45 | 189.2897 -9.96262 lineto 46 | 189.2897 9.96262 lineto 47 | 149.43924 9.96262 lineto 48 | closepath stroke 49 | showpage 50 | %%EOF 51 | -------------------------------------------------------------------------------- /graph/pst.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/graph/pst.pdf -------------------------------------------------------------------------------- /graph/src/beamer-warsaw.tex: -------------------------------------------------------------------------------- 1 | \documentclass{beamer} 2 | \usetheme{Warsaw} 3 | 4 | \input{../src/lang} 5 | 6 | \begin{document} 7 | 8 | \begin{frame} 9 | \title{金刚般若波罗蜜经} 10 | \author{鸠摩罗什\ 译} 11 | \date{} 12 | \maketitle 13 | \end{frame} 14 | 15 | \frame{\tableofcontents} 16 | 17 | \section{最大之乘,最正之宗} 18 | \begin{frame}{最大之乘,最正之宗} 19 | 若菩萨有我相,人相,众生相,寿者相。即非菩萨。 20 | \end{frame} 21 | 22 | \section{自如之理,乃见真实} 23 | \begin{frame}{自如之理,乃见真实} 24 | \begin{block}{佛告须菩提} 25 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 26 | \end{block} 27 | \begin{alertblock}{佛告须菩提} 28 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 29 | \end{alertblock} 30 | \begin{exampleblock}{佛告须菩提} 31 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 32 | \end{exampleblock} 33 | \end{frame} 34 | 35 | \section{修无为福,胜于布施} 36 | \frame{\tableofcontents[currentsection]} 37 | \begin{frame}{修无为福,胜于布施} 38 | 如恒河中所有沙数,如是沙等恒河,于意云何?是诸恒河沙,宁为多不? 39 | \end{frame} 40 | 41 | \section{受持此经,功德无量} 42 | \begin{frame}{受持此经,功德无量} 43 | \begin{itemize} 44 | \item 初日分以恒河沙等身布施 45 | \pause 46 | \item 中日分复以恒河沙等身布施 47 | \pause 48 | \item 后日分亦以恒河沙等身布施 49 | \pause 50 | \item 如是无量百千万亿劫以身布施 51 | \end{itemize} 52 | \end{frame} 53 | 54 | \section{应现设化,亦非真实} 55 | \begin{frame}{应现设化,亦非真实} 56 | \transdissolve 57 | 一切有为法,如梦幻泡影,如露亦如电,应作如是观。 58 | \end{frame} 59 | 60 | \end{document} 61 | -------------------------------------------------------------------------------- /graph/src/beamer.tex: -------------------------------------------------------------------------------- 1 | \documentclass{beamer} 2 | %\usetheme{Copenhagen} 3 | 4 | \input{../src/lang} 5 | 6 | \begin{document} 7 | 8 | \begin{frame} 9 | \title{金刚般若波罗蜜经} 10 | \author{鸠摩罗什\ 译} 11 | \date{} 12 | \maketitle 13 | \end{frame} 14 | 15 | \frame{\tableofcontents} 16 | 17 | \section{最大之乘,最正之宗} 18 | \begin{frame}{最大之乘,最正之宗} 19 | 若菩萨有我相、人相、众生相、寿者相,即非菩萨。 20 | \end{frame} 21 | 22 | \section{自如之理,乃见真实} 23 | \begin{frame}{自如之理,乃见真实} 24 | \begin{block}{佛告须菩提} 25 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 26 | \end{block} 27 | \begin{alertblock}{佛告须菩提} 28 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 29 | \end{alertblock} 30 | \begin{exampleblock}{佛告须菩提} 31 | 凡所有相,皆是虚妄。若见诸相非相,则见如来。 32 | \end{exampleblock} 33 | \end{frame} 34 | 35 | \section{修无为福,胜于布施} 36 | \frame{\tableofcontents[currentsection]} 37 | \begin{frame}{修无为福,胜于布施} 38 | 如恒河中所有沙数,如是沙等恒河,于意云何?是诸恒河沙,宁为多不? 39 | \end{frame} 40 | 41 | \section{受持此经,功德无量} 42 | \begin{frame}{受持此经,功德无量} 43 | \begin{itemize} 44 | \item 初日分以恒河沙等身布施 45 | \pause 46 | \item 中日分复以恒河沙等身布施 47 | \pause 48 | \item 后日分亦以恒河沙等身布施 49 | \pause 50 | \item 如是无量百千万亿劫以身布施 51 | \end{itemize} 52 | \end{frame} 53 | 54 | \section{应现设化,亦非真实} 55 | \begin{frame}{应现设化,亦非真实} 56 | \transdissolve 57 | 一切有为法,如梦幻泡影,如露亦如电,应作如是观。 58 | \end{frame} 59 | 60 | \end{document} 61 | -------------------------------------------------------------------------------- /graph/src/cv-banking.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt, a4paper]{moderncv} 2 | 3 | \moderncvstyle{banking} 4 | \moderncvcolor{orange} 5 | 6 | \input{cv-base} 7 | -------------------------------------------------------------------------------- /graph/src/cv-base.tex: -------------------------------------------------------------------------------- 1 | \input{../src/lang} 2 | 3 | \usepackage[scale=0.8]{geometry} 4 | 5 | %\firstname{John} 6 | \familyname{包太雷} 7 | \title{雷坛巨擘} 8 | \photo[48pt][0.4pt]{picture} 9 | \quote{一个雷人的传说} 10 | 11 | \address{北京 100081}{白石桥路7号} 12 | \mobile{+86 1381-666-1643} 13 | \phone{+86 (010) 6279-3001} 14 | \fax{+86 (010) 6841-6688} 15 | \email{bao@verilei.com} 16 | \homepage{www.verilei.com} 17 | \extrainfo{午休时间谢绝来电} 18 | 19 | \begin{document} 20 | \makecvtitle 21 | 22 | \section{教育背景} 23 | \cventry{1927--1936}{烈士(工商管理)}{巴灵顿大学}{}{}{} 24 | \cventry{1921--1927}{勇士(比较文学)}{克莱登大学}{}{}{} 25 | \cventry{1919--1921}{壮士(分子生物)}{卧龙岗大学}{}{}{} 26 | \cventry{1911--1919}{博士(有机化学)}{清华学堂}{}{}{} 27 | \cventry{1898--1900}{硕士(天体物理)}{京师大学堂}{}{}{} 28 | \cventry{1895--1898}{学士(应用数学)}{北洋大学}{}{}{} 29 | 30 | \section{壮士出站报告} 31 | \cvitem{题目}{\emph{马尾巴的功能}} 32 | \cvitem{导师}{达文西} 33 | \cvitem{摘要}{创造性地结合白马非马论和DNA双螺旋结构,系统性地分析了马尾巴的功能。} 34 | 35 | \section{工作经历} 36 | \subsection{全职工作} 37 | \cventry{1936--1937}{首席咨询顾问}{北美某大型财务公司}{埃德蒙顿}{}{ 38 | \begin{itemize} 39 | \item 调研和设计新产品:宠物意外怀孕保险 40 | \item 利用业余时间引进和培训多名新员工 41 | \item 按时并超额完成人寿保险推销计划 42 | \end{itemize}} 43 | \cventry{1906--1911}{高级技师}{欧罗巴天体实验中心}{罗马}{}{浩瀚的宇宙,无边的探索} 44 | \cventry{1901--1906}{技师}{希腊天体营}{雅典}{}{摆脱束缚,解放自我} 45 | 46 | \subsection{兼职工作} 47 | \cventry{1937--1945}{独立董事}{大圣国际娱乐有限公司}{温尼伯}{}{领衔测试新上市游戏} 48 | \cventry{1914--1916}{高级实验员}{某餐饮连锁企业加盟店}{北京}{}{主导研制麻辣烫高仿牛羊肉纯天然调味品} 49 | \cventry{1898--1899}{图书管理员}{京师大学堂藏经阁}{北京}{}{读书破万卷} 50 | 51 | \section{语言} 52 | \cvitemwithcomment{汉语}{多年来在国际著名电子公告板系统发表原创性学术论文上万篇}{专家} 53 | \cvitemwithcomment{英语}{大量成果登上杂志封面,并被学术带头人牛奶海引用}{熟练} 54 | \cvitemwithcomment{德语}{已通过德意志语言四、六级考试}{入门} 55 | 56 | \section{电脑技术} 57 | \cvdoubleitem{通用语言}{C, C++, C\#}{操作系统}{MacOS, Unix, Windows} 58 | \cvdoubleitem{脚本语言}{JavaScript, Python, Ruby}{数据库}{FoxPro, MySQL, Oracle} 59 | \cvdoubleitem{标记语言}{HTML, \LaTeX, XML}{NoSQL}{Cassandra, HBase, MongoDB} 60 | 61 | \section{荣誉称号} 62 | \cvlistitem{二级中老年妇女心理咨询师} 63 | \cvlistitem{崂山学者(副处级待遇)} 64 | \cvlistitem{县级三好学生} 65 | 66 | \section{业余爱好} 67 | \cvlistdoubleitem{搬砖砌墙}{挖坑灌水} 68 | \cvlistdoubleitem{割草喂猪}{吟诗作画} 69 | 70 | \end{document} 71 | -------------------------------------------------------------------------------- /graph/src/cv-casual.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt, a4paper]{moderncv} 2 | 3 | \moderncvstyle{casual} 4 | \moderncvcolor{blue} 5 | 6 | \input{cv-base} 7 | -------------------------------------------------------------------------------- /graph/src/cv-classic.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt, a4paper]{moderncv} 2 | 3 | \moderncvstyle{classic} 4 | \moderncvcolor{green} 5 | 6 | \input{cv-base} 7 | -------------------------------------------------------------------------------- /graph/src/cv-old.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt, a4paper]{moderncv} 2 | 3 | \moderncvstyle{oldstyle} 4 | \moderncvcolor{grey} 5 | 6 | \input{cv-base} 7 | -------------------------------------------------------------------------------- /graph/src/fig.mp: -------------------------------------------------------------------------------- 1 | u := 10pt; 2 | 3 | outputtemplate := "line.mps"; 4 | beginfig(1); 5 | draw (0,0)--(4u,0)--(2u,2u)--(0,0) withpen pencircle scaled .8pt; 6 | pickup pencircle scaled .8pt; 7 | draw (5u,0)--(9u,0)--(7u,2u)--cycle; 8 | pickup pencircle scaled 3pt; 9 | drawdot (10u,0); 10 | drawdot (14u,0); 11 | drawdot (12u,2u); 12 | endfig; 13 | 14 | outputtemplate := "predefined.mps"; 15 | beginfig(2); 16 | pickup pencircle scaled .8pt; 17 | draw fullcircle scaled 2u; 18 | draw halfcircle scaled 2u shifted (3u,0); 19 | draw quartercircle scaled 2u shifted (5u,0); 20 | draw fullcircle xscaled 4u yscaled 2u shifted (9u,0); 21 | draw unitsquare scaled 2u shifted (12u,-u); 22 | draw unitsquare xscaled 4u yscaled 2u shifted (15u,-u); 23 | endfig; 24 | 25 | outputtemplate := "curve.mps"; 26 | beginfig(3); 27 | pickup pencircle scaled .8pt; 28 | draw (0,0)..(4u,1u)..(8u,0); 29 | draw (9u,0){up}..(13u,1u){right}..(17u,0){down}; 30 | draw (18u,0){up}...(22u,1u){right}...(26u,0){down}; 31 | draw (0,2u)..(2u,3u)..(6u,3u)..(8u,2u); 32 | draw (9u,2u)..(11u,3u)..tension 1.5..(15u,3u)..(17u,2u); 33 | draw (18u,2u)..(20u,3u)..tension 1.5 and 1..(24u,3u)..(26u,2u); 34 | draw (0,4u)..(4u,5u)..(8u,4u); 35 | draw (9u,4u){curl 0}..(13u,5u)..{curl 0}(17u,4u); 36 | draw (18u,4u){curl 100}..(22u,5u)..{curl 100}(26u,4u); 37 | pickup pencircle scaled 3pt; 38 | drawdot (0,0); drawdot (4u,1u); drawdot (8u,0); 39 | drawdot (9u,0); drawdot (13u,1u); drawdot (17u,0); 40 | drawdot (18u,0); drawdot (22u,1u); drawdot (26u,0); 41 | drawdot (0,2u); drawdot (2u,3u); drawdot (6u,3u); drawdot (8u,2u); 42 | drawdot (9u,2u); drawdot (11u,3u); drawdot (15u,3u); drawdot (17u,2u); 43 | drawdot (18u,2u); drawdot (20u,3u); drawdot (24u,3u); drawdot (26u,2u); 44 | drawdot (0,4u); drawdot (4u,5u); drawdot (8u,4u); 45 | drawdot (9u,4u); drawdot (13u,5u); drawdot (17u,4u); 46 | drawdot (18u,4u); drawdot (22u,5u); drawdot (26u,4u); 47 | endfig; 48 | 49 | outputtemplate := "dashed.mps"; 50 | beginfig(4); 51 | pickup pencircle scaled .8pt; 52 | draw (0,0)--(10u,0) dashed withdots; 53 | draw (0,1u)--(10u,1u) dashed withdots scaled 2; 54 | draw (0,2u)--(10u,2u) dashed evenly; 55 | draw (0,3u)--(10u,3u) dashed evenly scaled 2; 56 | endfig; 57 | 58 | outputtemplate := "arrow.mps"; 59 | beginfig(5); 60 | pickup pencircle scaled .8pt; 61 | drawarrow (0,0)--(10u,0); 62 | drawarrow reverse ((0,1u)--(10u,1u)); 63 | drawdblarrow (0,2u)--(10u,2u); 64 | endfig; 65 | 66 | outputtemplate := "color.mps"; 67 | beginfig(6); 68 | pickup pencircle scaled .8pt; 69 | draw (0,0)--(10u,0) withcolor red; 70 | draw (0,1u)--(10u,1u) withcolor green; 71 | draw (0,2u)--(10u,2u) withcolor blue; 72 | endfig; 73 | 74 | outputtemplate := "fill.mps"; 75 | beginfig(7) 76 | path p; 77 | p := (0,0)--(2,0)--(1,1.732)--cycle; 78 | fill p scaled u; 79 | fill p scaled u shifted (3u,0) withcolor red; 80 | fill p scaled u shifted (6u,0) withcolor green; 81 | fill p scaled u shifted (9u,0) withcolor blue; 82 | endfig; 83 | 84 | outputtemplate := "transform.mps"; 85 | beginfig(8); 86 | pickup pencircle scaled .8pt; 87 | draw p scaled u; 88 | draw p scaled u shifted (3u,0) rotated 30; 89 | draw p scaled u rotated 30 shifted (5u,0); 90 | draw p scaled u rotatedaround ((2u,0),30) shifted (7u,0) ; 91 | draw p scaled u slanted 1 shifted (10u,0); 92 | draw p scaled u reflectedabout ((0,0),(2u,0)) shifted (13u,0); 93 | draw p xscaled 2u yscaled u shifted (16u,0); 94 | endfig; 95 | 96 | outputtemplate := "loop.mps"; 97 | beginfig(10); 98 | pickup pencircle scaled .8pt; 99 | drawarrow (0,0)--(10u,0); 100 | drawarrow (0,0)--(0,4u); 101 | draw (0,0) %注意这里没有分号 102 | for x=1 upto 3: 103 | ..(x*x,x)*u 104 | endfor; 105 | endfig; 106 | 107 | prologues:=3; 108 | outputtemplate := "label.mps"; 109 | beginfig(9); 110 | pickup pencircle scaled .8pt; 111 | draw unitsquare xscaled 8u yscaled 4u; 112 | label.top ("top", (4u,4u)); 113 | label.bot ("bottom", (4u,0)); 114 | label.lft ("left", (0,2u)); 115 | label.rt ("right", (8u,2u)); 116 | label.ulft ("upper left", (0,4u)); 117 | label.urt ("upper right", (8u,4u)); 118 | label.llft ("lower left", (0,0)); 119 | label.lrt ("lower right", (8u,0)); 120 | label.rt (btex $E=mc^2$ etex, (2u,2u)); 121 | drawarrow (16u,0)--(22u,0); 122 | drawarrow (16u,0)--(16u,4u); 123 | dotlabel.bot ("(0,0)", (16u,0)); 124 | label.bot (btex $x$ etex, (22u,0)); 125 | label.lft (btex $y$ etex, (16u,4u)); 126 | endfig; 127 | 128 | end 129 | -------------------------------------------------------------------------------- /graph/src/letter-bus.tex: -------------------------------------------------------------------------------- 1 | \documentclass[busletter]{newlfm} 2 | 3 | \nameto{Cousin Muscles} 4 | \addrto{Hogan's Alley} 5 | \namefrom{Jerry Mouse} 6 | \addrfrom{Jerry's Hole} 7 | 8 | \begin{document} 9 | \greetto{Dear Cousin Muscles,} 10 | \closeline{Sincerely yours,} 11 | 12 | \begin{newlfm} 13 | Am having serious trouble with Tom. Need your help at once. 14 | \end{newlfm} 15 | \end{document} 16 | -------------------------------------------------------------------------------- /graph/src/letter-env.tex: -------------------------------------------------------------------------------- 1 | \documentclass[12pt]{letter} 2 | \usepackage[businessenvelope]{envlab} 3 | \usepackage[papersize={4.125in, 9.5in}]{geometry} 4 | 5 | \begin{document} 6 | \startlabels 7 | \mlabel{Jerry Mouse\\Jerry's Hole}{% 8 | Cousin Muscles\\Hogan's Alley} 9 | \end{document} 10 | -------------------------------------------------------------------------------- /graph/src/letter-fullmemo.tex: -------------------------------------------------------------------------------- 1 | \documentclass[fullmemo]{newlfm} 2 | 3 | \nameto{Cousin Muscles} 4 | \addrto{Hogan's Alley} 5 | \namefrom{Jerry Mouse} 6 | \addrfrom{Mousehole} 7 | 8 | \begin{document} 9 | \greetto{Dear Cousin Muscles,} 10 | \closeline{Sincerely yours,} 11 | 12 | \begin{newlfm} 13 | Am having serious trouble with Tom. Need your help at once. 14 | \end{newlfm} 15 | \end{document} 16 | -------------------------------------------------------------------------------- /graph/src/letter-memo.tex: -------------------------------------------------------------------------------- 1 | \documentclass[stdmemo]{newlfm} 2 | 3 | \nameto{Cousin Muscles} 4 | \addrto{Hogan's Alley} 5 | \namefrom{Jerry Mouse} 6 | \addrfrom{Jerry's Hole} 7 | 8 | \begin{document} 9 | \greetto{Dear Cousin Muscles,} 10 | \closeline{Sincerely yours,} 11 | 12 | \begin{newlfm} 13 | Am having serious trouble with Tom. Need your help at once. 14 | \end{newlfm} 15 | \end{document} 16 | -------------------------------------------------------------------------------- /graph/src/letter-pr.tex: -------------------------------------------------------------------------------- 1 | \documentclass[pressrelease]{newlfm} 2 | 3 | \nameto{Cousin Muscles} 4 | \addrto{Hogan's Alley} 5 | \namefrom{Jerry Mouse} 6 | \addrfrom{Mousehole} 7 | 8 | \begin{document} 9 | \closeline{Sincerely yours,} \greetto{Dear Cousin Muscles,} 10 | 11 | \begin{newlfm} 12 | Am having serious trouble with Tom. Need your help at once. 13 | \end{newlfm} 14 | \end{document} 15 | -------------------------------------------------------------------------------- /graph/src/letter-std.tex: -------------------------------------------------------------------------------- 1 | \documentclass[stdletter]{newlfm} 2 | 3 | \nameto{Cousin Muscles} 4 | \addrto{Hogan's Alley} 5 | \namefrom{Jerry Mouse} 6 | \addrfrom{Jerry's Hole} 7 | 8 | \begin{document} 9 | \greetto{Dear Cousin Muscles,} 10 | \closeline{Sincerely yours,} 11 | \signature{J.} 12 | 13 | \begin{newlfm} 14 | Am having serious trouble with Tom. Need your help at once. 15 | \end{newlfm} 16 | \end{document} 17 | -------------------------------------------------------------------------------- /graph/src/mini.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt]{article} 2 | 3 | \input{../src/lang} 4 | 5 | \usepackage{simpsons} 6 | \usepackage{igo} 7 | 8 | %\usepackage{graphicx} 9 | \usepackage[percent]{overpic} 10 | \usepackage[active,tightpage]{preview} 11 | 12 | \begin{document} 13 | 14 | \begin{preview} 15 | \Homer 16 | \end{preview} 17 | 18 | \begin{preview} 19 | \begin{overpic}[scale=.3]{../../img/leftfoot.png} 20 | \put(21,54){\textit{清}} 21 | \put(6,24){\textit{明}} 22 | \end{overpic} 23 | \end{preview} 24 | 25 | \begin{preview} 26 | \begin{overpic}[scale=.3]{../../img/rightfoot.png} 27 | \put(31,54){\textit{反}} 28 | \put(44,24){\textit{复}} 29 | \end{overpic} 30 | \end{preview} 31 | 32 | \begin{preview} 33 | \title{雷人的传说} 34 | \author{包太雷$^*$\quad 包巨雷$^\dagger$\quad 包最雷$^\ddagger$\\[10pt] 35 | $*$Barrington University, Burlington, VT\\ 36 | $\dagger$Pacific Western University, San Diego, CA\\ 37 | $\ddagger$Preston University, Los Angeles, CA} 38 | \date{2011年1月11日} 39 | \maketitle 40 | \end{preview} 41 | 42 | \begin{preview} 43 | \black{d4,f3,c4,e3,b4,f2} 44 | \white{c3,d3,b3,e2,d1} 45 | \black[1]{a3,a2,b1} 46 | \copytogoban{2} 47 | \white[4]{c2,f1} 48 | \showgoban 49 | \quad 50 | \usegoban{2} 51 | \white[4]{c1,f1,b2,d2} 52 | \showgoban 53 | \end{preview} 54 | 55 | \end{document} 56 | -------------------------------------------------------------------------------- /graph/src/pgf.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt]{article} 2 | %\pdfminorversion=4 3 | 4 | \usepackage[active,tightpage]{preview} 5 | \usepackage[svgnames]{xcolor} % put before tikz 6 | %\def\pgfsysdriver{pgfsys-xetex.def} % put before tikz 7 | \usepackage{tikz} 8 | 9 | \usetikzlibrary{arrows,backgrounds,calc,decorations,patterns,positioning,shapes.geometric,through} 10 | \pgfsetxvec{\pgfpoint{10pt}{0}} 11 | \pgfsetyvec{\pgfpoint{0}{10pt}} 12 | \tikzset{ 13 | every picture/.style={line width=.8pt}, 14 | box/.style={rectangle, rounded corners=5pt, 15 | minimum width=50pt, minimum height=20pt, inner sep=5pt, 16 | draw=Silver,thick, fill=Lavender}, 17 | arrow/.style={->, shorten <=1pt, shorten >=1pt, >=stealth'}, 18 | larrow/.style={<-, shorten <=1pt, shorten >=1pt, >=stealth'}, 19 | bloop/.style={to path={-- ++(0,-35pt) -| (\tikztotarget)}}, 20 | rloop/.style={to path={-- ++(10pt,0) |- (\tikztotarget)}} 21 | } 22 | 23 | \begin{document} 24 | 25 | \begin{preview} % compile 26 | \begin{tikzpicture} 27 | \node[box] (tex) {.tex}; 28 | \node[box, right=19 of tex] (pdf) {.pdf}; 29 | \node[box, above=3 of pdf] (ps) {.ps}; 30 | \node[box, left=7 of ps] (dvi) {.dvi}; 31 | \path (tex.north) edge[arrow] node[above,sloped] {latex} (dvi.west) 32 | (dvi) edge[arrow] node[auto] {dvips} (ps) 33 | (dvi.east) edge[arrow] node[above,sloped] {dvipdfmx} (pdf.west) 34 | (ps) edge[arrow] node[right] {ps2pdf} (pdf) 35 | (tex) edge[arrow] node[auto] {xelatex} (pdf) 36 | (tex) edge[arrow,bloop] (pdf); 37 | \node[below=6 of dvi] {pdflatex}; 38 | \end{tikzpicture} 39 | \end{preview} 40 | 41 | \begin{preview} % RGB 42 | \begin{tikzpicture}[background rectangle/.style={fill=black}, show background rectangle] 43 | \coordinate (G) at (0,0);% point green 44 | \coordinate (B) at (4,0);% point blue 45 | \node[circle through=(B), fill, green] (CG) at (G) {};% circle green 46 | \node[circle through=(G), fill, blue] (CB) at (B) {};% circle blue 47 | \coordinate (R) at (intersection 2 of CG and CB);% point red 48 | \node[circle through=(G), fill, red] (CR) at (R) {};% circle red 49 | \coordinate (Y) at (intersection 1 of CR and CG);% point yellow 50 | \coordinate (C) at (intersection 1 of CG and CB);% point cyan 51 | \coordinate (M) at (intersection 1 of CB and CR);% point magenta 52 | \fill[Yellow] (R) arc (60:120:4) arc (180:240:4) arc (180:120:4); 53 | \fill[Cyan] (G) arc (180:240:4) arc (300:360:4) arc (300:240:4); 54 | \fill[Magenta] (B) arc (300:360:4) arc (60:120:4) arc (60:0:4); 55 | \fill[White] (R) arc (120:180:4) arc (240:300:4) arc (0:60:4); 56 | \end{tikzpicture} 57 | \end{preview} 58 | 59 | \begin{preview} % CMYK 60 | \begin{tikzpicture}[background rectangle/.style={draw=Silver, fill=white}, show background rectangle] 61 | \coordinate (M) at (0,0);% point magenta 62 | \coordinate (Y) at (4,0);% point yellow 63 | \node[circle through=(Y), fill, Magenta] (CM) at (M) {};% circle magenta 64 | \node[circle through=(M), fill, Yellow] (CY) at (Y) {};% circle yellow 65 | \coordinate (C) at (intersection 2 of CM and CY);% point cyan 66 | \node[circle through=(M), fill, Cyan] (CC) at (C) {};% circle cyan 67 | \coordinate (B) at (intersection 1 of CC and CM);% point blue 68 | \coordinate (R) at (intersection 1 of CM and CY);% point red 69 | \coordinate (G) at (intersection 1 of CY and CC);% point green 70 | \fill[blue] (C) arc (60:120:4) arc (180:240:4) arc (180:120:4); 71 | \fill[red] (M) arc (180:240:4) arc (300:360:4) arc (300:240:4); 72 | \fill[green] (Y) arc (300:360:4) arc (60:120:4) arc (60:0:4); 73 | \fill[Black] (C) arc (120:180:4) arc (240:300:4) arc (0:60:4); 74 | \end{tikzpicture} 75 | \end{preview} 76 | 77 | \begin{preview} % line & rectangle 78 | \begin{tikzpicture} 79 | \draw (0,0)--(4,0)--(2,2)--(0,0); 80 | \draw (5,0)--(9,0)--(7,2)--cycle; 81 | \draw[rounded corners] (10,0)--(14,0)--(12,2)--cycle; 82 | \draw (15,0) rectangle (19,2); 83 | \draw[rounded corners] (20,0) rectangle (24,2); 84 | \end{tikzpicture} 85 | \end{preview} 86 | 87 | \begin{preview} % circle 88 | \begin{tikzpicture} 89 | \draw (1,1) circle (1); 90 | \draw (5,1) ellipse (2 and 1); 91 | \draw (10,1) arc (0:270:1); 92 | \draw (15,1) arc (0:270:2 and 1); 93 | \end{tikzpicture} 94 | \end{preview} 95 | 96 | \begin{preview} % curve 97 | \begin{tikzpicture} 98 | \draw (0,0)..controls (2,2) and (4,2)..(4,0); 99 | \filldraw (0,0) circle (.1) 100 | (2,2) circle (.1) 101 | (4,2) circle (.1) 102 | (4,0) circle (.1); 103 | \draw (5,1) parabola bend (6,0) (7.414,2); 104 | \filldraw (5,1) circle (.1) 105 | (6,0) circle (.1) 106 | (7.414,2) circle (.1); 107 | \draw (8,0) sin (10,2) cos (12,0); 108 | \filldraw (8,0) circle(.1) 109 | (10,2) circle(.1) 110 | (12,0) circle(.1); 111 | \end{tikzpicture} 112 | \end{preview} 113 | 114 | \begin{preview} % grid 115 | \begin{tikzpicture} 116 | \draw[step=5pt] (0,0) grid (3,2); 117 | \draw[help lines,step=5pt] (4,0) grid (7,2); 118 | \end{tikzpicture} 119 | \end{preview} 120 | 121 | \begin{preview} % line width & type 122 | \begin{tikzpicture} 123 | \draw[line width=2pt] (0,0)--(9,0); 124 | \draw[dotted] (0,1)--(9,1); 125 | \draw[densely dotted] (0,2)--(9,2); 126 | \draw[loosely dotted] (0,3)--(9,3); 127 | \draw[dashed] (0,4)--(9,4); 128 | \draw[densely dashed] (0,5)--(9,5); 129 | \draw[loosely dashed] (0,6)--(9,6); 130 | \end{tikzpicture} 131 | \end{preview} 132 | 133 | \begin{preview} % arrow 134 | \begin{tikzpicture} 135 | \draw[white] (0,-0.2)--(1,-0.2); 136 | \draw[->] (0,0)--(9,0); 137 | \draw[<-] (0,1)--(9,1); 138 | \draw[<->] (0,2)--(9,2); 139 | \draw[>->>] (0,3)--(9,3); 140 | \draw[|<->|] (0,4)--(9,4); 141 | \draw[white] (0,4.4)--(1,4.4); 142 | \end{tikzpicture} 143 | \end{preview} 144 | 145 | \begin{preview} % color & fill 146 | \begin{tikzpicture} 147 | \draw[Red] (0,0)--(9,0); 148 | \draw[Green] (0,1)--(9,1); 149 | \draw[Blue] (0,2)--(9,2); 150 | \fill[Wheat] (11,1) circle (1); 151 | \filldraw[draw=Silver, fill=Lavender] (14,1) circle (1); 152 | \end{tikzpicture} 153 | \end{preview} 154 | 155 | \begin{preview} % pattern 156 | \begin{tikzpicture} 157 | \draw[pattern=dots] (1,1) circle (1); 158 | \draw[pattern=horizontal lines] (4,1) circle (1); 159 | \draw[pattern=vertical lines] (7,1) circle (1); 160 | \draw[pattern=north east lines] (10,1) circle (1); 161 | \draw[pattern=crosshatch] (13,1) circle (1); 162 | \draw[pattern=fivepointed stars] (16,1) circle (1); 163 | \draw[pattern=bricks] (19,1) circle (1); 164 | \draw[pattern=checkerboard] (22,1) circle (1); 165 | \end{tikzpicture} 166 | \end{preview} 167 | 168 | \begin{preview} % shading 169 | \begin{tikzpicture} 170 | \shade (0,0) rectangle (2,2); 171 | \shade[left color=Red,right color=Orange] (3,0) rectangle (5,2); 172 | \shade[inner color=Red,outer color=Orange] (6,0) rectangle (8,2); 173 | \shade[ball color=Blue] (10,1) circle (1); 174 | \end{tikzpicture} 175 | \end{preview} 176 | 177 | \begin{preview} % style 178 | \tikzset{ 179 | myline/.style={line width=2pt}, 180 | myblueline/.style={myline,Blue} 181 | } 182 | \begin{tikzpicture} 183 | \draw[myline] (0,0)--(9,0); 184 | \draw[myblueline] (0,1)--(9,1); 185 | \end{tikzpicture} 186 | \end{preview} 187 | 188 | \begin{preview} % transform 189 | \begin{tikzpicture} 190 | \draw (0,0) rectangle (2,2); 191 | \draw[shift={(3,0)},scale=1.5] (0,0) rectangle (2,2); 192 | \draw[xshift=70pt,xscale=1.5] (0,0) rectangle (2,2); 193 | \draw[xshift=125pt,rotate=45] (0,0) rectangle (2,2); 194 | \draw[xshift=140pt,xslant=1] (0,0) rectangle (2,2); 195 | \draw[xshift=175pt,rotate around={45:(2,2)}] (0,0) rectangle (2,2); 196 | \end{tikzpicture} 197 | \end{preview} 198 | 199 | \begin{preview} % flowchart 200 | \begin{tikzpicture} 201 | \node[box] (tex) at(0,0) {.tex}; 202 | \node[box] (xdv) at(12,0) {.xdv}; 203 | \node[box] (pdf) at(24,0) {.pdf}; 204 | \draw[->] (tex)--(xdv); 205 | \draw[->] (xdv)--(pdf); 206 | \node at (6,1) {xelatex}; 207 | \node at (18,1) {dvipdfmx}; 208 | \end{tikzpicture} 209 | \end{preview} 210 | 211 | \begin{preview} % better flowchart 212 | \begin{tikzpicture} 213 | \node[box] (tex) {.tex}; 214 | \node[box,right=7 of tex] (xdv) {.xdv}; 215 | \node[box,right=7 of xdv] (pdf) {.pdf}; 216 | \path (tex) edge[->] node[auto] {xelatex} (xdv) 217 | (xdv) edge[->] node[auto] {xdvipdfmx} (pdf); 218 | \end{tikzpicture} 219 | \end{preview} 220 | 221 | \begin{preview} % tree 222 | \begin{tikzpicture}[sibling distance=80pt] 223 | \node[box] {TeX} 224 | child {node[box] {Plain\TeX}} 225 | child {node[box] {\LaTeX} 226 | child {node[box] {amsmath}} 227 | child {node[box] {graphicx}} 228 | child {node[box] {hyperref}} 229 | }; 230 | \end{tikzpicture} 231 | \end{preview} 232 | 233 | \begin{preview} % shape 234 | \begin{tikzpicture} 235 | \node[diamond,draw] at(0,0) {}; 236 | \node[trapezium,draw] at(2,0) {}; 237 | \node[semicircle,draw] at(4,0) {}; 238 | \node[star,draw] at(6,0) {}; 239 | \node[isosceles triangle,draw] at(8,0) {}; 240 | \node[circular sector,draw] at(10,0) {}; 241 | \node[cylinder,draw] at(12,0) {}; 242 | cylinder 243 | \end{tikzpicture} 244 | \end{preview} 245 | 246 | \begin{preview} % polygon 247 | \begin{tikzpicture}[every node/.style={regular polygon}] 248 | \node[regular polygon sides=3,draw] at(2,0) {}; 249 | \node[regular polygon sides=4,draw] at(4,0) {}; 250 | \node[regular polygon sides=5,draw] at(6,0) {}; 251 | \node[regular polygon sides=6,draw] at(8,0) {}; 252 | \node[regular polygon sides=7,draw] at(10,0) {}; 253 | \node[regular polygon sides=8,draw] at(12,0) {}; 254 | \end{tikzpicture} 255 | \end{preview} 256 | 257 | \begin{preview} % loop 258 | \begin{tikzpicture}[every node/.style={regular polygon}] 259 | \foreach \x in {3,4,5,6,7,8}{ 260 | \node[regular polygon sides=\x, draw] at(\x*2,0) {}; 261 | } 262 | \end{tikzpicture} 263 | \end{preview} 264 | 265 | \begin{preview} % plot 266 | \begin{tikzpicture} 267 | \draw[->] (-0.2,0)--(6,0) node[right] {$x$}; 268 | \draw[->] (0,-0.2)--(0,6) node[above] {$f(x)$}; 269 | \draw[domain=0:4] plot (\x,{0.1*exp(\x)}) node[right] {$f(x)=\frac{1}{10}e^x$}; 270 | \end{tikzpicture} 271 | \end{preview} 272 | 273 | \begin{preview} % bibtex 274 | \begin{tikzpicture} 275 | \node[box] (tex) {.tex}; 276 | \node[box, right=6 of tex] (aux) {.aux}; 277 | \node[box, right=7 of aux] (bbl) {.bbl}; 278 | \node[box, above=1.5 of aux] (bib) {.bib}; 279 | \node[box, below=1.5 of aux] (bst) {.bst}; 280 | \path (tex) edge [arrow] node[auto] {xelatex} (aux) 281 | (aux) edge [arrow] node[auto] {bibtex} (bbl) 282 | (bib.east) edge [rloop] (bst); 283 | \end{tikzpicture} 284 | \end{preview} 285 | 286 | \begin{preview} % index 287 | \begin{tikzpicture} 288 | \node[box] (tex) {.tex}; 289 | \node[box, right=4.2 of tex] (idx) {.idx}; 290 | \node[box, right=5.6 of idx] (ind) {.ind}; 291 | \node[box, right=6 of ind] (pdf) {.pdf}; 292 | \node[box, above=1.5 of ind] (tex1) {.tex}; 293 | \node[right=1 of ind] (point) {}; 294 | \path (tex) edge [arrow] node[auto] {xelatex} (idx) 295 | (idx) edge [arrow] node[auto] {makeindex} (ind) 296 | (ind) edge [arrow] node[auto] {xelatex} (pdf) 297 | (tex1.east) edge [rloop] (point); 298 | \end{tikzpicture} 299 | \end{preview} 300 | 301 | \begin{preview} % page layout 302 | \scriptsize 303 | \pgfsetxvec{\pgfpoint{.54pt}{0}} 304 | \pgfsetyvec{\pgfpoint{0}{.54pt}} 305 | \begin{tikzpicture}[ 306 | cir/.style={draw,circle,thin,minimum width=10pt,inner sep=0pt}, 307 | cira/.style={cir,above=3pt}, 308 | cirr/.style={cir,right=3pt} 309 | ] 310 | \draw (0,0) rectangle (597,845); %paper 597x845 311 | \draw[dashed] (0,773)--(597,773); %1in 312 | \draw[dashed] (72,0)--(72,845); %1in 313 | \draw (118,755) rectangle (478,743);%header 360x12 314 | \node at(228,749) {Header}; 315 | \draw (118,718) rectangle (478,122);%body 360x596 316 | \node at(228,420) {Body}; 317 | \draw (118,104) rectangle (478,92); %footer 360x12 318 | \node at(228,98) {Footer}; 319 | \path (0,522) edge[<->,thin] node[cira] {1} (72,522) 320 | (72,522) edge[<->,thin] node[cira] {2} (118,522) 321 | (118,522) edge[<->,thin] node[cira] {3} (478,522) 322 | (478,522) edge[<->,thin] node[cira] {4} (597,522); 323 | \path (369,845) edge[<->,thin] node[cirr] {5} (369,773) 324 | (369,743) edge[<->,thin] node[cirr] {8} (369,718) 325 | (369,718) edge[<->,thin] node[cirr] {9} (369,122) 326 | (369,92) edge[<->,thin] node[cirr] {11} (369,0); 327 | \path node[cira] at(309,793) {6} 328 | (309,793) edge[->,thin] (309,773) 329 | (309,755) edge[<-,thin] (309,735); 330 | \path node[cira] at(429,775) {7} 331 | (429,775) edge[->,thin] (429,755) 332 | (429,743) edge[<-,thin] (429,723); 333 | \path node[cira] at(429,142) {10} 334 | (429,142) edge[->,thin] (429,122) 335 | (429,92) edge[<-,thin] (429,72); 336 | \end{tikzpicture} 337 | \normalsize 338 | \pgfsetxvec{\pgfpoint{10pt}{0}} 339 | \pgfsetyvec{\pgfpoint{0}{10pt}} 340 | \end{preview} 341 | 342 | 343 | \end{document} 344 | -------------------------------------------------------------------------------- /graph/src/pst.tex: -------------------------------------------------------------------------------- 1 | %initexmf --edit-config-file dvipdfmx 2 | 3 | \documentclass[11pt]{article} 4 | \usepackage[active,tightpage]{preview} 5 | \usepackage[svgnames]{xcolor}% put before pstricks 6 | \usepackage{pstricks,pst-plot} 7 | \psset{unit=10pt} 8 | 9 | \begin{document} 10 | 11 | \begin{preview}% dot & line 12 | \begin{pspicture}(-.2,-.2)(14,2.2) 13 | \psdot(0,0) 14 | \psdots(4,0)(2,2) 15 | \psline(5,0)(7,2)(9,0) 16 | \psline[linearc=.3](10,0)(12,2)(14,0) 17 | \end{pspicture} 18 | \end{preview} 19 | 20 | \begin{preview}% frame & polygon 21 | \begin{pspicture}(19,2) 22 | \psframe(0,0)(4,2) 23 | \psframe[framearc=.3](5,0)(9,2) 24 | \pspolygon(10,0)(14,0)(12,2) 25 | \pspolygon[linearc=.3](15,0)(19,0)(17,2) 26 | \end{pspicture} 27 | \end{preview} 28 | 29 | \begin{preview}% circle, ellipse, arc, wedge 30 | \begin{pspicture}(19,2) 31 | \pscircle(1,1){1} 32 | \psellipse(5,1)(2,1) 33 | \psarc(9,0){2}{0}{120} 34 | \psarcn(13,0){2}{120}{0} 35 | \pswedge(17,0){2}{0}{120} 36 | \end{pspicture} 37 | \end{preview} 38 | 39 | \begin{preview}% curve, bezier, parabola 40 | \begin{pspicture}(-0.2,-0.2)(25.2,2.2) 41 | \pscurve[showpoints=true](0,1)(1,2)(3,0)(4,2)(1,0) 42 | \psecurve[showpoints=true](5,1)(6,2)(8,0)(9,2)(5,0) 43 | \psccurve[showpoints=true](11,1)(12,2)(14,0)(15,2)(12,0) 44 | \psbezier[showpoints=true](16,0)(18,2)(20,0)(22,2) 45 | \psparabola[showpoints=true](25,2)(24,0) 46 | \end{pspicture} 47 | \end{preview} 48 | 49 | \begin{preview}% grid 50 | \psset{unit=20pt} 51 | \begin{pspicture}(-1,-1)(13.5,2.5) 52 | \psgrid(0,0)(-1,-1)(3,2) 53 | \psgrid(5,0)(8,2) 54 | \psgrid(13,2)(10,0) 55 | \end{pspicture} 56 | \end{preview} 57 | 58 | \begin{preview}% axis 59 | \psset{unit=20pt} 60 | \begin{pspicture}(-1,-1)(13.2,2.2) 61 | \psaxes{<->}(0,0)(-1,-1)(3,2) 62 | \psaxes[tickstyle=top,labels=none]{->}(5,0)(8,2) 63 | \psaxes[axesstyle=frame,tickstyle=top]{->}(10,0)(13,2) 64 | \end{pspicture} 65 | \end{preview} 66 | 67 | \begin{preview}% linestyle 68 | \begin{pspicture}(0,-0.1)(9,2.1) 69 | \psline[linewidth=1.5pt](0,0)(9,0) 70 | \psline[linestyle=dotted](0,1)(9,1) 71 | \psline[linestyle=dashed](0,2)(9,2) 72 | \end{pspicture} 73 | \end{preview} 74 | 75 | \begin{preview}% arrow 76 | \begin{pspicture}(-0.2,-0.2)(9.2,6.2) 77 | \psline{->}(0,0)(9,0) 78 | \psline{<-}(0,1)(9,1) 79 | \psline{<->}(0,2)(9,2) 80 | \psline{>-<}(0,3)(9,3) 81 | \psline{|-|}(0,4)(9,4) 82 | \psline{o-o}(0,5)(9,5) 83 | \psline{*-*}(0,6)(9,6) 84 | \end{pspicture} 85 | \end{preview} 86 | 87 | \begin{preview}% color 88 | \begin{pspicture}(0,-0.1)(9,2.1) 89 | \psline[linecolor=red](0,0)(9,0) 90 | \psline[linecolor=green](0,1)(9,1) 91 | \psline[linecolor=blue](0,2)(9,2) 92 | \end{pspicture} 93 | \end{preview} 94 | 95 | \begin{preview}% fill 96 | \begin{pspicture}(11,2) 97 | \pscircle[fillstyle=solid,fillcolor=RoyalBlue](1,1){1} 98 | \pscircle[fillstyle=vlines](4,1){1} 99 | \pscircle[fillstyle=hlines](7,1){1} 100 | \pscircle[fillstyle=crosshatch](10,1){1} 101 | \end{pspicture} 102 | \end{preview} 103 | 104 | \begin{preview}% shift, rotate 105 | \begin{pspicture}(12,3.2) 106 | \psframe(0,0)(3,2) 107 | \psframe[origin={4,0}](0,0)(3,2) 108 | \rput{30}(9,0){\psframe(0,0)(3,2)} 109 | \end{pspicture} 110 | \end{preview} 111 | 112 | \begin{preview}% label 113 | \begin{pspicture}(-0.8,-0.4)(12.3,3.3) 114 | \pspolygon(0,0)(4,0)(2,2) 115 | \rput[r](0,0){A} 116 | \rput[l](4,0){B} 117 | \rput[b](2,2){C} 118 | \pspolygon(7,0)(11,0)(9,2) 119 | \uput[l](7,0){A} 120 | \uput[r](11,0){B} 121 | \uput[u](9,2){C} 122 | \end{pspicture} 123 | \end{preview} 124 | 125 | \end{document} 126 | -------------------------------------------------------------------------------- /graph/transform.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -18 200 36 3 | %%HiResBoundingBox: -0.39851 -17.65372 199.65083 35.26723 4 | %%Creator: MetaPost 1.803 5 | %%CreationDate: 2013.09.04:2317 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.79701 dtransform truncate idtransform setlinewidth pop [] 0 setdash 1 setlinejoin 11 | 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 19.92523 0 lineto 14 | 9.96262 17.2552 lineto 15 | closepath stroke 16 | newpath 25.88371 14.94392 moveto 17 | 43.13951 24.90654 lineto 18 | 25.884 34.86871 lineto 19 | closepath stroke 20 | newpath 49.81308 0 moveto 21 | 67.06888 9.96262 lineto 22 | 49.81337 19.92479 lineto 23 | closepath stroke 24 | newpath 72.40775 -9.96262 moveto 25 | 89.66354 0 lineto 26 | 72.40804 9.96217 lineto 27 | closepath stroke 28 | newpath 99.62616 0 moveto 29 | 119.55139 0 lineto 30 | 126.84398 17.2552 lineto 31 | closepath stroke 32 | newpath 129.514 0 moveto 33 | 149.43924 0 lineto 34 | 139.47662 -17.2552 lineto 35 | closepath stroke 36 | newpath 159.40186 0 moveto 37 | 199.25232 0 lineto 38 | 179.32709 17.2552 lineto 39 | closepath stroke 40 | showpage 41 | %%EOF 42 | -------------------------------------------------------------------------------- /history.txt: -------------------------------------------------------------------------------- 1 | 2024-12-14 2.101 2 | - 友人序拼写错误 by Hongdong Ji 3 | - 再版序章节数目 by Hongdong Ji 4 | - 1.1.1节Warnock和Geschke生卒年份 by Hongdong Ji 5 | - 1.1.2节Aho年份 by Hongdong Ji 6 | - 1.1.2节Reid脚注“厅外”应为“庭外” by Hongdong Ji 7 | - 1.1.3节Spivak生卒年份 by Hongdong Ji 8 | - 11页行首符号 by Hongdong Ji 9 | - 表2.7: 计数器显示格式第三行“小写英文”应为“大写英文” by Hongdong Ji 10 | - 3.4.2节最后一段“短划线”应为“破折号” by Hongdong Ji 11 | - 4.2.7节,“命令”改为“符号或命令” by Hongdong Ji 12 | - 5.3.1节彩色文字小节行数错误 by Hongdong Ji 13 | - 5.3.2节第二段多了个“的”字 by Hongdong Ji 14 | - 例6.3第二行,beginfig序号从2改为3 by Hongdong Ji 15 | - 例6.4代码最后漏了endfig by Hongdong Ji 16 | - 例6.8beginfig漏了分号 by Hongdong Ji 17 | - 8.2.1节最后一段第二行cycle的起始点应为(5,0) by Hongdong Ji 18 | - 例10.4代码加回\usepackage, 之前去掉它是为了调整分页。但是去掉之后忘记改正文中引用该例的行数 by Hongdong Ji 19 | - 10.4.1, 10.4.2节\bibtem应为\bibitem by Hongdong Ji 20 | - 131页多了个“等”字 by Hongdong Ji 21 | - 例10.12代码第四行,“部”应为“部分” by Hongdong Ji 22 | - 11.2节最后一段,“第11行”应为“第12行” by Hongdong Ji 23 | - 12.4节,“copytogoban命令”应为“\copytogoban命令” by Hongdong Ji 24 | - B.1.1节,“毕升”应为“毕昇”,“宝元年间”应为“庆历年间” by Hongdong Ji 25 | - B.2.1节第一段漏了“下面的盒子里”;最后一段“术后”应为“书后” by Hongdong Ji 26 | - B.2.2节倒数第二行Linotype-Hell AG超出页边 by Hongdong Ji 27 | - B.3.3节最后一段文字略调整 by Hongdong Ji 28 | - B.3.4节第一段漏了一个“年”字 by Hongdong Ji 29 | - 再版跋最后一段文字略调整 by Hongdong Ji 30 | - 版权页年份 by GasinAn 31 | - xeCJK punctstyle从hangmobanjiao改为plain, 之前有些句号离后面文字太近。有些图周围空白不好调整;反正是电子版,多些布白也无妨,总好过拥挤。 32 | - 6.6.1节文字略调整,以避免一个突出行尾的句号 33 | - 12.3节页面略调整 34 | 35 | 2024-01-03 v2.66 36 | - 修正例12.1标点符号 by GasinAn 37 | 38 | 2024-01-02 v2.65 39 | - 修正build.txt和友人序中错误 by GasinAn 40 | 41 | 2021-10-24 v2.63 42 | - 修正README拼写错误 by boltomli 43 | 44 | 2021-09-21 v2.62 45 | - 修正LaTeX 2020某次更新导致的表格编译错误,见https://tex.stackexchange.com/questions/567985 46 | 47 | 2021-09-20 v2.61 48 | - 2.5.2节正文中identfirst -> indentfirst by 赵梓琪 49 | - 版权页All right -> All rights by shuangwen 50 | - 例12.1标点符号 by GasinAn 51 | - 3.5节\Tex -> \TeX by boltomli 52 | - 7.1节\rput后遗漏竖线符号 by boltomli 53 | 54 | 2019-04-29 v2.56 55 | - 换用 Adobe Source 字体 56 | - 换用 CTeX 宏集 57 | - 更新 ctex.cmd, mtex.cmd 58 | - 更新部分人物简历 59 | - 更新参考文献 60 | - 更新软件列表 61 | - 代码缩进改为两个空格 62 | - 一些顿号换为英文逗号 63 | - 采用 git by 李峰 64 | - 2.5.2节和附录B, identfirst -> indentfirst by Wang Chenlin 65 | - 5.3.1节 CMYK 四分色模型的描述 by Naitree Zhu 66 | - 加入友人评论、序言。 67 | 68 | 2013-09-04 v2.03 69 | - 更正了xeCJK-listings导致的代码列表格式错误 70 | - 12章插图中的巨搫更正为巨擘 71 | 72 | 2013-08-17 v2.02 73 | - 第3页脚注4行首逗号 by huow005 74 | - 封面和封底巨搫更正为巨擘 by karlchen 75 | 76 | 2013-06-08 77 | - 写完后记 78 | 79 | 2013-06-07 80 | - 重新整理了索引 81 | 82 | 2013-06-06 83 | - 更正了100和103页两处行首标点 by northwater 84 | - 更正了133页Wilhelm Ostwald的出生地 by northwater 85 | - 更正了134页德国标准化学会的拼写错误 by northwater 86 | 87 | 2013-04-07 88 | - 更正了mtex.cmd中cv-casual的文件名拼写错误 89 | - 简历中C#改为C\# 90 | 91 | 2012-12-23 92 | - 去掉了第7页最后一段多余的三个字母uth by Yiming 93 | - 更新了第7页脚注19 TAOCP的进程 by Yiming 94 | 95 | 2012-08-20 更新至第12章 96 | - 17页例2.1标题拼写错误 by Sofoot 97 | - 40页例3.2去掉了已废弃的CJKaddspaces选项 by milksea 98 | - 167页少了一个“年”字 by Hongdong Ji 99 | 100 | 2012-01-17 101 | - 第1页行首句号 by zoho 102 | - 21页乱码 by primenumber 103 | - 163页乱码 by maming 104 | - 插图一章中的MetaPost, PSTricks, PGF拆分为三个独立章节 105 | 106 | 2011-04-03 更新至第七章结构 107 | - 更正了22页表2.2, 2.3中的乱码字符 by IMB, tex 108 | - 112页例6.5中代码手工断了行 by milksea 109 | - 121页“例6.9中代码第14行”更正为“第12行” by IMB, Hongdong Ji 110 | - 若干\footnote上标, \texttt, \verb与周围文字间距过窄 111 | 112 | 2010-10-23 更新至第六章表格 113 | - 4.4.1节两个加号与前面字符间距过窄 by sesame 114 | 115 | 2010-07-07 更新至第五章插图 116 | - 4.1节amsmath equation环境和LaTeX版本的区别是次环境 by sesame 117 | - 4.4节三个等号后间距过窄 by sesame 118 | - 增加4.4.4小节分支公式 by sesame 119 | 120 | 2010-06-01 更新至第四章数学 121 | - 第三章字体结构内容略作调整 by milksea 122 | - 1、2页多了两个顿号,5页一个错别字 by Hongdong Ji 123 | - 校对了脚注和索引 124 | 125 | 2010-05-16 更新至第三章字体 126 | - 2.3.2小节宏包ulem拼写错误 by tex 127 | - 第三章第二段多了字符两字 by jiapeng 128 | - 29页表2.7罗马数字 by gaozhch 129 | 130 | 2010-05-01 更新至第二章入门 131 | - 关于字体的建议 by shenshou246, milksea, PaladinHL 132 | - ConTeXt版权信息 by garfileo 133 | - 错别字:亲历亲为 by tex 134 | 135 | 2010-04-16 完成第一章简介和附录B印刷简史 136 | -------------------------------------------------------------------------------- /img/599px-movable_type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/599px-movable_type.png -------------------------------------------------------------------------------- /img/anna.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna.jpg -------------------------------------------------------------------------------- /img/anna.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna.png -------------------------------------------------------------------------------- /img/anna1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna1.png -------------------------------------------------------------------------------- /img/anna2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna2.png -------------------------------------------------------------------------------- /img/anna4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna4.png -------------------------------------------------------------------------------- /img/anna8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna8.png -------------------------------------------------------------------------------- /img/anna8g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna8g.png -------------------------------------------------------------------------------- /img/anna_density.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna_density.jpg -------------------------------------------------------------------------------- /img/anna_gray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna_gray.jpg -------------------------------------------------------------------------------- /img/anna_resample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna_resample.jpg -------------------------------------------------------------------------------- /img/anna_resize.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/anna_resize.jpg -------------------------------------------------------------------------------- /img/cassatt_bath.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/cassatt_bath.jpg -------------------------------------------------------------------------------- /img/chinese_movable_type1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/chinese_movable_type1.png -------------------------------------------------------------------------------- /img/chinese_type.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/chinese_type.jpg -------------------------------------------------------------------------------- /img/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/color.png -------------------------------------------------------------------------------- /img/convert.txt: -------------------------------------------------------------------------------- 1 | convert dscf6030.jpg -crop 900x1350+640+150 -resize 100x150 -density 100x100 anna.jpg 2 | 3 | convert anna.jpg anna.png 4 | convert anna.jpg -colors 256 png8:anna8.png 5 | convert anna.jpg -colorspace gray png8:anna8g.png 6 | convert anna.jpg -colors 16 png8:anna4.png 7 | convert anna.jpg -colors 4 png8:anna2.png 8 | convert anna.jpg -monochrome anna1.png 9 | 10 | convert leftfoot.jpg -monochrome -fill silver -opaque black leftfoot.png -------------------------------------------------------------------------------- /img/dscf6030.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/dscf6030.jpg -------------------------------------------------------------------------------- /img/durer_st_christopher.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/durer_st_christopher.jpg -------------------------------------------------------------------------------- /img/gainsborough_georgiana_duchess.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/gainsborough_georgiana_duchess.jpg -------------------------------------------------------------------------------- /img/goya_sleep_of_reason.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/goya_sleep_of_reason.jpg -------------------------------------------------------------------------------- /img/goya_sleep_of_reason_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/goya_sleep_of_reason_sm.jpg -------------------------------------------------------------------------------- /img/gutenberg_bible.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/gutenberg_bible.jpg -------------------------------------------------------------------------------- /img/gutenberg_bible_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/gutenberg_bible_sm.jpg -------------------------------------------------------------------------------- /img/hopfer_soldier_wife.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/hopfer_soldier_wife.jpg -------------------------------------------------------------------------------- /img/hopfer_soldier_wife_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/hopfer_soldier_wife_sm.jpg -------------------------------------------------------------------------------- /img/ilsted_sunshinev.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/ilsted_sunshinev.jpg -------------------------------------------------------------------------------- /img/jingangjing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/jingangjing.jpg -------------------------------------------------------------------------------- /img/jingangjing_sm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/jingangjing_sm.jpg -------------------------------------------------------------------------------- /img/leftfoot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/leftfoot.jpg -------------------------------------------------------------------------------- /img/leftfoot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/leftfoot.png -------------------------------------------------------------------------------- /img/movable_type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/movable_type.png -------------------------------------------------------------------------------- /img/movable_type_transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/movable_type_transparent.png -------------------------------------------------------------------------------- /img/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/pattern.png -------------------------------------------------------------------------------- /img/rightfoot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/rightfoot.jpg -------------------------------------------------------------------------------- /img/rightfoot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/rightfoot.png -------------------------------------------------------------------------------- /img/siegen_portrait_of_hessen.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/siegen_portrait_of_hessen.jpg -------------------------------------------------------------------------------- /img/ury_woman_in_cafe.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/ury_woman_in_cafe.jpg -------------------------------------------------------------------------------- /img/vaillerant_young_man_reading.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/img/vaillerant_young_man_reading.jpg -------------------------------------------------------------------------------- /lnotes2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huangxg/lnotes/960656ea47e4d5da786b6bd8a8cfa98e16c012ad/lnotes2.pdf -------------------------------------------------------------------------------- /mtex.cmd: -------------------------------------------------------------------------------- 1 | :VARIABLES 2 | @SET PDFLATEX=xelatex 3 | @SET MAINFILE=src/lnotes2.tex 4 | @SET OPTIONS="-output-driver=\"xdvipdfmx -V 5\"" 5 | 6 | @IF "%1" == "-clean" GOTO CLEAN 7 | @IF "%1" == "-build" GOTO BUILD 8 | 9 | :USAGE 10 | @ECHO TeX Manager 0.7 (2019-04-12) by Alpha Huang 11 | @ECHO Manage workflow of LaTeX Notes 2. 12 | @ECHO. 13 | @ECHO Usage: mtex [ACTION] [TARGET] 14 | @ECHO ACTION: -clean Delete auxiliary files of TARGET. 15 | @ECHO -build Build TARGET. 16 | @ECHO TARGET: main Main file. 17 | @ECHO graph Graphics files. 18 | @ECHO all All files. 19 | @GOTO END 20 | 21 | :CLEAN 22 | @IF "%2" == "main" ( 23 | CALL :CLEAN_MAIN 24 | @GOTO :EOF 25 | ) ELSE @IF "%2" == "graph" ( 26 | CALL :CLEAN_GRAPH 27 | @GOTO :EOF 28 | ) ELSE @IF "%2" == "all" ( 29 | CALL :CLEAN_MAIN 30 | CALL :CLEAN_GRAPH 31 | @GOTO :EOF 32 | ) ELSE ( 33 | @ECHO Invalid TARGET 34 | @ECHO. 35 | @GOTO USAGE 36 | ) 37 | 38 | :CLEAN_MAIN 39 | @DEL tmp\*.* 40 | @ECHO main temporary files cleaned. 41 | @EXIT /B 42 | 43 | :CLEAN_GRAPH 44 | @DEL graph\tmp\*.* 45 | @ECHO graph temporary files cleaned. 46 | @EXIT /B 47 | 48 | :BUILD 49 | @IF "%2" == "main" ( 50 | CALL :BUILD_MAIN 51 | @GOTO :EOF 52 | ) ELSE @IF "%2" == "graph" ( 53 | CALL :BUILD_GRAPH 54 | @GOTO :EOF 55 | ) ELSE @IF "%2" == "all" ( 56 | CALL :BUILD_MAIN 57 | CALL :BUILD_GRAPH 58 | @GOTO :EOF 59 | ) ELSE ( 60 | @ECHO Invalid TARGET 61 | @ECHO. 62 | @GOTO USAGE 63 | ) 64 | 65 | :BUILD_MAIN 66 | @ECHO building main 67 | @MOVE tmp\*.* . > NUL 68 | 69 | @REM texify -pqV --tex-option=%OPTIONS% %MAINFILE% 70 | texify -pqV %MAINFILE% 71 | makeindex org 72 | makeindex people 73 | @REM texify -pqV --tex-option=%OPTIONS% %MAINFILE% 74 | texify -pqV %MAINFILE% 75 | 76 | @MOVE *.aux tmp > NUL 77 | @MOVE *.bbl tmp > NUL 78 | @MOVE *.blg tmp > NUL 79 | @MOVE *.exa tmp > NUL 80 | @MOVE *.idx tmp > NUL 81 | @MOVE *.ilg tmp > NUL 82 | @MOVE *.ind tmp > NUL 83 | @MOVE *.loe tmp > NUL 84 | @MOVE *.lof tmp > NUL 85 | @MOVE *.log tmp > NUL 86 | @MOVE *.lot tmp > NUL 87 | @MOVE *.out tmp > NUL 88 | @MOVE *.toc tmp > NUL 89 | 90 | @ECHO. 91 | @ECHO done 92 | @EXIT /B 93 | 94 | :BUILD_GRAPH 95 | @ECHO building graph 96 | 97 | @CD graph 98 | CALL ctex -x mini 99 | CALL ctex -m fig 100 | CALL ctex -x pst 101 | CALL ctex -p pgf 102 | CALL ctex -x beamer 103 | CALL ctex -x beamer-warsaw 104 | CALL ctex -x letter-bus 105 | CALL ctex -x letter-memo 106 | CALL ctex -x letter-pr 107 | CALL ctex -x letter-std 108 | CALL ctex -x letter-env 109 | CALL ctex -x cv-banking 110 | CALL ctex -x cv-casual 111 | CALL ctex -x cv-classic 112 | CALL ctex -x cv-old 113 | @CD .. 114 | 115 | @ECHO. 116 | @ECHO done 117 | @EXIT /B 118 | -------------------------------------------------------------------------------- /src/acknowledgements.tex: -------------------------------------------------------------------------------- 1 | \chapter{致谢} 2 | 3 | 在本文的写作过程中,我得到了众多网友的帮助和指点,各位反动学术权威的关心和鼓励。没有你们的帮助,包老师形只影单单枪匹马马不停蹄也难以完成这件超出本人能力的事情。 4 | 5 | 在此包老师依据我国法律\footnote{《中华人民共和国感谢法》,2010年3月12日。},首先郑重感谢党和政府的栽培,国家和人民的养育,以及有关部门的领导。感谢铁岭 TV,辽宁 TV,将来还有可能感谢 CCTV。 6 | 7 | 其次将网友们的名单公诸于众,以彰显社会良知、公民勇气。以下排名不分先后,其中多数网友来自水木清华 BBS \TeX 版和 C\TeX 论坛。 8 | 9 | \begin{multicols}{3} 10 | \noindent 11 | boltomli\\ 12 | careworn\\ 13 | Dieken\\ 14 | donated\\ 15 | gaozhch\\ 16 | garfileo\\ 17 | GasinAn\\ 18 | hkkhhk\\ 19 | Hongdong Ji\\ 20 | IMB\\ 21 | jjgod\\ 22 | Kov Chai\\ 23 | Langpku\\ 24 | LittleLeo\\ 25 | maming\\ 26 | meteorrain\\ 27 | milksea\\ 28 | Naitree Zhu\\ 29 | northwater\\ 30 | PaladinHL\\ 31 | PiscesGold\\ 32 | primenumber\\ 33 | sesame\\ 34 | shenshou246\\ 35 | shuangwen\\ 36 | snoopyzhao\\ 37 | Sofoot\\ 38 | tex\\ 39 | Wang Chenlin\\ 40 | Xiao Zigang\\ 41 | Xubuntu\\ 42 | yakun\\ 43 | Yiming\\ 44 | yli\\ 45 | yyzz11\\ 46 | zoho\\ 47 | 贾朋\\ 48 | 李峰\\ 49 | 张晓南\\ 50 | 赵梓琪 51 | \end{multicols} 52 | 53 | 特别感谢范、沈、王、李、林诸位教授的鼓励、意见与建议。 54 | 55 | 也借机感谢一下4.80\footnote{166.111.4.80 是清华大学校园网早期一个重要的 FTP 站点。}前站长 Jonny 和水木清华 BBS 前站长 Leeward。十余年前,在我开始浸淫于电脑网络时,这两位高手对我有很大的启发和影响。虽然两位高人淡出公众视野已久,但是他们为人民服务的精神却依然值得我们缅怀与尊敬。 56 | 57 | 最后还要感谢家人的理解和支持。老妻把她的博士论文给我当作学习 \LaTeX 的试验品;大女儿把她的玉照给我当作插图样板;小女儿把她的名字给我放在献辞页。 58 | -------------------------------------------------------------------------------- /src/back.tex: -------------------------------------------------------------------------------- 1 | %\newpage 2 | %\thispagestyle{empty} 3 | %~ 4 | 5 | \newpage 6 | \thispagestyle{empty} 7 | \vspace*{\fill} 8 | \begin{center} 9 | 中文:11pt Adobe Source Han Serif\\ 10 | 英文:11pt Adobe Source Serif Pro 11 | \end{center} 12 | \vspace{\fill} 13 | 14 | \begin{titlepage} 15 | 16 | \setlength\parindent{0pt} 17 | 18 | \definecolor{mygreen}{HTML}{9ABA5A} 19 | \definecolor{myblue}{HTML}{4F80BD} 20 | \textblockcolour{mygreen} 21 | \textblockrulecolour{white} 22 | 23 | \begin{textblock}{6}(10,0) 24 | \rule{0mm}{420mm} 25 | \end{textblock} 26 | 27 | \begin{textblock}{.02}(9.7,0) 28 | \rule{0mm}{420mm} 29 | \end{textblock} 30 | 31 | \begin{textblock}{.02}(9.8,0) 32 | \rule{0mm}{420mm} 33 | \end{textblock} 34 | 35 | \begin{textblock}{.02}(9.9,0) 36 | \rule{0mm}{420mm} 37 | \end{textblock} 38 | 39 | \begin{textblock}{3}(11,1) 40 | {\Huge \textbf{雷坛巨擘}\\[5pt] \textbf{扛鼎力作}} 41 | \end{textblock} 42 | 43 | \begin{textblock}{12.8}(3.9,5.3) 44 | \textblockcolour{} 45 | \includegraphics[scale=.9]{chinese_type.jpg} 46 | \end{textblock} 47 | 48 | \begin{textblock}{4}(11,13.5) 49 | {\huge \textit{\lnotesauthor}}\\[5pt] 50 | {\Large \lnotesdate} 51 | \end{textblock} 52 | 53 | \TPshowboxestrue 54 | \setlength\TPboxrulesize{0.8pt} 55 | \textblockcolour{myblue} 56 | 57 | \begin{textblock}{14}(0.01,3) 58 | \centering 59 | ~\\[20pt] 60 | {\fontsize{32}{40}\selectfont \LaTeX\ \ \textsc{Notes}}\\[8pt] 61 | {\huge \textit{雷太赫排版系统简介}}\\[8pt] 62 | 第二版\ \ \lnotesversion\\[20pt] 63 | \end{textblock} 64 | ~ 65 | \end{titlepage} 66 | -------------------------------------------------------------------------------- /src/copyright.tex: -------------------------------------------------------------------------------- 1 | \thispagestyle{empty} 2 | 3 | \noindent\textcopyright\ 2008--2024 Alpha Huang\\ 4 | Alpha Culture \& Education {\lmr\textregistered}\\ 5 | \ \\ 6 | \noindent All rights 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 雷人.\\ 7 | \ \\ 8 | \noindent The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories, technologies and programs to determine their effectiveness. The author and publisher make no warranty of any kind, express or implied, with regard to these techniques or programs contained in this book. The 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.\\ 9 | \ \\ 10 | \noindent Printed in the United States of America 11 | -------------------------------------------------------------------------------- /src/dedication.tex: -------------------------------------------------------------------------------- 1 | \thispagestyle{empty} 2 | 3 | \vspace*{\fill} 4 | \begin{center} 5 | \huge To: Anna and Bella 6 | \end{center} 7 | \vspace{\fill} 8 | \normalsize 9 | -------------------------------------------------------------------------------- /src/fonts.tex: -------------------------------------------------------------------------------- 1 | \chapter{字体} 2 | 3 | 英文中的 typeface 和 font 一般都被翻译为字体,传统印刷业通常使用 typeface,电脑字体通常使用 font;当然也有很多人混用这两个词。包老师认为电脑字体的诸多相关概念可以划分为三个层次: 4 | 5 | \begin{compactenum} 6 | \item 编码层,字符 (包括字母、数字、符号、控制码等) 的索引和编码,也就是字符集 (character set) 和字符编码 (character encoding) 。 7 | \item 格式层,字形 (glyph) 的定义描述方法,以及字体的文件存储格式。 8 | \item 显示层,字体的外在表现形式,比如字体的样式,或具体的字体。 9 | \end{compactenum} 10 | 11 | 看到这里好奇的读者可能会问,为什么微软\indexMSFT{} Word 和其他所见即所得软件可以直接用下拉菜单设置字体,同样是标记语言的HTML也可以方便地设置字体,而 \LaTeX 就要牵扯这么多概念?我们不得不承认,这是 \LaTeX 的历史局限性之一。Knuth\indexKnuth 当初设计 \TeX 时,既没有 Unicode 字符集和 UTF-8 编码,也没有 TrueType 和 OpenType 字体格式。 12 | 13 | 包老师语重心长地说,道路是曲折的,前途是光明的。这不马上就要侃到 \XeTeX 了,这些困难只是黎明前的黑暗。 14 | 15 | \section{字符集和编码} 16 | \label{sec:encoding} 17 | 18 | 众所周知电脑内部采用二进制编码,因为它易于用电子电路实现。所有字符在电脑内部都是用二进制表示的,字符集的二进制编码被称为字符编码,有时人们也会混用这两个术语。 19 | 20 | 1963年ANSI\indexANSI 发布了基于电报码的 ASCII,这就是最早的字符编码,它用7位 (bit) 表示了$2^7=128$个字符,只能勉强覆盖英文字符。 21 | 22 | 美国人发明了电脑,他们优先考虑英语是可以理解的。后来随着电脑技术的传播,人们呼吁把字符编码扩充到8位也就是一个字节 (byte) ,可以涵盖$2^8=256$个字符。 23 | 24 | 于是ISO\indexISO 在1980年代中期推出了 ISO 8859,256个字符显然也不能满足需要,所以8859被分为十几个部分:从8859-1 (西欧语言) 、8859-2 (中欧语言) ,直到8859-16 (东南欧语言) ,覆盖了大部分使用拉丁字母的语言文字。 25 | 26 | 在 ISO 标准完全定型之前,IBM 就有一系列自己的字符编码,也就是代码页 (code page) ,比如437 (扩展ASCII) 、850 (西欧语言) 、852 (东欧语言) 。IBM\indexIBM 代码页通常被用于控制台 (console) 环境,也就是 MS-DOS 或 Unix Shell 那样的命令行环境。 27 | 28 | 微软\indexMSFT 将 IBM 代码页称为 OEM 代码页,自己定义的称为 ANSI 代码页,比如1252 (西欧语言), 1250 (东欧语言), 936 (GBK简体中文), 950 (Big5繁体中文), 932 (SJIS日文), 949 (EUC-KR韩文) 等。 29 | 30 | 1981年,中国大陆推出了第一个自己的字符集标准 GB2312,它是一个94×94的表,包括7445个字符。GB2312 通常采用双字节的 EUC-CN 编码,所以后者也常常被称为 GB2312编码;其实 GB2312 还有另一种编码方式HZ,只是不常用。 31 | 32 | GB2312 中没有朱镕基的“镕”字,于是它在1993年被扩展为 GBK,包含21886个字符。GBK 不是正式标准。2000年发布的 GB18030 包含70244个字符,采用四字节编码。GB18030 之前还出现过一个 GB13000,但是没有形成气候。 33 | 34 | 1990年 ISO 推出了通用字符集 (universal character set,UCS) ,即 ISO 10646,意图一统江湖。它的容量是一百多万个字符,目前实际使用的有十万个左右。UCS 有两种编码:双字节的 UCS-2 和四字节的 UCS-4。 35 | 36 | ISO 之外还有个希望一统江湖的组织:统一码联盟 (The Unicode Consortium)\indexUnicode ,它于1991 年推出了 Unicode 1.0。后来两家组织意识到没必要做重复工作,于是双方开始合并成果,携手奔小康。Unicode 从2.0版开始采用与 ISO 10646-1 相同的编码。 37 | 38 | Unicode 主要有三种编码:UTF-8, UTF-16, UTF-32。UTF-8 使用一至四个8位编码。UTF-16 用一或两个16位编码,基本上是 UCS-2 的超集,和 ASCII 不兼容。UTF-32 用一个32位编码,它是 UCS-4 的一个子集。 39 | 40 | IETF\indexIETF 要求所有网络协议都支持 UTF-8,互联网电子邮件联盟 (Internet Mail Consortium, IMC)\indexIMC 也建议所有电子邮件软件都支持 UTF-8,所以它已成为互联网上的事实标准。 41 | 42 | \section{字体格式} 43 | 44 | \subsection{点阵和矢量字体} 45 | 46 | 电脑字体的数据格式可以分为三大类:点阵 (bitmap) 字体、轮廓 (outline) 字体和笔画 (stroke-based) 字体。 47 | 48 | 点阵字体通过点阵来描述字形。早期的电脑受到容量和绘图速度的限制,多采用点阵字体。点阵字体后来渐渐被轮廓字体所取代,但是很多小字号字体仍然使用它,因为这种情况下轮廓字体缩放太多会导致笔画不清晰。 49 | 50 | 轮廓字体又称作矢量字体,它通过一组直线段和曲线来描述字形。轮廓字体易于通过数学函数进行缩放等变换,形成平滑的轮廓。轮廓字体的主要缺陷在于它所采用的贝塞尔曲线 (Bézier curves) 在光栅设备 (比如显示器和打印机) 上不能精确渲染,因而需要额外的补偿处理比如字体微调 (font hinting) 。但是随着电脑硬件的发展,人们一般不在意它比点阵字体多出的处理时间。 51 | 52 | 笔画字体其实也是轮廓字体,不过它描述的不是完整的字形,而是笔画。它多用于东亚文字。 53 | 54 | \subsection{常见字体格式} 55 | 56 | 当前常见的轮廓字体格式有:Type 1, TrueType, OpenType。 57 | 58 | 1984年 Adobe\indexAdobe 推出PostScript时,同时支持两种字体格式:Type 1 和 Type 3,它们都采用三次贝塞尔曲线。Type 1 支持微调,它使用一个简化的 PostScript 子集;Type 3 不支持微调,但它可以使用全部 PostScript 功能,因此既可包含轮廓字体也可包含点阵字体信息。 59 | 60 | 1991年 苹果\indexApple 发布了 TrueType,它采用二次贝塞尔曲线。二次曲线处理起来比三次曲线快,但是需要更多的点来描述。所以从 TrueType 到 Type 1 的转换是无损的,反之是有损的。1994年苹果开始研究 TrueType 的下一代技术:TrueType GX,它后来演变为 Apple advanced typography (AAT) 。 61 | 62 | 1996年微软和 Adobe 联合发布了 OpenType,它可以被认为是 Type 1 和 TrueType 的超集,既可使用二次曲线,也可使用三次曲线。它比起 TrueType 和 AAT 的优势还有:平台独立、开放、易于开发,并且支持更多的语言比如阿拉伯语。 63 | 64 | 早在1984年 Knuth 就发布了 \MF ,它与 TrueType 和 OpenType 的区别是,不直接描述字形轮廓,而描述生成轮廓的笔的轨迹。笔的形状可以是椭圆形或多边形,尺寸缩放自如,字形边缘也柔和一些。两种字体可以用同一个 \MF 文件,当然还有不同的参数。\MF 技术如此先进,却没有流行开来。对此 Knuth 解释道,要求一位设计字体的艺术家掌握60个参数太变态了,那是用来折磨数学家的。 65 | 66 | 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) 。 67 | 68 | TrueType 和 OpenType 则将字体数据都存在一个文件里,它们的文件后缀分别是是.ttf和.otf。\MF 虽然用矢量图形来定义字形,实际输出的却是一种点阵格式:PK (packed raster) 。 69 | 70 | 这些字体格式按照技术先进性,从高到低依次为:OpenType, TrueType, Type 1, Type 3, PK,所以我们要优先选用 OpenType 和 TrueType。 71 | 72 | PostScript 文件可以包含 Type 1 和 Type 3 字体,而 PDF 除了这两种还支持 TrueType 和 OpenType 字体。 73 | 74 | \subsection{合纵连横} 75 | 76 | 当年 Adobe\indexAdobe{}推出 Type 1 和 Type 3 时,前者收费,后者是公开的自由规范。Type 1 专利许可费十分昂贵,穷人们只好用免费的 Type 3。为了打破这种垄断,苹果开发了 TrueType。1991年 TrueType 发布之后,Adobe 随即公开了 Type 1 的规范,它从贵族堕落为平民,因而流行开来。 77 | 78 | 1980年代中后期,Adobe 的大部分盈利来自于 PostScript 解释器的许可费。面对这种垄断局面,微软和苹果联合了起来。微软把买来的 PostScript 解释器 TrueImage 授权给苹果,苹果则把 TrueType 授权给微软。 79 | 80 | 微软得陇望蜀,又企图获得 AAT 的许可证,未遂。为了打破苹果的垄断,微软联合 Adobe 在1996年发布了 OpenType。Adobe 在2002年末将其字体库全面转向 OpenType。 81 | 82 | 上面这几出精彩好戏充分展示了商场上的勾心斗角、尔虞我诈,没有永恒的伙伴,只有永恒的利益。但它同时也告诉我们,市场竞争中受益的还是广大的消费者。 83 | 84 | \section{常见字体} 85 | 86 | 在 \ref{sec:font_style} 节中我们提到每种字体样式可以包含很多种具体的字体。为了方便读者,\autoref{tab:font} 列出一些最常见的字体。\TeX 的缺省字体是 Knuth 用 \MF 生成的 Computer Modern;\XeTeX 的缺省字体是1997年 \AmS 发布的 Latin Modern,它基于 Computer Modern,但是扩展了其字符集,其封装格式有 Type 1 和 OpenType。 87 | 88 | \begin{table}[htbp] 89 | \caption{常见字体} 90 | \label{tab:font} 91 | \centering 92 | \begin{tabular}{llll} 93 | \toprule 94 | 操作系统 & 衬线字体 & 无衬线字体 & 等宽字体 \\ 95 | \midrule 96 | \multirow{3}{*}{Windows} 97 | & Times New Roman & Tahoma & Courier New \\ 98 | & Georgia & Verdana & Lucida Console \\ 99 | & Palatino Linotype & Arial & Consolas \\ 100 | \midrule 101 | \multirow{3}{*}{macOS} 102 | & Times & Helvetica & Monaco \\ 103 | & Georgia & Lucida Grande & Courier \\ 104 | & Times New Roman & Geneva & Courier New \\ 105 | \bottomrule 106 | \end{tabular} 107 | \end{table} 108 | 109 | \section{字体的应用} 110 | 111 | 从理论上讲,任何电脑字体只要有TFM,\TeX 就可以使用它。然而早期的 \TeX 只能使用 \MF 生成的字体。直到 \LaTeXe 时代NFSS的出现后,Type 1 和 Type 3 才在 \LaTeX 中得到广泛应用。后起之秀 \XeTeX 则极大程度地简化了 TrueType 和 OpenType 的配置,而且它还支持 Unicode。 112 | 113 | \texttt{latex}, \texttt{pdflatex}, \texttt{xelatex} 编译程序,\texttt{dvips} 和 \texttt{dvipdfmx} 驱动,DVI 阅读器等分别采用不同的字体技术路线。本文主推 \XeLaTeX ,对其他早期技术只作简要介绍,聊以忆苦思甜。 114 | 115 | \subsection{早期技术} 116 | 117 | \subsubsection{latex和DVI} 118 | 119 | 我们用 \texttt{latex} 生成 DVI 时只需要 TFM 文件,因为 DVI 并不包含字形信息,而只包含对字体的引用。DVI 阅读器显示 DVI 时一般使用 PK,它在系统中查找相应的 \texttt{.pk} 文件,若找不到就调用 \MF 在后台自动生成。 120 | 121 | \subsubsection{dvips} 122 | 123 | 缺省情况下,\texttt{dvips} 也会查找 \texttt{.pk},或调用 \MF 自动生成;然后把 PK 转换成包含点阵字体的 Type 3,它的参数 \texttt{-D} 可以用来控制该点阵字体的分辨率。用 \texttt{ps2pdf} 处理含 Type 3 的 PostScript 时,输出的自然是含 Type 3 的 PDF。 124 | 125 | GSview\footnote{该软件已经停止更新,包老师正在寻找替代品。} 在低分辨率下可以很好地渲染 Type 3,Adobe Reader 或 Acrobat 却不能,因为它们使用的 Adobe Type Manager 不支持包含完整 PostScript 的 Type 3。因此含 Type 3 的 PDF 看起来会有些模糊,所以应尽量避免使用。 126 | 127 | \texttt{dvips} 的另一个参数 \texttt{-Ppdf} 把 Type 1 嵌入生成的 PostScript,这样再 \texttt{ps2pdf} 就能生成含 Type 1 的 PDF。 128 | 129 | \texttt{dvips} 不支持真正的 (native) TrueType,用户只能把 TrueType 先转成 PK 或 Type 1,这样绕了个弯效果总会打些折扣。 130 | 131 | \texttt{dvips} 的字体详细使用方法可查阅其手册\citep{Rokicki_dvips}第六章,此处不赘述。 132 | 133 | \subsubsection{dvipdfm(x)和pdflatex} 134 | 135 | \texttt{dvipdfm} 支持 PK 和 Type 1,它可以用一个 \texttt{t1fonts.map} 文件建立 PK 文件和 Type 1 文件之间的映射,这样生成的 PDF 用的就是 Type 1。\texttt{dvipdfm} 也不支持真正的 TrueType。\texttt{dvipdfmx} 通过正确的设置可以使用真正的 TrueType,它对中日韩等东亚文字的支持也较好;只是其安装配置较繁琐,此处不赘述,实在有兴趣考古的读者可以参考 lnotes 第一版\citep{Huang_lnotes}。 136 | 137 | pdflatex 支持 Type 1, TrueType,也在一定程度上支持 OpenType。它的配置也很繁琐,可以参考其用户手册\citep{Han_pdftex}第五章。 138 | 139 | \subsection{XeTeX} 140 | 141 | \XeTeX 可以直接使用电脑系统字体,不再需要 TFM 文件。我们首先需要知道电脑上有哪些字体,\XeTeX 用一个XML文件记录系统字体路径,MikTeX 用的是\texttt{localfonts.conf},TeXlive 用的是 \texttt{fonts.conf}。 142 | 143 | 我们设置字体时需要字体的引用名,它和字体的文件名是不同的概念。\texttt{fc-list} 程序可以用来获取字体引用名,比如下面命令生成的 \texttt{myfonts.txt} 文件就是一份字体引用名列表。 144 | 145 | \begin{Code}[] 146 | fc-list > myfonts.txt 147 | \end{Code} 148 | 149 | 带 \XeTeX 的发行包首次安装时会自动扫描这些字体目录,生成字体的缓存 (cache) 。每次系统安装了新字体时,我们需要手工运行字体缓存命令 \texttt{fc-cache},生成新的缓存。 150 | 151 | \begin{Code}[] 152 | fc-cache -r 153 | \end{Code} 154 | 155 | 关于字体路径,\texttt{fc-list} 和 \texttt{fc-cache} 命令等的详细信息,可以参考 Michel Goossens (1951--)\indexGoossens{} \footnote{布鲁塞尔自由大学 (Free University of Brussels) 物理系1972年学士,1978年博士。1979年加入 CERN。合著\emph{\LaTeX{} Companion}, \emph{\LaTeX{} Graphics Companion}, \emph{\LaTeX{} Web Companion}等书。曾任TUG总统。} 编辑的\emph{\XeTeX{} Companion}\citep{Goossens_xetex}。 156 | 157 | \XeTeX 提供的字体命令比较原始、繁琐,Will Robertson (1981--)\indexRobertson{} \footnote{阿德雷德大学 (University of Adelaide) 机械系2002年学士,2013年博士生,2016年讲师。} 的 \texttt{fontspec} 宏包提供了较好的封装。\XeLaTeX 下字体常用设置方法如下,详细信息可以参考 \texttt{fontspec} 的用户手册\citep{Robertson_fontspec}。 158 | 159 | \begin{example}[h] 160 | \begin{Code}[] 161 | \usepackage{fontspec} 162 | \setmainfont[Mapping=tex-text]{Times New Roman} 163 | \setsansfont[Mapping=tex-text]{Tahoma} 164 | \setmonofont{Courier New} 165 | \end{Code} 166 | \caption{\XeLaTeX 字体设置} 167 | \label{exa:xelatex_font} 168 | \end{example} 169 | 170 | \autoref{exa:xelatex_font} 中的代码分别设置了衬线、无衬线和等宽字体样式对应的字体。在 \ref{sec:char_input} 节 \autoref{exa:dash} 中我们学过中划线和破折号可以用 \texttt{--} 和 \texttt{---} 来输入。\TeX 中几个短划线是相连的,\XeTeX 中缺省它们之间是有空隙的。\autoref{exa:xelatex_font} 用 \texttt{Mapping} 参数指示改回 \TeX 的方式,即去掉短划线之间的空隙。 171 | 172 | \section{中文解决方案} 173 | 174 | \LaTeX 对中文的支持主要有两种方法:张林波\indexZhangLinbo{} \footnote{中科院数学与系统科学研究院研究员。} 的 CCT 和 Werner Lemberg (1968--)\indexLemberg{} \footnote{从维也纳音乐和表演艺术大学 (University of Music and Performing Arts, Vienna) 获得作曲、指挥、钢琴、乐团管理、歌手教练等五个专业文凭,后自学中文和数学。曾任职于奥地利和德国多家剧院和乐团,现任德国科布伦茨某剧院指挥。} 的 CJK 宏包。早期 CCT 比较流行,CJK 后来居上;新版 CCT 也可以和 CJK 配合使用。 175 | 176 | 支持简体中文的 \LaTeX 发行版有吴凌云等人的 CTeX 和李树钧\indexLiShujun{} \footnote{西安交大电子系1997年学士,2003年博士。2003年香港城市大学博士后,2005年香港理工大学博士后,2007年哈根函授大学 (Distance University of Hagen) 研究员,2008年康斯坦茨大学 (University of Konstanz) 研究员。} 的 ChinaTeX,支持繁体中文的有吴聪敏 (1952--)\indexWuCongmin{} \footnote{台湾大学电机学士,罗彻斯特大学经济学博士,台湾大学经济系教授。}、吴聪慧\indexWuConghui{} \footnote{新泽西理工学院电脑硕士,嘉南药理科技大学医务管理系助理教授。} 兄弟和翁鸿翎\indexWongHongling 的 cwTeX,蔡奇伟\indexCaiQiwei{} \footnote{犹他电脑博士,静宜大学资讯工程系副教授。} 的 PUTeX。这两个繁体中文的发行版本人都不熟悉,前两个简体中文发行版都包含MikTeX, CCT, CJK, WinEdt 等。 177 | 178 | \XeTeX 问世后,孙文昌 (1970--)\indexSunWenchang{} \footnote{南开大学数学系1993年学士,1998年博士,毕业后留校作博士后,2000年副教授,2002年教授。} 推出了 \texttt{xeCJK} 宏包,用于排版中日韩等文字,包括字体选择,标点、文字间距调整等功能。它可以被认为是 CCT 和 CJK 在某种程度上的结合。 179 | 180 | 在 \autoref{exa:xecjk} 中引用宏包时,\texttt{CJKchecksingle} 参数防止段落最后一行只有一个汉字;\texttt{CJKnumber} 参数自动载入另一个宏包 \texttt{CJKnumber},它提供的 \verb|\CJKnumber| 命令可以把阿拉伯数字转换为中文数字。 181 | 182 | \verb|\setCJKmainfont| 命令设置了中文正文字体,它的两个参数 \texttt{BoldFont} 和 \texttt{ItalicFont} 分别设置了粗体、斜体样式对应的字体。\verb|\setCJKsansfont|, \verb|\setCJKmonofont| 命令分别设置了无衬线和等宽字体样式对应的字体。 183 | 184 | \begin{example}[h] 185 | \begin{Code}[numbers=left] 186 | \usepackage[CJKchecksingle,CJKnumber]{xeCJK} 187 | \setCJKmainfont[BoldFont={Adobe Heiti Std}, 188 | ItalicFont={Adobe Kaiti Std}]{Adobe Song Std} 189 | \setCJKsansfont{Adobe Heiti Std} 190 | \setCJKmonofont{Adobe Fangsong Std} 191 | \punctstyle{hangmobanjiao} 192 | \end{Code} 193 | \caption{xeCJK} 194 | \label{exa:xecjk} 195 | \end{example} 196 | 197 | 其实严格地讲中文字体并没有衬线、无衬线、等宽、斜体等概念,只是习惯上宋体用得最多,辅以黑体、仿宋、楷体,文档会显得疏落有致,不至于太沉闷。如果我们把 \autoref{exa:xelatex_font} 和 \autoref{exa:xecjk} 中的命令结合起来,就可以为中英文分别设置字体。 198 | 199 | xeCJK 宏包的详细用法可参考其用户手册\citep{Sun_xecjk}。另外 Yin Dian 的 zhspacing 宏包也可以完成类似功能,具体用法可参考其文档\citep{Yin_zhspacing}。 200 | 201 | C\TeX 开发小组的 C\TeX 宏集是一个面向中文排版的通用 \LaTeX 排版框架,汉字输出支持、标点压缩、字体字号命令、标题文字汉化、中文版式调整、数字日期转换等支持功能,可适应论文、报告、书籍、幻灯片等不同类型的中文文档。包老师最近 (2019年) 才开始试用,读者请参考其手册\citep{CTeX_ctex}。 202 | 203 | \bibliographystyle{unsrtnat} 204 | \bibliography{lnotes2} 205 | -------------------------------------------------------------------------------- /src/forward.tex: -------------------------------------------------------------------------------- 1 | \chapter{评论} 2 | 3 | \begin{quotation} 4 | 包太雷同志是一个高尚的人,一个纯粹的人,一个有道德的人,一个脱离了低级趣味的人,一个有益于人民的人。 5 | \begin{flushright} 6 | --- 白求恩 7 | \end{flushright} 8 | \end{quotation} 9 | 10 | \begin{quotation} 11 | 一个人偶尔雷人容易,难的是一辈子雷人。 12 | \begin{flushright} 13 | --- 雷锋 14 | \end{flushright} 15 | \end{quotation} 16 | 17 | \begin{quotation} 18 | 全面实用,涵盖了使用 LaTeX 的方方面面。 19 | \begin{flushright} 20 | --- Dr. Shen Gang 21 | \end{flushright} 22 | \end{quotation} 23 | 24 | \begin{quotation} 25 | 旁征博引,寓教于乐。 26 | \begin{flushright} 27 | --- Dr. Li Juan 28 | \end{flushright} 29 | \end{quotation} 30 | 31 | % \begin{quotation} 32 | % 书中自有颜如玉。 33 | % \begin{flushright} 34 | % --- 如花 35 | % \end{flushright} 36 | % \end{quotation} 37 | 38 | % \begin{quotation} 39 | % 包老师帅得惊动了党中央。 40 | % \begin{flushright} 41 | % --- 犀利 42 | % \end{flushright} 43 | % \end{quotation} 44 | 45 | % \begin{quotation} 46 | % LXJX。 47 | % \begin{flushright} 48 | % --- 蓝翔技校 49 | % \end{flushright} 50 | % \end{quotation} 51 | -------------------------------------------------------------------------------- /src/front.tex: -------------------------------------------------------------------------------- 1 | \begin{titlepage} 2 | 3 | \setlength\parindent{0pt} 4 | 5 | \definecolor{mygreen}{HTML}{9ABA5A} 6 | \definecolor{myblue}{HTML}{4F80BD} 7 | \textblockcolour{mygreen} 8 | \textblockrulecolour{white} 9 | 10 | % Green block% 11 | \begin{textblock}{6}(10,0) 12 | \rule{0mm}{420mm} 13 | \end{textblock} 14 | 15 | % Three green bars% 16 | \begin{textblock}{.02}(9.7,0) 17 | \rule{0mm}{420mm} 18 | \end{textblock} 19 | 20 | \begin{textblock}{.02}(9.8,0) 21 | \rule{0mm}{420mm} 22 | \end{textblock} 23 | 24 | \begin{textblock}{.02}(9.9,0) 25 | \rule{0mm}{420mm} 26 | \end{textblock} 27 | 28 | \begin{textblock}{3}(11,1) 29 | {\Huge \textbf{雷坛巨擘}\\[5pt] \textbf{扛鼎力作}} 30 | \end{textblock} 31 | 32 | \begin{textblock}{12}(1.8,6) 33 | \textblockcolour{} 34 | \includegraphics[scale=.8]{movable_type_transparent.png} 35 | \end{textblock} 36 | 37 | \begin{textblock}{4}(11,12.5) 38 | {\huge \textit{\lnotesauthor}}\\[5pt] 39 | {\Large \lnotesdate} 40 | \end{textblock} 41 | 42 | \TPshowboxestrue 43 | \setlength\TPboxrulesize{0.8pt} 44 | \textblockcolour{myblue} 45 | 46 | \begin{textblock}{14}(0.01,3) 47 | \centering 48 | ~\\[20pt] 49 | {\fontsize{32}{40}\selectfont \LaTeX\ \ \textsc{Notes}}\\[8pt] 50 | {\huge \textit{雷太赫排版系统简介}}\\[8pt] 51 | 第二版\ \ \lnotesversion\\[20pt] 52 | \end{textblock} 53 | ~ 54 | \end{titlepage} 55 | 56 | \newpage 57 | \thispagestyle{empty} 58 | ~ 59 | 60 | \begin{titlepage} 61 | %\thispagestyle{empty} 62 | \begin{center} 63 | \hrule\ \\[5pt] 64 | \Huge \LaTeX\ \ \textsc{Notes}\\[8pt] 65 | \Large \textit{雷太赫排版系统简介}\\[8pt] 66 | \normalsize 第二版\ \ \lnotesversion\\[20pt] 67 | \hrule\ \\[100pt] 68 | 69 | \huge \textit{包太雷}\\[8pt] 70 | \Large \lnotesdate\\[200pt] 71 | 72 | \textsc{Alpha Culture \& Education}\\[8pt] 73 | \huge \textit{一\ 品\ 文\ 化\ 教\ 育} 74 | \normalsize 75 | \end{center} 76 | \end{titlepage} 77 | -------------------------------------------------------------------------------- /src/gra-mp.tex: -------------------------------------------------------------------------------- 1 | \chapter{Metapost} 2 | \label{sec:mp} 3 | 4 | 前文提到Knuth的 \MF 可以用来设计矢量字体,但是输出的是点阵格式 PK。1980年代末 John D. Hobby\indexHobby{} \footnote{1985年斯坦福电脑博士,师从 Knuth。后加入贝尔实验室。} 设计了一种绘图语言及其编译器,也就是 \MP ,它从 \MF 那里获得了大量灵感和源代码。 5 | 6 | \MP 青出于蓝,它输出的是 EPS,而且支持彩色;\MF 只支持黑白,因为它是用来设计字体的。\MP 可以在图形上加文字标注,甚至插入 \TeX 源码。同时它也从 \MF 那里继承了一些缺点:数值变量精度较低,且绝对值不能超过4096;只支持部分 PostScript 功能。雷人可以考虑用 Asymptote 取代 \MP。 7 | 8 | 1994年之后,Taco Hoekwater\indexHoekwater{} \footnote{曾学习艺术史和哲学,1992年辍学加入荷兰军队。退伍后加入克鲁沃学术出版公司 (Kluwer Academic Publishers) ,2000年跳到精灵公司 (Elvenkind) 。参与开发\LuaTeX{}和 Con\TeX t。} 和 Hagen 等人接管了 \MP 的开发和维护工作。若想深入了解,可以参阅其用户手册\citep{Hobby_metapost}。 9 | 10 | \section{准备工作} 11 | 12 | \MP 的缺省长度单位是 bp,我们也可以使用 \autoref{tab:unit} 中的其它单位。也可以定义一个缩放系数,把坐标都转换为它的倍数,以后想缩放图形时只要修改这个系数即可。注意变量赋值符号是 \texttt{:=},而 \texttt{=} 则用于方程式。一个变量在同一源文件中只须定义一次,在其后的图形中都可以使用。 13 | 14 | 一个 \MP 源文件 (.mp) 可以包含多个图形,如 \autoref{exa:mp_src} 所示。代码中每行语句以分号结尾,注释以百分号起始。绘图命令包含在一对起始和结尾声明之间。文件结尾也要有一个结尾声明。 15 | 16 | \begin{example}[h] 17 | \begin{Code}[numbers=left] 18 | u := 10pt; %缩放系数 19 | beginfig(1); %图形起始 20 | ... %绘图命令 21 | endfig; %图形结尾 22 | 23 | beginfig(2); 24 | ... 25 | endfig; 26 | ... 27 | end %文件结尾 28 | \end{Code} 29 | \caption{\MP 源文件} 30 | \label{exa:mp_src} 31 | \end{example} 32 | 33 | 我们可以用命令行程序 \texttt{mpost}编译 \MP 源文件,生成一种特殊的 EPS,也就是 MPS;然后再把 MPS 插入 \LaTeX 源文件中使用。假设源文件名是 \texttt{fig.mp},可以执行以下编译命令, 34 | 35 | \begin{Code}[] 36 | mpost fig(.mp) 37 | \end{Code} 38 | 39 | 编译后会得到“fig.1, fig.2, $\cdots$”等文件,每个文件的后缀就是相应的图形起始声明中的编号。此编号在一个源文件中应保持唯一,否则后生成的文件就会覆盖前面的。 40 | 41 | 数字文件名后缀不便于管理,\MP 为此提供了一个变量来设置输出文件名。我们可以把下面代码加到源文件头部,编译输出的文件名就会是“fig-01.mps, fig-02.mps, $\cdots$”;或者在在每个图形前面声明各自的名字。 42 | 43 | \begin{Code}[] 44 | outputtemplate "%j-%2c.mps"; %`加在源文件头部` 45 | outputtemplate "flowchart.mps" %`加在每个图形前面` 46 | \end{Code} 47 | 48 | \texttt{xelatex} 不认识MPS格式,所以我们需要使用 \texttt{.eps} 后缀,或者用 \verb|\DeclareGraphicsRule| 命令把 \texttt{.mps} 声明为 EPS。 49 | 50 | \begin{Code}[] 51 | \DeclareGraphicsRule{.mps}{eps}{.mps}{} 52 | \end{Code} 53 | 54 | \section{基本图形对象} 55 | 56 | \subsection{点和直线} 57 | 58 | \MP 的缺省画笔直径为0.5bp,拿它画点,直径就是0.5bp;拿它画线,宽度也是0.5bp。我们可以用 \texttt{withpen} 选项为单个绘图命令设置画笔,也可以用 \texttt{pickup} 命令为之后所有的绘图命令设置画笔。 59 | 60 | 在 \autoref{exa:mp_line} 中,\texttt{draw} 命令把几个点以直线段连接起来。\texttt{drawdot} 命令在指定坐标画点,为了使它醒目些我们可以换了支粗一点的画笔。 61 | 62 | \begin{example}[htbp] 63 | \begin{FBTDemo}[numbers=left]{\includegraphics{line.mps}} 64 | filenametemplate "line.eps"; 65 | beginfig(1); 66 | draw (0,0)--(4u,0)--(2u,2u)--(0,0) 67 | withpen pencircle scaled .8pt; 68 | pickup pencircle scaled .8pt; 69 | draw (5u,0)--(9u,0)--(7u,2u)--cycle; 70 | pickup pencircle scaled 3pt; 71 | drawdot (10u,0); 72 | drawdot (14u,0); 73 | drawdot (12u,2u); 74 | endfig; 75 | \end{FBTDemo} 76 | \caption{\MP 点和直线} 77 | \label{exa:mp_line} 78 | \end{example} 79 | 80 | 几段直线或曲线可以构成一条路径 (path) ,在路径末尾加个 \texttt{cycle} 命令就构成封闭路径 (closed path) 。上例中两个三角形看起来都是封闭的,其实后面的才是真正的封闭路径。 81 | 82 | \subsection{预定义形状} 83 | 84 | \begin{example}[htbp] 85 | \begin{FBTDemo}[numbers=left]{\includegraphics{predefined.mps}} 86 | filenametemplate "predefined.eps"; 87 | beginfig(2); 88 | pickup pencircle scaled .8pt; 89 | draw fullcircle scaled 2u; 90 | draw halfcircle scaled 2u shifted (3u,0); 91 | draw quartercircle scaled 2u shifted (5u,0); 92 | draw fullcircle xscaled 4u yscaled 2u shifted (9u,0); 93 | draw unitsquare scaled 2u shifted (12u,-u); 94 | draw unitsquare xscaled 4u yscaled 2u shifted (15u,-u); 95 | endfig; 96 | \end{FBTDemo} 97 | \caption{\MP 预定义形状} 98 | \label{exa:mp_predefined} 99 | \end{example} 100 | 101 | \texttt{fullcircle} 命令以原点为圆心画一个单位圆,类似的预定义形状还有 \texttt{halfcircle, quartercircle, unitsquare} 等。注意单位正方形的参考点在左下而不在其中心。在 \autoref{exa:mp_predefined} 中,我们使用了不同方向的缩放系数 \texttt{xscaled} 和 \texttt{yscaled},把把圆形和正方形变为椭圆和长方形。 102 | 103 | \subsection{曲线} 104 | 105 | 如果把画直线时坐标点之间的 \texttt{--} 换成 \texttt{..},我们就得到一条曲线。直线和曲线共用一些点时,它们也可以混在一条语句里画。 106 | 107 | \begin{example}[htbp] 108 | \begin{FBTDemo}[numbers=left]{\includegraphics{curve.mps}} 109 | filenametemplate "curve.eps"; 110 | beginfig(3); 111 | pickup pencircle scaled .8pt; 112 | draw (0,0)..(4u,1u)..(8u,0); 113 | draw (9u,0){up}..(13u,1u){right}..(17u,0){down}; 114 | draw (18u,0){up}...(22u,1u){right}...(26u,0){down}; 115 | draw (0,2u)..(2u,3u)..(6u,3u)..(8u,2u); 116 | draw (9u,2u)..(11u,3u)..tension 1.5..(15u,3u)..(17u,2u); 117 | draw (18u,2u)..(20u,3u)..tension 1.5 118 | and 1..(24u,3u)..(26u,2u); 119 | draw (0,4u)..(4u,5u)..(8u,4u); 120 | draw (9u,4u){curl 0}..(13u,5u)..{curl 0}(17u,4u); 121 | draw (18u,4u){curl 100}..(22u,5u)..{curl 100}(26u,4u); 122 | pickup pencircle scaled 3pt; 123 | drawdot (0,0); drawdot (4u,1u); drawdot (8u,0); 124 | drawdot (9u,0); drawdot (13u,1u); drawdot (17u,0); 125 | drawdot (18u,0); drawdot (22u,1u); drawdot (26u,0); 126 | drawdot (0,2u); drawdot (2u,3u); drawdot (6u,3u); 127 | drawdot (8u,2u); 128 | drawdot (9u,2u); drawdot (11u,3u); drawdot (15u,3u); 129 | drawdot (17u,2u); 130 | drawdot (18u,2u); drawdot (20u,3u); drawdot (24u,3u); 131 | drawdot (26u,2u); 132 | drawdot (0,4u); drawdot (4u,5u); drawdot (8u,4u); 133 | drawdot (9u,4u); drawdot (13u,5u); drawdot (17u,4u); 134 | drawdot (18u,4u); drawdot (22u,5u); drawdot (26u,4u); 135 | endfig; 136 | \end{FBTDemo} 137 | \caption{\MP 曲线} 138 | \label{exa:mp_curve} 139 | \end{example} 140 | 141 | \MP 的曲线用三次贝塞尔算法实现,我们还可以在曲线上使用方向 (direction) 、张力 (tension) 和曲率 (curl) 等控制。\autoref{exa:mp_curve} 中左列三图未加任何控制 (代码第四、七、十行) ,下排后两图使用了方向控制 (代码第五、六行) ,中排后两图使用了张力 (代码第八、九行) ,上排后两图使用了曲率 (代码第11、12行) 。 142 | 143 | \section{图形控制} 144 | \subsection{线型} 145 | 146 | 在绘制图形时,我们不仅可以变换线宽,也可以使用多种线型。 147 | 148 | \begin{example}[htbp] 149 | \begin{FBTDemo}[numbers=left]{\includegraphics{dashed.mps}} 150 | filenametemplate "dashed.eps"; 151 | beginfig(4); 152 | pickup pencircle scaled .8pt; 153 | draw (0,0)--(10u,0) dashed withdots; 154 | draw (0,1u)--(10u,1u) dashed withdots scaled 2; 155 | draw (0,2u)--(10u,2u) dashed evenly; 156 | draw (0,3u)--(10u,3u) dashed evenly scaled 2; 157 | endfig; 158 | \end{FBTDemo} 159 | \caption{\MP 线型} 160 | \label{exa:mp_dashed} 161 | \end{example} 162 | 163 | \subsection{箭头} 164 | 165 | 箭头画法如下,注意反向箭头需要把两个坐标用一对圆括号括起来。 166 | 167 | \begin{example}[htbp] 168 | \begin{FBTDemo}[numbers=left]{\includegraphics{arrow.mps}} 169 | filenametemplate "arrow.eps"; 170 | beginfig(5); 171 | pickup pencircle scaled .8pt; 172 | drawarrow (0,0)--(10u,0); 173 | drawarrow reverse ((0,1u)--(10u,1u)); 174 | drawdblarrow (0,2u)--(10u,2u); 175 | endfig; 176 | \end{FBTDemo} 177 | \caption{\MP 箭头} 178 | \label{exa:mp_arrow} 179 | \end{example} 180 | 181 | \subsection{彩色和填充} 182 | 183 | \MP 不能使用 \texttt{xcolor} 宏包,它只支持 rgb 和 cmyk 色彩模式,预定义了黑、白、红、绿、蓝等颜色。自定义颜色的方法如下, 184 | 185 | \begin{Code}[] 186 | color c[]; 187 | c1 := .9red + .6green + .3blue; 188 | c2 := (.9,.6,.3); 189 | \end{Code} 190 | 191 | 绘图命令一般可以通过 \texttt{withcolor} 选项来使用各种颜色。 192 | 193 | \begin{example}[htbp] 194 | \begin{FBTDemo}[numbers=left]{\includegraphics{color.mps}} 195 | filenametemplate "color.eps"; 196 | beginfig(6); 197 | pickup pencircle scaled .8pt; 198 | draw (0,0)--(10u,0) withcolor red; 199 | draw (0,1u)--(10u,1u) withcolor green; 200 | draw (0,2u)--(10u,2u) withcolor blue; 201 | endfig; 202 | \end{FBTDemo} 203 | \caption{\MP 彩色} 204 | \label{exa:mp_color} 205 | \end{example} 206 | 207 | 封闭路径可以用 \texttt{fill} 命令来填充。\autoref{exa:mp_fill} 中第三、四行代码定义了一个 \texttt{path} 变量,以便后面重用。另一个命令 \texttt{filldraw} 可以看作是 \texttt{fill+draw},它除了填充外还会把路径用指定的画笔画一遍。然而不幸的是画边缘和填充内部只能用同一种颜色,所以它的用处不大。 208 | 209 | \begin{example}[htbp] 210 | \begin{FBTDemo}[numbers=left]{\includegraphics{fill.mps}} 211 | filenametemplate "fill.eps"; 212 | beginfig(7); 213 | path p; 214 | p := (0,0)--(2,0)--(1,1.732)--cycle; 215 | fill p scaled u; 216 | fill p scaled u shifted (3u,0) withcolor red; 217 | fill p scaled u shifted (6u,0) withcolor green; 218 | fill p scaled u shifted (9u,0) withcolor blue; 219 | endfig; 220 | \end{FBTDemo} 221 | \caption{\MP 填充} 222 | \label{exa:mp_fill} 223 | \end{example} 224 | 225 | 除了为每个绘图命令单独指定颜色,我们也可以使用一个全局命令 \texttt{drawoption},使得其后的绘图命令都使用某种颜色。 226 | 227 | \begin{Code}[] 228 | drawoption(withcolor blue); 229 | \end{Code} 230 | 231 | \section{图形变换} 232 | 233 | 除了前文提到的缩放,我们还可以对路径进行平移 (\texttt{shifted}) 、旋转 (\texttt{rotated}) 、定点旋转 (\texttt{rotatedaround}) 、镜像 (\texttt{reflectedabout}) 、倾斜 (\texttt{slanted})等变换操作。平移的参数是移到的坐标点;旋转的参数是角度,旋转中心是原点;定点旋转的参数是旋转中心;倾斜的参数是倾斜比;镜像的参数是两点确定的一条直线。 234 | 235 | 这些变换操作可以任意结合使用。由于旋转是围绕原点进行的,所以要注意平移和旋转的顺序。\autoref{exa:mp_transform} 中重用了 \autoref{exa:mp_fill} 中定义的路径。 236 | 237 | \begin{example}[htbp] 238 | \begin{FBTDemo}[numbers=left]{\includegraphics{transform.mps}} 239 | filenametemplate "transform.eps"; 240 | beginfig(8); 241 | pickup pencircle scaled .8pt; 242 | draw p scaled u; 243 | draw p scaled u shifted (3u,0) rotated 30; 244 | draw p scaled u rotated 30 shifted (5u,0); 245 | draw p scaled u rotatedaround ((2u,0),30) shifted (7u,0) ; 246 | draw p scaled u slanted 1 shifted (10u,0); 247 | draw p scaled u reflectedabout ((0,0),(2u,0)) 248 | shifted (13u,0); 249 | draw p xscaled 2u yscaled u shifted (16u,0); 250 | endfig; 251 | \end{FBTDemo} 252 | \caption{\MP 图形变换} 253 | \label{exa:mp_transform} 254 | \end{example} 255 | 256 | \section{标注} 257 | 258 | \texttt{label} 命令可以在指定位置加文字标注,该命令有八种后缀,对应着指定坐标点的八个方位 (见 \autoref{tab:mp_label}) 。\texttt{dotlabel} 命令在加标注同时画了个点,它也用同样的方法表示标注的方位。 259 | 260 | \begin{table}[htbp] 261 | \centering 262 | \caption{ \texttt{label} 命令的方位} 263 | \label{tab:mp_label} 264 | \begin{tabular}{llllllll} 265 | \toprule 266 | top & 上 & bottom & 下 & lft & 左 & rt & 右 \\ 267 | ulft & 左上 & urt & 右上 & llft & 左下 & lrt & 右下 \\ 268 | \bottomrule 269 | \end{tabular} 270 | \end{table} 271 | 272 | 我们也可以用一对 \texttt{btex} 和 \texttt{etex} 来嵌入一些 \TeX 内容,比如数学标注 (\autoref{exa:mp_label} 代码第14、18、19行) 。\texttt{mpost} 会把 \TeX 内容存到一个临时文件,调用 \texttt{tex} 编译它生成 DVI; \texttt{mpost} 把 DVI 转换为\MP 内容存到一个 \texttt{.mpx} 文件中,然后再把它嵌入输出的 MPS。 273 | 274 | \begin{example}[htbp] 275 | \begin{FBTDemo}[numbers=left]{\includegraphics{label.mps}} 276 | prologues:=3; 277 | filenametemplate "label.eps"; 278 | beginfig(9); 279 | pickup pencircle scaled .8pt; 280 | draw unitsquare xscaled 8u yscaled 4u; 281 | label.top ("top", (4u,4u)); 282 | label.bot ("bottom", (4u,0)); 283 | label.lft ("left", (0,2u)); 284 | label.rt ("right", (8u,2u)); 285 | label.ulft ("upper left", (0,4u)); 286 | label.urt ("upper right", (8u,4u)); 287 | label.llft ("lower left", (0,0)); 288 | label.lrt ("lower right", (8u,0)); 289 | label.rt (btex $E=mc^2$ etex, (2u,2u)); 290 | drawarrow (16u,0)--(22u,0); 291 | drawarrow (16u,0)--(16u,4u); 292 | dotlabel.bot ("(0,0)", (16u,0)); 293 | label.bot (btex $x$ etex, (22u,0)); 294 | label.lft (btex $y$ etex, (16u,4u)); 295 | endfig; 296 | \end{FBTDemo} 297 | \caption{\MP 标注} 298 | \label{exa:mp_label} 299 | \end{example} 300 | 301 | \MP 中也可以嵌入复杂的 \LaTeX 代码,比如字体和语言等的设置。这时需要在源文件头尾加两对 \texttt{verbatimtex} 和 \texttt{etex} 命令,分别包含前置和后置处理代码,原图形代码放在这两对命令之间。可惜\MP 不支持嵌入 \XeLaTeX 代码,所以其文字标注不能使用后者的字体功能。 302 | 303 | MPS缺省不嵌入字体,当它包含文字时,GSview 就不能正常查看;但是把这种MPS插入文档生成的PDF还是正常的,因为驱动会自行处理字体。我们可以强制 MPS 嵌入字体,一种方法是在源文件头部加一行语句 (\autoref{exa:mp_label} 代码第一行) ,另一种方法是在编译时加一个参数, 304 | 305 | \begin{Code}[] 306 | mpost \prologues:=3; input fig.mp 307 | \end{Code} 308 | 309 | \section{编程} 310 | \subsection{数据类型和变量} 311 | 312 | \MP 的基本数据类型有:\texttt{numeric}, \texttt{pair}, \texttt{path}, \texttt{pen}, \texttt{color}, \texttt{cmykcolor}, \texttt{transform}, \texttt{string}, \texttt{boolean}, \texttt{picture}。我们已经接触过其中几种,比如缩放系数 \texttt{u} 是 \texttt{numeric},点的坐标是 \texttt{pair},几个点用直线连起来是一个 \texttt{path},\texttt{pencircle} 是一种 \texttt{pen},红、绿、蓝都是 \texttt{color},\texttt{scaled, shifted, rotated} 都是 \texttt{transform}。 313 | 314 | numeric 类型变量的精度是1/65536,它的绝对值不能超过4096,在计算过程中数值可以达到32768。这样的规定也应归功于当年的电脑硬件,不过对于科技文档插图而言,4096一般还是够用的。 315 | 316 | 除了缺省的 numeric,其它变量在使用之前都需要用数据类型来显式声明。相同类型的变量可以在一行语句中声明,但是带下标的变量不能放在同一行 (这个规定很蹊跷) 。 317 | 318 | \begin{Code} 319 | numeric x,y,z; %正确 320 | numeric x1,x2,x3; %错误 321 | numeric x[]; %正确 322 | \end{Code} 323 | 324 | \subsection{数学运算} 325 | 326 | \MP 中可以使用普通的运算符,比如 \verb|+ - * /|;也提供一些特殊的运算符,比如\verb|a++b| 表示$\sqrt{a^2+b^2}$,\verb|a+-+b| 表示$\sqrt{a^2-b^2}$;另外 \autoref{tab:mp_math_func} 列出一些常用数学函数。 327 | 328 | \begin{table}[htbp] 329 | \centering 330 | \caption{\MP 数学函数} 331 | \label{tab:mp_math_func} 332 | \begin{tabular}{llll} 333 | \toprule 334 | \texttt{abs} & 绝对值 & \texttt{mexp} & 指数 \\ 335 | \texttt{round} & 四舍五入 & \texttt{mlog} & 对数 \\ 336 | \texttt{ceiling} & 向上圆整 & \texttt{sind} & 正弦 \\ 337 | \texttt{floor} & 向下圆整 & \texttt{cosd} & 余弦 \\ 338 | \texttt{mod} & 模余 & \texttt{normaldeviate} & 正态分布随机数 \\ 339 | \texttt{sqrt} & 开方 & \texttt{uniformdeviate} & 均匀分布随机数 \\ 340 | \bottomrule 341 | \end{tabular} 342 | \end{table} 343 | 344 | \subsection{循环} 345 | 346 | 当执行重复任务时,循环语句可以让程序变得简洁 (见 \autoref{exa:mp_loop}) 。 347 | 348 | \begin{example}[h] 349 | \begin{FBTDemo}[numbers=left]{\includegraphics{loop.mps}} 350 | filenametemplate "loop.eps"; 351 | beginfig(10); 352 | pickup pencircle scaled .8pt; 353 | drawarrow (0,0)--(10u,0); 354 | drawarrow (0,0)--(0,4u); 355 | draw (0,0) %注意这里没有分号 356 | for x=1 upto 3: ..(x*x,x)*u endfor; 357 | endfig; 358 | \end{FBTDemo} 359 | \caption{\MP 循环} 360 | \label{exa:mp_loop} 361 | \end{example} 362 | 363 | 循环语句缺省步长是1,我们也可以改用其它步长。\texttt{upto} 其实就是 \texttt{step 1 until} 的简写方式。 364 | 365 | \begin{Code}[] 366 | for x=1 step .5 until 3: 367 | \end{Code} 368 | 369 | \bibliographystyle{unsrtnat} 370 | \bibliography{lnotes2} 371 | -------------------------------------------------------------------------------- /src/gra-pgf.tex: -------------------------------------------------------------------------------- 1 | \chapter{PGF} 2 | \label{sec:pgf} 3 | 4 | PGF 和 Beamer 的作者都是 Till Tantau (1975--)\indexTantau{} \footnote{柏林工业大学1999年电脑学士,2001年数学学士,2003年电脑博士。2004年伯克利访问学者,2005年吕贝克大学 (University of Lübeck) 理论计算机研究所教授。}。Tantau 当初开发 Beamer 是为了准备2003年他的博士学位论文答辩,之后它在 CTAN 上流行开来。2005年 PGF 从 Beamer 项目中分离出来,成为一个独立的宏包\citep{Tantau_pgf}。 5 | 6 | \section{准备工作} 7 | 8 | 一般人们并不直接使用 PGF 底层命令,而是通过它前端 TikZ 来调用。在引用 \texttt{tikz} 宏包之前,用户需要设置 PGF 系统驱动。比如 \texttt{dvipdfmx} 的设置方法如下,使用 \texttt{pdflatex} 和 \texttt{xelatex} 时,它知道驱动是谁。 9 | 10 | \begin{Code}[] 11 | \def\pgfsysdriver{pgfsys-dvipdfmx.def} 12 | \usepackage{tikz} 13 | \end{Code} 14 | 15 | PGF 的缺省长度单位是1cm,我们也可以改用其它单位。注意这样预定义的长度单位有时会失效,这可能是 PGF 的 bug。 16 | 17 | \begin{Code}[] 18 | \pgfsetxvec{\pgfpoint{10pt}{0}} 19 | \pgfsetyvec{\pgfpoint{0}{10pt}} 20 | \end{Code} 21 | 22 | TikZ 提供 \verb|\tikz| 命令和 \texttt{tikzpicture} 环境,具体绘图指令可以放在 \verb|\tikz| 后面,也可以放在 \texttt{tikzpicture} 中间。两者效果相同,用户可以任意选择。为了节省空间,本节的示例将省略部分环境代码。 23 | 24 | \begin{Code}[] 25 | \tikz ... %绘图命令 26 | \begin{tikzpicture} 27 | ... %绘图命令 28 | \end{tikzpicture} 29 | \end{Code} 30 | 31 | \ref{sec:pst_setup} 小节提到,为了节省编译时间,我们可以用 \texttt{preview} 宏包生成独立的图形文件。对于 PGF 我们也可以如法炮制,虽然这样做不是必须的。 32 | 33 | \begin{example}[htbp] 34 | \begin{Code}[] 35 | \documentclass{article} 36 | \usepackage[active,tightpage,xetex]{preview} 37 | \usepackage{tikz} 38 | 39 | \begin{document} 40 | \begin{preview} 41 | \begin{tikzpicture} 42 | ... 43 | \end{tikzpicture} 44 | \end{preview} 45 | \end{document} 46 | \end{Code} 47 | \caption{制作独立的PGF图形文件} 48 | \label{exa:pgf} 49 | \end{example} 50 | 51 | \section{基本图形对象} 52 | \subsection{直线和矩形} 53 | 54 | PGF 绘图命令的语法和 \MP 有点类似。在 \autoref{exa:pgf_line} 中,\verb|\draw| 称为一个命令,它后面的 \texttt{--}, \texttt{cycle}, \texttt{rectangle} 等称为操作,\texttt{[rounded corners]} 称作一个选项。\texttt{--} 用来画直线,\texttt{rectangle} 画矩形; \texttt{cycle} 用来封闭路径,前两个三角形看起来一样,其实只有第二个才是真正的封闭路径;\texttt{[rounded corners]} 用来给图形加圆角。 55 | 56 | \begin{example}[htbp] 57 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=4]{pgf.pdf}} 58 | \draw (0,0)--(4,0)--(2,2)--(0,0); 59 | \draw (5,0)--(9,0)--(7,2)--cycle; 60 | \draw [rounded corners] (10,0)--(14,0)--(12,2)--cycle; 61 | \draw (15,0) rectangle (19,2); 62 | \draw [rounded corners] (20,0) rectangle (24,2); 63 | \end{FBTDemo} 64 | \caption{PGF 直线和矩形} 65 | \label{exa:pgf_line} 66 | \end{example} 67 | 68 | 操作都需要一个起始点参数,比如第一行代码第一个 \texttt{--} 操作的起始点是(0,0);第二行 \texttt{cycle} 的起始点是(5,0);第四行 \texttt{rectangle} 的起始点是(15,0),也就是矩形的一个顶点,(19,2)是其对角顶点。 69 | 70 | \subsection{圆、椭圆、弧} 71 | 72 | 圆、椭圆、弧等形状的画法如下。圆的参数是圆心和半径,椭圆的参数是中心、长径、短径。圆弧的参数是起始点,起始角度、终止角度、半径;椭圆弧则把半径换成了长径和短径。 73 | 74 | \begin{example}[htbp] 75 | \begin{FBTDemo}[]{\includegraphics[page=5]{pgf.pdf}} 76 | \draw (1,1) circle (1); 77 | \draw (5,1) ellipse (2 and 1); 78 | \draw (10,1) arc (0:270:1); 79 | \draw (15,1) arc (0:270:2 and 1); 80 | \end{FBTDemo} 81 | \caption{PGF 圆、椭圆、弧} 82 | \label{exa:pgf_circle} 83 | \end{example} 84 | 85 | \vspace{-10pt} 86 | \subsection{曲线} 87 | 88 | 我们把直线的 \texttt{--} 换成 \texttt{..},就得到贝塞尔曲线,它需要至少一个控制点 (\autoref{exa:pgf_curve} 第一行) 。抛物线用 \texttt{parabola},代码第六行的(5,1)是它的起始点,(7.414,2)是终止点,\texttt{bend (6,0)}指定了顶点。 89 | 90 | \begin{example}[htbp] 91 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=6]{pgf.pdf}} 92 | \draw (0,0)..controls (2,2) and (4,2)..(4,0); 93 | \filldraw (0,0) circle (.1) 94 | (2,2) circle (.1) 95 | (4,2) circle (.1) 96 | (4,0) circle (.1); 97 | \draw (5,1) parabola bend (6,0) (7.414,2); 98 | \filldraw (5,1) circle (.1) 99 | (6,0) circle (.1) 100 | (7.414,2) circle (.1); 101 | \draw (8,0) sin (10,2) cos (12,0); 102 | \filldraw (8,0) circle(.1) 103 | (10,2) circle(.1) 104 | (12,0) circle(.1); 105 | \end{FBTDemo} 106 | \caption{PGF 曲线} 107 | \label{exa:pgf_curve} 108 | \end{example} 109 | 110 | 正弦和余弦都需要起、止点,第11行代码中的余弦操作看起来少一个起始点,其实它是接着正弦的末端画的。\verb|\filldraw| 命令是为了标明曲线上的点,这方面 PSTricks 比 \MP 和 PGF 都方便,一个 \texttt{showpoints} 参数就都搞定了。 111 | 112 | \subsection{网格} 113 | 114 | 网格的画法如下,其缺省步长是1cm。\texttt{grid} 操作需要起止点两个参数。\texttt{help lines} 参数指示用 0.2pt 的灰线。 115 | 116 | \begin{example}[htbp] 117 | \begin{FBTDemo}[]{\includegraphics[page=7]{pgf.pdf}} 118 | \draw [step=5pt] (0,0) grid (3,2); 119 | \draw [help lines,step=5pt] (4,0) grid (7,2); 120 | \end{FBTDemo} 121 | \caption{PGF 网格} 122 | \label{exa:grid} 123 | \end{example} 124 | 125 | \section{图形控制} 126 | \subsection{箭头} 127 | 128 | 各种箭头的画法如下: 129 | 130 | \begin{example}[htbp] 131 | \begin{FBTDemo}[]{\includegraphics[page=9]{pgf.pdf}} 132 | \draw [->] (0,0)--(9,0); 133 | \draw [<-] (0,1)--(9,1); 134 | \draw [<->] (0,2)--(9,2); 135 | \draw [>->>] (0,3)--(9,3); 136 | \draw [|<->|] (0,4)--(9,4); 137 | \end{FBTDemo} 138 | \caption{PGF 箭头} 139 | \label{exa:pgf_arrow} 140 | \end{example} 141 | 142 | \subsection{线宽和线型} 143 | 144 | PGF中线条的缺省宽度是0.4pt,线型是实线。改变线宽和线型的方法见 \autoref{exa:pgf_linewidth}。 145 | 146 | \begin{example}[htbp] 147 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=8]{pgf.pdf}} 148 | \draw [line width=2pt] (0,0)--(9,0); 149 | \draw [dotted] (0,1)--(9,1); 150 | \draw [densely dotted] (0,2)--(9,2); 151 | \draw [loosely dotted] (0,3)--(9,3); 152 | \draw [dashed] (0,4)--(9,4); 153 | \draw [densely dashed] (0,5)--(9,5); 154 | \draw [loosely dashed] (0,6)--(9,6); 155 | \end{FBTDemo} 156 | \caption{PGF 线宽和线型} 157 | \label{exa:pgf_linewidth} 158 | \end{example} 159 | 160 | \subsection{颜色和填充} 161 | 162 | PGF可以使用 \verb|xcolor| 宏包的色彩功能。颜色和填充的用法见 \autoref{exa:pgf_color},其中 \verb|\filldraw| 命令可以用不同颜色画线和填充。注意封闭路径才可以填充。PGF 还有十几种填充模式,可惜 \XeTeX 不支持。 163 | 164 | \begin{example}[htbp] 165 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=10]{pgf.pdf}} 166 | \draw[Red] (0,0)--(9,0); 167 | \draw[Green] (0,1)--(9,1); 168 | \draw[Blue] (0,2)--(9,2); 169 | \fill[Wheat] (11,1) circle (1); 170 | \filldraw[draw=Silver, fill=Lavender] (14,1) circle (1); 171 | \end{FBTDemo} 172 | \caption{PGF 颜色和填充} 173 | \label{exa:pgf_color} 174 | \end{example} 175 | 176 | \subsection{渐变和阴影} 177 | 178 | \verb|\shade| 命令可以产生渐变和阴影效果,缺省是从上到下,灰色渐变为白色。我们也可以使用其它方向和颜色的渐变(\autoref{exa:pgf_shade})。 179 | 180 | \begin{example}[htbp] 181 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=12]{pgf.pdf}} 182 | \shade (0,0) rectangle (2,2); 183 | \shade[left color=Red,right color=Orange] (3,0) rectangle (5,2); 184 | \shade[inner color=Red,outer color=Orange] (6,0) rectangle (8,2); 185 | \shade[ball color=Blue] (10,1) circle (1); 186 | \end{FBTDemo} 187 | \caption{PGF 阴影} 188 | \label{exa:pgf_shade} 189 | \end{example} 190 | 191 | \subsection{样式} 192 | 193 | PGF 比 \MP 和 PSTricks 多了一个有趣的概念:样式 (style) ,它像面向对象的类一样可以继承,语法和 HTML 的 CSS 相近。在 \autoref{exa:pgf_style} 中我们先定义了两种样式,然后就可以在绘图命令中使用它们, 194 | 195 | \begin{example}[htbp] 196 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=13]{pgf.pdf}} 197 | \tikzset{ 198 | myline/.style={line width=2pt}, 199 | myblueline/.style={myline,Blue} 200 | } 201 | \draw[myline] (0,0)--(9,0); 202 | \draw[myblueline] (0,1)--(9,1); 203 | \end{FBTDemo} 204 | \caption{PGF 全局样式} 205 | \label{exa:pgf_style} 206 | \end{example} 207 | 208 | 除了用 \verb|\tikzset| 命令定义样式,我们也可以在 \texttt{tikzpicture} 环境头部声明样式。前者是全局有效,后者则是局部范围有效。 209 | 210 | \begin{example}[htbp] 211 | \begin{Code}[numbers=left] 212 | \begin{tikzpicture}[ 213 | thickline/.style=2pt, 214 | bluethickline/.style={thickline,color=blue} 215 | ] 216 | \end{tikzpicture} 217 | \end{Code} 218 | \caption{PGF 局部样式} 219 | \label{exa:pgf_style_scope} 220 | \end{example} 221 | 222 | 注意在样式中预定义长度单位有时会失效,所以最好使用绝对单位。 223 | 224 | \section{图形变换} 225 | 226 | 我们可以对图形对象进行一些变换操作,比如缩放 (scale), 平移 (shift), 倾斜 (slant), 旋转 (rotate), 定点旋转 (rotate around) 等。注意如果两种操作同时进行,它们是有顺序的。预定义的长度单位在这里对单向平移选项 (xshift 或 yshift) 失效。 227 | 228 | \begin{example}[htbp] 229 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=14]{pgf.pdf}} 230 | \draw (0,0) rectangle (2,2); 231 | \draw[shift={(3,0)},scale=1.5] (0,0) rectangle (2,2); 232 | \draw[xshift=70pt,xscale=1.5] (0,0) rectangle (2,2); 233 | \draw[xshift=125pt,rotate=45] (0,0) rectangle (2,2); 234 | \draw[xshift=140pt,xslant=1] (0,0) rectangle (2,2); 235 | \draw[xshift=175pt,rotate around={45:(2,2)}] (0,0) rectangle (2,2); 236 | \end{FBTDemo} 237 | \caption{PGF 图形变换} 238 | \label{exa:pgf_transform} 239 | \end{example} 240 | 241 | \section{示意图} 242 | \subsection{节点} 243 | 244 | PGF 中的节点 (node) 可以是简单的标签,也可以有各种形状的边框,还可以有各种复杂的属性。比如下例中的 \texttt{box} 样式,它的边框是矩形,有圆角;它有最小宽度、高度、文字和边框的距离,边框和填充颜色等属性。 245 | 246 | \begin{example}[htbp] 247 | \begin{Code}[numbers=left] 248 | \tikzset{ 249 | box/.style={rectangle,rounded corners=5pt, 250 | minimum width=50pt,minimum height=20pt,inner sep=5pt, 251 | draw=Silver,fill=Lavender} 252 | } 253 | \end{Code} 254 | \caption{PGF \texttt{box} 样式} 255 | \label{exa:pgf_box} 256 | \end{example} 257 | 258 | \subsection{流程图} 259 | 260 | 除了上述属性,节点还可以有名字、位置等属性。在 \autoref{exa:pgf_transform} 中,我们先画了三个有名字和边框的节点,也就是文本框;然后用两跳箭头连线把文本框连接起来,注意连接时要引用文本框的名字;接着在连线上加了两个没有名字和边框的标签。 261 | 262 | \begin{example}[htbp] 263 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=15]{pgf.pdf}} 264 | \node[box] (tex) at(0,0) {.tex}; 265 | \node[box] (xdv) at(12,0) {.xdv}; 266 | \node[box] (pdf) at(24,0) {.pdf}; 267 | \draw[->] (tex)--(xdv); 268 | \draw[->] (xdv)--(pdf); 269 | \node at (6,1) {xelatex}; 270 | \node at (18,1) {dvipdfmx}; 271 | \end{FBTDemo} 272 | \caption{PGF 流程图} 273 | \label{exa:pgf_flowchart} 274 | \end{example} 275 | 276 | \autoref{exa:pgf_flowchart} 中的节点都使用了绝对位置,我们还可以使用更灵活一点的相对位置。在 \autoref{exa:pgf_better_flowchart} 中,我们把 xdv 节点设在在 tex 节点右边 70pt 处 (前面定义的基本长度单位是 10pt) ,而 pdf 节点又在 xdv 节点右边 70pt 处。 277 | 278 | \begin{example}[htbp] 279 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=16]{pgf.pdf}} 280 | \node[box] (tex) {.tex}; 281 | \node[box,right=7 of tex] (xdv) {.xdv}; 282 | \node[box,right=7 of xdv] (pdf) {.pdf}; 283 | \path (tex) edge[->] node[auto] {xelatex} (xdv) 284 | (xdv) edge[->] node[auto] {xdvipdfmx} (pdf); 285 | \end{FBTDemo} 286 | \caption{PGF 又一个流程图} 287 | \label{exa:pgf_better_flowchart} 288 | \end{example} 289 | 290 | 节点间的连线换为专门用来连接节点的 \texttt{edge};标签也改成相对位置,自动排列在 \texttt{edge} 上方。 291 | 292 | \subsection{树} 293 | 294 | \autoref{exa:pgf_tree} 是一棵简单的树。\texttt{child} 关键字用来声明子节点; \texttt{sibling distance} 选项可以控制相邻节点之间的距离,预定义长度单位对此选项失效。 295 | 296 | \begin{example}[htbp] 297 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=17]{pgf.pdf}} 298 | \begin{tikzpicture}[sibling distance=80pt] 299 | \node[box] {TeX} 300 | child {node[box] {Plain\TeX}} 301 | child {node[box] {\LaTeX} 302 | child {node[box] {amsmath}} 303 | child {node[box] {graphicx}} 304 | child {node[box] {hyperref}} 305 | }; 306 | \end{tikzpicture} 307 | \end{FBTDemo} 308 | \caption{PGF 好大一棵树} 309 | \label{exa:pgf_tree} 310 | \end{example} 311 | 312 | \subsection{预定义节点形状} 313 | 314 | PGF中节点的基本形状只有矩形和圆形,\texttt{shapes.geometric} 库预定义了其他一些形状,比如正多边形 (regular polygon), 等腰三角形 (isosceles triangle), 菱形 (diamond), 梯形 (trapezium), 半圆 (semicircle), 扇形 (circular sector), 星形 (star), 圆柱 (cylinder) 等形状。如要使用某库的功能,需要先引用它,其引用方法类似于宏包的引用,见 \autoref{exa:pgf_shape} 代码第一行。 315 | 316 | \begin{example}[htbp] 317 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=18]{pgf.pdf}} 318 | \usetikzlibrary{shapes.geometric} 319 | \node[diamond,draw] at(0,0) {}; 320 | \node[trapezium,draw] at(2,0) {}; 321 | \node[semicircle,draw] at(4,0) {}; 322 | \node[star,draw] at(6,0) {}; 323 | \node[isosceles triangle,draw] at(8,0) {}; 324 | \node[circular sector,draw] at(10,0) {}; 325 | \node[cylinder,draw] at(12,0) {}; 326 | \end{FBTDemo} 327 | \caption{PGF 预定义节点形状} 328 | \label{exa:pgf_shape} 329 | \end{example} 330 | 331 | \autoref{exa:pgf_polygon} 中代码第一行指出每个节点都是正多边形,没有这个声明的话每个节点都要重复拼写 \texttt{regular polygon}。 332 | 333 | \begin{example}[htbp] 334 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=19]{pgf.pdf}} 335 | \begin{tikzpicture}[every node/.style={regular polygon}] 336 | \node[regular polygon sides=3,draw] at(2,0) {}; 337 | \node[regular polygon sides=4,draw] at(4,0) {}; 338 | \node[regular polygon sides=5,draw] at(6,0) {}; 339 | \node[regular polygon sides=6,draw] at(8,0) {}; 340 | \node[regular polygon sides=7,draw] at(10,0) {}; 341 | \node[regular polygon sides=8,draw] at(12,0) {}; 342 | \end{tikzpicture} 343 | \end{FBTDemo} 344 | \caption{PGF 预定义正多边形节点} 345 | \label{exa:pgf_polygon} 346 | \end{example} 347 | 348 | \section{编程} 349 | 350 | \subsection{循环语句} 351 | 352 | 包老师正准备跟 \autoref{exa:pgf_polygon} 里那样的冗长代码拼个你死我活,猛然发现 TikZ 提供了循环语句。Only you 能精简我代码,Only you\~{}\~{}\~{} 353 | 354 | \begin{Code}[numbers=left] 355 | \begin{tikzpicture}[every node/.style={regular polygon}] 356 | \foreach \x in {3,4,5,6,7,8}{ 357 | \node[regular polygon sides=\x, draw] at(\x*2,0) {}; 358 | } 359 | \end{tikzpicture} 360 | \end{Code} 361 | 362 | \begin{example}[htbp] 363 | \begin{Demo} 364 | \includegraphics[page=20]{pgf.pdf} 365 | \end{Demo} 366 | \caption{PGF 循环语句} 367 | \label{exa:pgf_loop} 368 | \end{example} 369 | 370 | \subsection{数据图} 371 | 372 | PGF 有强大的数据绘图 (plot) 功能,支持多种绘图方法:直接给点,读取外部数据文件,函数绘图,调用 Gnuplot。其中函数绘图可以调用 PGF 数学引擎,进行基本算术和20多种函数的运算。 373 | 374 | \autoref{exa:pgf_plot} 是一个简单的指数函数,其中标注使用了 \LaTeX 数学公式,\texttt{domain} 选项用来设置值域。 375 | 376 | \begin{example}[htbp] 377 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=21]{pgf.pdf}} 378 | \draw[->] (-0.2,0)--(6,0) node[right] {$x$}; 379 | \draw[->] (0,-0.2)--(0,6) node[above] {$f(x)$}; 380 | \draw[domain=0:4] plot (\x,{0.1*exp(\x)}) node[right] {$f(x)=\frac{1}{10}e^x$}; 381 | \end{FBTDemo} 382 | \caption{PGF 函数图} 383 | \label{exa:pgf_plot} 384 | \end{example} 385 | 386 | \bibliographystyle{unsrtnat} 387 | \bibliography{lnotes2} 388 | -------------------------------------------------------------------------------- /src/gra-pst.tex: -------------------------------------------------------------------------------- 1 | \chapter{PSTricks} 2 | \label{sec:pstricks} 3 | 4 | PSTricks 是一个基于 PostScript 的宏包,有了它用户就可以直接在 \LaTeX 文档中插入绘图命令。PSTricks 早期的作者是 van Zandt\indexVanZandt ,初始开发年月不详,1997年之后 Denis Girou\indexGirou{} \footnote{供职于法国国家科学研究中心 (National Centre for Scientific Research, CNSR) 。} 和 Herbert Voß\indexVoss{} \footnote{电力工程博士,高中数学、物理、电脑教师,柏林自由大学 (Free University of Berlin) 讲师。\LaTeX{}3项目成员,十几本书的作者。} 接管了维护工作。 5 | 6 | \autoref{tab:pst_add} 列出了一些可以和 PSTricks 配合使用的辅助宏包。 7 | 8 | \begin{table}[htbp] 9 | \caption{PSTricks 辅助宏包} 10 | \label{tab:pst_add} 11 | \centering 12 | \begin{tabular}{llll} 13 | \toprule 14 | multido & 循环 & pst-3dplot & 三维绘图 \\ 15 | pst-node & 示意图 & pst-solides3d & 三维实体 \\ 16 | pst-tree & 树状图 & pst-circ & 电路 \\ 17 | pst-plot & 函数绘图 & pst-labo & 化学 \\ 18 | pst-func & 数学函数 & pst-geo & 地理 \\ 19 | pst-eucl & 几何函数 & pstricks-add & 杂项 \\ 20 | \bottomrule 21 | \end{tabular} 22 | \end{table} 23 | 24 | \section{准备工作} 25 | \label{sec:pst_setup} 26 | 27 | PSTricks 中缺省长度单位是 1cm,我们也可以设置自己的单位。绘图命令一般要放在 \texttt{pspicture} 环境里,其参数是一个矩形的左下角和右上角,如果左下从原点开始可以省略该点坐标。这样 \LaTeX 就会给它预留空间,注意这个矩形要能容纳所有图形对象。 28 | 29 | \begin{Code}[] 30 | \psset{unit=10pt} 31 | \begin{pspicture}(0,0)(4,2) 32 | ... 33 | \end{pspicture} 34 | \end{Code} 35 | 36 | 另外需要注意的是,嵌入 \LaTeX 的PSTricks生成的是PostScript,\texttt{dvips} 认得自家人,\texttt{xdvipdfmx} 也可以处理。\texttt{dvipdfm} 和 \texttt{pdflatex} 则不能;如果使用后两种驱动,需要先行生成EPS或PDF。 37 | 38 | \texttt{pst-eps} 宏包能够在线处理 PSTricks 代码并生成 EPS,这样用户就可以在同一 \LaTeX 源文件中插入该 EPS。然而 \texttt{dvipdfmx} 不能正确处理 \texttt{pst-eps} 生成的 EPS,它和 \verb|\rput|, \verb|\uput|, \verb|\psaxes| 等命令都不兼容。 39 | 40 | \begin{example}[h] 41 | \begin{Code}[numbers=left] 42 | %fig.tex 43 | \documentclass{article} 44 | \usepackage{pst-pdf} 45 | \begin{document} 46 | \begin{pspicture}(0,0)(4,2) 47 | ... 48 | \end{pspicture} 49 | \end{document} 50 | \end{Code} 51 | \caption{ \texttt{pst-pdf} 宏包} 52 | \label{exa:pst-pdf} 53 | \end{example} 54 | 55 | 较好的方法是用 \texttt{pst-pdf} 宏包生成包含 PSTricks 图形的 EPS,然后再根据需要转为 PDF。每个 \texttt{pspicture} 环境中的内容会自成一页,方便插入文档。下面 \texttt{dvips} 命令的 \texttt{-E} 参数指示生成 EPS。 56 | 57 | \begin{Code}[] 58 | latex fig(.tex) 59 | dvips fig(.dvi) -E fig.eps 60 | ps2pdf fig.eps fig.pdf 61 | \end{Code} 62 | 63 | \begin{example}[htbp] 64 | \begin{Code}[numbers=left] 65 | \documentclass{article} 66 | \usepackage[active,tightpage,xetex]{preview} 67 | \usepackage{pstricks} 68 | \begin{document} 69 | \begin{preview} 70 | \begin{pspicture}(0,0)(4,2) 71 | ... 72 | \end{pspicture} 73 | \end{preview} 74 | \end{document} 75 | \end{Code} 76 | \caption{ \texttt{preview} 宏包} 77 | \label{exa:preview} 78 | \end{example} 79 | 80 | 使用 \texttt{dvips} 或 \texttt{xdvipdfmx} 时也可以考虑这种生成独立图形的方法,因为直接在 \LaTeX 源文件中使用绘图命令,编译时间会比较长。使用 \texttt{pst-pdf} 宏包时的编译命令较繁琐,用两个命令生成 EPS,第三个命令才得到 PDF。如果使用 \texttt{xdvipdfmx},可以改用 \texttt{preview} 宏包 (见 \autoref{exa:preview}) ,这样直接生成 PDF,而且文件体积较小。每个 \texttt{preview} 环境中的内容也会自成一页。 81 | 82 | \section{基本图形对象} 83 | \subsection{点和直线} 84 | 85 | \verb|\dot| 命令画一个点,\verb|\dots| 命令画多个点。因为点是有直径的,我们需要把\texttt{pspicture} 的尺寸设稍大一点。\verb|\psline| 命令把多个点用直线段连接起来,线段之间的连接缺省为尖角,也可以设置为圆角。 86 | 87 | \begin{example}[htbp] 88 | \begin{FBTDemo}[numbers=left]{\includegraphics{pst.pdf}} 89 | \begin{pspicture}(-.2,-.2)(14,2.2) 90 | \psdot(0,0) 91 | \psdots(4,0)(2,2) 92 | \psline(5,0)(7,2)(9,0) 93 | \psline[linearc=.3](10,0)(12,2)(14,0) 94 | \end{pspicture} 95 | \end{FBTDemo} 96 | \caption{PStricks 点和直线} 97 | \label{exa:pst_dot} 98 | \end{example} 99 | 100 | \subsection{矩形和多边形} 101 | 102 | 矩形用 \verb|\psframe| 命令,其参数就是矩形左下角和右上角的坐标。多边形用 \verb|\pspolygon| 命令,语法和 \verb|\psline| 类似,但是它会形成封闭路径。矩形和多边形都可以设置圆角。 103 | 104 | \begin{Code}[numbers=left] 105 | \begin{pspicture}(19,3) 106 | \psframe(0,0)(4,3) 107 | \psframe[framearc=.3](5,0)(9,3) 108 | \pspolygon(10,0)(14,0)(12,3) 109 | \pspolygon[linearc=.3](15,0)(19,0)(17,3) 110 | \end{pspicture} 111 | \end{Code} 112 | 113 | \begin{example}[htbp] 114 | \begin{Demo} 115 | \includegraphics[page=2]{pst.pdf} 116 | \end{Demo} 117 | \caption{PStricks 矩形和多边形} 118 | \label{exa:pst_frame} 119 | \end{example} 120 | 121 | \subsection{圆、椭圆、圆弧、扇形} 122 | 123 | 圆形用 \verb|\pscircle| 命令,参数是圆心和半径。椭圆用 \verb|\psellipse| 命令,参数是中心、长径、短径。注意这两个命令的半径参数用不同的括号,可能是作者的笔误。圆弧用 \verb|\psarc| 命令,其参数是圆心、半径、起止角度,逆时针作图。\verb|\psarcn| 类似,只是顺时针作图。扇形用 \verb|\pswedge| 命令。 124 | 125 | \begin{example}[htbp] 126 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=3]{pst.pdf}} 127 | \begin{pspicture}(19,2) 128 | \pscircle(1,1){1} 129 | \psellipse(5,1)(2,1) 130 | \psarc(9,0){2}{0}{120} 131 | \psarcn(13,0){2}{120}{0} 132 | \pswedge(17,0){2}{0}{120} 133 | \end{pspicture} 134 | \end{FBTDemo} 135 | \caption{PStricks 圆、椭圆、圆弧、扇形} 136 | \label{exa:pst_circle} 137 | \end{example} 138 | 139 | \subsection{曲线} 140 | 141 | \begin{example}[htbp] 142 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=4]{pst.pdf}} 143 | \begin{pspicture}(-0.2,-0.2)(25.2,2.2) 144 | \pscurve[showpoints=true](0,1)(1,2)(3,0)(4,2)(1,0) 145 | \psecurve[showpoints=true](5,1)(6,2)(8,0)(9,2)(5,0) 146 | \psccurve[showpoints=true](11,1)(12,2)(14,0)(15,2)(12,0) 147 | \psbezier[showpoints=true](16,0)(18,2)(20,0)(22,2) 148 | \psparabola[showpoints=true](25,2)(24,0) 149 | \end{pspicture} 150 | \end{FBTDemo} 151 | \caption{PStricks 曲线} 152 | \label{exa:pst_curve} 153 | \end{example} 154 | 155 | \verb|\pscurve| 命令把一系列点用平滑曲线连接起来;\verb|\psecurve| 命令不显示曲线的两个端点;\verb|\psccurve| 命令则把曲线封闭起来。\verb|showpoints| 参数用来指示是否显示曲线的构成点,它也可用于其它绘图命令。 156 | 157 | 贝塞尔曲线用 \verb|\psbezier| 命令,其参数就是曲线的控制点。抛物线用 \verb|\psparabola| 命令,它有两个参数,一个是抛物线通过的某点,另一个是抛物线的顶点。 158 | 159 | \subsection{网格和坐标轴} 160 | 161 | 科技制图通常会用到坐标和网格。\verb|\psgrid| 命令输出一个矩形网格,它有三个参数点。网格坐标标注在通过第一个点的两条直线上,第二和第三个点是矩形的两个对角顶点。当第一个参数省略时,坐标标注在通过第一个顶点的两条矩形边上。 162 | 163 | \begin{example}[htbp] 164 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=5]{pst.pdf}} 165 | \psset{unit=20pt} 166 | \begin{pspicture}(-1,-1)(13.5,2.5) 167 | \psgrid(0,0)(-1,-1)(3,2) 168 | \psgrid(5,0)(8,2) 169 | \psgrid(13,2)(10,0) 170 | \end{pspicture} 171 | \end{FBTDemo} 172 | \caption{PStricks 网格} 173 | \label{exa:pst_grid} 174 | \end{example} 175 | 176 | \begin{example}[htbp] 177 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=6]{pst.pdf}} 178 | \psset{unit=20pt} 179 | \begin{pspicture}(-1,-1)(13.4,2.4) 180 | \psaxes{<->}(0,0)(-1,-1)(3,2) 181 | \psaxes[tickstyle=top,labels=none]{->}(5,0)(8,2) 182 | \psaxes[axesstyle=frame,tickstyle=top]{->}(10,0)(13,2) 183 | \end{pspicture} 184 | \end{FBTDemo} 185 | \caption{PStricks 坐标轴} 186 | \label{exa:pst_axis} 187 | \end{example} 188 | 189 | 坐标轴可以用 \texttt{pst-plot} 宏包的 \verb|\psaxes| 命令。它的参数和 \verb|\psgrid| 的类似,刻度和标注的设置都很方便,也可以把坐标轴改成矩形框。 190 | 191 | \section{图形控制} 192 | \subsection{线宽和线型} 193 | 194 | PSTricks中缺省线条是0.8pt的实线。线宽和线型参数使用方法如下, 195 | 196 | \begin{example}[htbp] 197 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=7]{pst.pdf}} 198 | \begin{pspicture}(0,-0.1)(9,2.1) 199 | \psline[linewidth=1.5pt](0,0)(9,0) 200 | \psline[linestyle=dotted](0,1)(9,1) 201 | \psline[linestyle=dashed](0,2)(9,2) 202 | \end{pspicture} 203 | \end{FBTDemo} 204 | \caption{PStricks 线宽和线型} 205 | \label{exa:pst_linestyle} 206 | \end{example} 207 | 208 | \subsection{箭头} 209 | 210 | 以下参数可以控制绘图命令的箭头。 211 | 212 | \begin{example}[htbp] 213 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=8]{pst.pdf}} 214 | \begin{pspicture}(-0.2,-0.2)(9.2,6.2) 215 | \psline{->}(0,0)(9,0) 216 | \psline{<-}(0,1)(9,1) 217 | \psline{<->}(0,2)(9,2) 218 | \psline{>-<}(0,3)(9,3) 219 | \psline{|-|}(0,4)(9,4) 220 | \psline{o-o}(0,5)(9,5) 221 | \psline{*-*}(0,6)(9,6) 222 | \end{pspicture} 223 | \end{FBTDemo} 224 | \caption{PStricks 箭头} 225 | \label{exa:pst_arrow} 226 | \end{example} 227 | 228 | \subsection{颜色和填充} 229 | 230 | PSTricks 预定义了 black, darkgray, gray, lightgray, white 等灰度颜色,和 red, green, blue, cyan, magenta, yellow 等彩色。它可以使用 \texttt{xcolor} 宏包。设置线条颜色的方法如 \autoref{exa:pst_color} 所示, 231 | 232 | \begin{example}[htbp] 233 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=9]{pst.pdf}} 234 | \begin{pspicture}(0,-0.1)(9,2.1) 235 | \psline[linecolor=red](0,0)(9,0) 236 | \psline[linecolor=green](0,1)(9,1) 237 | \psline[linecolor=blue](0,2)(9,2) 238 | \end{pspicture} 239 | \end{FBTDemo} 240 | \caption{PStricks 彩色} 241 | \label{exa:pst_color} 242 | \end{example} 243 | 244 | 设置填充模式和填充颜色的方法如 \autoref{exa:pst_fill}。注意只有封闭路径才可以填充。 245 | 246 | \begin{example}[htbp] 247 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=10]{pst.pdf}} 248 | \begin{pspicture}(11,2) 249 | \pscircle[fillstyle=solid,fillcolor=RoyalBlue](1,1){1} 250 | \pscircle[fillstyle=vlines](4,1){1} 251 | \pscircle[fillstyle=hlines](7,1){1} 252 | \pscircle[fillstyle=crosshatch](10,1){1} 253 | \end{pspicture} 254 | \end{FBTDemo} 255 | \caption{PStricks 填充} 256 | \label{exa:pst_fill} 257 | \end{example} 258 | 259 | \subsection{全局设置} 260 | 261 | 前文提到过用 \verb|\pseset| 命令设置长度单位,它还可以用来设置线宽、线型、颜色等全局参数。 262 | 263 | \begin{Code}[] 264 | \psset{linewidth=1pt, linestyle=dashed, linecolor=Silver, 265 | fillcolor=Lavender, fillstyle=crosshatch} 266 | \end{Code} 267 | 268 | \section{图形变换} 269 | 270 | \texttt{origin} 参数让一个图形对象平移到指定的位置。\verb|\rput| 命令可以对一个图形对象同时进行旋转和平移操作。它有四个参数: 271 | 272 | \verb|语法: \rput[参考点]{旋转角度}{平移坐标}{操作对象}| 273 | 274 | \begin{enumerate} 275 | \item 参考点,可选。其取值见 \autoref{tab:rput},缺省是左下。 276 | \item 旋转角度,可以取任意角度,也可以用U、L、D、R分别代表0$^\circ$, 90$^\circ$, 180$^\circ$, 270$^\circ$ 。 277 | \item 平移到的位置。 278 | \item 操作对象。 279 | \end{enumerate} 280 | 281 | \begin{table}[htbp] 282 | \centering 283 | \caption{ \texttt{\char`\\rput} 命令的参考点} 284 | \label{tab:rput} 285 | \begin{tabular}{cccc} 286 | \toprule 287 | \multicolumn{2}{c}{水平方向} & \multicolumn{2}{c}{垂直方向} \\ 288 | \midrule 289 | l & 左 & t & 上 \\ 290 | r & 右 & b & 下 \\ 291 | \bottomrule 292 | \end{tabular} 293 | \end{table} 294 | 295 | \begin{example}[htbp] 296 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=11]{pst.pdf}} 297 | \begin{pspicture}(12,3.2) 298 | \psframe(0,0)(3,2) 299 | \psframe[origin={4,0}](0,0)(3,2) 300 | \rput{30}(9,0){\psframe(0,0)(3,2)} 301 | \end{pspicture} 302 | \end{FBTDemo} 303 | \caption{PStricks 平移和旋转} 304 | \label{exa:pst_transform} 305 | \end{example} 306 | 307 | 如果要进行全局坐标变换,可以考虑使用 \verb|translate|, \verb|scale|, \verb|rotate|, \verb|swapaxes| 等命令。 308 | 309 | \section{标注} 310 | 311 | \verb|\rput| 命令还可以在指定的坐标点标注文字,\autoref{exa:pst_label} 中的参考点参数指示把文字分别标注在某点的左边、右边、上边。它生成的标注就在坐标点上,有时会感觉离图形太近。 312 | 313 | \begin{example}[htbp] 314 | \begin{FBTDemo}[numbers=left]{\includegraphics[page=12]{pst.pdf}} 315 | \begin{pspicture}(-0.8,-0.4)(12.3,3.3) 316 | \pspolygon(0,0)(4,0)(2,2) 317 | \rput[r](0,0){A} 318 | \rput[l](4,0){B} 319 | \rput[b](2,2){C} 320 | \pspolygon(7,0)(11,0)(9,2) 321 | \uput[l](7,0){A} 322 | \uput[r](11,0){B} 323 | \uput[u](9,2){C} 324 | \end{pspicture} 325 | \end{FBTDemo} 326 | \caption{PStricks 标注} 327 | \label{exa:pst_label} 328 | \end{example} 329 | 330 | 另一个命令 \verb|\uput| 则生成缺省距离指定坐标点5pt的标注。它的第一个参数是标注相对于坐标点的角度,取值可以是角度或字母 (见 \autoref{tab:uput}) 。注意 \verb|\uput| 的角度参数和 \verb|\rput| 命令的参考点位置参数的定义几乎正好相反,比较容易混淆。 331 | 332 | \begin{table}[htbp] 333 | \centering 334 | \caption{ \texttt{\char`\\uput} 命令的角度参数} 335 | \label{tab:uput} 336 | \begin{tabular}{lrlr} 337 | \toprule 338 | r & 0$^\circ$ & ur & 45$^\circ$ \\ 339 | u & 90$^\circ$ & ul & 135$^\circ$ \\ 340 | l & 180$^\circ$ & dl & 225$^\circ$ \\ 341 | d & 270$^\circ$ & dr & 315$^\circ$ \\ 342 | \bottomrule 343 | \end{tabular} 344 | \end{table} 345 | 346 | 若想深入了解 PSTricks,可以参阅其用户手册\citep{Zandt_pstricks}。 347 | 348 | \bibliographystyle{unsrtnat} 349 | \bibliography{lnotes2} 350 | -------------------------------------------------------------------------------- /src/lang.tex: -------------------------------------------------------------------------------- 1 | % common language and font settings 2 | 3 | \usepackage[CJKchecksingle]{xeCJK} 4 | \punctstyle{plain} 5 | 6 | % Adobe Legacy 7 | % \setmainfont{Adobe Garamond Pro}[Ligatures=TeX] 8 | % \setCJKmainfont{Adobe Song Std}[BoldFont={Adobe Heiti Std},ItalicFont={Adobe Kaiti Std}] 9 | % \setCJKsansfont{Adobe Heiti Std} 10 | % \setCJKmonofont{Adobe Fangsong Std} 11 | 12 | % Adobe Source 13 | \setmainfont{Source Serif Pro}[Ligatures=TeX] 14 | \setsansfont{Source Sans Pro} 15 | \setmonofont{Source Code Pro} 16 | \setCJKmainfont{Source Han Serif SC}[BoldFont={Source Han Sans SC},ItalicFont={KaiTi}] 17 | \setCJKsansfont{Source Han Sans SC} 18 | \setCJKmonofont{FangSong} 19 | 20 | % Google Noto 21 | % \setmainfont{Noto Serif}[Ligatures=TeX] 22 | % \setCJKmainfont[BoldFont={Noto Sans CJK SC},ItalicFont={KaiTi}]{Noto Serif CJK SC Light} 23 | % \setCJKsansfont{Noto Sans CJK SC} 24 | % \setCJKmonofont{FangSong} 25 | -------------------------------------------------------------------------------- /src/layout.tex: -------------------------------------------------------------------------------- 1 | \chapter{布局} 2 | 3 | \begin{quotation} 4 | 离娄之明,公输子之巧,不以规矩,不能成方圆。 5 | \begin{flushright} 6 | --- 《孟子·离娄上》 7 | \end{flushright} 8 | \end{quotation} 9 | 10 | 我们在 \ref{sec:box} 节中曾经提到,在 \LaTeX 中每一个排版对象都是一个盒子。排版就是要把小盒子用空白间距粘在一起放到大盒子里,然后再依次嵌套到更大的盒子里。怎样优化这些大大小小的盒子是一门很深的学问,在本章里我们将会略窥门径。 11 | 12 | \section{页面尺寸} 13 | 14 | 在排版时页面是最大的盒子,所以我们就先看一看它。人们在日常生活中可以见到多种规格的纸张,它们一般归属于两大类标准:公制和美制。 15 | 16 | \subsection{普通青年} 17 | 18 | 早在1786年,德国科学家 Georg C. Lichtenberg (1742--1799)\indexLichtenberg 就发现$1/\sqrt{2}$这个比例可以用于分割纸张。你拿一张这个比例的纸,在较长的那个方向上一分为二,得到的两张纸也是同样比例。 19 | 20 | 1912--1914年间,另一个德国人 Walter Porstmann (1886--1959)\indexPorstmann 在为诺贝尔化学奖得主 Wilhelm Ostwald (1853--1932)\indexOstwald{} \footnote{生于拉脱维亚,1878年塔图大学 (University of Tartu) 博士,1909年诺贝尔化学奖。}当助手时,两人企图把这个比例变成一个世界标准。一个数学家和一个化学家在一起琢磨这个好像不务正业,但是考虑到 Ostwald 当时还兼任一个知识产权研究所的主任,好歹也沾点边儿。他们从 1cm x 1.41cm 开始,每次加倍短边,直至无穷。然而他们的提议无人理会,也许人们都正忙于第一次世界大战。此后几年 Porstmann 一直沿着这个方向灌水,甚至他在1918年写的博士论文也与此相关。 21 | 22 | 当时德国标准化学会 (Deutsches Institut für Normung, DIN)\index{org}{org.din@Deutsches Institut für Normung, DIN, 德国标准化学会} 刚成立没多久,无所事事的学会领导 Waldemar Hellmich\indexHellmich 注意到了 Porstmann,就在1920年将其网罗至门下。1922年,DIN 发布了476纸张标准,这次是从面积一平方米的 A0 (841mm x 1189mm)开始,每次减半长边。后来又陆续加上了 B, C, D 系列。 23 | 24 | DIN 476 因为其简单易用,逐渐流行到其他国家。1961年 ISO 将 A 和 B 系列采纳为推荐标准,1975年变成 ISO 216 标准。其中 B 系列比 DIN 476 的略大一点,它从 1000mm x 1414mm 的 B0 开始。1985年发布的 ISO 269 加上了 C 系列,它的尺寸是 A 和 B 系列纸张尺寸的几何平均。 25 | 26 | A 系列常用于公文;B 系列常用于海报和护照 (B7, 88mm x 125mm);C 系列常用于信封,因为它恰好比 A 系列大一点,比如 A4 纸可以装在 C4 信封里,对折一下就可以装进 C5 信封,再对折一次装进 C6 信封。 27 | 28 | \subsection{文二青年} 29 | 30 | 当今世界大多数国家都采用此项国际标准,冥顽不化的只有美国和它的几个小弟,在这些地方流行的是比 A4 胖一点的 Letter (8.5in x 11in) 。Letter 追溯上去应该源于大英帝国,只是英国在1950年代末就已经全面接受了公制标准。窃以为一小撮美洲人对英制情有独钟的原因是他们的历史短,所以但凡有把年纪的东西都颇为珍惜。 31 | 32 | IEEE\indexIEEE{}定义过一个Government-Letter (8in x 10.5in) ,主要用于儿童读物。想来儿童读的东西信息量少,不需要 Letter 那么大的纸。Herbert Hoover (1874--1964)\indexHoover{} \footnote{美国第31任总统,历任总统中罕见的工科 WSN。1895年斯坦福地质学士,自称是该校首名学生。在校期间曾担任棒球队经理,向前总统 Benjamin Harrison 追讨两毛五门票钱。} 在1920年代担任商务部长期间,规定政府公文也采用此规格。我今天量过《时代周刊》和《商业周刊》,也是这个规格。 33 | 34 | 1980年代初Ronald Reagan (1911--2004)\indexReagon{} 上台后,认为美利坚乃天朝上国,用小纸太丢脸,于是政府公文改用 Letter。我对 Letter 没啥意见,在写本章之前用的就是它,现在改用 A4 是为了照顾中文读者的习惯。坑爹的是 Legal (8.5in x 14in) ,比普通文件夹都长一大截,它主要用于法律文件。 35 | 36 | 面对世界标准化潮流,老美的颜面有点 hold 不住,于是在1996年推出 ANSI Y14.1 作为遮羞布。它定义了 A, B, C, D, E 五种规格,A 就是 Letter,B 比A 面积大一倍,C 比 B 大一倍,依次类推。它们的长宽比不一致,B 和 C 比其他三种瘦很多。它们的尺寸倒是和 A4--A0 差不多,如果不挑剔也可以混用。 37 | 38 | \subsection{尺寸详解} 39 | 40 | \begin{figure}[!htbp] 41 | \centering 42 | \includegraphics[page=24]{pgf.pdf} 43 | \caption{页面尺寸} 44 | \label{fig:pagelayout} 45 | \end{figure} 46 | 47 | \autoref{fig:pagelayout} 是一张 A4,尺寸为 210mm x 297mm 也就是 597pt x 845pt。图中标注为 Body 的是正文区域,Header 是页眉,Footer 是页脚。图中标注的尺寸有些是固定的,另一些是随着正文字号或其他因素而改变的;在这里我们会遇到一些 \LaTeX 定义的尺寸宏变量。 48 | 49 | lshort 里有张类似的图流传甚广,包老师为了操练一把20年前学到的机械制图本领,就自己画了一张。图中尺寸用的是 11pt,oneside 的,下面我们就以此为例介绍一下这些尺寸: 50 | 51 | \begin{enumerate} 52 | \item 页边距,1in。在微软Word里这个尺寸也很常见; 53 | \item \verb|\oddsidemargin| 或 \verb|\evensidemargin|,奇数或偶数页左边距,46pt; 54 | \item \verb|\textwidth|,正文宽度,360pt,可以放下大概32个汉字; 55 | \item 597pt减去左边的 1in + 46pt 和中间的 360pt,还剩下 119pt,左右相差不到 1pt。如果双面打印的话,两面的正文部分恰好是重叠的; 56 | \item 页边距,1in; 57 | \item \verb|\topmargin|,上边距,18pt; 58 | \item \verb|\headheight|,页眉高度,12pt; 59 | \item \verb|\headsep|,页眉与正文间距,25pt; 60 | \item \verb|\textheight|,正文高度,595pt,可以放下38行文字; 61 | \item \verb|\footskip|,正文与页脚基线间距,30pt。它比页眉的 12pt + 25pt 小了 7pt,不理解的同学可以照照镜子,你左右是对称的,但是上下呢? 62 | \item 845pt 减去上面全部尺寸,还剩下 93pt,比上面的 1in + 18pt 多了 3pt。 63 | \end{enumerate} 64 | 65 | 当字号等发生变化时,上述某些尺寸也会发生一定的变化。比如我们把 oneside 改成 twoside,那么奇偶页的左边距就分别变成 22pt 和 70pt。但是奇数页右边空白恰好和偶数页左边空白相等,不会给双面打印造成困扰。 66 | 67 | 一般情况下我们无须改动 \LaTeX 的页面布局缺省设置。当有特殊需要时,可以使用 \ref{sec:length} 节提到的 \verb|\setlength| 或 \verb|\addtolength| 来设置上述宏变量的值。 68 | 69 | 梅木秀雄\indexUmeki{} \footnote{东芝高级经理。}的 \texttt{geometry} 宏包\citep{Umeki_geometry}则提供了更高级的用户接口。比如我们可以用如下的方法来设置页面尺寸和边距, 70 | 71 | \begin{Code}[] 72 | \usepackage[paperwidth=100mm, paperheight=150mm, margin=20mm]{geometry} 73 | \end{Code} 74 | 75 | 也可以像下面这样单独设置每个边距, 76 | 77 | \begin{Code}[] 78 | \usepackage[top=2in, bottom=1in, left=1in, right=1in]{geometry} 79 | \end{Code} 80 | 81 | 想把页面横过来,可以这样, 82 | 83 | \begin{Code}[] 84 | \usepackage[landscape]{geometry} 85 | \end{Code} 86 | 87 | \section{页面样式} 88 | 89 | 了解页面尺寸之后,我们再来看看页面样式,也就是页眉和页脚的内容。\LaTeX 预定义了四种样式,见 \autoref{tab:pagestyle}。 90 | 91 | \begin{table}[htbp] 92 | \caption{\LaTeX 页面样式} 93 | \label{tab:pagestyle} 94 | \centering 95 | \begin{tabular}{ll} 96 | \toprule 97 | \texttt{empty} & 页眉、页脚空白 \\ 98 | \texttt{plain} & 页眉空白,页脚含居中页码,非book文档类缺省值 \\ 99 | \texttt{headings} & 页脚空白,页眉含章节名和页码,book文档类缺省值 \\ 100 | \texttt{myheadings} & 页脚空白,页眉含页码和用户自定义信息 \\ 101 | \bottomrule 102 | \end{tabular} 103 | \end{table} 104 | 105 | 我们可以用 \verb|\pagestyle| 和 \verb|\thispagestyle| 命令来设置整个文档或单独某页的样式。 106 | 107 | \begin{Code}[numbers=none] 108 | \pagestyle{plain} %全局设置 109 | \thispagestyle{empty}%单页设置 110 | \end{Code} 111 | 112 | \autoref{tab:pagestyle} 中的样式是通过重定义四个宏变量 \texttt{@oddhead}, \texttt{@evenhead}, \texttt{@oddfoot}, \texttt{@evenfoot} 来设置奇偶页的页眉与页脚。 113 | 114 | 我们也可以用 \autoref{exa:def_pagestyle} 中的方法来自定义样式。其中第二行代码定义了 \texttt{permanentdamagedhead} 样式,定义这个特殊命令时一定要写成 \verb|\ps@style| 的样子;而在引用时,则写成 \verb|\pagestyle{style}|。第三至六行分别定义了奇偶页的页眉和页脚;单面文档奇偶页样式一样,所以需要且只需要定义奇数页的页眉和页脚,偶数页的定义不起作用。 115 | 116 | \begin{example}[htbp] 117 | \LoadFBTDemo[]{texlet/layout-pagestyle} 118 | \LoadDemo{texlet/layout-pagestyle-a} 119 | \caption{自定义页面样式} 120 | \label{exa:def_pagestyle} 121 | \end{example} 122 | 123 | 这段代码中的 \verb|\hfill| 是个弹性填充命令,它把两边的内容“推”得尽可能远。例中使用了特殊符号 \texttt{@},所以要在第一行用 \verb|\makeatletter| 命令声明一下,暂时把它当正常符号用;用完之后,在最后一行用相应的 \verb|\makeatother| 命令恢复现场。 124 | 125 | 在自定义页面样式时,我们不仅可以在页眉和页脚里使用普通字符串,也可以使用一些宏变量来显示页码、章节号码和名称等(见 \autoref{tab:pagestyle_macro})。 126 | 127 | \begin{table}[!h] 128 | \centering 129 | \caption{页眉和页脚常用宏变量} 130 | \label{tab:pagestyle_macro} 131 | \begin{tabularx}{350pt}{lX} 132 | \toprule 133 | \verb|\thepage| & 页码 \\ 134 | \verb|\thechapter| & 章编号 \\ 135 | \verb|\thesection| & 节编号 \\ 136 | \verb|\chaptername| & 章起始单词名,Chapter \\ 137 | \verb|\sectionname| & 节起始单词名,Section \\ 138 | \verb|\leftmark| & 左标记,在 \texttt{article} 文档类中包含 \texttt{section} 信息,在 \texttt{report} 和 \texttt{book} 中则包含 \texttt{chapter} 信息。\\ 139 | \verb|\rightmark| & 右标记,在 \texttt{article} 中包含 \texttt{subsection} 信息,在 \texttt{report} 和 \texttt{book} 中则包含 \texttt{section} 信息。\\ 140 | \bottomrule 141 | \end{tabularx} 142 | \end{table} 143 | 144 | \autoref{tab:pagestyle_macro} 中前五个变量都可以直接重定义,左右标记特殊一点,需要用下面的命令来间接定义, 145 | 146 | \begin{Code}[numbers=none] 147 | \markboth{`左标记`}{`右标记`}%定义两个标记 148 | \markright{`右标记`} %定义右标记 149 | \end{Code} 150 | 151 | 需要注意的是,引用时要用 \verb|\leftmark| 和 \verb|\rightmark|,定义时要用 \verb|\markboth| 和 \verb|\markright|。为什么会这样呢?因为 Lamport 是个怪叔叔。另外为什么没有 \verb|\markleft| 呢?其实这个命令在AMS的几个文档类里是有的。这个故事告诉我们:AMS 是左派进步青年,Lamport 是右倾分子,所以他后来脱离革命加入了微软。 152 | 153 | \autoref{exa:headings} 是 \texttt{book} 文档类中双面打印时 \texttt{headings} 样式定义的节选。其中第二行清空页脚;第三行定义偶数页(也就是左页)页眉,页码居左,左标记居右;第四行定义奇数页(右页)页眉,右标记居左,页码居右。这样页码总是在书的外侧,便于阅读时翻页定位。 154 | 155 | \begin{example}[htbp] 156 | \begin{Code}[] 157 | \def\ps@headings{% 158 | \let\@oddfoot\@empty\let\@evenfoot\@empty 159 | \def\@evenhead{\thepage\hfil\slshape\leftmark}% 160 | \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% 161 | ... 162 | \end{Code} 163 | \caption{\texttt{headings} 样式} 164 | \label{exa:headings} 165 | \end{example} 166 | 167 | \autoref{exa:myheadings} 则是 \texttt{book} 文档类中 \texttt{myheadings} 样式的定义。只看前四行它好像和 \texttt{headings} 样式是孪生兄弟,差别在于下面三行清空了左右标记,用户需要自行定义,否则偶数页右上角和奇数页左上角是空白的。 168 | 169 | \begin{example}[htbp] 170 | \begin{Code}[] 171 | \def\ps@myheadings{% 172 | \let\@oddfoot\@empty\let\@evenfoot\@empty 173 | \def\@evenhead{\thepage\hfil\slshape\leftmark}% 174 | \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% 175 | \let\@mkboth\@gobbletwo 176 | \let\chaptermark\@gobble 177 | \let\sectionmark\@gobble 178 | } 179 | \end{Code} 180 | \caption{\texttt{myheadings} 样式} 181 | \label{exa:myheadings} 182 | \end{example} 183 | 184 | \autoref{exa:markboth} 演示了怎样为 \texttt{myheadings} 样式定制左右标记。写到这里包老师忽然想到,好像东西方文化在左比右高级这一点上是一致的,文东武西,男左女右。正因为如此阳顶天挂了之后杨逍可以去泡妞,而范遥只能毁了容去卧底,思想境界上还是差那么一点点。 185 | 186 | \begin{example}[htbp] 187 | \LoadFBTDemo[]{texlet/layout-markboth} 188 | \LoadDemo{texlet/layout-markboth-a} 189 | \caption{定制左右标记} 190 | \label{exa:markboth} 191 | \end{example} 192 | 193 | 用户可能会觉得上述定义页面样式的方法比较繁琐和低级,Piet van Oostrum\indexOostrum{} \footnote{曾任教于荷兰乌德勒支大学(Utrecht University),退休后隐居于南美。}的 \texttt{fancyhdr} 宏包\citep{Oostrum_fancyhdr}则提供了更灵活的控制和高级的语法。 194 | 195 | \begin{example}[htbp] 196 | \LoadFBTDemo[]{texlet/layout-fancyhdr} 197 | \caption{\texttt{fancyhdr} 宏包} 198 | \label{exa:fancyhdr} 199 | \end{example} 200 | 201 | 在 \autoref{exa:fancyhdr} 的代码中,第三行将页面样式设置为 \texttt{fancyhdr} 宏包定义的 \texttt{fancy} 样式;第五至十行分别定制了页眉和页脚;最后两行定制了页眉下方和页脚上方的横线。 202 | 203 | 左右标记里除了页码,通常还会有章节编号和名称等,这时我们就要用到另两个命令 \verb|\chaptermark| 和 \verb|\sectionmark|,其用法见 \autoref{exa:chaptermark}。 204 | 205 | 在这段代码中,第三行清空了页眉和页脚;第四行将页码置于偶数页左上和奇数页右上,第五行将左标记置于偶数页右上,第六行将右标记置于奇数页左上。 206 | 207 | \begin{example}[htbp] 208 | \LoadFBTDemo[]{texlet/layout-chaptermark} 209 | \LoadDemo{texlet/layout-chaptermark-a} 210 | \caption{定制章节标记} 211 | \label{exa:chaptermark} 212 | \end{example} 213 | 214 | \texttt{fancyhdr} 宏包将每章起始页的样式设为 \texttt{plain},若想去掉页脚中间的页码,可以重定义 \texttt{plain} 样式。代码第七至十行清空了 \texttt{plain} 页的页眉和页脚,还去掉了页眉下方的横线。 215 | 216 | 第11行重定义了章标记,它传给 \verb|\markboth| 命令的参数是章的名称,这样章名就会出现在左标记里。章名最初是从哪里来的呢?它是用 \verb|\chapter{章名}| 命令定义的。章名从 \verb|\chapter{}| 传到 \verb|\chaptermark|,再传到 \verb|\markboth|,最后到了 \verb|\leftmark| 那里。它这样一路走来,不畏艰险,踏平坎坷,战胜妖魔,最终修成正果。 217 | 218 | 类似地,第12行重定义了节标记,它传给 \verb|\markright| 命令的参数是节的名称,这样节名就会出现在右标记里。 219 | 220 | \section{分栏} 221 | 222 | 我们经常看到一些期刊报纸使用两栏或更多的栏位,这样可以节省空间和方便阅读。 \LaTeX 的标准文档类都有一个选项来支持双栏, 223 | 224 | \begin{Code}[numbers=none] 225 | \documentclass[twocolumn]{article} 226 | \end{Code} 227 | 228 | Mittelbach\indexMittelbach 的 \texttt{multicol} 宏包提供了更多的功能,比如它支持多达十个栏位,栏位数目可以任意切换;各栏长度相同,最后一页看起来会左右平衡一些。 229 | 230 | \autoref{exa:cols} 中第二行代码将栏位之间的距离设为 12pt(缺省是 10pt),第三行将栏位之间的分割线宽度设为 1pt(缺省 0pt,也就是不显示);下面几行使用了 \texttt{multicols} 环境,注意环境名和宏包名是不同的。 231 | 232 | \begin{example}[htbp] 233 | \LoadFBTDemo[]{texlet/layout-cols} 234 | \caption{\texttt{multicol} 宏包} 235 | \label{exa:cols} 236 | \end{example} 237 | 238 | \texttt{multicols} 环境对浮动体的支持有限,只能使用带 \texttt{*} 的版本,见 \autoref{exa:starred_float}。这种特殊浮动体是跨栏位的,而且它们的 \texttt{h} 选项会失效,也就是不会出现在当前页。不管你的期望是多么地殷切,它最早也只能出现在下一页的页首。 239 | 240 | \begin{example}[htbp] 241 | \begin{Code}[] 242 | \begin{figure*}[tbp] 243 | ... 244 | \end{figure*} 245 | 246 | \begin{table*}[tbp] 247 | ... 248 | \end{table*} 249 | \end{Code} 250 | \caption{特殊浮动体} 251 | \label{exa:starred_float} 252 | \end{example} 253 | 254 | 某些权宜之计可以让浮动体出现在某栏内,但是它们就失去了浮动性,所以此处不赘述。 255 | 256 | \section{分页} 257 | 258 | \TeX 通常都会自动分页,无须人工干涉。但是浮动体较多的情况下,分页就变成一个 NP 完全问题 \footnote{传说 Knuth 在2046年写完那套书后,才会有时间改进分页算法。},自动分页的效果可能不是我们想要的。这时就需要手工插入分页命令, 259 | 260 | \begin{Code}[numbers=none] 261 | \newpage 262 | \end{Code} 263 | 264 | 如果我们也不确定某处分页是否妥当,可以使用另一个命令,给 \TeX 留点面子。这个参数取值1--4,4表示强烈要求分页,1表示你看着办吧。 265 | 266 | \begin{Code}[numbers=none] 267 | \pagebreak[3] 268 | \end{Code} 269 | 270 | 类似地,我们还可以建议 \TeX 不要分页,其参数取值也是1--4,4表示强烈反对分页,1表示随便。 271 | 272 | \begin{Code}[numbers=none] 273 | \nopagebreak[2] 274 | \end{Code} 275 | 276 | 浮动体较多,\TeX 无所适从时,我们可以用下面的命令帮它减轻点责任。此命令要求 \TeX 排完此前所有浮动体,不管是否难看,咱就这么办了。 277 | 278 | \begin{Code}[numbers=none] 279 | \clearpage 280 | \end{Code} 281 | 282 | \bibliographystyle{unsrtnat} 283 | \bibliography{lnotes2} 284 | -------------------------------------------------------------------------------- /src/ldemo.sty: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesPackage{ldemo}[2010/04/27 Standard LaTeX package] 3 | 4 | \RequirePackage{listings,verbatim} 5 | 6 | \lstset{escapechar=`, extendedchars=false, 7 | backgroundcolor=\color{Lavender}, basicstyle=\small\ttfamily, 8 | language=[LaTeX]TeX, keywordstyle=\color{blue}, 9 | frame=single, rulecolor=\color{Silver}, 10 | firstnumber=1, stepnumber=2, breaklines=true 11 | } 12 | 13 | \let\oldfboxsep=\fboxsep 14 | \newlength{\demosep} 15 | \setlength{\demosep}{3pt} 16 | \newsavebox{\mybox} 17 | \newwrite{\file} 18 | 19 | \newcommand{\demo@start}[0]{ 20 | \begingroup% keep the changes local 21 | \@bsphack 22 | \immediate\openout\file=\jobname.exa 23 | \let\do\@makeother\dospecials 24 | \catcode`\^^M\active 25 | \def\verbatim@processline{ 26 | \immediate\write\file{\the\verbatim@line} 27 | } 28 | \verbatim@start 29 | } 30 | 31 | \newcommand{\demo@end}[0]{ 32 | \immediate\closeout\file 33 | \@esphack 34 | \endgroup 35 | } 36 | 37 | \newcommand{\demo@code}[2][\jobname.exa]{% file, width 38 | \makebox[#2]{% 39 | \begin{minipage}[c]{#2-6pt-.8pt}% listings framesep=3pt, framerule=0.4pt 40 | \vspace{6pt}% 41 | \lstinputlisting{#1} 42 | \end{minipage}% 43 | }% 44 | } 45 | 46 | \newcommand{\demo@out}[2][\jobname.exa]{% file, width 47 | \setlength{\fboxsep}{5pt}% 48 | \framebox[#2]{% 49 | \begin{minipage}[c]{#2-2\fboxsep-2\fboxrule} 50 | \input{#1} 51 | \end{minipage}% 52 | }% 53 | \setlength{\fboxsep}{\oldfboxsep}% 54 | } 55 | 56 | \newcommand{\fdemo@out}[2]{% real code, width 57 | \setlength{\fboxsep}{5pt}% 58 | \begin{lrbox}{\mybox} 59 | \fbox{% 60 | \begin{minipage}[c]{#2-2\fboxsep-2\fboxrule} 61 | #1 62 | \end{minipage}% 63 | }% 64 | \end{lrbox} 65 | \setlength{\fboxsep}{\oldfboxsep}% 66 | } 67 | 68 | \newenvironment{Code}[1][numbers=none]{% 69 | \ignorespaces 70 | \lstset{#1}% endgroup of newenvironment doesn't accept arguments 71 | \demo@start 72 | }{ 73 | \demo@end 74 | \noindent 75 | \demo@code{\textwidth} 76 | \ignorespacesafterend 77 | } 78 | 79 | \newenvironment{Demo}{ 80 | \demo@start 81 | }{ 82 | \demo@end 83 | \noindent 84 | \demo@out{\textwidth}% 85 | } 86 | 87 | \newenvironment{TBDemo}[1][numbers=none]{ 88 | \ignorespaces 89 | \lstset{#1}% 90 | \demo@start 91 | }{ 92 | \demo@end 93 | \noindent 94 | \demo@out{\textwidth}% 95 | \\[5pt] 96 | \demo@code{\textwidth}% 97 | \ignorespacesafterend 98 | } 99 | 100 | \newenvironment{FTBDemo}[2][numbers=none]{% lstset argument, real code 101 | \ignorespaces 102 | \lstset{#1}% 103 | \fdemo@out{#2}{\textwidth}% save to \mybox 104 | \demo@start 105 | }{ 106 | \demo@end 107 | \noindent 108 | \usebox{\mybox}% 109 | \\[\demosep] 110 | \demo@code{\textwidth}% 111 | \ignorespacesafterend 112 | } 113 | 114 | \newenvironment{BTDemo}[1][numbers=none]{ 115 | \ignorespaces 116 | \lstset{#1}% 117 | \demo@start 118 | }{ 119 | \demo@end 120 | \noindent 121 | \demo@code{\textwidth}% 122 | \\[\demosep] 123 | \demo@out{\textwidth}% 124 | \ignorespacesafterend 125 | } 126 | 127 | \newenvironment{FBTDemo}[2][numbers=none]{% lstset argument, real code 128 | \ignorespaces 129 | \lstset{#1}% 130 | \fdemo@out{#2}{\textwidth}% save to \mybox 131 | \demo@start 132 | }{ 133 | \demo@end 134 | \noindent 135 | \demo@code{\textwidth}% 136 | \\[\demosep] 137 | \usebox{\mybox}% 138 | \ignorespacesafterend 139 | } 140 | 141 | \newenvironment{LRDemo}[1][numbers=none]{% lstset argument 142 | \ignorespaces 143 | \lstset{#1}% 144 | \demo@start 145 | }{ 146 | \demo@end 147 | \noindent 148 | \demo@out{.47\textwidth} 149 | \hfill 150 | \demo@code{.47\textwidth} 151 | \ignorespacesafterend 152 | } 153 | 154 | \newenvironment{FLRDemo}[2][numbers=none]{% lstset argument, real code 155 | \ignorespaces 156 | \lstset{#1}% 157 | \fdemo@out{#2}{.47\textwidth}% save to \mybox 158 | \demo@start 159 | }{ 160 | \demo@end 161 | \noindent 162 | \usebox{\mybox}% 163 | \hfill 164 | \demo@code{.47\textwidth}% 165 | \ignorespacesafterend 166 | } 167 | 168 | \newenvironment{RLDemo}[1][numbers=none]{% lstset argument 169 | \ignorespaces 170 | \lstset{#1}% 171 | \demo@start 172 | }{ 173 | \demo@end 174 | \noindent 175 | \demo@code{.49\textwidth} 176 | \hfill 177 | \demo@out{.49\textwidth} 178 | \ignorespacesafterend 179 | } 180 | 181 | \newenvironment{FRLDemo}[2][numbers=none]{% lstset argument, real code 182 | \ignorespaces 183 | \lstset{#1}% 184 | \fdemo@out{#2}{.49\textwidth}% save to \mybox 185 | \demo@start 186 | }{ 187 | \demo@end 188 | \noindent 189 | \demo@code{.49\textwidth}% 190 | \hfill 191 | \usebox{\mybox}% 192 | \ignorespacesafterend 193 | } 194 | 195 | \newcommand{\LoadCode}[2][numbers=none]{% lstset argument, file 196 | \lstset{#1}% 197 | \noindent 198 | \demo@code[#2.tex]{\textwidth}% 199 | } 200 | 201 | \newcommand{\LoadDemo}[1]{% file 202 | \noindent 203 | \demo@out[#1.tex]{\textwidth}% 204 | } 205 | 206 | \newcommand{\LoadTBDemo}[2][numbers=none]{% lstset argument, file 207 | \lstset{#1}% 208 | \noindent 209 | \demo@out[#2.tex]{\textwidth}% 210 | \\[\demosep] 211 | \demo@code[#2.tex]{\textwidth}% 212 | } 213 | 214 | \newcommand{\LoadFTBDemo}[2][numbers=none]{% lstset argument, file 215 | \lstset{#1}% 216 | \noindent 217 | \demo@out[#2.tex]{\textwidth}% 218 | \\[\demosep] 219 | \demo@code[#2-esc.tex]{\textwidth}% 220 | } 221 | 222 | \newcommand{\LoadBTDemo}[2][numbers=none]{% lstset argument, file 223 | \lstset{#1}% 224 | \noindent 225 | \demo@code[#2.tex]{\textwidth}% 226 | \\[\demosep] 227 | \demo@out[#2.tex]{\textwidth}% 228 | } 229 | 230 | \newcommand{\LoadFBTDemo}[2][numbers=none]{% lstset argument, file 231 | \lstset{#1}% 232 | \noindent 233 | \demo@code[#2-esc.tex]{\textwidth}% 234 | \\[\demosep] 235 | \demo@out[#2.tex]{\textwidth}% 236 | } 237 | 238 | \newcommand{\LoadLRDemo}[2][numbers=none]{% lstset argument, file 239 | \lstset{#1}% 240 | \noindent 241 | \demo@out[#2.tex]{0.47\textwidth}% 242 | \hfill 243 | \demo@code[#2.tex]{.47\textwidth}% 244 | } 245 | 246 | \newcommand{\LoadFLRDemo}[2][numbers=none]{% lstset argument, file 247 | \lstset{#1}% 248 | \noindent 249 | \demo@out[#2.tex]{0.47\textwidth}% 250 | \hfill 251 | \demo@code[#2-esc.tex]{.47\textwidth}% 252 | } 253 | 254 | \newcommand{\LoadRLDemo}[2][numbers=none]{% lstset argument, file 255 | \lstset{#1}% 256 | \noindent 257 | \demo@code[#2.tex]{.49\textwidth}% 258 | \hfill 259 | \demo@out[#2.tex]{0.49\textwidth}% 260 | } 261 | 262 | \newcommand{\LoadFRLDemo}[2][numbers=none]{% lstset argument, file 263 | \lstset{#1}% 264 | \noindent 265 | \demo@code[#2-esc.tex]{.49\textwidth}% 266 | \hfill 267 | \demo@out[#2.tex]{0.49\textwidth}% 268 | } 269 | -------------------------------------------------------------------------------- /src/lnotes2.bib: -------------------------------------------------------------------------------- 1 | % This file was created with JabRef 2.7.2. 2 | % Encoding: UTF8 3 | 4 | @MANUAL{AMS_amsmath, 5 | title = {amsmath User's Guide}, 6 | author = {AMS}, 7 | year = {2002}, 8 | owner = {Alpha}, 9 | review = {good}, 10 | timestamp = {2008.04.01}, 11 | url = {https://www.ams.org/tex/amslatex.html} 12 | } 13 | 14 | @MANUAL{AMS_short_math, 15 | title = {Short Math Guide for LaTeX}, 16 | author = {AMS}, 17 | year = {2002}, 18 | owner = {Alpha}, 19 | timestamp = {2008.04.01}, 20 | url = {https://www.ams.org/tex/amslatex.html} 21 | } 22 | 23 | @MANUAL{Carlisle_colortbl, 24 | title = {The colortbl Package}, 25 | author = {David P. Carlisle}, 26 | year = {2018}, 27 | owner = {Alpha}, 28 | timestamp = {2019.04.20}, 29 | url = {https://ctan.org/tex-archive/macros/latex/contrib/colortbl/} 30 | } 31 | 32 | @MANUAL{Carlisle_longtable, 33 | title = {The longtable Package}, 34 | author = {David P. Carlisle}, 35 | year = {2014}, 36 | owner = {Alpha}, 37 | timestamp = {2019.04.20}, 38 | url = {https://ctan.org/pkg/longtable/} 39 | } 40 | 41 | @MANUAL{Carlisle_tabularx, 42 | title = {The tabularx Package}, 43 | author = {David P. Carlisle}, 44 | year = {2016}, 45 | owner = {Alpha}, 46 | timestamp = {2010.10.18}, 47 | url = {https://ctan.org/pkg/tabularx/} 48 | } 49 | 50 | @BOOK{Chicago_style, 51 | title = {Chicago Manual of Style, 17th Edition}, 52 | publisher = {University of Chicago}, 53 | year = {2017}, 54 | editor = {UCP}, 55 | owner = {Alpha}, 56 | timestamp = {2019.04.20}, 57 | url = {https://www.chicagomanualofstyle.org/} 58 | } 59 | 60 | @BOOK{Clair_printing, 61 | title = {A Chronology of Printing}, 62 | publisher = {Praeger}, 63 | year = {1969}, 64 | author = {Colin Clair}, 65 | owner = {Alpha}, 66 | timestamp = {2010.05.25}, 67 | url = {https://www.amazon.com/dp/B000YC2K66/} 68 | } 69 | 70 | @MANUAL{Cochran_subfig, 71 | title = {The subfig Package}, 72 | author = {Steven D. Cochran}, 73 | year = {2005}, 74 | owner = {Alpha}, 75 | timestamp = {2010.06.24}, 76 | url = {https://ctan.org/tex-archive/macros/latex/contrib/subfig/} 77 | } 78 | 79 | @MANUAL{CTeX_faq, 80 | title = {CTeX 常见问题集}, 81 | author = {中国 TeX 用户组}, 82 | year = {2009}, 83 | owner = {Alpha}, 84 | timestamp = {2008.04.01}, 85 | url = {https://ctan.org/tex-archive/info/ctex-faq/} 86 | } 87 | 88 | @MANUAL{CTeX_ctex, 89 | title = {CTeX 宏集手册}, 90 | author = {中国 TeX 用户组}, 91 | year = {2019}, 92 | owner = {Alpha}, 93 | timestamp = {2019.04.20}, 94 | url = {https://ctan.org/tex-archive/language/chinese/ctex} 95 | } 96 | 97 | @MANUAL{Daly_natbib, 98 | title = {Natural Sciences Citations and References}, 99 | author = {Patrick W. Daly}, 100 | year = {2010}, 101 | owner = {Alpha}, 102 | timestamp = {2008.04.01}, 103 | url = {https://ctan.org/tex-archive/macros/latex/contrib/natbib/} 104 | } 105 | 106 | @MANUAL{Dupuis_igo, 107 | title = {Typesetting Go diagrams in TeX or LaTeX with igo}, 108 | author = {Étienne Dupuis}, 109 | year = {2006}, 110 | owner = {Alpha}, 111 | timestamp = {2012.08.19}, 112 | url = {https://ctan.org/tex-archive/fonts/igo/} 113 | } 114 | 115 | @MANUAL{Fairbairns_rotating, 116 | title = {A package for rotated objects in LaTeX}, 117 | author = {Robin Fairbairns and Sebastian Rahtz and Leonor Barroca}, 118 | year = {2018}, 119 | owner = {Alpha}, 120 | timestamp = {2019.04.20}, 121 | url = {https://ctan.org/pkg/rotating/} 122 | } 123 | 124 | @MANUAL{Fear_booktabs, 125 | title = {Publication Quality Tables in LaTeX}, 126 | author = {Simon Fear}, 127 | year = {2016}, 128 | owner = {Alpha}, 129 | timestamp = {2019.04.20}, 130 | url = {http://www.ctan.org/tex-archive/macros/latex/contrib/booktabs/} 131 | } 132 | 133 | @MANUAL{Goossens_xetex, 134 | title = {The XeTeX Companion}, 135 | author = {Michel Goossens}, 136 | year = {2010}, 137 | owner = {Alpha}, 138 | timestamp = {2019.04.20}, 139 | url = {https://xml.web.cern.ch/XML/lgc2/xetexmain.pdf} 140 | } 141 | 142 | @BOOK{Gratzer_more_math, 143 | title = {More Math into LaTeX}, 144 | publisher = {Springer}, 145 | year = {2016}, 146 | author = {George Grätzer}, 147 | edition = {5th}, 148 | owner = {Alpha}, 149 | timestamp = {2019.04.20}, 150 | url = {https://www.amazon.com/dp/3319237950/} 151 | } 152 | 153 | @MANUAL{Han_pdftex, 154 | title = {The pdfTeX User Manual}, 155 | author = {Th\'{ê} Thành Hàn and Sebastian Rahtz and Hans Hagen and Hartmut 156 | Henkel and Paweł Jackowski and Martin Schröder}, 157 | year = {2018}, 158 | owner = {Alpha}, 159 | timestamp = {2019.04.20}, 160 | url = {https://www.tug.org/applications/pdftex/} 161 | } 162 | 163 | @BOOK{Higham_1998, 164 | title = {Handbook of Writing for the Mathematical Sciences}, 165 | publisher = {Society for Industrial and Applied Mathematics}, 166 | year = {1998}, 167 | author = {Nicholas J. Higham}, 168 | owner = {Alpha}, 169 | review = {great}, 170 | timestamp = {2008.05.20}, 171 | url = {https://www.siam.org/books/ot63/} 172 | } 173 | 174 | @MANUAL{Hobby_metapost, 175 | title = {MetaPost: A User's Manual}, 176 | author = {John D. Hobby and Taco Hoekwater and Hans Hagen}, 177 | year = {2018}, 178 | owner = {Alpha}, 179 | timestamp = {2019.04.20}, 180 | url = {https://www.tug.org/metapost/} 181 | } 182 | 183 | @MANUAL{Huang_lnotes, 184 | title = {LaTeX Notes}, 185 | author = {包太雷}, 186 | year = {2008}, 187 | owner = {Alpha}, 188 | timestamp = {2010.05.16}, 189 | url = {https://ctan.org/tex-archive/info/latex-notes-zh-cn/} 190 | } 191 | 192 | @MANUAL{Kern_xcolor, 193 | title = {Extending LaTeX's Color Facilities: The xcolor Package}, 194 | author = {Uwe Kern}, 195 | organization = {CTAN}, 196 | year = {2016}, 197 | owner = {Alpha}, 198 | timestamp = {2019.04.20}, 199 | url = {https://www.ukern.de/tex/xcolor.html} 200 | } 201 | 202 | @MANUAL{Lee_cjk, 203 | title = {我的CJK}, 204 | author = {李果正}, 205 | year = {2004}, 206 | owner = {Alpha}, 207 | timestamp = {2008.05.12}, 208 | url = {http://edt1023.sayya.org/tex/mycjk/} 209 | } 210 | 211 | @MANUAL{Lee_latex, 212 | title = {大家来学LaTeX}, 213 | author = {李果正}, 214 | year = {2004}, 215 | owner = {Alpha}, 216 | review = {good}, 217 | timestamp = {2008.04.11}, 218 | url = {http://edt1023.sayya.org/tex/latex123/} 219 | } 220 | 221 | @MANUAL{Markey_beast, 222 | title = {Tame the BeaST: The B to X of BibTeX}, 223 | author = {Nicolas Markey}, 224 | organization = {CTAN}, 225 | year = {2009}, 226 | owner = {Alpha}, 227 | timestamp = {2019.04.20}, 228 | url = {https://ctan.org/tex-archive/info/bibtex/tamethebeast/} 229 | } 230 | 231 | @MANUAL{Mittelbach_array, 232 | title = {A new implementation of LaTeX's tabular and array environment}, 233 | author = {Frank Mittelbach and David P. Carlisle}, 234 | year = {2019}, 235 | owner = {Alpha}, 236 | timestamp = {2019.04.20}, 237 | url = {https://ctan.org/pkg/array/} 238 | } 239 | 240 | @BOOK{Mittelbach_latex_comp, 241 | title = {The LaTeX Companion (Tools and Techniques for Computer Typesetting)}, 242 | publisher = {Addison-Wesley}, 243 | year = {2004}, 244 | author = {Frank Mittelbach and Michel Goossens and Johannes Braams and David 245 | P. Carlisle and Chris Rowley}, 246 | edition = {2nd}, 247 | owner = {Alpha}, 248 | review = {good}, 249 | timestamp = {2019.04.20}, 250 | url = {https://www.amazon.com/dp/0201362996/} 251 | } 252 | 253 | @MANUAL{Moses_listings, 254 | title = {The listings Package}, 255 | author = {Carsten Heinz and Brooks Moses}, 256 | year = {2019}, 257 | owner = {Alpha}, 258 | timestamp = {2019.04.20}, 259 | url = {https://ctan.org/tex-archive/macros/latex/contrib/listings/} 260 | } 261 | 262 | @MANUAL{Oetiker_lshort, 263 | title = {A (Not So) Short Introduction to LaTeX2e}, 264 | author = {Tobias Oetiker}, 265 | year = {2018}, 266 | owner = {Alpha}, 267 | review = {good}, 268 | timestamp = {2019.04.20}, 269 | url = {https://ctan.org/tex-archive/info/lshort/} 270 | } 271 | 272 | @MANUAL{Oostrum_fancyhdr, 273 | title = {Page Layout in LaTeX}, 274 | author = {Piet van Oostrum}, 275 | year = {2019}, 276 | owner = {Alpha}, 277 | timestamp = {2019.04.20}, 278 | url = {https://ctan.org/tex-archive/macros/latex/contrib/fancyhdr/} 279 | } 280 | 281 | @MANUAL{Pakin_comprehensive, 282 | title = {The Comprehensive LaTeX Symbol List}, 283 | author = {Scott Pakin}, 284 | year = {2017}, 285 | owner = {Alpha}, 286 | timestamp = {2019.04.20}, 287 | url = {https://ctan.org/tex-archive/info/symbols/comprehensive/} 288 | } 289 | 290 | @MANUAL{Patashnik_bibtex, 291 | title = {BibTeXing}, 292 | author = {Oren Patashnik}, 293 | year = {1988}, 294 | owner = {Alpha}, 295 | timestamp = {2008.04.01}, 296 | url = {https://ctan.org/tex-archive/biblio/bibtex/contrib/doc/} 297 | } 298 | 299 | @MANUAL{Rahtz_hyperref, 300 | title = {Hypertext Marks in LaTeX: A Manual for hyperref}, 301 | author = {Sebastian Rahtz and Heiko Oberdiek}, 302 | year = {2018}, 303 | owner = {Alpha}, 304 | timestamp = {2019.04.20}, 305 | url = {https://ctan.org/tex-archive/macros/latex/contrib/hyperref/} 306 | } 307 | 308 | @MANUAL{Reckdahl_epslatex, 309 | title = {Using Imported Graphics in LaTeX and pdfLaTeX}, 310 | author = {Keith Reckdahl}, 311 | year = {2006}, 312 | owner = {Alpha}, 313 | timestamp = {2008.04.01}, 314 | url = {https://ctan.org/tex-archive/info/epslatex/} 315 | } 316 | 317 | @MANUAL{Robertson_fontspec, 318 | title = {The fontspec Package}, 319 | author = {Will Robertson}, 320 | year = {2019}, 321 | owner = {Alpha}, 322 | timestamp = {2019.04.20}, 323 | url = {https://ctan.org/tex-archive/macros/xetex/latex/fontspec/} 324 | } 325 | 326 | @MANUAL{Rochester_warpcol, 327 | title = {The warpcol Package}, 328 | author = {Wayne A. Rochester}, 329 | year = {2007}, 330 | owner = {Alpha}, 331 | timestamp = {2010.10.22}, 332 | url = {https://ctan.org/tex-archive/macros/latex/contrib/warpcol/} 333 | } 334 | 335 | @MANUAL{Rokicki_dvips, 336 | title = {Dvips: A DVI-to-PostScript Translator}, 337 | author = {Tomas Rokicki}, 338 | year = {2005}, 339 | owner = {Alpha}, 340 | timestamp = {2008.05.12}, 341 | url = {https://www.tug.org/dvips/} 342 | } 343 | 344 | @MANUAL{Sommerfeldt_caption, 345 | title = {Customizing captions of floating environments using the caption package}, 346 | author = {Axel Sommerfeldt}, 347 | year = {2018}, 348 | owner = {Alpha}, 349 | timestamp = {2019.04.20}, 350 | url = {https://ctan.org/tex-archive/macros/latex/contrib/caption/} 351 | } 352 | 353 | @BOOK{Strauss_printing, 354 | title = {The Printing Industry}, 355 | publisher = {Printing Industries of America}, 356 | year = {1967}, 357 | author = {Victor Strauss}, 358 | owner = {Alpha}, 359 | timestamp = {2010.05.25}, 360 | url = {https://www.amazon.com/dp/B000GRKF5C/} 361 | } 362 | 363 | @MANUAL{Sun_xecjk, 364 | title = {xeCJK 宏包}, 365 | author = {孙文昌}, 366 | year = {2019}, 367 | owner = {Alpha}, 368 | timestamp = {2019.04.20}, 369 | url = {https://ctan.org/tex-archive/macros/xetex/latex/xecjk/} 370 | } 371 | 372 | @MANUAL{Tantau_beamer, 373 | title = {The Beamer Class}, 374 | author = {Till Tantau and Joseph Wright and Vedran Miletić}, 375 | year = {2018}, 376 | owner = {Alpha}, 377 | timestamp = {2019.04.20}, 378 | url = {https://ctan.org/tex-archive/macros/latex/contrib/beamer/} 379 | } 380 | 381 | @MANUAL{Tantau_pgf, 382 | title = {TikZ and PGF Manual}, 383 | author = {Till Tantau}, 384 | year = {2019}, 385 | owner = {Alpha}, 386 | timestamp = {2019.04.20}, 387 | url = {https://ctan.org/tex-archive/graphics/pgf/} 388 | } 389 | 390 | @MANUAL{Thompson_newlfm, 391 | title = {A New Letter, Fax, Memo Document Class for LaTeX2e}, 392 | author = {Paul A. Thompson}, 393 | year = {2009}, 394 | owner = {Alpha}, 395 | timestamp = {2012.08.05}, 396 | url = {https://ctan.org/tex-archive/macros/latex/contrib/newlfm/} 397 | } 398 | 399 | @MISC{UKTUG_faq, 400 | author = {{UK TeX User Group}}, 401 | title = {UK List of TeX Frequently Asked Questions}, 402 | owner = {Alpha}, 403 | timestamp = {2019.04.20}, 404 | url = {https://texfaq.org/} 405 | } 406 | 407 | @MANUAL{Umeki_geometry, 408 | title = {The geometry package}, 409 | author = {Hideo Umeki and David Carlisle}, 410 | year = {2018}, 411 | owner = {Alpha}, 412 | timestamp = {2019.04.20}, 413 | url = {https://ctan.org/tex-archive/macros/latex/contrib/geometry/} 414 | } 415 | 416 | @MANUAL{Veytsman_envlab, 417 | title = {Printing Envelopes and Labels in LaTeX2e: EnvLab Package}, 418 | author = {Boris Veytsman}, 419 | year = {1997}, 420 | owner = {Alpha}, 421 | timestamp = {2012.08.16}, 422 | url = {https://ctan.org/tex-archive/macros/latex/contrib/envlab/} 423 | } 424 | 425 | @MANUAL{Wicks_dvipdfm, 426 | title = {Dvipdfm User's Manual}, 427 | author = {Mark A. Wicks}, 428 | year = {1999}, 429 | owner = {Alpha}, 430 | timestamp = {2008.05.12}, 431 | url = {https://ctan.org/tex-archive/dviware/dvipdfm/} 432 | } 433 | 434 | @MANUAL{Wilson_memoir, 435 | title = {The Memoir Class}, 436 | author = {Peter R. Wilson and Lars Madsen}, 437 | edition = {10th}, 438 | year = {2018}, 439 | owner = {Alpha}, 440 | timestamp = {2019.04.20}, 441 | url = {https://ctan.org/tex-archive/macros/latex/contrib/memoir/} 442 | } 443 | 444 | @MANUAL{Wilson_memdesign, 445 | title = {A Few Notes on Book Design}, 446 | author = {Peter R. Wilson}, 447 | year = {2018}, 448 | owner = {Alpha}, 449 | timestamp = {2018.04.20}, 450 | url = {https://ctan.org/tex-archive/info/memdesign/} 451 | } 452 | 453 | @MANUAL{Yin_zhspacing, 454 | title = {Typesetting Chinese in XeTeX: zhspacing User's Manual}, 455 | author = {Dian Yin and Qing Lee}, 456 | year = {2016}, 457 | owner = {Alpha}, 458 | timestamp = {2019.04.20}, 459 | url = {https://ctan.org/tex-archive/macros/xetex/generic/zhspacing/} 460 | } 461 | 462 | @MANUAL{Zandt_fancyvrb, 463 | title = {Fancy Verbatims in LaTeX}, 464 | author = {Timothy van Zandt}, 465 | year = {2019}, 466 | owner = {Alpha}, 467 | timestamp = {2019.04.20}, 468 | url = {https://ctan.org/tex-archive/macros/latex/contrib/fancyvrb/} 469 | } 470 | 471 | @MANUAL{Zandt_pstricks, 472 | title = {PSTricks User's Guide}, 473 | author = {Timothy van Zandt}, 474 | year = {2007}, 475 | owner = {Alpha}, 476 | timestamp = {2008.04.01}, 477 | url = {https://www.tug.org/PSTricks/} 478 | } 479 | -------------------------------------------------------------------------------- /src/lnotes2.tex: -------------------------------------------------------------------------------- 1 | \documentclass[a4paper,11pt,fontset=none,scheme=chinese]{ctexbook} 2 | \ctexset{ 3 | section/format = \Large\bfseries, 4 | today=old 5 | } 6 | 7 | % ************************************** 8 | % Language & Fonts 9 | % ************************************** 10 | \input{lang} 11 | \usepackage{CJKnumb} 12 | %Mapping fixes endash & emdash 13 | \newfontfamily\lmr{Latin Modern Roman} 14 | \newfontfamily\courier{Courier New} 15 | 16 | %\xeCJKsetcharclass{"0}{"2E7F}{0} 17 | %\xeCJKsetcharclass{"2E80}{"FFFF}{1} 18 | \DeclareTextAccent{\.}{EU1}{"0307} 19 | %\DeclareTextAccent{\v}{EU1}{"030C} 20 | %\DeclareTextAccent{\d}{EU1}{"0323} 21 | %\DeclareTextAccent{\b}{EU1}{"0331} 22 | 23 | \usepackage{etex} 24 | \usepackage{metalogo,mflogo,texnames} 25 | \usepackage{textcomp} 26 | 27 | \usepackage[normalem]{ulem} 28 | %\usepackage{xltxtra} % load etex automatically 29 | 30 | % ************************************** 31 | % Graphics 32 | % ************************************** 33 | \usepackage{adjustbox} 34 | \usepackage{graphicx, rotating} 35 | \usepackage[svgnames, table]{xcolor}% put before pstricks, textpos, tikz 36 | 37 | \DeclareGraphicsRule{.mps}{eps}{.mps}{} 38 | \graphicspath{{graph/}{img/}} 39 | 40 | % ************************************** 41 | % Table 42 | % ************************************** 43 | \usepackage{booktabs,longtable,multirow,tabularx,warpcol} 44 | 45 | % ************************************** 46 | % Float 47 | % ************************************** 48 | \usepackage{caption} 49 | \DeclareCaptionType [fileext=loe]{example}[例][例目录] 50 | %\usepackage{float} 51 | %\newfloat{example}{tbph}{loe} 52 | %\restylefloat*{example} 53 | %\floatstyle{plain} 54 | %\floatname{example}{例} 55 | %\captionsetup[example]{position=top} 56 | %\newcommand{\listofexamples}{\listof{example}{例目录}} 57 | \usepackage{subfig} % put before fvrb-ex 58 | \newsubfloat[position=bottom,listofformat=subsimple]{example} 59 | 60 | % ************************************** 61 | % Structure 62 | % ************************************** 63 | %\usepackage{xurl} % not working with url 64 | %\PassOptionsToPackage{hyphens}{url} 65 | \usepackage[ 66 | bookmarksnumbered, 67 | pdfencoding=auto, 68 | pdfpagelayout=TwoPageRight, 69 | breaklinks, 70 | colorlinks, 71 | linkcolor=RoyalBlue, 72 | urlcolor=blue] 73 | {hyperref} 74 | \usepackage{multicol} % need etex 75 | \usepackage{multind} 76 | \makeindex{people} 77 | \makeindex{org} 78 | % replaced by ctexbook 79 | % \usepackage{titlesec} 80 | 81 | \newcommand{\lnotesauthor}{包 太 雷} 82 | \newcommand{\lnotesversion}{v2.101} 83 | \newcommand{\lnotesdate}{2024年12月} 84 | 85 | % replaced by ctexbook 86 | % \renewcommand{\contentsname}{目录} 87 | \renewcommand{\listfigurename}{图目录} 88 | \renewcommand{\listtablename}{表目录} 89 | \renewcommand{\chaptername}{第\CJKnumber{\thechapter}章} 90 | %\newcommand{\sectionname}{\thesection 节} 91 | % \renewcommand{\figurename}{图} 92 | % \renewcommand{\tablename}{表} 93 | % \renewcommand{\appendixname}{附录{\thechapter}} 94 | % \renewcommand{\bibname}{参考文献} 95 | % \renewcommand{\indexname}{索引} 96 | 97 | \renewcommand{\figureautorefname}{图} 98 | \renewcommand{\tableautorefname}{表} 99 | \renewcommand{\appendixautorefname}{附录} 100 | 101 | % replaced by ctexbook 102 | % \titleformat{\chapter}[block]{\center\Huge}{\chaptername}{20pt}{} 103 | \makeatletter 104 | \renewcommand{\tableofcontents}{% 105 | \setlength{\columnsep}{2.5em} 106 | %\setlength{\columnseprule}{.8pt} 107 | \begin{multicols}{2}[\chapter*{\contentsname}]% 108 | \@starttoc{toc}% 109 | \end{multicols}} 110 | \makeatother 111 | 112 | % ************************************** 113 | % Format 114 | % ************************************** 115 | \usepackage{calc} 116 | \usepackage{indentfirst,setspace} 117 | 118 | %\usepackage{enumitem} % conflict with paralist 119 | %\setlist[1]{labelindent=0.5\parindent,leftmargin=\parindent} 120 | \usepackage{paralist} 121 | \newenvironment{CompactEnum}{ 122 | \begin{enumerate} 123 | \setlength{\itemsep}{0pt} 124 | \setlength{\parsep}{0pt} 125 | \setlength{\parskip}{0pt} 126 | }{\end{enumerate}} 127 | 128 | \newenvironment{CompactItem}{ 129 | \begin{enumerate} 130 | \setlength{\itemsep}{0pt} 131 | \setlength{\parsep}{0pt} 132 | \setlength{\parskip}{0pt} 133 | }{\end{enumerate}} 134 | 135 | \newenvironment{CompactDesc}{ 136 | \begin{enumerate} 137 | \setlength{\itemsep}{0pt} 138 | \setlength{\parsep}{0pt} 139 | \setlength{\parskip}{0pt} 140 | }{\end{enumerate}} 141 | 142 | \usepackage{fancyvrb,listings,verbatim} 143 | 144 | \VerbatimFootnotes 145 | \usepackage{ldemo} 146 | 147 | %\usepackage{framed} 148 | \usepackage{marginnote} 149 | 150 | %\renewcommand{\labelitemi}{\ensuremath{\bullet}}% xunicode changes the bullet 151 | 152 | \makeatletter 153 | \renewenvironment{quotation}{ 154 | \list{}{ 155 | \listparindent 2em 156 | \itemindent \listparindent 157 | \rightmargin \leftmargin 158 | \parsep \z@ \@plus\p@ 159 | } 160 | \item 161 | }{ 162 | \endlist 163 | } 164 | \makeatother 165 | 166 | % ************************************** 167 | % Layout 168 | % ************************************** 169 | \usepackage{fancyhdr} 170 | \usepackage[absolute]{textpos} 171 | \usepackage{varwidth} 172 | 173 | \pagestyle{fancy} 174 | \fancyhf{} 175 | \fancyhead[LE,RO]{\thepage} 176 | \fancyhead[RE]{\textit{\leftmark}} 177 | \fancyhead[LO]{\textit{\rightmark}} 178 | \fancypagestyle{plain}{ % set header and footer of plain pages 179 | \fancyhf{} 180 | \renewcommand{\headrulewidth}{0pt} 181 | \fancyfoot[LE,RO]{\thepage} 182 | } 183 | 184 | \makeatletter 185 | \renewcommand{\cleardoublepage}{ 186 | \clearpage 187 | \if@twoside \ifodd 188 | \c@page 189 | \else 190 | \if@openrecto 191 | \thispagestyle{empty} 192 | \vspace*{\fill} 193 | \begin{center} 194 | 广告位招租 195 | \end{center} 196 | \vspace{\fill} 197 | \newpage 198 | \if@twocolumn 199 | \newpage 200 | \fi 201 | \fi 202 | \fi\fi 203 | } 204 | 205 | \newif\if@openrecto 206 | \makeatother 207 | 208 | % ************************************** 209 | % Bibliography 210 | % ************************************** 211 | \usepackage{chapterbib} 212 | \usepackage[sectionbib,super,square,sort&compress]{natbib} 213 | 214 | % ************************************** 215 | % Math 216 | % ************************************** 217 | \usepackage{amsmath,amsfonts,amsthm,mathrsfs} 218 | 219 | \begin{document} 220 | \frontmatter 221 | \include{front} % Front cover and title page 222 | \include{copyright} 223 | 224 | % Open right pages: title, dedication, TOC 225 | \makeatletter 226 | \@openrectotrue 227 | \makeatother 228 | 229 | \include{dedication} 230 | 231 | % TOC, LOF, LOT 232 | \tableofcontents 233 | 234 | % Open any pages: LOF, LOT, forward, preface, acknowledgements, abbreviations 235 | \makeatletter 236 | \@openrectofalse 237 | \makeatother 238 | 239 | \listoffigures 240 | \listoftables 241 | \listofexamples 242 | 243 | \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 244 | \onehalfspacing 245 | \let\oldparskip\parskip 246 | \addtolength{\parskip}{3pt} 247 | \addtolength{\abovecaptionskip}{-3pt} 248 | \addtolength{\belowcaptionskip}{-3pt} 249 | \setlength{\parindent}{2em} 250 | 251 | \include{forward} 252 | \include{preface-fan} 253 | \include{preface} 254 | \include{preface-old} 255 | \include{acknowledgements} 256 | 257 | \makeatletter 258 | \@openrectotrue 259 | \makeatother 260 | \mainmatter 261 | \renewcommand{\chaptermark}[1]{\markboth{\chaptername: #1}{}} 262 | \renewcommand{\sectionmark}[1]{\markright{\thesection: #1}} 263 | 264 | \input{index} 265 | \include{introduction} 266 | \include{basics} 267 | \include{fonts} 268 | \include{math} 269 | \include{graphics} 270 | \include{gra-mp} 271 | \include{gra-pst} 272 | \include{gra-pgf} 273 | \include{tables} 274 | \include{structure} 275 | \include{layout} 276 | \include{apps} 277 | 278 | \appendix 279 | \renewcommand{\chaptername}{附录{\thechapter}} 280 | 281 | \include{software} 282 | \include{printing} 283 | 284 | \makeatletter 285 | \@openrectofalse 286 | \makeatother 287 | 288 | \backmatter 289 | 290 | \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 291 | \renewcommand{\sectionmark}[1]{\markright{#1}} 292 | %\renewcommand{\chaptername}{附录{\thechapter}} 293 | 294 | \include{postscript} 295 | \include{postscript-old} 296 | 297 | \singlespacing 298 | \setlength{\parskip}{\oldparskip} 299 | 300 | \chapter{索引} 301 | \printindex{people}{人物索引} 302 | \printindex{org}{组织机构索引} 303 | 304 | \include{back} 305 | 306 | \end{document} 307 | -------------------------------------------------------------------------------- /src/multind.sty: -------------------------------------------------------------------------------- 1 | % indexes document style option for producing multiple indexes 2 | % for use with the modified bbok style, CHbook.sty 3 | % Written by F.W. Long, Version 1.1, 12 August 1991. 4 | 5 | % Modified by F.W. Long, Version 1.1a, 29 August 1991 6 | % to get the index heading correctly spaced. 7 | 8 | % Modified by F.W. Long, Version 1.1b, 31 August 1991 9 | % to remove the abbreviation \ix (which should be in the document, not here). 10 | 11 | % Modified \makeindex and \index commands to allow multiple indexes 12 | % in both cases the first parameter is the index name. 13 | % They now work more like \@starttoc and \addcontentsline. 14 | % \index is no longer defined inside \makeindex but determines 15 | % whether the appropriate file is defined before writing to it. 16 | 17 | \def\makeindex#1{\begingroup 18 | \makeatletter 19 | \if@filesw \expandafter\newwrite\csname #1@idxfile\endcsname 20 | \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax 21 | \typeout{Writing index file #1.idx }\fi \endgroup} 22 | 23 | \def\index#1{\@bsphack\begingroup 24 | \def\protect##1{\string##1\space}\@sanitize 25 | \@wrindex{#1}} 26 | 27 | % \@wrindex now checks that the appropriate file is defined. 28 | 29 | \def\@wrindex#1#2{\let\thepage\relax 30 | \xdef\@gtempa{\@ifundefined{#1@idxfile}{}{\expandafter 31 | \write\csname #1@idxfile\endcsname{\string 32 | \indexentry{#2}{\thepage}}}}\endgroup\@gtempa 33 | \if@nobreak \ifvmode\nobreak\fi\fi\@esphack} 34 | 35 | % Modified \printindex command to allow multiple indexes. 36 | % This now takes over much of the work of \theindex. 37 | % Again, the first parameter is the index name. 38 | % The second parameter is the index title (as printed). 39 | 40 | \newif\if@restonecol 41 | \def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi 42 | \columnseprule \z@ \columnsep 35pt 43 | \newpage \twocolumn[{\Large\bf #2 \vskip4ex}] 44 | \markright{\uppercase{#2}} 45 | \addcontentsline{toc}{section}{#2} 46 | \@input{#1.ind}} 47 | 48 | % The following index commands are taken from book.sty. 49 | % \theindex is modified to not start a chapter. 50 | 51 | \def\theindex{\parindent\z@ 52 | \parskip\z@ plus .3pt\relax\let\item\@idxitem} 53 | \def\@idxitem{\par\hangindent 40pt} 54 | \def\subitem{\par\hangindent 40pt \hspace*{20pt}} 55 | \def\subsubitem{\par\hangindent 40pt \hspace*{30pt}} 56 | \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi} 57 | \def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax} 58 | 59 | % the command \ix allows an abbreviation for the general index 60 | 61 | %\def\ix#1{#1\index{general}{#1}} 62 | 63 | % define the \see command from makeidx.sty 64 | 65 | \def\see#1#2{{\em see\/} #1} 66 | -------------------------------------------------------------------------------- /src/postscript-old.tex: -------------------------------------------------------------------------------- 1 | \chapter{原版跋} 2 | 3 | 首先向一路披荆斩棘看到这里的读者表示祝贺,至少在精神上你已经成为一名合格的 \LaTeX{}er。从此你生是 \LaTeX 的人,死是 \LaTeX 的鬼。Once black, never back。没有坚持到这里的同学自然已经重新投向“邪恶”的MS Word,毕竟那里点个按钮就可以插入图形,点个下拉框就可以选择字体。 4 | 5 | 当然 \LaTeX{}er也有简单的出路,就是只使用缺省设置,尽量少用插图;不必理会点阵、矢量,也不必理会 Type 1, Type 3, TrueType, OpenType。因为内容高于形式,你把文章的版面、字体搞得再漂亮,它也不会因此成为《红楼梦》;而《红楼梦》即使是手抄本,也依然是不朽的名著。 6 | 7 | 包老师曾经以为 \LaTeX 和 Word 的关系就好像是《笑傲江湖》中华山的气宗和剑宗,头十年剑宗进步快,中间十年打个平手,再往后气宗就遥遥领先。至于令狐冲的无招胜有招,风清扬的神龙见首不见尾又是另一重境界,普通人恐怕只能望其颈背。 8 | 9 | 费尽九牛二虎之力熬到本文杀青的时候,才发现从前的想法很傻很天真。让我们挥一挥衣袖,不带走一片云,卧薪尝胆忍辱负重,耐心等待 \XeTeX 和 \LuaTeX。 10 | 11 | \begin{flushright} 12 | 2008年7月于法戈 13 | \end{flushright} 14 | -------------------------------------------------------------------------------- /src/postscript.tex: -------------------------------------------------------------------------------- 1 | \chapter{再版跋} 2 | 3 | 今天包老师很欣慰,终于为 lnotes2 画上了句号。三年零三个月以前动笔的时候,老包又一次高估了自己的能力与热情。一百页的第一版用了不到半年的时间,两百页的第二版为什么会如此难产呢?包老师陷入了深深的思考。 4 | 5 | Frederick P. Brooks 在 \emph{The Mythical Man-Month} 中提到,一个系统的完成时间和系统组件数量的关系不是线性的,而是平方的。 6 | 7 | 如此说来,第二版因为长度加倍,完成时间应增加到四倍也就是两年。考虑到第一版的基础,时间会比两年短;而第一版的内容不能完全照搬,时间又会比一年半长。取个平均,lnote2的合理用时应该是21个月。 8 | 9 | 这多出来的18个月,包老师将其分别归功于自己的懒惰,工作的变化,和多了一个女儿。 10 | 11 | 在那本书里 Brooks 还指出,一个设计师的第二个系统往往是不靠谱的,因为他很可能会把第一个系统没有实现的东西一股脑都加入新系统。老包也犯了这个错误,还好他迷途知返,当发现篇幅可能远远超过两百页时,就把多余的东西都给砍了。 12 | 13 | 五年前写完 lnotes 时,包老师曾经很期待 \XeTeX 和 \LuaTeX。几年来,\XeTeX 和 \XeLaTeX 果然不负厚望,已然取代了 \TeX 和 \LaTeX。至于 \LuaTeX,好像还没有火起来。用 C 重写的模块,Lua 的支持,还是很令人憧憬的。 14 | 15 | 另外恭喜一下 milksea 新书《\LaTeX 入门》出版和 donated 博士毕业。这两位都为中国 \TeX 社区作出过很大的贡献,在本人学习 \TeX 的过程中也提供了无私的帮助。 16 | 17 | \begin{flushright} 18 | 2013年6月于法戈 19 | \end{flushright} 20 | 21 | %\newpage 22 | -------------------------------------------------------------------------------- /src/preface-fan.tex: -------------------------------------------------------------------------------- 1 | \chapter{友人序} 2 | 3 | This book was written by a friend Dr. Bao. The first version was published two years ago and this is the updated version. With many \LaTeX{} books around, is this book necessary? The answer is yes. This book is super cool. This is an advanced \LaTeX{} book and however it starts from basic and guides the readers to the most advanced tips. In addition, the style of the book is unique. It is half comments and half technical notes. If you missed the anecdotes, you miss many of the great materials. 4 | 5 | Technical wise, the feature of the book is several fold: the presentation of digital printing technology and history, the description of software packages that can make paper/dissertation writing easier (such as how to convert a pdf to an eps file), the collection of tricks that otherwise take long time to master. 6 | 7 | The book has 12 chapters with two Appendices. With Chapter 1 as introduction of history and Chapter 2 as introduction of \LaTeX{} as a whole from a "hello world" example, Chapter 3 as on fonts. This is a surprise arrangement and it showcases the author as an aesthete more than a software engineer. PS, \LaTeX{} lovers are more or less aesthetes, aren't they? Mathematic expressions are described in Chapter 4 and Chapter 5 is on figures. The next three chapters are not usually seen in \LaTeX{} books and they are: Metapost, PSTricks and PGF. Honestly speaking, I have not read these three chapters. Tables are mentioned in Chapter 9 and it is super useful. After reading Chapter 9, one knows how to rotate a table, how to make a long table, a wide table, etc. Chapter 10 is on structure. Chapter 11 is on printing. It gives a graphic explanation on page margins. Finally chapter 12 is on other applications such as Beamer for slides show, CV template, and letter template. The Appendices are of much use as well: Appendix A is about packages. Appendix B is on brief history of printing. 8 | 9 | Nontechnical wise, the book is super funny with its anecdotes. The writing is in Chinese and many historical poems were re-shaped in preface. In Chapter 1, when history of digital printing was described, names and stories of computer scientists who devoted their energy in making \LaTeX{}, Adobe and etc were told. The author was obsessed with each person's background, school and degree. In footnotes, you will see sth like this 1: Ph.D. from Cambridge or PhD from MIT, etc. 10 | 11 | The only disadvantage of this book is it is in Chinese and thus, the language limits its readers. On the other hand, with English as second language, can a book in English be that funny? 12 | 13 | \begin{flushright} 14 | Dr. Fan Lingling \\ 15 | August 26, 2013 16 | \end{flushright} 17 | -------------------------------------------------------------------------------- /src/preface-old.tex: -------------------------------------------------------------------------------- 1 | \chapter{原版序} 2 | 3 | \begin{quotation} 4 | 满纸荒唐言,一把辛酸泪!都云作者痴,谁解其中味?\footnote{当年作博士论文时虽不曾增删五次披阅十载,也被折磨得欲仙欲死,故与室友戏言将此五绝加入序言。多年以后的今天终于实现了此夙愿。} 5 | \begin{flushright} 6 | --- 曹雪芹 7 | \end{flushright} 8 | \end{quotation} 9 | 10 | 最早听说 \LaTeX 大约是2002年,一位同事演示了用它排版的一篇文章和几幅图。包老师\footnote{吾有多重人格,比如本色的是阿黄,下围棋的是隐忍灰衣人,道貌岸然的是包老师。}不以为然,因为那些东西用 Microsoft Word 和 Visio 也可以做到,而且可以做得更快。再次听说它是王垠同学在闹退学,传说他玩 Linux 和 \LaTeX 而走火入魔。 11 | 12 | 大约是2005年底,看了一下 lshort,用 \LaTeX 记了些数学笔记,开始有点感觉。包老师生性愚钝,所以喜欢相对简单的东西。HTML, Java 都用手写,FrontPage, Dreamweaver, JBuilder 之类笨重的家伙看两眼就扔了,所以喜欢上 \LaTeX 只是时间问题。 13 | 14 | 次年老妻要写博士论文,拿出 Word 底稿让我排版。大家都知道 Word 太简单了,谁都能用,但是不是谁都能用好。人称电脑杀手的老妻制作的 Word 文档自然使出了各种奇门遁甲,加上她实验室、学校和家里电脑里的三个 EndNote 版本互不兼容,实在难以驯服。我只好重起炉灶,拿她的博士论文当小白鼠,试验一下 \LaTeX 的威力。 15 | 16 | 就这样接触了两三年,总算略窥门径,感觉 \LaTeX 实在是博大精深,浩如烟海。而人到中年大脑储存空间和处理能力都有点捉襟见肘,故时常作些笔记。一来对常用资料和问题进行汇编索引,便于查询;二来也记录一些心得。 17 | 18 | 日前老妻吵着要学 \LaTeX,便想这份笔记对初学者或有些许借鉴意义,于是系统地整理了一番,添油加醋包装上市。 19 | 20 | 原本打算分九章,以纪念《九章算术》,实际上第八章完成时已如强弩之末,最后一章还须另择黄道吉日。 21 | 22 | 本文第一章谈谈历史背景;第二章介绍入门基础;第三至五章讲解数学、插图、表格等对象的用法;第六章是一些特殊功能;第七、八章讨论中文和字体的处理;第九章附加定制内容。 23 | 24 | 从难易程度上看前两章较简单,插图、字体两章较难。一般认为 \LaTeX 相对于微软的傻瓜型软件比较难学,所以这里采取循序渐进,温水煮青蛙的方法。 25 | 26 | 初则示弱,麻痹读者;再则巧言令色,请君入瓮;三则舌绽莲花,诱敌深入;彼入得罄中则摧动机关,关门打狗;继而严刑拷打,痛加折磨;待其意乱情迷彷徨无计之时,给予当头棒喝醍醐灌顶,虽戛然而止亦余音绕梁。 27 | 28 | 鄙人才疏学浅功力不逮,面对汗牛充栋罄竹难书\footnote{此处用法循阿扁古例。}的资料,未免考虑不周挂一漏万,或有误导,敬请海涵。若有高手高手高高手略拨闲暇指点一二,在下感激不尽。 29 | 30 | 借此感谢一下老妻,如果不是伊天天看韩剧,包老师也不会有时间灌水和整理这份笔记。 31 | 32 | \begin{flushright} 33 | 2008年2月于法戈 34 | \end{flushright} 35 | -------------------------------------------------------------------------------- /src/preface.tex: -------------------------------------------------------------------------------- 1 | \chapter{再版序} 2 | 3 | 这是一本关于 \LaTeX 排版系统的小书。原版开始只是一份学习笔记,完成于2008年;1.2版有八章,一百页左右。2010年,\XeTeX 技术已经比较成熟,于是花了三年多点将之扩充为12章,两百余页。第一版放在 Comprehensive \TeX{} Archive Network (CTAN)\footnote{\url{https://ctan.org/pkg/latex-notes-zh-cn}},第二版放在水木清华 BBS 和中科院的 CTeX BBS。 4 | 5 | 2019年初发现 CTeX BBS 关了,水木残了\footnote{现在发文要先用国内手机号认证,国外网友不太方便。}。就在第二版的基础上作了一些小的调整和修改 \footnote{细节见附件中的 history.txt。},凑个整2.56版,放到 GitHub\footnote{\url{https://github.com/huangxg/lnotes}} 上。 6 | 7 | \section*{新版改进} 8 | 新版本力求实现以下几个目标: 9 | 10 | \begin{compactenum} 11 | \item 系统性;结构完整,脉络清晰。 12 | \item 层次性;详略得当,重点突出。 13 | \item 进步性;技术先进,内容创新。 14 | \item 一致性;前后呼应,风格统一。 15 | \end{compactenum} 16 | 17 | 古人云:知易行难。古人又云:法乎其上,得乎其中。为实现这些目标,本文作出以下具体调整: 18 | 19 | \begin{compactenum} 20 | \item 全文按出版业惯例分为三大部分:前置部分,包括封面、标题、版权、献辞、目录、序、致谢等;主体部分包括12章;后置部分包括跋、附录、索引等。 21 | \item 第一章简介,历史回顾部分有较大扩充。 22 | \item 第二章入门,结构有所调整,重组了对齐和间距、特殊段落、列表等节,内容也有增强。 23 | \item 第三章字体,介绍电脑字体相关概念,字符集、编码、字体格式等,以及字体在 \LaTeX 中的应用。由于 \XeTeX 日趋成熟,新字体技术方案得到广泛应用;从前的一些中文解决方案和字体安装配置方法已经过时。本章由原第七章中文和第八章字体压缩合并而来,增加了 \XeTeX 相关内容。 24 | \item 第四章数学,结构基本不变,补充了部分示例的代码。 25 | \item 第五章插图,介绍图形格式及其转换,怎样插入图形,矢量绘图。增加了色彩模型介绍;若干小节标题略作调整,更加一致。 26 | \item \MP, PSTricks, PGF等绘图工具的介绍因篇幅较长,拆分为三个独立章节,内容亦有所增强和扩充。 27 | \item 第九章表格,增加了数字表格和宽表格两节,宽度控制和彩色表格有所增加和扩充。 28 | \item 第十章结构,介绍文档结构,标题、目录、长文档、参考文献、索引、超链接等。 29 | \item 第十一章布局,介绍页面尺寸,页面样式以及左右标记、章节标记等的定制,多栏、分页等。 30 | \item 第十二章应用,包括幻灯、书信、简历、棋谱等内容。 31 | \item 附录 A 软件资源,软件、宏包、字体等的链接。 32 | \item 附录 B 印刷简史,有图有真相。 33 | \item 索引,包括人物,学校、研究所、公司、政府部门等组织机构的索引。 34 | \end{compactenum} 35 | 36 | \section*{体例} 37 | 38 | \begin{compactenum} 39 | \item 人物,西方人名正文中一般用原文,索引中加中文翻译。中国人和日本人正文中用中文,索引中加英文翻译。正文中人名第一次出现时附生卒年份。 40 | \item 组织、机构、公司、学校等,著名的在正文中使用较短的中文或英文缩写 \footnote{这么安排是为了阅读的流畅,当然著名与否比较主观。} ,比如惠普、微软,和 MIT, IBM, ISO 等。一般的先写中文名,括号内提供英文名和缩写。索引中有全名。 41 | \item 人物和组织机构等,与本文没有直接关系的不加索引。 42 | \item 英文大小写,组织、机构、公司、学校等,一般首字母大写;其他词汇全部小写。 43 | \item 标点符号,中文间用全角,西文间用半角。 44 | \item 命令行程序、宏包、\LaTeX 命令和环境等用等宽字体。 45 | \item 源代码缩进两字符。 46 | \end{compactenum} 47 | 48 | \begin{flushright} 49 | 2010年3月于法戈\\ 50 | 2019年4月于约巴 51 | \end{flushright} 52 | -------------------------------------------------------------------------------- /src/software.tex: -------------------------------------------------------------------------------- 1 | \chapter{软件资源} 2 | 3 | \begin{longtable}{ll} 4 | \multicolumn{2}{r}{接上页} \\ 5 | \toprule 6 | \endhead 7 | \caption{宏包列表} \\ 8 | \toprule 9 | \endfirsthead 10 | \bottomrule 11 | \multicolumn{2}{r}{接下页\dots} \\ 12 | \endfoot 13 | \bottomrule 14 | \endlastfoot 15 | metalogo & 特殊符号和预定义字符串 \\ 16 | mflogo & 特殊符号和预定义字符串 \\ 17 | texnames & 特殊符号和预定义字符串 \\ 18 | ulem & 字体修饰 \\ 19 | indentfirst & 首行缩进 \\ 20 | setspace & 行距 \\ 21 | marginnote & 边注 \\ 22 | paralist & 行间列表 \\ 23 | fancyvrb & 原文打印、代码列表 \\ 24 | listings & 原文打印、代码列表 \\ 25 | verbatim & 原文打印、代码列表 \\ 26 | \midrule 27 | fontspec & \XeTeX 命令封装 \\ 28 | xeCJK & 中文字体和排版 \\ 29 | CJKnumber & 中文数字 \\ 30 | \midrule 31 | amsmath & 公式 \\ 32 | amsthm & 定理 \\ 33 | amsfonts & 数学字体 \\ 34 | mathrsfs & 数学字体 \\ 35 | \midrule 36 | graphicx & 插入图形 \\ 37 | subfig & 子图 \\ 38 | xcolor & 彩色 \\ 39 | pstricks & 绘制PSTricks图形 \\ 40 | pst-plot & 坐标图 \\ 41 | tikz & PGF前端 \\ 42 | preview & 生成单页图形 \\ 43 | \midrule 44 | booktabs & 三线表格 \\ 45 | tabularx & 控制表格宽度 \\ 46 | array & 表格对齐方式 \\ 47 | multirow & 跨行表格 \\ 48 | warpcol & 表格内数字对齐 \\ 49 | longtable & 长表格 \\ 50 | rotating & 旋转插图或表格 \\ 51 | colortbl & 彩色表格 \\ 52 | \midrule 53 | syntonly & 语法检查 \\ 54 | caption & 自定义浮动环境 \\ 55 | natbib & 文献列表 \\ 56 | makeidx & 索引 \\ 57 | hyperref & 超链接 \\ 58 | \midrule 59 | geometry & 页面布局 \\ 60 | fancyhdr & 页面样式 \\ 61 | multicol & 多栏 \\ 62 | \midrule 63 | beamer & 幻灯文档类 \\ 64 | letter & 书信文档类 \\ 65 | newlfm & 书信文档类 \\ 66 | envlab & 书信 \\ 67 | igo & 围棋棋谱 \\ 68 | \end{longtable} 69 | 70 | \begin{sidewaystable}[!h] 71 | \caption{软件列表} 72 | \label{tab:software_list} 73 | \centering 74 | \begin{tabular}{rl} 75 | \toprule 76 | MacTeX & \url{https://www.tug.org/mactex} \\ 77 | MikTeX & \url{https://www.miktex.org} \\ 78 | TeX Live & \url{https://www.tug.org/texlive} \\ 79 | \midrule 80 | Kile & \url{https://kile.sourceforge.net} \\ 81 | TeXShop & \url{https://pages.uoregon.edu/koch/texshop} \\ 82 | TeXstudio & \url{https://www.texstudio.org} \\ 83 | TeXworks & \url{https://www.tug.org/texworks} \\ 84 | \midrule 85 | Emacs & \url{https://www.gnu.org/software/emacs} \\ 86 | Visual Studio Code & \url{https://code.visualstudio.com} \\ 87 | Vim & \url{https://www.vim.org} \\ 88 | \midrule 89 | Bullzip PDF Printer & \url{https://www.bullzip.com/products/pdf} \\ 90 | Evince & \url{https://wiki.gnome.org/Apps/Evince} \\ 91 | Ghostscript & \url{https://www.ghostscript.com} \\ 92 | GSView & \url{http://pages.cs.wisc.edu/~ghost} \\ 93 | \midrule 94 | ImageMagick & \url{https://www.imagemagick.org} \\ 95 | Paint.NET & \url{https://www.getpaint.net} \\ 96 | \midrule 97 | JabRef & \url{https://www.jabref.org} \\ 98 | \midrule 99 | 本文源码 & \url{https://github.com/huangxg/lnotes} \\ 100 | Adobe 思源字体 & \url{https://github.com/adobe-fonts} \\ 101 | 思源西文字体合集 & \url{https://github.com/huangxg/font-source-collection} \\ 102 | \bottomrule 103 | \end{tabular} 104 | \end{sidewaystable} 105 | -------------------------------------------------------------------------------- /src/tables.tex: -------------------------------------------------------------------------------- 1 | \chapter{表格} 2 | 3 | \section{简单表格} 4 | 5 | \texttt{tabular} 环境提供了最简单的表格功能。它用 \verb|\hline| 命令表示横线,\verb+|+ 表示竖线;用 \verb|&| 来分列,用 \verb|\\| 来换行;每列可以采用居左、居中、居右等横向对齐方式,分别用 \texttt{l, c, r} 来表示。 6 | 7 | \begin{example}[htbp] 8 | \LoadFBTDemo[numbers=left]{texlet/tab-simple} 9 | \caption{简单表格} 10 | \label{tab:simple_tab} 11 | \end{example} 12 | 13 | %\clearpage 14 | 15 | 在插图一章中我们介绍了一种图形浮动环境 \texttt{figure};表格也有一种类似的浮动环境 \texttt{table},其标题和交叉引用的用法和图形浮动环境类似。我们可以用它给 \autoref{tab:simple_tab} 中的表格穿件马甲,顺便把表格简化为科技文献中常用的三线表。\autoref{tab:simple_tab} 中的三条横线一样粗细,如果嫌它不够美观,可以使用 Simon Fear\indexFear{} \footnote{这名字看起来像个笔名。《圣经·新约》路加福音卷有一个故事:耶稣于某湖边传教时,命渔人西门撒网,得鱼甚多。西门惊诧,五体投地,口称罪人。耶稣道:西门莫怕,打渔这个职业没什么前途,你还是跟我打人罢 (Jesus said unto Simon, Fear not; from henceforth thou shalt catch men.) 。西门遂忝列夫子门墙。另外有个恐怖小说系列\emph{Fear Street}里的主角也叫西门怕怕。} 的 \texttt{booktabs} 宏包\citep{Fear_booktabs}。三条横线就分别用 \verb|\toprule|, \verb|\midrule|, \verb|\bottomrule| 等命令表示。改进后的表格见 \autoref{tab:threesome_tab}。 16 | 17 | \begin{example}[htbp] 18 | \LoadFBTDemo[numbers=left]{texlet/tab-threesome} 19 | \caption{浮动三线表} 20 | \label{tab:threesome_tab} 21 | \end{example} 22 | 23 | \texttt{tabular} 环境中的行可以采用居顶、居中、居底等纵向对齐方式,分别用 \texttt{t, c, b} 来表示,缺省的是居中对齐。列之间的分隔符也可以改用其他符号,比如用 \verb+||+ 来画双竖线。 24 | 25 | \verb|语法:[纵向对齐]{横向对齐和分隔符}| 26 | 27 | \section{宽度控制} 28 | 29 | 有时我们需要控制某列的宽度,可以将其对齐方式参数从 \texttt{l, c, r} 改为 \verb|p{宽度}|。这时纵向对齐方式是居顶,\texttt{t, c, b}等参数失效。 30 | 31 | \begin{example}[htbp] 32 | \LoadFBTDemo[numbers=left]{texlet/tab-width} 33 | \caption{控制列宽} 34 | \label{tab:width_tab} 35 | \end{example} 36 | 37 | 使用宽度控制参数之后,表格内容缺省居左对齐。我们可以用列前置命令 \verb|>{}| 配合 38 | \verb|\centering, \raggedleft| 命令来把横向对齐方式改成居中或居右。列前置命令仅对紧邻其后的一列有效,其语法如下: 39 | 40 | \verb|语法:>{命令}列参数| 41 | 42 | \LoadCode[numbers=left]{texlet/tab-width-aligned-esc} 43 | 44 | \begin{example}[htbp] 45 | \LoadDemo{texlet/tab-width-aligned} 46 | \caption{控制列宽和横向对齐} 47 | \label{tab:width_aligned_tab} 48 | \end{example} 49 | 50 | 若要控制整个表格的宽度,可以使用 Carlisle\indexCarlisle 的 \texttt{tabularx} 宏包\citep{Carlisle_tabularx}的同名环境,其语法如下,其中 \texttt{X} 参数表示某列可以折行。 51 | 52 | \verb|语法:{表格宽度}{横向对齐, 分隔符, 折行}| 53 | 54 | %\LoadCode{texlet/tab_tabularx_esc} 55 | \begin{example}[htbp] 56 | \LoadFBTDemo[numbers=left]{texlet/tab-tabularx} 57 | \caption{控制表格宽度} 58 | \label{tab:tabularx_tab} 59 | \end{example} 60 | 61 | 如果想把纵向对齐方式改为居中和居底,可以使用 Mittelbach\indexMittelbach 和 Carlisle的 \texttt{array} 宏包\citep{Mittelbach_array},它提供了另两个对齐方式参数:\verb|m{宽度}, b{宽度}|。 62 | 63 | \section{跨行跨列} 64 | 65 | 有时表格某单元格需要横跨几列,可以使用 \verb|\multicolumn| 命令,同时用 \texttt{booktabs} 宏包的 \verb|\cmidrule| 命令来画横跨几列的横线。它们的语法如下: 66 | 67 | \verb|语法:\multicolumn{横跨列数}{对齐方式}{内容}|\\ 68 | \indent\verb|语法:\cmidrule{起始列-结束列}| 69 | 70 | \begin{example}[htbp] 71 | \LoadFBTDemo[numbers=left]{texlet/tab-multicol} 72 | \caption{跨列表格} 73 | \label{tab:multicol_tab} 74 | \end{example} 75 | 76 | 跨行表格可以使用 \texttt{multirow} 宏包的 \verb|\multirow| 命令,其语法如下, 77 | 78 | \verb|语法:\multirow{竖跨行数}{宽度}{内容}| 79 | 80 | \begin{example}[htbp] 81 | \LoadFBTDemo[numbers=left]{texlet/tab-multirow} 82 | \caption{跨行表格} 83 | \label{tab:multirow_tab} 84 | \end{example} 85 | 86 | \section{数字表格} 87 | 88 | 表格有大量数字时,手工调整小数点和数位的对齐很麻烦,这时可以用 Rochester\indexRochester{} \footnote{曾就职于昆士兰大学昆虫系,后转到澳大利亚联邦科学与工业研究组织 (Commonwealth Scientific and Industrial Research Organisation) 。} 的 \texttt{warpcol} 宏包\citep{Rochester_warpcol}。它为 \texttt{tabular} 环境提供了列对齐参数 \texttt{P},其语法如下,其中 \texttt{m} 和 \texttt{n} 分别是小数点前后的位数,数字前负号可选。 89 | 90 | \verb|语法:P{-m.n}| 91 | 92 | \begin{example}[htbp] 93 | \LoadFBTDemo[numbers=left]{texlet/tab-num} 94 | \caption{数字表格} 95 | \label{tab:num_tab} 96 | \end{example} 97 | 98 | \autoref{tab:num_tab} 中使用 \verb|\multicolumn| 命令是为了保护表头,防止它们被 \texttt{P} 参数误伤。把跨列命令的列数设为1是设置单元格格式的一种常用方法。 99 | 100 | \section{长表格} 101 | 102 | 有时表格太长要跨页,可以使用 Carlisle\indexCarlisle 的 \texttt{longtable} 宏包\citep{Carlisle_longtable}。这位同学对表格情有独钟,表格的宏包被他承包了一半。我们需要做以下工作: 103 | 104 | \begin{enumerate} 105 | \item 首先用 \texttt{longtable} 环境取代 \texttt{tabular} 环境; 106 | \item 然后在表格开始部分定义每页页首出现的通用表头,表头最后一行末尾不用 \verb|\\| 换行,而是加一个 \verb|\endhead| 命令; 107 | \item 接着定义首页表头 (如果它和通用表头不同的话) ,同样地最后一行用 \verb|\endfirsthead| 命令结尾; 108 | \item 然后是以 \verb|\endfoot| 命令结尾的通用表尾; 109 | \item 然后是以 \verb|\endlastfoot| 命令结尾的末页表尾 (如果它和通用表尾不同的话) ; 110 | \item 最后是表格的具体内容。 111 | \end{enumerate} 112 | 113 | \LoadCode[numbers=left]{texlet/tab-long-esc} 114 | 115 | \begin{Code}[numbers=left,firstnumber=last] 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 | \end{longtable} 141 | \end{Code} 142 | 143 | \input{texlet/tab-long} 144 | 145 | %\clearpage 146 | \section{宽表格} 147 | 148 | 表格太宽时可以使用 Fairbairns\indexFairbairns{} \footnote{1970年代剑桥数学学士,电脑硕士,现任剑桥网管。UK FAQ的维护者。} 等人的 \texttt{rotating} 宏包\citep{Fairbairns_rotating}。其方法很简单,用 \texttt{sidewaystable} 环境替代 \texttt{table} 环境即可。 149 | 150 | \begin{Code}[numbers=left] 151 | \begin{sidewaystable}[htbp] 152 | \caption{`主流英文词典`} 153 | \label{tab:dict} 154 | \centering 155 | \begin{tabularx}{550pt}{Xllcrrr} 156 | \toprule 157 | Title & Abbr & Publisher & Year 158 | & Pages & Entries & Price \\ 159 | \midrule 160 | Oxford English Dict, 2nd Ed & OED 161 | & Oxford Univ & 1989 & 21,728 & 616,500 & 995 \\ 162 | \end{Code} 163 | 164 | \LoadCode[numbers=left,firstnumber=last]{texlet/tab-rotate-esc} 165 | \input{texlet/tab-rotate} 166 | \lstset{firstnumber=1} 167 | 168 | \section{彩色表格} 169 | 170 | 若想给表格增加点色彩,可以使用 Carlisle的 \texttt{colortbl} 宏包\citep{Carlisle_colortbl}。它提供的 \verb|\columncolor|, \verb|\rowcolor|, \verb|\cellcolor| 命令可以分别设置列、行、单元格的颜色。这三个命令的基本语法相似: 171 | 172 | \verb|语法:{颜色}| 173 | 174 | \verb|\columncolor| 需要放到列前置命令里,\verb|\rowcolor|, \verb|\cellcolor| 分别放到行、单元格之前。\texttt{colortbl} 宏包可以使用 \texttt{xcolor} 宏包的色彩模型;两者同时,前者不能直接加载,需要通过后者的选项 \texttt{table} 来加载。三个命令同时使用时,它们的优先顺序为:单元格、行、列。 175 | 176 | \autoref{tab:color_tab} 这样的彩色表格过于花里胡哨,和包老师低调中年宅男的定位极不相称。\texttt{xcolor} 宏包的 \verb|\rowcolors| 命令 (需要 \texttt{colortbl} 宏包的支持) 可以分别设置奇偶行的颜色,甚合吾意。该命令语法如下: 177 | 178 | \begin{example}[htbp] 179 | \LoadFBTDemo[numbers=left]{texlet/tab-color} 180 | \caption{彩色表格} 181 | \label{tab:color_tab} 182 | \end{example} 183 | 184 | \verb|语法:{起始行}{奇数行颜色}{偶数行颜色}| 185 | 186 | \autoref{tab:alt_color_tab} 中代码第14行的 \verb|\hiderowcolors| 命令是用来暂停显示前面设置的奇偶行颜色,否则后面的其他表格会继续显示颜色。另一个命令 \verb|\showrowcolors| 可以用来重新激活奇偶行颜色设置。 187 | 188 | \begin{example}[ht] 189 | \LoadFBTDemo[numbers=left]{texlet/tab-color-alt} 190 | \caption{彩色表格} 191 | \label{tab:alt_color_tab} 192 | \end{example} 193 | 194 | \bibliographystyle{unsrtnat} 195 | \bibliography{lnotes2} 196 | -------------------------------------------------------------------------------- /src/texlet/big-ops.tex: -------------------------------------------------------------------------------- 1 | $ \sum_{i=1}^n i\quad \prod_{i=1}^n\quad 2 | \lim_{x\to0}x^2\quad \int_a^b x^2 dx $\\ 3 | $ \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 $ 5 | \[ \sum_{i=1}^n i\quad \prod_{i=1}^n\quad 6 | \lim_{x\to0}x^2\quad \int_a^b x^2 dx \] 7 | \[ \sum\nolimits_{i=1}^n i\quad 8 | \prod\nolimits_{i=1}^n\quad 9 | \lim\nolimits_{x\to0}x^2\quad 10 | \int\nolimits_a^b x^2 dx \] 11 | -------------------------------------------------------------------------------- /src/texlet/box-make-esc.tex: -------------------------------------------------------------------------------- 1 | %`语法:[宽度][对齐方式]`{`内容`} 2 | \makebox[100pt][c]{`仪仗队`} 3 | \framebox[100pt][s]{`仪仗队`} -------------------------------------------------------------------------------- /src/texlet/box-make.tex: -------------------------------------------------------------------------------- 1 | \makebox[100pt][c]{仪仗队} 2 | \framebox[100pt][s]{亻义亻丈阝人} -------------------------------------------------------------------------------- /src/texlet/box-par-esc.tex: -------------------------------------------------------------------------------- 1 | \fbox{% 2 | \parbox[c][36pt][t]{170pt}{ 3 | `锦瑟无端五十弦,一弦一柱思华年。庄生晓梦迷蝴蝶,望帝春心托杜鹃。` 4 | }% 5 | } 6 | \hfill 7 | \fbox{% 8 | \begin{minipage}[c][36pt][b]{170pt} 9 | `沧海月明珠有泪,蓝田日暖玉生烟。此情可待成追忆,只是当时已惘然。` 10 | \end{minipage}% 11 | } 12 | -------------------------------------------------------------------------------- /src/texlet/box-par.tex: -------------------------------------------------------------------------------- 1 | \fbox{% 2 | \parbox[c][36pt][t]{170pt}{ 3 | 锦瑟无端五十弦,一弦一柱思华年。庄生晓梦迷蝴蝶,望帝春心托杜鹃。 4 | }% 5 | } 6 | \hfill 7 | \fbox{% 8 | \begin{minipage}[c][36pt][b]{174pt} 9 | 沧海月明珠有泪,蓝田日暖玉生烟。此情可待成追忆,只是当时已惘然。 10 | \end{minipage}% 11 | } 12 | -------------------------------------------------------------------------------- /src/texlet/color-text-esc.tex: -------------------------------------------------------------------------------- 1 | \textcolor{Red}{`红`} 2 | \textcolor{Green}{`绿`} 3 | \textcolor{Blue}{`蓝`} 4 | \textcolor[RGB]{255,0,0}{`红`} 5 | \textcolor[HTML]{00FF00}{`绿`} 6 | \textcolor[rgb]{0,0,1}{`蓝`} 7 | -------------------------------------------------------------------------------- /src/texlet/color-text.tex: -------------------------------------------------------------------------------- 1 | \textcolor{Red}{红} 2 | \textcolor{Green}{绿} 3 | \textcolor{Blue}{蓝} 4 | \textcolor[RGB]{255,0,0}{红} 5 | \textcolor[HTML]{00FF00}{绿} 6 | \textcolor[rgb]{0,0,1}{蓝} 7 | -------------------------------------------------------------------------------- /src/texlet/delimiters.tex: -------------------------------------------------------------------------------- 1 | \[ \Bigg(\bigg(\Big(\big((x)\big)\Big)\bigg)\Bigg)\quad 2 | \Bigg[\bigg[\Big[\big[[x]\big]\Big]\bigg]\Bigg]\quad 3 | \Bigg\{\bigg\{\Big\{\big\{\{x\}\big\}\Big\}\bigg\}\Bigg\} 4 | \]\[ 5 | \Bigg\langle\bigg\langle\Big\langle\big\langle\langle x 6 | \rangle\big\rangle\Big\rangle\bigg\rangle\Bigg\rangle\quad 7 | \Bigg\lvert\bigg\lvert\Big\lvert\big\lvert\lvert x 8 | \rvert\big\rvert\Big\rvert\bigg\rvert\Bigg\rvert\quad 9 | \Bigg\lVert\bigg\lVert\Big\lVert\big\lVert\lVert x 10 | \rVert\big\rVert\Big\rVert\bigg\rVert\Bigg\rVert \] 11 | -------------------------------------------------------------------------------- /src/texlet/fig-better-subfig-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[htbp] 2 | \centering 3 | \subfloat[`左脚清明`]{ 4 | \label{fig:improved_subfig_a} 5 | \begin{minipage}[t]{60pt} 6 | \centering 7 | \includegraphics{left.pdf} 8 | \end{minipage} 9 | } 10 | \subfloat[`右脚反复`]{ 11 | \label{fig:improved_subfig_b} 12 | \begin{minipage}[t]{60pt} 13 | \centering 14 | \includegraphics{right.pdf} 15 | \end{minipage} 16 | } 17 | \caption{`反清复明`} 18 | \label{fig:improved_subfig} 19 | \end{figure} 20 | -------------------------------------------------------------------------------- /src/texlet/fig-better-subfig.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \subfloat[左脚清明]{ 3 | \label{fig:improved_subfig_a} 4 | \begin{minipage}[t]{60pt} 5 | \centering 6 | \includegraphics[page=2,scale=1.2]{mini.pdf} 7 | \end{minipage} 8 | } 9 | \subfloat[右脚反复]{ 10 | \label{fig:improved_subfig_b} 11 | \begin{minipage}[t]{60pt} 12 | \centering 13 | \includegraphics[page=3,scale=1.2]{mini.pdf} 14 | \end{minipage} 15 | } 16 | \captionof{figure}{反清复明} 17 | \label{fig:improved_subfig} 18 | -------------------------------------------------------------------------------- /src/texlet/fig-rotate-esc.tex: -------------------------------------------------------------------------------- 1 | \includegraphics[angle=90]{homer.pdf} 2 | \includegraphics[angle=180]{homer.pdf} 3 | \includegraphics[angle=270]{homer.pdf} \\ 4 | \includegraphics[angle=90,origin=c]{homer.pdf} 5 | \includegraphics[angle=180,origin=c]{homer.pdf} 6 | \includegraphics[angle=270,origin=c]{homer.pdf} \\ 7 | -------------------------------------------------------------------------------- /src/texlet/fig-rotate.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{ccc} 3 | \includegraphics[width=60pt,angle=90]{mini.pdf} & 4 | \includegraphics[width=60pt,angle=180]{mini.pdf} & 5 | \includegraphics[width=60pt,angle=270]{mini.pdf} \\ 6 | \includegraphics[width=60pt,angle=90,origin=c]{mini.pdf} & 7 | \includegraphics[width=60pt,angle=180,origin=c]{mini.pdf} \rule{0pt}{80pt} & 8 | \includegraphics[width=60pt,angle=270,origin=c]{mini.pdf} \\ 9 | \end{tabular} 10 | -------------------------------------------------------------------------------- /src/texlet/fig-subfig-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[htbp] 2 | \centering 3 | \subfloat[`左脚清明`]{ 4 | \label{fig:subfig_a} 5 | \includegraphics{left.pdf} 6 | } 7 | \hspace{10pt}% 8 | \subfloat[`右脚反复`]{ 9 | \label{fig:subfig_b} 10 | \includegraphics{right.pdf} 11 | } 12 | \caption{`反清复明`} 13 | \label{fig:subfig} 14 | \end{figure} 15 | -------------------------------------------------------------------------------- /src/texlet/fig-subfig.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \subfloat[左脚清明]{ 3 | \label{fig:subfig_a} 4 | \includegraphics[page=2,scale=1.2]{mini.pdf} 5 | } 6 | \hspace{10pt}% 7 | \subfloat[右脚反复]{ 8 | \label{fig:subfig_b} 9 | \includegraphics[page=3,scale=1.2]{mini.pdf} 10 | } 11 | \captionof{figure}{反清复明} 12 | \label{fig:subfig} 13 | -------------------------------------------------------------------------------- /src/texlet/fig-title-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[htbp] 2 | \centering 3 | \includegraphics{left.pdf} 4 | \includegraphics{right.pdf} 5 | \caption{`反清复明`} 6 | \end{figure} 7 | -------------------------------------------------------------------------------- /src/texlet/fig-title.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \includegraphics[page=2,scale=1.2]{mini.pdf} 3 | \includegraphics[page=3,scale=1.2]{mini.pdf} 4 | \captionof{figure}{反清复明}% figure can't be inside minipage 5 | \vspace{3pt} 6 | -------------------------------------------------------------------------------- /src/texlet/fig-titles-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{figure}[htbp] 2 | \centering 3 | \begin{minipage}{60pt} 4 | \centering 5 | \includegraphics{left.pdf} 6 | \caption{`清明`} 7 | \end{minipage} 8 | \hspace{10pt}% 9 | \begin{minipage}{60pt} 10 | \centering 11 | \includegraphics{right.pdf} 12 | \caption{`反复`} 13 | \end{minipage} 14 | \end{figure} 15 | -------------------------------------------------------------------------------- /src/texlet/fig-titles.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{minipage}{60pt} 3 | \centering 4 | \includegraphics[page=2,scale=1.2]{mini.pdf} 5 | \captionof{figure}{清明} 6 | \label{fig:titles_a} 7 | \end{minipage} 8 | \hspace{10pt}% 9 | \begin{minipage}{60pt} 10 | \centering 11 | \includegraphics[page=3,scale=1.2]{mini.pdf} 12 | \captionof{figure}{反复} 13 | \label{fig:titles_b} 14 | \end{minipage} 15 | -------------------------------------------------------------------------------- /src/texlet/fig-zoom-esc.tex: -------------------------------------------------------------------------------- 1 | \includegraphics[width=60pt]{homer.pdf} 2 | \includegraphics[width=80pt]{homer.pdf} 3 | \includegraphics[width=80pt,height=100pt]{homer.pdf} 4 | \includegraphics[width=80pt,height=100pt,keepaspectratio]{homer.pdf} 5 | -------------------------------------------------------------------------------- /src/texlet/fig-zoom.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{cccc} 3 | \includegraphics[width=60pt]{mini.pdf} & 4 | \includegraphics[width=80pt]{mini.pdf} & 5 | \includegraphics[width=80pt,height=100pt]{mini.pdf} & 6 | \includegraphics[width=80pt,height=100pt,keepaspectratio]{mini.pdf} \\ 7 | 原图 & 放大 & 变形 & 不变形 \\ 8 | \end{tabular} 9 | -------------------------------------------------------------------------------- /src/texlet/hello-world.tex: -------------------------------------------------------------------------------- 1 | %hello_world.tex 2 | \documentclass{article} 3 | \begin{document} 4 | Hello, World! 5 | \end{document} 6 | -------------------------------------------------------------------------------- /src/texlet/href-esc.tex: -------------------------------------------------------------------------------- 1 | \url{http://www.dralpha.com/}\\ 2 | \href{http://www.dralpha.com/}{`包老师的主页`} 3 | -------------------------------------------------------------------------------- /src/texlet/href.tex: -------------------------------------------------------------------------------- 1 | \url{http://www.dralpha.com/}\\ 2 | \href{http://www.dralpha.com/}{包老师的主页} 3 | -------------------------------------------------------------------------------- /src/texlet/hyperref-esc.tex: -------------------------------------------------------------------------------- 1 | \label{sec:hyperlink} 2 | ... 3 | `编号形式的链接:`\ref{sec:hyperlink}\\ 4 | `文字形式的链接:`\hyperref[sec:hyperlink]{`链接`} 5 | -------------------------------------------------------------------------------- /src/texlet/hyperref.tex: -------------------------------------------------------------------------------- 1 | 编号形式的链接:\ref{sec:hyperlink}\\ 2 | 文字形式的链接:\hyperref[sec:hyperlink]{链接} 3 | -------------------------------------------------------------------------------- /src/texlet/layout-chaptermark-a.tex: -------------------------------------------------------------------------------- 1 | \noindent 28\hfill Chapter 3: 章名 2 | \ \\ 3 | 4 | \hfill 偶数页\hfill 5 | -------------------------------------------------------------------------------- /src/texlet/layout-chaptermark-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage{fancyhdr} 2 | \pagestyle{fancy} 3 | \fancyhf{} 4 | \fancyhead[LE,RO]{\thepage} 5 | \fancyhead[RE]{\leftmark} 6 | \fancyhead[LO]{\rightmark} 7 | \fancypagestyle{plain}{ 8 | \fancyhf{} 9 | \renewcommand{\headrulewidth}{0pt} 10 | } 11 | \renewcommand\chaptermark[1]{\markboth{\chaptername\ \thechapter: #1}{}} 12 | \renewcommand\sectionmark[1]{\markright{\thesection: #1}} 13 | -------------------------------------------------------------------------------- /src/texlet/layout-chaptermark.tex: -------------------------------------------------------------------------------- 1 | \noindent 3.2: 节名\hfill 27 2 | \ \\ 3 | 4 | \hfill 奇数页\hfill 5 | -------------------------------------------------------------------------------- /src/texlet/layout-cols-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage{multicol} 2 | \setlength{\columnsep}{12pt} 3 | \setlength{\columnseprule}{1pt} 4 | \begin{multicols}{2} 5 | ... 6 | \end{multicols} 7 | -------------------------------------------------------------------------------- /src/texlet/layout-cols.tex: -------------------------------------------------------------------------------- 1 | \let\oldcolumnsep=\columnsep 2 | \let\oldcolumnseprule=\columnseprule 3 | \setlength{\columnsep}{12pt} 4 | \setlength{\columnseprule}{1pt} 5 | \setlength{\columnsep}{\oldcolumnsep} 6 | \setlength{\columnseprule}{\oldcolumnseprule} 7 | 8 | \begin{multicols}{2} 9 | 如是我闻,一时,佛在舍卫国祗树给孤独园,与大比丘众千二百五十人俱。尔时,世尊食时,著衣持钵,入舍卫大城乞食。于其城中,次第乞已,还至本处。饭食讫,收衣钵,洗足已,敷座而坐。 10 | \end{multicols} 11 | -------------------------------------------------------------------------------- /src/texlet/layout-fancyhdr-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage{fancyhdr} 2 | ... 3 | \pagestyle{fancy} 4 | \lhead{`左擎苍`} 5 | \chead{`三个代表`} 6 | \rhead{`右牵黄`} 7 | \lfoot{`左青龙`} 8 | \cfoot{`八荣八耻`} 9 | \rfoot{`右白虎`} 10 | \renewcommand{\headrulewidth}{0.4pt} 11 | \renewcommand{\footrulewidth}{0.4pt} 12 | -------------------------------------------------------------------------------- /src/texlet/layout-fancyhdr.tex: -------------------------------------------------------------------------------- 1 | \noindent 左擎苍\hfill 三个代表\hfill 右牵黄 2 | \hrule 3 | \ \\ 4 | 5 | \hfill 和谐社会\hfill\ 6 | 7 | \ \\ 8 | \hrule 9 | \noindent 左青龙\hfill 八荣八耻\hfill 右白虎 10 | -------------------------------------------------------------------------------- /src/texlet/layout-macro.tex: -------------------------------------------------------------------------------- 1 | \pagestyle{fancy} 2 | \fancyhf{} %清空页眉页脚 3 | \fancyhead[LE,RO]{\thepage} %偶数页左,奇数页右 4 | \fancyhead[RE]{\leftmark} %偶数页右 5 | \fancyhead[LO]{\rightmark} %奇数页左 6 | \fancypagestyle{plain}{ %重定义plain页面样式 7 | \fancyhf{} 8 | \renewcommand{\headrulewidth}{0pt} 9 | } 10 | -------------------------------------------------------------------------------- /src/texlet/layout-markboth-a.tex: -------------------------------------------------------------------------------- 1 | \noindent 2\hfill 光明左使 2 | \ \\ 3 | 4 | 杨逍 5 | -------------------------------------------------------------------------------- /src/texlet/layout-markboth-esc.tex: -------------------------------------------------------------------------------- 1 | \documentclass{book} 2 | \markboth{`光明左使`}{`光明右使`} 3 | \pagestyle{myheadings} 4 | ... 5 | \begin{document} 6 | `范遥` 7 | \newpage 8 | `杨逍` 9 | \newpage 10 | \end{document} 11 | -------------------------------------------------------------------------------- /src/texlet/layout-markboth.tex: -------------------------------------------------------------------------------- 1 | \noindent 光明右使\hfill 1 2 | \ \\ 3 | 4 | 范遥 5 | -------------------------------------------------------------------------------- /src/texlet/layout-pagestyle-a.tex: -------------------------------------------------------------------------------- 1 | \noindent 芙蓉姐姐\hfill 貌似天仙 2 | \ \\ 3 | 4 | \hfill 闭月羞花,沉鱼落雁。\hfill\ 5 | \ \\ 6 | 7 | \noindent \hfill 2 \hfill 8 | -------------------------------------------------------------------------------- /src/texlet/layout-pagestyle-esc.tex: -------------------------------------------------------------------------------- 1 | \makeatletter 2 | \newcommand{\ps@permanentdamagedhead}{ 3 | \renewcommand{\@oddhead}{`信春哥`\hfill `不挂科`} 4 | \renewcommand{\@oddfoot}{\hfill\thepage\hfill} 5 | \renewcommand{\@evenhead}{`芙蓉姐姐`\hfill `美若天仙`} 6 | \renewcommand{\@evenfoot}{\@oddfoot} 7 | } 8 | \makeatother 9 | -------------------------------------------------------------------------------- /src/texlet/layout-pagestyle.tex: -------------------------------------------------------------------------------- 1 | \noindent 信春哥\hfill 不挂科 2 | \ \\ 3 | 4 | \hfill 至于你信不信,我反正信了。\hfill\ 5 | \ \\ 6 | 7 | \noindent \hfill 1 \hfill 8 | -------------------------------------------------------------------------------- /src/texlet/list-description.tex: -------------------------------------------------------------------------------- 1 | \begin{description} 2 | \item[C++] 编程语言 3 | \item[Java] 编程语言 4 | \item[HTML] 标记语言 5 | \end{description} 6 | -------------------------------------------------------------------------------- /src/texlet/list-enumerate.tex: -------------------------------------------------------------------------------- 1 | \begin{enumerate} 2 | \item C++ 3 | \item Java 4 | \item HTML 5 | \end{enumerate} 6 | -------------------------------------------------------------------------------- /src/texlet/list-itemize.tex: -------------------------------------------------------------------------------- 1 | \begin{itemize} 2 | \item C++ 3 | \item Java 4 | \item HTML 5 | \end{itemize} 6 | -------------------------------------------------------------------------------- /src/texlet/matrix.tex: -------------------------------------------------------------------------------- 1 | \[ \begin{pmatrix} a&b\\c&d \end{pmatrix} \quad 2 | \begin{bmatrix} a&b\\c&d \end{bmatrix} \quad 3 | \begin{Bmatrix} a&b\\c&d \end{Bmatrix} \quad 4 | \begin{vmatrix} a&b\\c&d \end{vmatrix} \quad 5 | \begin{Vmatrix} a&b\\c&d \end{Vmatrix} \] 6 | -------------------------------------------------------------------------------- /src/texlet/note-footnote-esc.tex: -------------------------------------------------------------------------------- 1 | `正文`\footnote{`脚注`} -------------------------------------------------------------------------------- /src/texlet/note-footnote.tex: -------------------------------------------------------------------------------- 1 | 正文\footnote{脚注} -------------------------------------------------------------------------------- /src/texlet/par-center-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{center} 2 | `居中`\\`段落` 3 | \end{center} -------------------------------------------------------------------------------- /src/texlet/par-center.tex: -------------------------------------------------------------------------------- 1 | \begin{center} 2 | 居中\\段落 3 | \end{center} -------------------------------------------------------------------------------- /src/texlet/par-left-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{flushleft} 2 | `居左`\\`段落` 3 | \end{flushleft} -------------------------------------------------------------------------------- /src/texlet/par-left.tex: -------------------------------------------------------------------------------- 1 | \begin{flushleft} 2 | 居左\\段落 3 | \end{flushleft} -------------------------------------------------------------------------------- /src/texlet/par-right-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{flushright} 2 | `居右`\\`段落` 3 | \end{flushright} -------------------------------------------------------------------------------- /src/texlet/par-right.tex: -------------------------------------------------------------------------------- 1 | \begin{flushright} 2 | 居右\\段落 3 | \end{flushright} -------------------------------------------------------------------------------- /src/texlet/quote-quotation-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{quotation} 2 | `引文两端缩进,首行增加缩进。` 3 | \end{quotation} -------------------------------------------------------------------------------- /src/texlet/quote-quotation.tex: -------------------------------------------------------------------------------- 1 | \begin{quotation} 2 | 引文两端缩进,首行增加缩进。 3 | \end{quotation} -------------------------------------------------------------------------------- /src/texlet/quote-quote-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{quote} 2 | `引文两端`\\`都缩进。` 3 | \end{quote} 4 | -------------------------------------------------------------------------------- /src/texlet/quote-quote.tex: -------------------------------------------------------------------------------- 1 | \begin{quote} 2 | 引文两端\\都缩进。 3 | \end{quote} 4 | -------------------------------------------------------------------------------- /src/texlet/quote-verse-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{verse} 2 | `引文两端缩进,第二行起增加缩进。` 3 | \end{verse} -------------------------------------------------------------------------------- /src/texlet/quote-verse.tex: -------------------------------------------------------------------------------- 1 | \begin{verse} 2 | 引文两端缩进,第二行起增加缩进。 3 | \end{verse} -------------------------------------------------------------------------------- /src/texlet/ref-esc.tex: -------------------------------------------------------------------------------- 1 | `一个标签`\label{marker} 2 | ... 3 | `第`\pageref{marker}`页`\ref{marker}`节` -------------------------------------------------------------------------------- /src/texlet/ref.tex: -------------------------------------------------------------------------------- 1 | 一个标签\\ 2 | ...\\ 3 | 第 \pageref{sec:crossref} 页 \ref{sec:crossref} 节 -------------------------------------------------------------------------------- /src/texlet/tab-base-cross.tex: -------------------------------------------------------------------------------- 1 | 跨平台 & TeX Live & TeXworks \\ 2 | -------------------------------------------------------------------------------- /src/texlet/tab-base-header.tex: -------------------------------------------------------------------------------- 1 | 操作系统 & 发行版 & 编辑器 \\ 2 | -------------------------------------------------------------------------------- /src/texlet/tab-base-mac.tex: -------------------------------------------------------------------------------- 1 | macOS & MacTeX & TeXShop \\ 2 | -------------------------------------------------------------------------------- /src/texlet/tab-base-unix.tex: -------------------------------------------------------------------------------- 1 | Unix/Linux & teTeX & Kile \\ 2 | -------------------------------------------------------------------------------- /src/texlet/tab-base-win.tex: -------------------------------------------------------------------------------- 1 | Windows & MikTeX & TeXnicCenter \\ 2 | -------------------------------------------------------------------------------- /src/texlet/tab-color-alt-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage[table]{xcolor} 2 | ... 3 | \begin{table}[htbp] 4 | \centering 5 | \rowcolors{1}{White}{Lavender} 6 | \begin{tabular}{lll} 7 | \hline 8 | `操作系统` & `发行版` & `编辑器` \\ 9 | Windows & MikTeX & TeXnicCenter \\ 10 | Unix/Linux & teTeX & Kile \\ 11 | macOS & MacTeX & TeXShop \\ 12 | `跨平台` & TeX Live & TeXworks \\ 13 | \hline 14 | \hiderowcolors 15 | \end{tabular} 16 | \end{table} 17 | -------------------------------------------------------------------------------- /src/texlet/tab-color-alt.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \rowcolors{1}{White}{Lavender} 3 | \begin{tabular}{lll} 4 | \hline 5 | \input texlet/tab-base-header 6 | \input texlet/tab-base-win 7 | \input texlet/tab-base-unix 8 | \input texlet/tab-base-mac 9 | \input texlet/tab-base-cross 10 | \hline 11 | \hiderowcolors 12 | \end{tabular} 13 | -------------------------------------------------------------------------------- /src/texlet/tab-color-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage[table]{xcolor} 2 | ... 3 | \begin{table}[htbp] 4 | \centering 5 | \begin{tabular}{l>{\columncolor{Yellow}}ll} 6 | \rowcolor{Red}`操作系统` & `发行版` & `编辑器` \\ 7 | Windows & MikTeX & TeXnicCenter \\ 8 | \rowcolor{Green}Unix/Linux & \cellcolor{Lavender}teTeX 9 | & Kile \\ 10 | macOS & MacTeX & TeXShop \\ 11 | \rowcolor{Blue}`跨平台` & TeX Live & TeXworks \\ 12 | \end{tabular} 13 | \end{table} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-color.tex: -------------------------------------------------------------------------------- 1 | %\begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{l>{\columncolor{Yellow}}ll} 4 | \rowcolor{Red}操作系统 & 发行版 & 编辑器 \\ 5 | Windows & MikTeX & TeXnicCenter \\ 6 | \rowcolor{Green}Unix/Linux & \cellcolor{Lavender}teTeX & Kile \\ 7 | macOS & MacTeX & TeXShop \\ 8 | \rowcolor{Blue}跨平台 & TeX Live & TeXworks \\ 9 | \end{tabular} 10 | %\end{table} 11 | -------------------------------------------------------------------------------- /src/texlet/tab-long-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{longtable}{ll} 2 | \multicolumn{2}{r}{`接上页`} \\ 3 | \toprule 4 | `作者` & `作品` \\ 5 | \midrule 6 | \endhead 7 | \caption{`长表格`} \\ 8 | \toprule 9 | `作者` & `作品` \\ 10 | \midrule 11 | \endfirsthead 12 | \bottomrule 13 | \multicolumn{2}{r}{`接下页`\dots} \\ 14 | \endfoot 15 | \bottomrule 16 | \endlastfoot 17 | -------------------------------------------------------------------------------- /src/texlet/tab-long.tex: -------------------------------------------------------------------------------- 1 | \begin{longtable}{ll} 2 | \multicolumn{2}{r}{接上页} \\ 3 | \toprule 4 | 作者 & 作品 \\ 5 | \midrule 6 | \endhead 7 | \caption{长表格} \\ 8 | \toprule 9 | 作者 & 作品 \\ 10 | \midrule 11 | \endfirsthead 12 | \bottomrule 13 | \multicolumn{2}{r}{接下页\dots} \\ 14 | \endfoot 15 | \bottomrule 16 | \endlastfoot 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 | \end{longtable} 42 | -------------------------------------------------------------------------------- /src/texlet/tab-multicol-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{lll} 4 | \toprule 5 | & \multicolumn{2}{c}{`常用工具`} \\ 6 | \cmidrule{2-3} 7 | `操作系统` & `发行版` & `编辑器` \\ 8 | \midrule 9 | Windows & MikTeX & TexMakerX \\ 10 | Unix/Linux & teTeX & Kile \\ 11 | macOS & MacTeX & TeXShop \\ 12 | `跨平台` & TeX Live & TeXworks \\ 13 | \bottomrule 14 | \end{tabular} 15 | \end{table} 16 | -------------------------------------------------------------------------------- /src/texlet/tab-multicol.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{lll} 3 | \toprule 4 | & \multicolumn{2}{c}{常用工具} \\ 5 | \cmidrule{2-3} 6 | \input texlet/tab-base-header 7 | \midrule 8 | \input texlet/tab-base-win 9 | \input texlet/tab-base-unix 10 | \input texlet/tab-base-mac 11 | \input texlet/tab-base-cross 12 | \bottomrule 13 | \end{tabular} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-multirow-esc.tex: -------------------------------------------------------------------------------- 1 | \usepackage{multirow} 2 | ... 3 | \begin{table}[htbp] 4 | \centering 5 | \begin{tabular}{lllc} 6 | \toprule 7 | `操作系统` & `发行版` & `编辑器` & `用户体验`\\ 8 | \midrule 9 | Windows & MikTeX & TeXnicCenter & 10 | \multirow{3}{*}{\centering `爽`} \\ 11 | Unix/Linux & TeX Live & Emacs \\ 12 | macOS & MacTeX & TeXShop \\ 13 | \bottomrule 14 | \end{tabular} 15 | \end{table} 16 | -------------------------------------------------------------------------------- /src/texlet/tab-multirow.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{lllc} 3 | \toprule 4 | 操作系统 & 发行版 & 编辑器 & 用户体验\\ 5 | \midrule 6 | Windows & MikTeX & TeXnicCenter & 7 | \multirow{3}{*}{\centering 爽} \\ 8 | Unix/Linux & TeX Live & Emacs \\ 9 | macOS & MacTeX & TeXShop \\ 10 | \bottomrule 11 | \end{tabular} 12 | -------------------------------------------------------------------------------- /src/texlet/tab-num-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{P{2.5}P{-2.5}} 4 | \toprule 5 | \multicolumn{1}{c}{`数学常数`} & 6 | \multicolumn{1}{c}{`物理常数`} \\ 7 | \midrule 8 | 3.14159 & 2.99792 \\ 9 | 27.18281 & -17.58819 \\ 10 | \bottomrule 11 | \end{tabular} 12 | \end{table} 13 | -------------------------------------------------------------------------------- /src/texlet/tab-num.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{P{2.5}P{-2.5}} 3 | \toprule 4 | \multicolumn{1}{c}{数学常数} & \multicolumn{1}{c}{物理常数} \\ 5 | \midrule 6 | 3.14159 & 2.99792 \\ 7 | 27.18281 & -17.58819 \\ 8 | \bottomrule 9 | \end{tabular} 10 | -------------------------------------------------------------------------------- /src/texlet/tab-rotate-esc.tex: -------------------------------------------------------------------------------- 1 | \midrule 2 | Shorter Oxford English Dict, 7th Ed & SOED 3 | & Oxford Univ & 2007 & 3,888 & 600,000 & 175 \\ 4 | New Oxford Dict of English, 2nd & NODE 5 | & Oxford Univ & 2005 & 2,112 & 355,000 & 68 \\ 6 | Webster's Third New International Dict & W3 7 | & Merriam-Webster & 1961 & 2,816 & 476,000 & 129 \\ 8 | American Heritage Dict, 4th Ed & AHD 9 | & Houghton Mifflin & 2000 & 2,112 & 90,000 & 60 \\ 10 | Random House Webster's Unabridged Dict, 2nd Ed & Random 11 | & Random House & 2005 & 2,256 & 315,000 & 69 \\ 12 | \midrule 13 | Concise Oxford Dict, 11th Ed & COD 14 | & Oxford Univ & 2006 & 1,728 & 240,000 & \\ 15 | Chambers Dict, 10th Ed & Chambers 16 | & Chambers Harrap & 2006 & 1,872 & & 50 \\ 17 | Collins English Dict, 9th Ed & Collins 18 | & HarperCollins & 2007 & 1,888 & & 67 \\ 19 | Longman Dict of Contemporary English, 4th Ed & Longman 20 | & Longman & 2005 & & 207,000 & 71 \\ 21 | Merriam-Webster's Collegiate Dict, 11th Ed & 22 | & Merriam-Webster & 2003 & 1,664 & 225,000 & 26 \\ 23 | American Heritage College Dict, 4th Ed & 24 | & Houghton Mifflin & 2007 & 1,664 & & 26 \\ 25 | Random House Webster's College Dict & 26 | & Random House & 2005 & 1,632 & & 26 \\ 27 | Webster's New World College Dict, 4th Ed & 28 | & John Wiley \& Sons & 2004 & 1,744 & 160,000 & 26 \\ 29 | \bottomrule 30 | \end{tabularx} 31 | \end{sidewaystable} 32 | -------------------------------------------------------------------------------- /src/texlet/tab-rotate.tex: -------------------------------------------------------------------------------- 1 | \begin{sidewaystable}[htbp] 2 | \caption{主流英语词典} 3 | \label{tab:dict} 4 | \centering 5 | \begin{tabularx}{550pt}{Xllcrrr} 6 | \toprule 7 | Title & Abbr & Publisher & Year & Pages & Entries & Price \\ 8 | \midrule 9 | Oxford English Dict, 2nd Ed & OED 10 | & Oxford Univ & 1989 & 21,728 & 616,500 & 995 \\ 11 | \midrule 12 | Shorter Oxford English Dict, 7th Ed & SOED 13 | & Oxford Univ & 2007 & 3,888 & 600,000 & 175 \\ 14 | New Oxford Dict of English, 2nd & NODE 15 | & Oxford Univ & 2005 & 2,112 & 355,000 & 68 \\ 16 | Webster's Third New International Dict & W3 17 | & Merriam-Webster & 1961 & 2,816 & 476,000 & 129 \\ 18 | American Heritage Dict, 4th Ed & AHD 19 | & Houghton Mifflin & 2000 & 2,112 & 90,000 & 60 \\ 20 | Random House Webster's Unabridged Dict, 2nd Ed & Random 21 | & Random House & 2005 & 2,256 & 315,000 & 69 \\ 22 | \midrule 23 | Concise Oxford Dict, 11th Ed & COD 24 | & Oxford Univ & 2006 & 1,728 & 240,000 & \\ 25 | Chambers Dict, 10th Ed & Chambers 26 | & Chambers Harrap & 2006 & 1,872 & & 50 \\ 27 | Collins English Dict, 9th Ed & Collins 28 | & HarperCollins & 2007 & 1,888 & & 67 \\ 29 | Longman Dict of Contemporary English, 4th Ed & Longman 30 | & Longman & 2005 & & 207,000 & 71 \\ 31 | Merriam-Webster's Collegiate Dict, 11th Ed & 32 | & Merriam-Webster & 2003 & 1,664 & 225,000 & 26 \\ 33 | American Heritage College Dict, 4th Ed & 34 | & Houghton Mifflin & 2007 & 1,664 & & 26 \\ 35 | Random House Webster's College Dict & 36 | & Random House & 2005 & 1,632 & & 26 \\ 37 | Webster's New World College Dict, 4th Ed & 38 | & John Wiley \& Sons & 2004 & 1,744 & 160,000 & 26 \\ 39 | \bottomrule 40 | \end{tabularx} 41 | \end{sidewaystable} 42 | -------------------------------------------------------------------------------- /src/texlet/tab-simple-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{tabular}{|l|c|r|} 2 | \hline 3 | `操作系统` & `发行版` & `编辑器` \\ 4 | \hline 5 | Windows & MikTeX & TeXnicCenter \\ 6 | \hline 7 | Unix/Linux & teTeX & Kile \\ 8 | \hline 9 | macOS & MacTeX & TeXShop \\ 10 | \hline 11 | `跨平台` & TeX Live & TeXworks \\ 12 | \hline 13 | \end{tabular} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-simple.tex: -------------------------------------------------------------------------------- 1 | \begin{tabular}{|l|c|r|} 2 | \hline 3 | \input texlet/tab-base-header 4 | \hline 5 | \input texlet/tab-base-win 6 | \hline 7 | \input texlet/tab-base-unix 8 | \hline 9 | \input texlet/tab-base-mac 10 | \hline 11 | \input texlet/tab-base-cross 12 | \hline 13 | \end{tabular} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-tabularx-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabularx}{350pt}{lXlX} 4 | \toprule 5 | `李白` & `平林漠漠烟如织,寒山一带伤心碧。暝色入高楼,有人楼上愁。` 6 | `玉阶空伫立,宿鸟归飞急。何处是归程,长亭更短亭。`& 7 | `泰戈尔` & `夏天的飞鸟,飞到我的窗前唱歌,又飞去了。` 8 | `秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。`\\ 9 | \bottomrule 10 | \end{tabularx} 11 | \end{table} 12 | -------------------------------------------------------------------------------- /src/texlet/tab-tabularx.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabularx}{350pt}{lXlX} 3 | \toprule 4 | 李白 & 平林漠漠烟如织,寒山一带伤心碧。暝色入高楼,有人楼上愁。玉阶空伫立,宿鸟归飞急。何处是归程,长亭更短亭。& 5 | 泰戈尔 & 夏天的飞鸟,飞到我的窗前唱歌,又飞去了。秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。\\ 6 | \bottomrule 7 | \end{tabularx} 8 | -------------------------------------------------------------------------------- /src/texlet/tab-threesome-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{lll} 4 | \toprule 5 | `操作系统` & `发行版` & `编辑器` \\ 6 | \midrule 7 | Windows & MikTeX & TexMakerX \\ 8 | Unix/Linux & teTeX & Kile \\ 9 | macOS & MacTeX & TeXShop \\ 10 | `跨平台` & TeX Live & TeXworks \\ 11 | \bottomrule 12 | \end{tabular} 13 | \end{table} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-threesome.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{lll} 3 | \toprule 4 | \input texlet/tab-base-header 5 | \midrule 6 | \input texlet/tab-base-win 7 | \input texlet/tab-base-unix 8 | \input texlet/tab-base-mac 9 | \input texlet/tab-base-cross 10 | \bottomrule 11 | \end{tabular} 12 | -------------------------------------------------------------------------------- /src/texlet/tab-width-aligned-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{p{80pt}>{\centering}p{80pt}>{\raggedleft\arraybackslash}p{80pt}} 4 | \toprule 5 | `操作系统` & `发行版` & `编辑器` \\ 6 | \midrule 7 | Windows & MikTeX & TexMakerX \\ 8 | Unix/Linux & teTeX & Kile \\ 9 | macOS & MacTeX & TeXShop \\ 10 | `跨平台` & TeX Live & TeXworks \\ 11 | \bottomrule 12 | \end{tabular} 13 | \end{table} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-width-aligned.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{p{80pt}>{\centering}p{80pt}>{\raggedleft\arraybackslash}p{80pt}} 3 | \toprule 4 | \input texlet/tab-base-header 5 | \midrule 6 | \input texlet/tab-base-win 7 | \input texlet/tab-base-unix 8 | \input texlet/tab-base-mac 9 | \input texlet/tab-base-cross 10 | \bottomrule 11 | \end{tabular} 12 | -------------------------------------------------------------------------------- /src/texlet/tab-width-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{table}[htbp] 2 | \centering 3 | \begin{tabular}{p{80pt}p{80pt}p{80pt}} 4 | \toprule 5 | `操作系统` & `发行版` & `编辑器` \\ 6 | \midrule 7 | Windows & MikTeX & TexMakerX \\ 8 | Unix/Linux & teTeX & Kile \\ 9 | macOS & MacTeX & TeXShop \\ 10 | `跨平台` & TeX Live & TeXworks \\ 11 | \bottomrule 12 | \end{tabular} 13 | \end{table} 14 | -------------------------------------------------------------------------------- /src/texlet/tab-width.tex: -------------------------------------------------------------------------------- 1 | \centering 2 | \begin{tabular}{p{80pt}p{80pt}p{80pt}} 3 | \toprule 4 | \input texlet/tab-base-header 5 | \midrule 6 | \input texlet/tab-base-win 7 | \input texlet/tab-base-unix 8 | \input texlet/tab-base-mac 9 | \input texlet/tab-base-cross 10 | \bottomrule 11 | \end{tabular} 12 | -------------------------------------------------------------------------------- /src/texlet/theorem-cor-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{corollary} 2 | `晚上喝咖啡可能会导致失眠。` 3 | \end{corollary} -------------------------------------------------------------------------------- /src/texlet/theorem-cor.tex: -------------------------------------------------------------------------------- 1 | \begin{corollary} 2 | 晚上喝咖啡可能会导致失眠。 3 | \end{corollary} -------------------------------------------------------------------------------- /src/texlet/theorem-def-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{definition} 2 | `Java是一种跨平台的编程语言。` 3 | \end{definition} 4 | -------------------------------------------------------------------------------- /src/texlet/theorem-def.tex: -------------------------------------------------------------------------------- 1 | \begin{definition} 2 | Java是一种跨平台的编程语言。 3 | \end{definition} 4 | -------------------------------------------------------------------------------- /src/texlet/theorem-lem-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{lemma} 2 | `茶和咖啡都会使人的大脑兴奋。` 3 | \end{lemma} -------------------------------------------------------------------------------- /src/texlet/theorem-lem.tex: -------------------------------------------------------------------------------- 1 | \begin{lemma} 2 | 茶和咖啡都会使人的大脑兴奋。 3 | \end{lemma} -------------------------------------------------------------------------------- /src/texlet/theorem-proof-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{proof}[`命题物质无限可分的证明`] 2 | `一尺之棰,日取其半,万世不竭。` 3 | \end{proof} -------------------------------------------------------------------------------- /src/texlet/theorem-proof.tex: -------------------------------------------------------------------------------- 1 | \begin{proof}[命题物质无限可分的证明] 2 | 一尺之棰,日取其半,万世不竭。 3 | \end{proof} -------------------------------------------------------------------------------- /src/texlet/theorem-the-esc.tex: -------------------------------------------------------------------------------- 1 | \begin{theorem} 2 | `咖啡因可以刺激人的中枢神经。` 3 | \end{theorem} -------------------------------------------------------------------------------- /src/texlet/theorem-the.tex: -------------------------------------------------------------------------------- 1 | \begin{theorem} 2 | 咖啡因可以刺激人的中枢神经。 3 | \end{theorem} --------------------------------------------------------------------------------