├── .gitignore ├── asymptote-by-example-zh-cn ├── README └── src │ ├── CLEAN.bat │ ├── MAKEPDF.bat │ ├── asy.bib │ ├── asymptote.sty │ ├── asysyntex.sty │ ├── automata.pdf │ ├── automata.tex │ ├── automata_hand.pdf │ ├── cct.ist │ ├── cleantmp │ ├── figure-src │ ├── CJKmove.sty │ ├── area.asy │ ├── automata.asy │ ├── automata_hand.asy │ ├── ballfill.asy │ ├── convexhull.asy │ ├── digraph.asy │ ├── hanoi.asy │ ├── hsvinter.asy │ ├── hyper.asy │ ├── movie15.sty │ ├── node.asy │ ├── recplot.asy │ ├── simplenode.asy │ ├── stars.asy │ ├── tiling.asy │ └── xiantu.asy │ ├── gpl-3.0.tex │ ├── main.tex │ ├── makepdf │ ├── myfonts.sty │ ├── stars.pdf │ ├── stars.tex │ ├── tiling.pdf │ ├── tiling.tex │ ├── xasy.png │ ├── xiantu-ancient.pdf │ ├── xiantu.pdf │ └── xiantu.tex ├── asymptote-faq-zh-cn ├── README └── src │ ├── asy-faq.tex │ ├── figures │ ├── 4-1.asy │ ├── 4-1.pdf │ ├── 4-2.asy │ ├── 4-2.pdf │ ├── 4-7.asy │ ├── 4-7.pdf │ ├── 4-8.asy │ ├── 4-8.pdf │ ├── 4-9.asy │ ├── 4-9.pdf │ ├── 5-1a.asy │ ├── 5-1a.pdf │ ├── 5-2.asy │ ├── 5-2.pdf │ ├── 5-4.asy │ ├── 5-4.pdf │ ├── 6-1.asy │ ├── 6-1.pdf │ ├── 6-11a.asy │ ├── 6-11a.pdf │ ├── 6-11b.asy │ ├── 6-11b.pdf │ ├── 6-12.asy │ ├── 6-12.pdf │ ├── 6-14.asy │ ├── 6-14.pdf │ ├── 6-15.asy │ ├── 6-15.pdf │ ├── 6-19.asy │ ├── 6-19.pdf │ ├── 6-2.asy │ ├── 6-2.pdf │ ├── 6-3.asy │ ├── 6-3.pdf │ ├── 6-4.asy │ ├── 6-4.pdf │ ├── 6-5.asy │ ├── 6-5.pdf │ ├── 6-6.asy │ ├── 6-6.pdf │ ├── 6-7b.asy │ ├── 6-7b.pdf │ ├── 6-7c.asy │ ├── 6-7c.pdf │ ├── 6-8b.asy │ ├── 6-8b.pdf │ ├── 6-8c.asy │ ├── 6-8c.pdf │ ├── 6-9.asy │ ├── 6-9.pdf │ ├── 8-4.asy │ ├── 8-4.pdf │ ├── 8-8a.asy │ ├── 8-8a.pdf │ ├── 8-8b.asy │ ├── 8-8b.pdf │ ├── 8-8c.asy │ ├── 8-8c.pdf │ ├── 8-8d.asy │ ├── 8-8d.pdf │ ├── 8-9a.asy │ ├── 8-9a.pdf │ ├── 8-9b.asy │ └── 8-9b.pdf │ └── preamble_newnew.tex ├── asymptote-manual-zh-cn ├── README └── src │ ├── CDlabel.asy │ ├── CLEAN.bat │ ├── Coons.asy │ ├── Gouraud.asy │ ├── MAKEPDF.bat │ ├── Pythagoras.asy │ ├── adobefonts.tex │ ├── asycolors.sty │ ├── asysyntex.tex │ ├── axialshade.asy │ ├── bezier2.asy │ ├── beziercurve.asy │ ├── bigdiagonal.asy │ ├── bigsquare.asy │ ├── cleantmp │ ├── clippath.asy │ ├── colons.asy │ ├── colors.asy │ ├── cube.asy │ ├── diagonal.asy │ ├── dots.asy │ ├── fzfonts.tex │ ├── hatch.asy │ ├── join.asy │ ├── labelalign.asy │ ├── labelsquare.asy │ ├── latticeshading.asy │ ├── linecap.asy │ ├── linejoin.asy │ ├── linetype.asy │ ├── logo.asy │ ├── main.tex │ ├── makepdf │ ├── makepen.asy │ ├── mexicanhat.asy │ ├── quartercircle.asy │ ├── shadedtiling.asy │ ├── shadestroke.asy │ ├── square.asy │ ├── subpictures.asy │ ├── superpath.asy │ ├── tile.asy │ ├── transparency.asy │ ├── windingnumber.asy │ └── winfonts.tex ├── clsguide-zh-cn └── clsguide-zh-cn.tex ├── context-notes-zh-cn ├── README └── src │ ├── Makefile │ ├── basis.tex │ ├── bibl-lyr.tex │ ├── bibliography.bib │ ├── ctxnotes.tex │ ├── doc-env.tex │ ├── figures │ ├── bookmark.png │ ├── cow.pdf │ ├── gardeninglion.jpg │ └── header.png │ ├── fonts.tex │ ├── layout.tex │ ├── metafun.tex │ ├── presentation.tex │ ├── project.tex │ ├── references.tex │ ├── t-layout.tex │ ├── t-zhfonts.lua │ ├── t-zhfonts.mkiv │ ├── t-zhspuncs.lua │ └── zhfonts.tex ├── context-top-ten ├── README └── src │ ├── Makefile │ ├── apple.pdf │ ├── bg-slide.asy │ ├── bg-slide.eps │ ├── bg-slide.pdf │ ├── cmds.tex │ ├── ctanlion.pdf │ ├── fish.pdf │ ├── gnu.pdf │ ├── hacker.pdf │ ├── post.pdf │ ├── sin.asy │ ├── sin.pdf │ ├── slide-bg.pdf │ └── title-slide.pdf ├── ctex-faq ├── README └── src │ ├── ctex-faq.sty │ ├── ctex-faq.tex │ └── make.bat ├── latex-notes-zh-cn ├── README ├── history.txt ├── license.txt └── src │ ├── basics.tex │ ├── dscf4684.jpg │ ├── examples │ ├── arrow.mps │ ├── color.mps │ ├── colors.mps │ ├── curve.mps │ ├── dashed.mps │ ├── dot.mps │ ├── fill.mps │ ├── label.mps │ ├── line.mps │ ├── loop.mps │ ├── path.mps │ ├── predefined.mps │ ├── pst_arc.eps │ ├── pst_arrow.eps │ ├── pst_axis.eps │ ├── pst_bezier.eps │ ├── pst_circle.eps │ ├── pst_color.eps │ ├── pst_curve.eps │ ├── pst_dot.eps │ ├── pst_fill.eps │ ├── pst_frame.eps │ ├── pst_grid.eps │ ├── pst_label.eps │ ├── pst_line.eps │ ├── pst_linestyle.eps │ ├── pst_origin.eps │ ├── pst_parabola.eps │ ├── pst_polygon.eps │ ├── pst_rput.eps │ ├── pst_uput.eps │ ├── subfig.mps │ ├── subfig_left.mps │ ├── subfig_right.mps │ ├── transform.mps │ └── uline.mps │ ├── fonts.tex │ ├── graphics.tex │ ├── i18n.tex │ ├── introduction.tex │ ├── lnotes.tex │ ├── math.tex │ ├── misc.tex │ ├── postcript.tex │ ├── preface.tex │ ├── reading.bib │ └── tables.tex ├── natbib-zh-cn ├── natbib-zh │ ├── figures │ │ ├── natbib1.PNG │ │ ├── natbib2.PNG │ │ ├── natbib3.PNG │ │ ├── natbib4.PNG │ │ ├── natbib5.PNG │ │ ├── natbib6.PNG │ │ ├── natbib7.PNG │ │ └── natbib8.PNG │ ├── natbib-zh.pdf │ └── natbib-zh.tex └── natbib.tex └── ttb-zh-cn ├── Makefile ├── idxstyle.ist ├── local.bib ├── ttb-zh-cn.tex └── ttb_style.sty /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.dmp 3 | *.fd 4 | *.glo 5 | *.gls 6 | *.hd 7 | *.idx 8 | *.ilg 9 | *.ind 10 | *.ins 11 | *.out 12 | *.swp 13 | *.synctex.gz 14 | *.synctex.gz(busy) 15 | *.tmp 16 | *.toc 17 | *.ver 18 | *.xdv 19 | *.zip 20 | *~ 21 | *.fdb_latexmk 22 | *.log 23 | 24 | # Mac OS X 25 | .DS_Store 26 | 27 | # natbib 28 | natbib-zh-cn/natbib.pdf 29 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/README: -------------------------------------------------------------------------------- 1 | Asymptote by Example is an Asymptote tutorial in Simplified Chinese by milksea at ctex.org. 2 | 3 | Asymptote 1.90 should be used to compile the example. 4 | 5 | The document is released under GPL. 6 | 7 | If you are interested in the process of development you may observe 8 | 9 | http://code.google.com/p/ctex-doc/updates/list 10 | 11 | Report feedback in the Issues section of ctex-doc project, 12 | or in http://bbs.ctex.org forum. 13 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/CLEAN.bat: -------------------------------------------------------------------------------- 1 | del main-??.pdf main.asy 2 | del *.bak *.???~ 3 | del *.log *.aux *.toc *.out *.ilg *.ind *.idx *.bbl *.blg -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/MAKEPDF.bat: -------------------------------------------------------------------------------- 1 | xelatex main 2 | asy -compact -divisor 4 main 3 | xelatex main 4 | iconv -f utf-8 -t gbk main.idx | cctmkind -C mixed -s cct.ist| iconv -f gbk -t utf-8 > main.ind 5 | bibtex main 6 | xelatex main 7 | xelatex main 8 | move /y main.pdf AsymptoteByExample.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/asy.bib: -------------------------------------------------------------------------------- 1 | % This file was created with JabRef 2.4.2. 2 | % Encoding: UTF8 3 | 4 | @ARTICLE{quanjing, 5 | author = {曲安京}, 6 | title = {商高、趙爽與劉徽關於勾股定理的證明}, 7 | journal = {數學傳播}, 8 | year = {1998}, 9 | volume = {20}, 10 | number = {3}, 11 | owner = {milksea}, 12 | timestamp = {2009.05.14} 13 | } 14 | 15 | @BOOK{aho1974, 16 | title = {The Design and Analysis of Computer Algorithms}, 17 | publisher = {Addison Wesley}, 18 | year = {1974}, 19 | author = {Alfred V. Aho and John E. Hopcroft and Jeffrey D. Ullman}, 20 | note = {这是算法设计与分析的经典文献, 21 | 22 | 机械工业出版社有中文译本: 23 | 24 | 《计算机算法的设计与分析》}, 25 | owner = {milksea}, 26 | timestamp = {2009.11.04} 27 | } 28 | 29 | @MANUAL{metafun, 30 | title = {METAFUN}, 31 | author = {Hans Hagen}, 32 | edition = {Preliminary}, 33 | month = {January}, 34 | year = {2002}, 35 | owner = {milksea}, 36 | timestamp = {2009.10.01} 37 | } 38 | 39 | @MANUAL{asyman, 40 | title = {Asymptote: the Vector Graphics Language}, 41 | author = {Andy Hammerlindl and John Bowman and Tom Prince}, 42 | edition = {\asyversion{}}, 43 | year = {2009}, 44 | note = {这是 Asymptote 的官方手册,刘海洋给出了文档的一个翻译,见 \url{http://code.google.com/p/asy4cn/}}, 45 | owner = {milksea}, 46 | timestamp = {2009.05.13} 47 | } 48 | 49 | @BOOK{harbison2002, 50 | title = {C: A Reference Manual}, 51 | publisher = {Prentice-Hall}, 52 | year = {2002}, 53 | author = {Samuel P. Harbison and Guy L. Steele}, 54 | edition = {Fifth}, 55 | month = {February}, 56 | note = {机械工业出版社有中译本《C 语言参考手册》}, 57 | owner = {milksea}, 58 | timestamp = {2009.12.20} 59 | } 60 | 61 | @MANUAL{mpman, 62 | title = {\MP: A User's Manual}, 63 | author = {John D. Hobby and {the MetaPost development team}}, 64 | edition = {1.005}, 65 | month = {May}, 66 | year = {2008}, 67 | owner = {milksea}, 68 | timestamp = {2009.06.16} 69 | } 70 | 71 | @MANUAL{geometry, 72 | title = {\prgname{geometry.asy}: Euclidean geometry with \Asy{}}, 73 | author = {Philippe Ivaldi}, 74 | edition = {1.0}, 75 | month = {May}, 76 | year = {2009}, 77 | comment = {English Translation by Olivier Guibé \& Philippe Ivaldi}, 78 | owner = {milksea}, 79 | timestamp = {2009.10.11} 80 | } 81 | 82 | @BOOK{kandr, 83 | title = {The C programming Language}, 84 | publisher = {Prentice-Hall}, 85 | year = {1988}, 86 | author = {Brian W. Kernighan and Dennis M. Ritchie}, 87 | edition = {second}, 88 | note = {这是 ANSI C 语言的经典文献,机械工业出版社有中译本《C 程序设计语言》}, 89 | owner = {milksea}, 90 | timestamp = {2009.10.25} 91 | } 92 | 93 | @BOOK{knuth1986, 94 | title = {The \MF{}book}, 95 | publisher = {Addison Wesley}, 96 | year = {1986}, 97 | author = {Donald Ervin Knuth}, 98 | volume = {C}, 99 | series = {Computers \& Typesetting}, 100 | owner = {milksea}, 101 | timestamp = {2009.06.16} 102 | } 103 | 104 | @BOOK{taocp2, 105 | title = {Seminumerical Algorithm}, 106 | publisher = {Addison-Wesley}, 107 | year = {1981}, 108 | author = {Donald Ervin Knuth}, 109 | volume = {2}, 110 | series = {The Art Of Computer Programming}, 111 | edition = {second}, 112 | note = {这是算法分析的经典文献, 113 | 114 | 国防工业出版社有中文 115 | 116 | 译本《计算机程序设计艺术:半数值算法》 117 | 118 | (旧译《计算机程序设{计}技巧:半数值算法》)}, 119 | owner = {milksea}, 120 | timestamp = {2009.10.24} 121 | } 122 | 123 | @BOOK{roberts1995, 124 | title = {The Art and Science of C: A Library Based Introduction to Computer 125 | Science}, 126 | publisher = {Addison Wesley}, 127 | year = {1995}, 128 | author = {Eric S. Roberts}, 129 | note = {机械工业出版社有中文译本}, 130 | owner = {milksea}, 131 | timestamp = {2009.11.04} 132 | } 133 | 134 | @MANUAL{pgfman, 135 | title = {The Ti\emph{k}Z \& \textsc{PGF} Packages}, 136 | author = {Till Tantau}, 137 | organization = {Institut für Theoretische Informatik Universität zu Lübeck}, 138 | edition = {2.00}, 139 | month = {February}, 140 | year = {2008}, 141 | owner = {milksea}, 142 | timestamp = {2009.10.24} 143 | } 144 | 145 | @MANUAL{pstricks, 146 | title = {PSTricks: PostScript macros for Generic \TeX{}}, 147 | author = {Timothy Van Zandt}, 148 | edition = {97}, 149 | month = {July}, 150 | year = {2003}, 151 | owner = {milksea}, 152 | timestamp = {2009.05.19} 153 | } 154 | 155 | @comment{jabref-meta: selector_publisher:} 156 | 157 | @comment{jabref-meta: selector_author:} 158 | 159 | @comment{jabref-meta: selector_journal:} 160 | 161 | @comment{jabref-meta: selector_keywords:} 162 | 163 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/automata.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/automata.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/automata_hand.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/automata_hand.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/cct.ist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/cct.ist -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/cleantmp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm main-??.pdf main.asy 3 | rm *.bak *.???~ 4 | rm *.log *.aux *.toc *.out *.ilg *.ind *.idx *.bbl *.blg 5 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/CJKmove.sty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/figure-src/CJKmove.sty -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/area.asy: -------------------------------------------------------------------------------- 1 | // 一段 Bezier 曲线的面积(相对 x 轴,逆时钟环绕为正) 2 | // 直接利用 S = ∫-y(t)*x'(t) dt 做 0 到 1 的定积分得到 3 | // 其中 z(t) = (x(t), y(t)) = (1-t)^3*z0 + 3t*(1-t)^2*c0 + 3t^2*(1-t)*c1 + t^3*z1 4 | private real area(pair z0, pair c0, pair c1, pair z1) 5 | { 6 | return (3*c1.y*(z0.x - 2*z1.x) - z0.y*(3*c1.x - 10*z0.x + z1.x) 7 | - 3*c0.y*(c1.x - 2*z0.x + z1.x) + (6*c1.x + z0.x - 10*z1.x)*z1.y 8 | + 3*c0.x*(c1.y - 2*z0.y + z1.y))/20.; 9 | } 10 | 11 | // 一条路径的有向面积 12 | // 仅当路径是闭合的时候,有正确的几何意义,此时应具有平移不变性 13 | real area(path[] p) 14 | { 15 | real A = 0; 16 | for (path g : p) { 17 | for (int i = 0; i < length(g); ++i) { 18 | pair z0 = point(g, i), z1 = point(g, i+1); 19 | pair c0 = postcontrol(g, i), c1 = precontrol(g, i+1); 20 | A += area(z0, c0, c1, z1); 21 | } 22 | } 23 | return A; 24 | } 25 | 26 | 27 | // 应返回 3.14xxx 和 -314.xxx,后面的位不准 28 | write(area(unitcircle)); 29 | write(area(reverse(circle((-2,3), 10)))); 30 | 31 | import graph; 32 | // 应返回 3.14159265358979 和 -314.159265358979,这里 15 位都是准确的 33 | write(area(Circle((0,0), 1))); 34 | write(area(reverse(Circle((-2,3), 10)))); 35 | 36 | write(area(Circle((0,0), 1, 16))); 37 | write(nCircle); 38 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/automata.asy: -------------------------------------------------------------------------------- 1 | //#-*- coding: utf-8 -*- 2 | // automata.asy 3 | // `\color{comment}描述 C 语言浮点数词法有限自动机(需要 simplenode 模块)` 4 | import simplenode; 5 | 6 | settings.tex="xelatex"; 7 | usepackage("xeCJK"); 8 | texpreamble("\setCJKmainfont{SimHei}"); 9 | 10 | real u = 2cm; 11 | Arrow = Arrow(6); 12 | pen text = white; 13 | pen starttext = black; 14 | currentpen = linewidth(0.6) + fontcommand("\scriptsize\ttfamily"); 15 | 16 | draw_t Initial = none; 17 | draw_t State = compose(shadow, filldrawer(deepgreen, darkgreen+0.6)); 18 | draw_t Accepting = compose(shadow, filler(deepgreen), 19 | drawer(darkgreen+1.8), drawer(white+0.6)); 20 | 21 | node q0 = Circle("$q_0$", (0,0), text, State), 22 | q1 = Circle("$q_1$", q0.pos + u*S, text, State), 23 | q2 = Circle("$q_2$", q1.pos + u*E, text, Accepting), 24 | q3 = Circle("$q_3$", q0.pos + u*E, text, State), 25 | q4 = Circle("$q_4$", q3.pos + u*E + 0.5u*S, text, State), 26 | q5 = Circle("$q_5$", q4.pos + u*E, text, State), 27 | q6 = Circle("$q_6$", q5.pos + u*E, text, Accepting), 28 | q7 = Circle("$q_7$", q6.pos + u*E, text, Accepting); 29 | node start = Circle("开始", q0.pos + 0.7u*W, starttext, Initial); 30 | draw(start, q0, q1, q2, q3, q4, q5, q6, q7); 31 | 32 | draw(start -- q0 @ shorten, Arrow); 33 | draw(".", q0 -- q1 @ shorten, Arrow); 34 | draw("[0-9]", q1 -- q2 @ shorten, Arrow); 35 | draw(".", q3 -- q2 @ shorten, Arrow); 36 | draw("[eE]", q2 -- q4 @ shorten(1,2), Arrow); 37 | draw(Label("[0-9]", LeftSide), q0 -- q3 @ shorten, Arrow); 38 | draw(Label("[eE]", LeftSide), q3 -- q4 @ shorten, Arrow); 39 | draw(Label("[+-]", LeftSide), q4 -- q5 @ shorten, Arrow); 40 | draw(Label("[0-9]", LeftSide), q5 -- q6 @ shorten, Arrow); 41 | draw(Label("[fFlL]", LeftSide), q6 -- q7 @ shorten(1,2), Arrow); 42 | draw("[0-9]", q3 .. loop(N) @ shorten, Arrow); 43 | draw("[0-9]", q2 .. loop(S) @ shorten(1,2), Arrow); 44 | draw("[0-9]", q6 .. loop(N) @ shorten(1,2), Arrow); 45 | draw("[0-9]", q4 .. bendright .. q6 @ shorten, Arrow); 46 | draw("[fFlL]", q2 .. bendright .. q7 @ shorten(1,2), Arrow); 47 | 48 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/automata_hand.asy: -------------------------------------------------------------------------------- 1 | //#-*- coding: utf-8 -*- 2 | // 模仿手绘自动机(需要 node 模块) 3 | // 刘海洋 4 | import node; 5 | import trembling; 6 | 7 | startTrembling(); 8 | 9 | typedef path fpath(path); 10 | 11 | path operator@(path p, fpath t) 12 | { 13 | return t(p); 14 | } 15 | 16 | fpath shorten(real pre=0, real post=2) 17 | { 18 | return new path(path p) { 19 | return subpath(p, arctime(p, pre), arctime(p, arclength(p)-post)); 20 | }; 21 | } 22 | fpath shorten=shorten(0,2); 23 | 24 | settings.tex="xelatex"; 25 | usepackage("fontspec"); 26 | usepackage("amsmath"); 27 | texpreamble("\setmainfont{FZQiTi-S14}"); 28 | 29 | real u = 2cm; 30 | Arrow = Arrow(SimpleHead, 6); 31 | pen text = black; 32 | pen starttext = black; 33 | defaultpen(linewidth(0.6)); 34 | currentpen = fontcommand("\scriptsize"); 35 | 36 | draw_t Initial = none; 37 | draw_t State = drawer; 38 | draw_t Accepting = compose(drawer(linewidth(1.8)), drawer(white+0.6)); 39 | 40 | node q0 = Circle("q$_{\text{0}}$", (0,0), text, State), 41 | q1 = Circle("q$_{\text{1}}$", q0.pos + u*S, text, State), 42 | q2 = Circle("q$_{\text{2}}$", q1.pos + u*E, text, Accepting), 43 | q3 = Circle("q$_{\text{3}}$", q0.pos + u*E, text, State), 44 | q4 = Circle("q$_{\text{4}}$", q3.pos + u*E + 0.5u*S, text, State), 45 | q5 = Circle("q$_{\text{5}}$", q4.pos + u*E, text, State), 46 | q6 = Circle("q$_{\text{6}}$", q5.pos + u*E, text, Accepting), 47 | q7 = Circle("q$_{\text{7}}$", q6.pos + u*E, text, Accepting); 48 | node start = Rectangle("开始", q0.pos + 0.7u*W, starttext, innersep=0, Initial); 49 | draw(start, q0, q1, q2, q3, q4, q5, q6, q7); 50 | 51 | draw(start -- q0 @ shorten, Arrow); 52 | draw(".", q0 -- q1 @ shorten, Arrow); 53 | draw("[0-9]", q1 -- q2 @ shorten, Arrow); 54 | draw(".", q3 -- q2 @ shorten, Arrow); 55 | draw("[eE]", q2 -- q4 @ shorten(1,2), Arrow); 56 | draw(Label("[0-9]", LeftSide), q0 -- q3 @ shorten, Arrow); 57 | draw(Label("[eE]", LeftSide), q3 -- q4 @ shorten, Arrow); 58 | draw(Label("[+-]", LeftSide), q4 -- q5 @ shorten, Arrow); 59 | draw(Label("[0-9]", LeftSide), q5 -- q6 @ shorten, Arrow); 60 | draw(Label("[fFlL]", LeftSide), q6 -- q7 @ shorten(1,2), Arrow); 61 | draw("[0-9]", loop(q3, N) @ shorten, Arrow); 62 | draw("[0-9]", loop(q2, S) @ shorten(1,2), Arrow); 63 | draw("[0-9]", loop(q6, N) @ shorten(1,2), Arrow); 64 | draw("[0-9]", q4 .. bendright .. q6 @ shorten, Arrow); 65 | draw("[fFlL]", q2 .. bendright .. q7 @ shorten(1,2), Arrow); 66 | 67 | //shipout(bbox(0.5cm, Fill(white))); 68 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/ballfill.asy: -------------------------------------------------------------------------------- 1 | //# -*- coding: utf-8 -*- 2 | 3 | path operator@(path p, transform t) 4 | { 5 | return t * p; 6 | } 7 | 8 | typedef path fpath(path); 9 | 10 | path operator@(path p, fpath t) 11 | { 12 | return t(p); 13 | } 14 | 15 | fpath cutbefore(path knife) 16 | { 17 | return new path (path p) { 18 | return firstcut(p, knife).after; 19 | }; 20 | } 21 | 22 | fpath cutafter(path knife) 23 | { 24 | return new path (path p) { 25 | return lastcut(p, knife).before; 26 | }; 27 | } 28 | 29 | filltype BallShade(pen color, pen bgcolor=black, pair lightdir=NW) 30 | { 31 | return filltype(new void(frame f, path[] g, pen) { 32 | pair diff = max(g) - min(g); 33 | real r = max(diff.x, diff.y)/2; 34 | pair c = (min(g)+max(g))/2 + 0.3r*unit(lightdir); 35 | frame fr; 36 | radialshade(fr, g, interp(bgcolor,color,0.1), c, r, 37 | interp(bgcolor,color,0.5), c, 0.5r); 38 | radialshade(fr, circle(c, 0.5r), interp(bgcolor,color,0.5), c, 0.5r, 39 | interp(bgcolor,color,0.7), c, 0.36r); 40 | radialshade(fr, circle(c, 0.36r), interp(bgcolor,color,0.7), c, 0.36r, 41 | interp(white,color,0.75), c, 0.18r); 42 | radialshade(fr, circle(c, 0.18r), interp(white,color,0.75), c, 0.18r, 43 | interp(white,color,0.15), c, 0); 44 | clip(fr, g); 45 | add(f, fr); 46 | }); 47 | } 48 | 49 | filltype BallShade = BallShade(blue); 50 | 51 | unitsize(2cm); 52 | object a = draw("A", ellipse, (0,0), BallShade(yellow)); 53 | object b = draw("B", ellipse, dir(30), BallShade); 54 | object c = draw("C", ellipse, dir(-30), BallShade(lightgreen,darkred)); 55 | object d = draw("D", roundbox, (sqrt(3),0), xmargin=5, ymargin=2, FillDraw(palegreen)); 56 | object e = draw("E", box, sqrt(3)+(1,0), xmargin=2, FillDraw(palegreen)); 57 | add( 58 | new void(picture pic, transform t) { 59 | draw(pic, point(a,ENE,t) -- point(b,WSW,t), Arrow); 60 | draw(pic, point(a,ESE,t) -- point(c,WNW,t), Arrow); 61 | draw(pic, point(b,ESE,t) -- point(d,WNW,t), Arrow); 62 | draw(pic, point(c,ENE,t) -- point(d,WSW,t), Arrow); 63 | draw(pic, "loop", point(b,NNE,t){NNE} .. point(b,N,t)+(0,15) .. {SSE}point(b,NNW,t), Arrow);//loop 64 | draw(pic, point(d,ENE,t){ENE} .. {ESE}point(e,WNW,t), Arrow); 65 | draw(pic, point(e,WSW,t){WSW} .. {WNW}point(d,ESE,t), Arrow); 66 | } 67 | ); 68 | 69 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/convexhull.asy: -------------------------------------------------------------------------------- 1 | size(5cm); 2 | int n = 10; 3 | pair[] Q = new pair[n]; 4 | for (int i = 0; i < n; ++i) 5 | { 6 | Q[i] = unitrand() * expi(2pi*unitrand()); 7 | dot(Q[i]); 8 | } 9 | 10 | pair p0 = Q[0]; 11 | int imin = 0; 12 | for (int i = 0; i < n; ++i) { 13 | if (Q[i].y < p0.y) { 14 | p0 = Q[i]; 15 | imin = i; 16 | } 17 | } 18 | pair[] parr = sort(copy(Q), 19 | new bool(pair i, pair j) { 20 | if (i == p0 && j != p0) 21 | return true; 22 | else if (i == p0 || j == p0) 23 | return false; 24 | else 25 | return angle(i-p0) < angle(j-p0); 26 | }); 27 | 28 | pair[] CH; 29 | int k; 30 | CH.push(parr[0]); 31 | CH.push(parr[1]); 32 | CH.push(parr[2]); 33 | k = 2; 34 | 35 | bool nonleftturn(pair z1, pair z2, pair z3) 36 | { 37 | pair u = z2-z1, v = z3-z2; 38 | return u.x*v.y < v.x*u.y; 39 | } 40 | 41 | for (int i = 3; i < n; ++i) { 42 | while (nonleftturn(CH[CH.length-2], CH[CH.length-1], parr[i])) 43 | CH.pop(); 44 | CH.push(parr[i]); 45 | } 46 | 47 | guide g = nullpath; 48 | for (pair p: CH) { g = g .. tension atleast 2 .. p; } 49 | g = g .. tension atleast 2 .. cycle; 50 | draw(g); -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/digraph.asy: -------------------------------------------------------------------------------- 1 | import node; 2 | 3 | void drawarrows(picture pic=currentpicture, path[] g, pen p=currentpen, 4 | arrowbar arrow=Arrow, arrowbar bar=None) 5 | { 6 | for (path g0 : g) 7 | draw(pic, g0, p, arrow, bar); 8 | } 9 | 10 | real u = 1.5cm; 11 | pen textpen = white; 12 | draw_t shader = ballshade; 13 | 14 | node v1 = Circle("$v_1$", (0,0), textpen, shader), 15 | v2 = Circle("$v_2$", v1.pos+2u*E, textpen, shader), 16 | v3 = Circle("$v_3$", v1.pos+u*(E+S), textpen, shader), 17 | v4 = Circle("$v_4$", v2.pos+2u*S, textpen, shader), 18 | v5 = Circle("$v_5$", v1.pos+2u*S, textpen, shader), 19 | v7 = Circle("$v_7$", v5.pos+u*S, textpen, shader), 20 | v8 = Circle("$v_8$", v4.pos+u*S, textpen, shader), 21 | v6 = Circle("$v_9$", v7.pos+u*(E+S), textpen, shader); 22 | 23 | picture digraph; 24 | 25 | draw(digraph, v1, v2, v3, v4, v5, v6, v7, v8); 26 | 27 | drawarrows(digraph, v1 -- v2 ^^ v1 -- v5 ^^ v1 .. bendright .. v4 28 | ^^ v2 -- v3 ^^ v2 -- v4 29 | ^^ v3 -- v1 30 | ^^ v4 -- v3 31 | ^^ v5 -- v4 32 | ^^ v6 -- v7 ^^ v6 .. bend(15) .. v8 33 | ^^ v7 -- v5 34 | ^^ v8 -- v4 ^^ v8 .. bend(15) .. v6 ^^ v8 -- v7); 35 | 36 | picture spanningforest; 37 | 38 | void setpos(node nd, pair pos) 39 | { 40 | nd.pos = pos; 41 | nd.updateanchors(nd._anchor); 42 | } 43 | 44 | real v = 1.5u; 45 | pair lb = v*dir(-120), rb = v*dir(-60); 46 | setpos(v1, (0,0)); 47 | setpos(v2, v1.pos + lb); 48 | setpos(v3, v2.pos + lb); 49 | setpos(v4, v2.pos + rb); 50 | setpos(v5, v1.pos + rb); 51 | setpos(v7, v5.pos + v*E); 52 | setpos(v6, v7.pos - lb); 53 | setpos(v8, v6.pos + rb); 54 | 55 | draw(spanningforest, v1, v2, v3, v4, v5, v6, v7, v8); 56 | drawarrows(spanningforest, v1 -- v2 ^^ v1 -- v5 57 | ^^ v2 -- v3 ^^ v2 -- v4 58 | ^^ v6 -- v7 ^^ v6 -- v8, 59 | linewidth(1), Arrow(6)); 60 | drawarrows(spanningforest, v1 -- v4 61 | ^^ v3 .. bendleft .. v1 62 | ^^ v4 -- v3 63 | ^^ v5 -- v4 64 | ^^ v7 -- v5 65 | ^^ v8 -- v4 ^^ v8 .. bendright .. v6 ^^ v8 -- v7, 66 | gray, Arrow(6)); 67 | 68 | add(digraph.fit(), (0,0), align=.5u*W); 69 | add(spanningforest.fit(), (0,0), align=.5u*E); 70 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/hanoi.asy: -------------------------------------------------------------------------------- 1 | struct Peg 2 | { 3 | private struct Disk 4 | { 5 | private int size; 6 | 7 | picture draw(pen p = pink+1mm) 8 | { 9 | picture pic; 10 | fill(pic, scale(5mm+size*7.5mm, 4mm)*box((-1/2,-1/2),(1/2,1/2)), p); 11 | label(pic, string(size)); 12 | return pic; 13 | } 14 | void operator init(int size) 15 | { 16 | this.size = size; 17 | } 18 | } 19 | 20 | private Disk[] disks; 21 | private string name; 22 | 23 | string getname() 24 | { 25 | return name; 26 | } 27 | 28 | picture draw(pen p = blue+1mm) 29 | { 30 | picture pic; 31 | int n = disks.length; 32 | fill(pic, box((-2mm, -4mm),(2mm,40mm)), gray); 33 | fill(pic, box((-4cm, -10mm), (4cm, -4mm)), gray); 34 | label(pic, name, (0,-5mm), align=down); 35 | for (int k = 0; k < n; ++k) 36 | add(pic, disks[k].draw(), (0,k*5mm)); 37 | return pic; 38 | } 39 | 40 | void operator init(int n, string name) 41 | { 42 | for (int k = n; k > 0; --k) 43 | disks.push(Disk(k)); 44 | this.name = name; 45 | } 46 | 47 | static void transfer(Peg a, Peg b) 48 | { 49 | Disk disk = a.disks.pop(); 50 | b.disks.push(disk); 51 | } 52 | } 53 | from Peg unravel transfer; 54 | 55 | 56 | import animation; 57 | //usepackage("animate"); 58 | //usepackage("movie15"); 59 | settings.tex = "pdflatex"; 60 | 61 | void solvehanoi(int n) 62 | { 63 | animation ani; 64 | int step = 0; 65 | Peg A = Peg(n,"A"), B = Peg(0,"B"), C = Peg(0,"C"); 66 | 67 | picture pic; 68 | add(pic, A.draw().fit(), 0, align=NW); 69 | add(pic, B.draw().fit(), 0, align=NE); 70 | add(pic, C.draw().fit(), 0, align=S); 71 | ani.add(pic); 72 | void solve(Peg src, Peg dest, Peg mid, int k) 73 | { 74 | if (k != 0) { 75 | solve(src, mid, dest, k-1); 76 | 77 | transfer(src, dest); 78 | ++step; 79 | write(format("%3d: ", step) 80 | + src.getname() + " -> " + dest.getname()); 81 | picture pic; 82 | add(pic, A.draw().fit(), 0, align=NW); 83 | add(pic, B.draw().fit(), 0, align=NE); 84 | add(pic, C.draw().fit(), 0, align=S); 85 | ani.add(pic); 86 | 87 | solve(mid, dest, src, k-1); 88 | } 89 | } 90 | solve(A, B, C, n); 91 | //label(ani.pdf(delay=500)); 92 | ani.movie(delay=500); 93 | } 94 | 95 | solvehanoi(2); 96 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/hsvinter.asy: -------------------------------------------------------------------------------- 1 | hsv interp(explicit hsv p1, explicit hsv p2, real t) 2 | { 3 | real h1 = p1.h>0 ? p1.h%360 : p1.h%360+360; 4 | real h2 = p2.h>0 ? p2.h%360 : p2.h%360+360; 5 | if (h1 < h2 && h2 - h1 > 180) 6 | h2 = h2-360; 7 | else if (h1 > h2 && h1 - h2 > 180) 8 | h1 = h1-360; 9 | return hsv(interp(h1,h2,t), interp(p1.s,p2.s,t), interp(p1.v,p2.v,t)); 10 | } 11 | 12 | unitsize(2cm); 13 | 14 | for(real x = 0; x <= 1; x += 0.01) 15 | draw((x,0) -- (x+0.015,0), interp(hsv(red),hsv(green),x)+squarecap+4bp); 16 | for(real x = 0; x <= 1; x += 0.01) 17 | draw((x,1) -- (x+0.015,1), interp(hsv(blue),hsv(red),x)+squarecap+4bp); 18 | for(real x = 0; x <= 1; x += 0.01) 19 | draw((x,2) -- (x+0.015,2), interp(hsv(brown),hsv(lightgreen),x)+squarecap+4bp); 20 | 21 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/hyper.asy: -------------------------------------------------------------------------------- 1 | real r = 5cm; 2 | 3 | draw(circle(0,r), black+1); 4 | dot(0); 5 | 6 | path hyperline(pair origin, real r, real deg1, real deg2, bool iscycle=false) 7 | { 8 | deg1 %= 360; 9 | deg2 %= 360; 10 | bool isCCW; 11 | if (abs(deg1-deg2) == 180) { 12 | if (iscycle) 13 | return shift(origin) * (arc(0, r*dir(deg1), r*dir(deg2)) -- cycle); 14 | else 15 | return shift(origin) * (r*dir(deg1) -- r*dir(deg2)); 16 | } 17 | if (deg1 > deg2) { 18 | if (deg1-deg2 > 180) { 19 | deg1 -= 360; 20 | isCCW = true; 21 | } 22 | else 23 | isCCW = false; 24 | } 25 | else { 26 | if (deg2-deg1 > 180) { 27 | deg2 -= 360; 28 | isCCW = false; 29 | } 30 | else 31 | isCCW = true; 32 | } 33 | 34 | real delta = isCCW ? deg2-deg1 : deg1-deg2; 35 | pair z1 = r * dir(deg1), z2 = r * dir(deg2); 36 | real rad = r/Cos(delta/2); 37 | pair c = rad * dir((deg1+deg2)/2); 38 | if (iscycle) 39 | return shift(origin) * 40 | (arc(c, z1, z2, !isCCW) & arc(0, z2, z1, !isCCW)) -- cycle; 41 | else 42 | return shift(origin) * arc(c, z1, z2, !isCCW); 43 | } 44 | 45 | path[] g1, g2; 46 | for (real t = 30; t <= 180; t += 30) { 47 | for (real angle = 0; angle < 360; angle += 30) { 48 | g1.push(hyperline(0, r, angle, angle+t, true)); 49 | g2.push(hyperline(0, r, angle, angle+t, false)); 50 | } 51 | } 52 | fill(g1, evenodd); 53 | draw(g2, orange+0.6); 54 | shipout(bbox(Fill(white))); 55 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/recplot.asy: -------------------------------------------------------------------------------- 1 | // 使用自适应方法产生 y = f(x) 的图象 guide 2 | guide plot(real f(real), real min, real max, int nplotpoints=10, int maxrec=7) 3 | { 4 | if (nplotpoints < 2) 5 | nplotpoints = 2; 6 | // 描初始的 nplotpoints 个点,并估计函数变化幅度 7 | pair[] fpoints; 8 | real fmax = -infinity, fmin = infinity; 9 | for (int i = 0; i <= nplotpoints; ++i) { 10 | real x = min + i/nplotpoints * (max-min); 11 | pair z = (x, f(x)); 12 | fmax = max(fmax, z.y); 13 | fmin = min(fmin, z.y); 14 | fpoints.push(z); 15 | } 16 | // 定义辅助的递归函数:在规定的递归次数之内,在两个样本点之间描新点 17 | // 误差 fuzz 达到函数变化幅度估计值的 1/500 为止 18 | // 这个误差值在一般屏幕显示上只有一两个像素 19 | real fuzz = max(0.002(fmax-fmin), realEpsilon); 20 | guide helper(int nrec, pair a, pair b) 21 | { 22 | if (nrec == 0) 23 | return b; 24 | pair mid = (a+b)/2; 25 | pair z = (mid.x, f(mid.x)); 26 | if (abs(z.y-mid.y) < fuzz) 27 | return z -- b; 28 | else 29 | return helper(nrec-1, a, z) -- helper(nrec-1, z, b); 30 | } 31 | // 递归构造 guide 32 | guide g = fpoints[0]; 33 | for (int i = 0; i < nplotpoints; ++i) 34 | g = g -- helper(maxrec, fpoints[i], fpoints[i+1]); 35 | return g; 36 | } 37 | 38 | 39 | 40 | ////////////////////////////////////////// 41 | 42 | real f(real x) {return 2sin(x^3);} 43 | real min = -5.0, max = 5.0; 44 | 45 | // 用自适应方法绘制函数 f(x) 46 | guide g = scale(1cm)*plot(f, min, max); 47 | draw(g, red+1pt); 48 | for (int i = 0; i < size(g); ++i) { 49 | draw(point(g,i), blue+2pt); 50 | } 51 | write(size(g)); 52 | 53 | 54 | // 用 graph 模块的默认方法(均匀取点)绘制函数 f(x) 55 | import graph; 56 | guide h = shift(-5cm*I)*scale(1cm)*graph(f, min, max); 57 | draw(h, orange+1pt); 58 | for (int i = 0; i < size(h); ++i) { 59 | draw(point(h,i), blue+2pt); 60 | } 61 | write(size(h)); 62 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/simplenode.asy: -------------------------------------------------------------------------------- 1 | //#-*- coding: utf-8 -*- 2 | // simplenode.asy 3 | // `\color{comment}关于绘制图论图形、自动机、流程图的简单模块` 4 | 5 | // `\color{comment}结点类型,第二个实现` 6 | struct node { 7 | path outline; 8 | picture stuff; 9 | pair pos; 10 | pair E, N, W, S; 11 | pair dir(pair v) 12 | { 13 | path g = shift(pos) * outline; 14 | pair M = max(g), m = min(g), c = 0.5*(M+m); 15 | path ray = c -- c + length(M-m)*unit(v); 16 | return intersectionpoint(g, ray); 17 | } 18 | pair angle(real ang) 19 | { 20 | return this.dir(dir(ang)); 21 | } 22 | } 23 | 24 | // `\color{comment}画出结点数组` 25 | void draw(picture pic=currentpicture, node[] nodearr) 26 | { 27 | for (node nd: nodearr) 28 | add(pic, shift(nd.pos) * nd.stuff); 29 | } 30 | 31 | // `\color{comment}画出一个或多个结点` 32 | void draw(picture pic=currentpicture ... node[] nodearr) 33 | { 34 | draw(pic, nodearr); 35 | } 36 | 37 | // `\color{comment}边框绘制函数类型` 38 | typedef void draw_t(picture pic, path g); 39 | 40 | // `\color{comment}多个边框绘制函数的复合` 41 | draw_t compose(... draw_t[] drawfns) 42 | { 43 | return new void(picture pic, path g) { 44 | for (draw_t f : drawfns) 45 | f(pic, g); 46 | }; 47 | } 48 | 49 | // `\color{comment}空函数,不做边框的绘制` 50 | draw_t none = new void(picture pic, path g){}; 51 | // `\color{comment}画边框线` 52 | draw_t drawer(pen p) 53 | { 54 | return new void(picture pic, path g) { 55 | draw(pic, g, p); 56 | }; 57 | } 58 | draw_t drawer=drawer(currentpen); 59 | // `\color{comment}填充边框` 60 | draw_t filler(pen p) 61 | { 62 | return new void(picture pic, path g) { 63 | fill(pic, g, p); 64 | }; 65 | } 66 | draw_t filler=filler(currentpen); 67 | // `\color{comment}对边框填充并画线` 68 | draw_t filldrawer(pen fillpen, pen drawpen=currentpen) 69 | { 70 | return new void(picture pic, path g) { 71 | filldraw(pic, g, fillpen, drawpen); 72 | }; 73 | } 74 | 75 | // `\color{comment}画双线边框,第二个实现` 76 | draw_t doubledrawer(pen p, pen bg=white) 77 | { 78 | return compose(drawer(p+linewidth(p)*3), drawer(bg+linewidth(p))); 79 | } 80 | draw_t doubledrawer = doubledrawer(currentpen); 81 | 82 | // `\color{comment}画阴影` 83 | draw_t shadow(pair shift=2SE, real scale=1, pen color=gray) 84 | { 85 | return new void(picture pic, path g) { 86 | fill(pic, shift(shift)*scale(scale)*g, color); 87 | }; 88 | } 89 | draw_t shadow=shadow(); 90 | 91 | // `\color{comment}圆形结点的构造函数,第三个实现` 92 | node Circle(Label text, pair pos, pen textpen=currentpen, 93 | draw_t drawfn) 94 | { 95 | node nd; 96 | nd.pos = pos; 97 | label(nd.stuff, text, textpen); 98 | pair M = max(nd.stuff), m = min(nd.stuff); 99 | nd.outline = circle(0.5*(M+m), 0.5*length(M-m)); 100 | drawfn(nd.stuff, nd.outline); 101 | nd.E = nd.dir(E); 102 | nd.N = nd.dir(N); 103 | nd.W = nd.dir(W); 104 | nd.S = nd.dir(S); 105 | return nd; 106 | } 107 | 108 | // `\color{comment}直线连接结点` 109 | path operator--(node nd1, node nd2) 110 | { 111 | path g1 = shift(nd1.pos) * nd1.outline; 112 | path g2 = shift(nd2.pos) * nd2.outline; 113 | pair c1 = (max(g1)+min(g1)) / 2; 114 | pair c2 = (max(g2)+min(g2)) / 2; 115 | path edge = c1 -- c2; 116 | edge = firstcut(edge, g1).after; 117 | edge = lastcut(edge, g2).before; 118 | return edge; 119 | } 120 | 121 | // `\color{comment}结点连线函数类型` 122 | typedef path edgeconnector(node nd1, node nd2); 123 | // `\color{comment}由单结点生成边的函数类型` 124 | typedef path edgemaker(node nd); 125 | 126 | // `\color{comment}nd1 .. con .. nd2 的前一半` 127 | edgemaker operator..(node nd, edgeconnector con) 128 | { 129 | return new path(node nd2) { 130 | return con(nd, nd2); 131 | }; 132 | } 133 | 134 | // `\color{comment}nd1 .. con .. nd2 的后一半` 135 | path operator..(edgemaker maker, node nd) 136 | { 137 | return maker(nd); 138 | } 139 | 140 | path operator..(node nd, edgemaker maker) 141 | { 142 | return maker(nd); 143 | } 144 | 145 | // `\color{comment}以 ang 角弯曲连曲线` 146 | edgeconnector bend(real ang) 147 | { 148 | return new path (node nd1, node nd2) { 149 | path g1 = shift(nd1.pos) * nd1.outline; 150 | path g2 = shift(nd2.pos) * nd2.outline; 151 | pair c1 = (max(g1)+min(g1)) / 2; 152 | pair c2 = (max(g2)+min(g2)) / 2; 153 | real deg = degrees(c2 - c1); 154 | return nd1.angle(deg+ang) {dir(deg+ang)} 155 | .. {dir(deg-ang)} nd2.angle(180+deg-ang); 156 | }; 157 | } 158 | 159 | // `\color{comment}左弯与右弯` 160 | edgeconnector bendleft = bend(30); 161 | edgeconnector bendright = bend(-30); 162 | 163 | // `\color{comment}自动机循环` 164 | edgemaker loop(pair direction, real ratio=1.5) 165 | { 166 | return new path(node nd) { 167 | real deg = degrees(direction); 168 | real angle1 = deg - 15, angle2 = deg + 15; 169 | pair mid = nd.angle(deg) 170 | + ratio*fontsize(currentpen)*unit(direction); 171 | return nd.angle(angle1) {dir(angle1)} .. mid 172 | .. {-dir(angle2)} nd.angle(angle2); 173 | }; 174 | } 175 | 176 | // `\color{comment}对路径作任意变换的函数类型` 177 | typedef path fpath(path); 178 | 179 | // `\color{comment}用函数 t 作用于路径 p` 180 | path operator@(path p, fpath t) 181 | { 182 | return t(p); 183 | } 184 | 185 | // `\color{comment}缩短路径。默认为末端缩短 2bp` 186 | fpath shorten(real pre=0, real post=2) 187 | { 188 | return new path(path p) { 189 | return subpath(p, arctime(p, pre), arctime(p, arclength(p)-post)); 190 | }; 191 | } 192 | fpath shorten=shorten(0,2); 193 | 194 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/stars.asy: -------------------------------------------------------------------------------- 1 | // # -*- coding:utf-8 -*- 2 | // 星空图 3 | // 刘海洋 4 | srand(seconds()); 5 | // 随机实数 6 | real random(real a, real b=0) 7 | { 8 | return (b-a) * unitrand() + a; 9 | } 10 | // 半径为 1 的 n 角星形路向 11 | guide star(int n = 5, real r = 0, real angle = 90) 12 | { 13 | guide unitstar; 14 | if (n < 2) return nullpath; 15 | real theta = 180/n; 16 | if (r == 0) { 17 | if (n < 5) 18 | r = 1/4; 19 | else 20 | r = Cos(2theta) / Cos(theta); 21 | } 22 | for (int k = 0; k < n; ++k) 23 | unitstar = unitstar -- dir(angle+2k*theta) -- r * dir(angle+(2k+1)*theta); 24 | unitstar = unitstar -- cycle; 25 | return unitstar; 26 | } 27 | // 全局定义 28 | size(15cm); 29 | real xmin=0, ymin=0, xmax=40, ymax=30, sizemin=0.3, sizemax=0.8; 30 | pen[] colors = {palered, paleblue, lightyellow, pink}; 31 | // 夜空 32 | fill(box((xmin-1,ymin-1), (xmax+1,ymax+1)), darkblue); 33 | // 星星 34 | for (int i = 0; i < 100; ++i) { 35 | real shape = unitrand(); 36 | pair pos = (random(xmin, xmax), random(ymin, ymax)); 37 | real size = random(sizemin, sizemax); 38 | pen color = colors[rand() % colors.length]; 39 | if (shape < 1/3) 40 | fill(shift(pos)*scale(size)*star(4), color); 41 | else if (shape < 2/3) 42 | fill(shift(pos)*scale(size)*star(5), color); 43 | else 44 | draw(pos, white+1bp); 45 | } 46 | // 彗星 47 | picture comet; 48 | radialshade(comet, unitcircle, 49 | yellow, (0,0), 0.2, 50 | darkblue, (0,0), 1); 51 | path tail = (0,0){NW} .. {W}(-20,10); 52 | for (real t = 0; t < 1; t += 1/1000) { 53 | real r = 0.2 + 2*t^3; 54 | draw(comet, point(tail,t^3) + (random(-r,r), random(-r,r)), 55 | lightyellow+1bp); 56 | } 57 | add(shift(30,3) * comet); 58 | // 月亮 59 | picture moon_nobg, moon; 60 | fill(moon_nobg, unitcircle, lightyellow); 61 | unfill(moon_nobg, shift(-0.5,-0.2)*unitcircle); 62 | fill(moon, unitcircle, darkblue); 63 | add(moon, moon_nobg); 64 | add(shift(5, 25) * scale(2) * moon); 65 | // 文字 66 | settings.tex = "xelatex"; 67 | usepackage("xeCJK"); 68 | texpreamble("\setCJKmainfont{FZSongHeiTi_GB18030}"); // 方正宋黑体 69 | string text = "\begin{minipage}{3em} 70 | 天上星\par 71 | 亮晶晶\par 72 | 永燦爛\par 73 | 長安寧 74 | \end{minipage}"; 75 | label(text, (xmax,ymax), align=SW, yellow+fontsize(0.7cm), 76 | Fill(darkblue+opacity(0.5))); 77 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/tiling.asy: -------------------------------------------------------------------------------- 1 | // tiling.asy 2 | // 铺砌图案 3 | // 刘海洋 4 | size(15cm, 0); 5 | guide headleft = (0,1.5){SE} .. tension 1.4 .. (0.5,-0.2){dir(-150)} .. 6 | {NW}(0,0); 7 | guide headbottom = (0,0){SE} .. {dir(30)}(0.5,-0.2) ..{SE}(3,0); 8 | guide head = headleft & headbottom & 9 | shift(3,0)*reverse(headleft) & shift(0,1.5)*reverse(headbottom) & cycle; 10 | guide eye = circle((2.6,1.2), 0.1); 11 | guide ear = (2.3,1.3) .. (2.1,1.5) .. (2.2,1.7) 12 | & (2.2,1.7) .. (2.4,1.6) .. (2.5,1.4); 13 | guide muzzle = circle((3.5,0.5), 0.15); 14 | guide mouth = (3,0.4) .. (3.4,0.1) .. (3.6,0.2); 15 | for (int x = 0; x < 8; ++x) { 16 | for (int y = 0; y < 8; ++y) { 17 | transform pos = shift(3x, 1.5y); 18 | pen color = (i+j)%2==0 ? cyan : yellow; 19 | filldraw(pos * head, color, linewidth(2bp)); 20 | fill(pos * (eye ^^ muzzle) ); 21 | draw(pos * (ear ^^ mouth), linewidth(2bp)); 22 | } 23 | } 24 | clip(ellipse((12,6), 10, 5)); 25 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/figure-src/xiantu.asy: -------------------------------------------------------------------------------- 1 | // xiantu.asy 2 | // 弦图 3 | // by milksea 4 | 5 | //pen operator %(pen p, real x) {return interp(white, p, x/100);} 6 | pen operator %(pen p, real x) {return p + opacity(x/100);} 7 | 8 | pen helpline = gray + 0.4; 9 | pen zhu = red + 0.8; 10 | pen huang = yellow + 0.8; 11 | 12 | path[] grid(pair z1, pair z2, real xstep = 1, real ystep = xstep) 13 | { 14 | path[] g; 15 | pair lb = minbound(z1, z2); 16 | pair rt = maxbound(z1, z2); 17 | for (real x = ceil(lb.x/xstep)*xstep; x <= rt.x; x += xstep) 18 | g.push((x, lb.y) -- (x, rt.y)); 19 | for (real y = ceil(lb.y/ystep)*ystep; y <= rt.y; y += ystep) 20 | g.push((lb.x, y) -- (rt.x, y)); 21 | return g; 22 | } 23 | 24 | unitsize(1cm); 25 | settings.tex = "xelatex"; 26 | 27 | usepackage("xeCJK"); 28 | usepackage("CJKmove"); 29 | texpreamble( 30 | "\setCJKmainfont[RawFeature={script=hani:language=CHN:vertical:+valt}] 31 | {FZSongHeiTi_GB18030} 32 | %\XeTeXuseglyphmetrics=0 33 | \setCJKmove{-0.45}{0.5} 34 | \CJKmove 35 | "); 36 | defaultpen(fontsize(10.5)); // 五号 37 | 38 | Label vert(Label L) 39 | { 40 | return rotate(-90) * L; 41 | } 42 | 43 | draw(grid((0,0), (7,7)), helpline); 44 | draw(shift(4)*rotate(degrees((3,4)))*grid((0,0), (5,5)), helpline); 45 | 46 | path huangshi = box((3,3), (4,4)); 47 | path[] zhushi = (0,3)--(4,0)--(7,4)--(3,7)--cycle ^^ reverse(huangshi); 48 | filldraw(zhushi, zhu%10, zhu); 49 | fill(huangshi, huang%50); 50 | draw((0,3)--(4,3) ^^ (4,0)--(4,4) ^^ (7,4)--(3,4) ^^ (3,7)--(3,3), zhu); 51 | 52 | label(vert("中黃實"), (3.5,3.5), 0.5huang); 53 | label(vert("朱實"), (2,4), right, 0.5zhu); 54 | label(vert("弦實"), (5,4), left, interp(0.5huang,0.5zhu,0.5)); 55 | label(Label("句三",MidPoint,Rotate(down)), (4,0)--(4,3), LeftSide); 56 | label(Label("股四",MidPoint,Rotate(left)), (0,3)--(4,3), RightSide); 57 | label(Label("弦五",MidPoint,Rotate((4,-3))), (0,3)--(4,0), LeftSide); 58 | 59 | label(vert("朱實六黃實\ 一"), (0,3.5), left, fontsize(14)); // 四号字 60 | label(vert("弦實二十五朱及黃"), (7,3.5), right, fontsize(14)); 61 | 62 | label(vert("弦圖"), (3.5,7), 4up, fontsize(16)); // 三号字 63 | 64 | label(vert(minipage("句股各自乘,併之為弦實,開方除之即弦。 65 | 案:弦圖又可以句股相乘為朱實二,倍之為朱實四, 66 | 以句股之差自相乘為中黃實,加差實亦成弦實。", 64)), (3.5,0), 4down); 67 | 68 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/main.tex: -------------------------------------------------------------------------------- 1 | %# -*- coding: utf-8 -*- 2 | \documentclass[cs4size,oneside,openany,nofonts,UTF8,CJKnormalspaces] 3 | {ctexbook}[2009/05/20] 4 | \linespread{1.0} 5 | 6 | %\includeonly{automata} 7 | 8 | \usepackage{amsmath} 9 | 10 | \usepackage{makeidx} 11 | \makeindex 12 | 13 | \usepackage{geometry} 14 | \geometry{screen,left=0.5cm,right=0.5cm,top=0.5cm,bottom=0.5cm, 15 | headheight=15pt,includeheadfoot} 16 | 17 | \usepackage{fancyhdr} 18 | \renewcommand{\headrulewidth}{0pt} 19 | \pagestyle{fancy} 20 | \fancyhf{} 21 | \lhead{\rmfamily\mdseries\itshape\rightmark} 22 | \rhead{\rmfamily\mdseries\itshape\thepage} 23 | \fancypagestyle{plain}{\fancyhf{}} 24 | 25 | \usepackage{float} 26 | \floatplacement{htbp} 27 | \AtBeginDocument{ 28 | \renewcommand{\topfraction}{0.9} % default 0.7 29 | \renewcommand{\bottomfraction}{0.5} % default 0.3 30 | \renewcommand{\textfraction}{0.1} % default 0.2 31 | \renewcommand{\floatpagefraction}{0.8} % default 0.5 32 | \setlength{\floatsep}{3pt plus 1pt minus 1pt} % default 12pt plus2pt minus2pt 33 | \setlength{\textfloatsep}{6pt plus 1pt minus 1pt} % default 20pt plus2pt minus4pt 34 | \setlength{\intextsep}{3pt plus 1pt minus 1pt} % default 12pt plus2pt minus2pt 35 | } 36 | 37 | \usepackage{caption} 38 | \captionsetup{skip=6pt} % default 10pt 39 | 40 | \usepackage{amssymb} 41 | \usepackage{upgreek} 42 | \usepackage{xltxtra} 43 | \usepackage{mflogo} 44 | \usepackage{myfonts} 45 | 46 | \usepackage{multicol} 47 | 48 | \usepackage{xcolor} 49 | \pagecolor{lightgray!50} 50 | 51 | \usepackage{everypage} 52 | \AddEverypageHook{% 53 | \special{pdf: put @thispage << /Group << /S /Transparency /I true % 54 | /CS /DeviceRGB >> >>}} % 处理插入透明图形时变色的问题 55 | \usepackage{asymptote} 56 | \usepackage{graphicx} 57 | 58 | \usepackage{hyperref} 59 | \hypersetup{ 60 | bookmarksopen=false, 61 | pdfpagemode=FullScreen, 62 | colorlinks=false, 63 | pdfborder=0 0 0, 64 | pdftitle={Asymptote 范例教程}, 65 | pdfauthor={刘海洋}, 66 | pdfsubject={Asymptote 教程}, 67 | pdfkeywords={Asymptote, LaTeX, 绘图, 示例}, 68 | pdfcreator={XeLaTeX}, 69 | } 70 | \renewcommand\figureautorefname{图} 71 | \renewcommand\sectionautorefname{\S} 72 | 73 | \usepackage{asysyntex} 74 | \usepackage{listings} 75 | \lstloadlanguages{C} 76 | \def\cinline{\expandafter\lstinline[language=C]} 77 | 78 | \newcommand*\prgname[1]{\textsf{#1}} 79 | \newcommand*\Asy{\textsf{Asymptote}} 80 | \newcommand*\asyversion{1.91} 81 | \begin{document} 82 | 83 | \frontmatter 84 | 85 | % 标题页 86 | \begin{titlepage} 87 | \vspace*{\stretch{1}} 88 | \begin{center} 89 | {\zihao{2}\bfseries 90 | \Asy\ 范例教程} 91 | \bigskip 92 | 93 | {\zihao{3}\rmfamily\itshape 94 | 刘海洋} 95 | \bigskip 96 | 97 | {\today} 98 | \end{center} 99 | \vspace*{\stretch{3}} 100 | \end{titlepage} 101 | 102 | % 版权页 103 | \begingroup 104 | \setlength{\parindent}{0pt} 105 | \vspace*{\stretch{1}} 106 | 本文是基于 \Asy\ \asyversion{} 的一组教程。 107 | 108 | \url{http://asy4cn.googlecode.com/} 109 | \medskip 110 | 111 | 版权所有\copyright\ 2009 刘海洋,\nolinkurl{leoliu.pku@gmail.com} 112 | 113 | {\setlength{\leftskip}{2em} 114 | 在 GNU General Public License(GNU 通用公共许可证)的条款下授予复制、发布和/或修改此文档的许可。许可证条款见附录 \ref{chap:license}。\par} 115 | \endgroup 116 | \newpage 117 | 118 | \tableofcontents 119 | 120 | \mainmatter 121 | \include{xiantu} 122 | \include{tiling} 123 | \include{stars} 124 | \include{automata} 125 | 126 | \appendix 127 | \include{gpl-3.0} 128 | 129 | \printindex 130 | 131 | \bibliographystyle{plain} 132 | \bibliography{asy} 133 | \end{document} 134 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/makepdf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | xelatex main 3 | asy main 4 | xelatex main 5 | # makeindex main 6 | iconv -f utf-8 -t gbk main.idx | cctmkind -C mixed -s cct.ist| iconv -f gbk -t utf-8 > main.ind 7 | bibtex main 8 | xelatex main 9 | xelatex main 10 | mv main.pdf AsymptoteByExample.pdf 11 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/myfonts.sty: -------------------------------------------------------------------------------- 1 | \ProvidesPackage{myfonts} 2 | 3 | % Lucida 系列字体设置(来自 Java Runtime Environment) 4 | \setmainfont[Mapping=tex-text,Scale=0.95]{Lucida Bright} 5 | \setsansfont[Mapping=tex-text,Scale=0.95]{Lucida Sans} 6 | \setmonofont[Scale=0.95]{Lucida Sans Typewriter} 7 | 8 | % 方正系列字体设置 9 | \setCJKmainfont[BoldFont={FZXiaoBiaoSong-B05}, ItalicFont={FZKai-Z03}]{FZShuSong_GB18030-Z01} 10 | \setCJKsansfont[BoldFont={FZHei-B01}]{FZXiHei I-Z08} 11 | \setCJKmonofont[BoldFont={FZCuYuan-M03}]{FZZhunYuan-M02} 12 | 13 | \setCJKfamilyfont{rm}[BoldFont={FZXiaoBiaoSong-B05}, ItalicFont={FZKai-Z03}]{FZShuSong_GB18030-Z01} 14 | \setCJKfamilyfont{sf}[BoldFont={FZHei-B01}]{FZXiHei I-Z08} 15 | \setCJKfamilyfont{tt}[BoldFont={FZCuYuan-M03}]{FZZhunYuan-M02} 16 | 17 | \endinput 18 | 19 | -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/stars.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/stars.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/tiling.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/tiling.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/xasy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/xasy.png -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/xiantu-ancient.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/xiantu-ancient.pdf -------------------------------------------------------------------------------- /asymptote-by-example-zh-cn/src/xiantu.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-by-example-zh-cn/src/xiantu.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/README: -------------------------------------------------------------------------------- 1 | This is a Chinese translation of Asymptote FAQ (original English version can be found on http://asymptote.sourceforge.net/FAQ) by goodluck at bbs.ctex.org 2 | 3 | cvgmt and milksea also contributed to the translation. 4 | 5 | If you are interested in the process of development you may observe 6 | 7 | http://code.google.com/p/ctex-doc/updates/list 8 | 9 | Report feedback in the Issues section of ctex-doc project, 10 | or in http://bbs.ctex.org forum. 11 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-1.asy: -------------------------------------------------------------------------------- 1 | label("$\omega$",(0,0)); 2 | label("$\Omega$",(20,0)); 3 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/4-1.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-2.asy: -------------------------------------------------------------------------------- 1 | usepackage("amsmath"); 2 | label("$\begin{matrix} 1 & 2 \\\ 1 & 1 \end{matrix}$",(0,0)); 3 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/4-2.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-7.asy: -------------------------------------------------------------------------------- 1 | frame f; 2 | label(f,"This is some text",white,Fill(blue)); 3 | add(rotate(65)*f); 4 | 5 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-7.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/4-7.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-8.asy: -------------------------------------------------------------------------------- 1 | import three; 2 | size(100,100); 3 | 4 | draw(rotate(90,project(Z))*"A",O--X); 5 | 6 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/4-8.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-9.asy: -------------------------------------------------------------------------------- 1 | real u=2cm; 2 | 3 | picture square; 4 | draw(square,scale(u)*shift(-0.5,-0.5)*unitsquare); 5 | 6 | picture circle; 7 | draw(circle,scale(0.5u)*unitcircle); 8 | 9 | void add(picture pic=currentpicture, Label L, picture object, pair z) { 10 | add(pic,object,z); 11 | label(pic,L,z); 12 | } 13 | 14 | add("square",square,(0,0)); 15 | add("circle",circle,(5cm,0)); 16 | 17 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/4-9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/4-9.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-1a.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | path g = (0,0)..(1,3)..(3,0); 3 | draw(g,Arrow(Relative(0.9))); 4 | add(arrow(g,invisible,FillDraw(black),Relative(0.5))); 5 | add(arrow(reverse(g),invisible,FillDraw(white,black),Relative(0.9))); 6 | 7 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-1a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/5-1a.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-2.asy: -------------------------------------------------------------------------------- 1 | path g=((0,0)--(5cm,0)); 2 | draw(reverse(g),Arrow(Relative(0.55))); 3 | 4 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/5-2.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-4.asy: -------------------------------------------------------------------------------- 1 | arrowhead DotHead; 2 | DotHead.head=new path(path g, position position=EndPoint, pen p=currentpen, 3 | real size=0, real angle=0) 4 | { 5 | if(size == 0) size=DotHead.size(p); 6 | bool relative=position.relative; 7 | real position=position.position.x; 8 | if(relative) position=reltime(g,position); 9 | path r=subpath(g,position,0.0); 10 | pair x=point(r,0); 11 | real t=arctime(r,size); 12 | pair y=point(r,t); 13 | return circle(0.5(x+y),0.5size); 14 | }; 15 | 16 | size(100); 17 | draw((0,0)..(1,1)..(2,0),Arrow(DotHead)); 18 | dot((2,0),red); 19 | 20 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/5-4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/5-4.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-1.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(250,200,IgnoreAspect); 4 | 5 | draw(graph(exp,-1,1),red); 6 | 7 | xaxis("$x$",RightTicks(Label(align=left))); 8 | yaxis("$y$",RightTicks); 9 | 10 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-1.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-11a.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(200,200,IgnoreAspect); 4 | 5 | real factorial(real t) {return gamma(t+1);} 6 | 7 | scale(Linear,Log); 8 | 9 | // Graph the factorial function. 10 | draw(graph(factorial,0,10)); 11 | 12 | // Method 1: Draw nodes, but hide line 13 | pair F(int t) {return (t,factorial(t));} 14 | // Graph of factorial function from 0 to 10 15 | pair[] z=sequence(F,11); 16 | draw(graph(z),invisible,marker(scale(0.8mm)*unitcircle,blue,Fill,above=true)); 17 | 18 | // Method 2: Nongraphing routines require explicit scaling: 19 | //pair dotloc(int t) {return Scale(F(t));} 20 | //pair[] dotlocs=sequence(dotloc,11); 21 | //dot(dotlocs); 22 | 23 | xaxis("$x$",BottomTop,LeftTicks); 24 | yaxis("$y$",LeftRight,RightTicks); 25 | 26 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-11a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-11a.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-11b.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(200,200,IgnoreAspect); 4 | 5 | real factorial(real t) {return gamma(t+1);} 6 | 7 | scale(Linear,Log); 8 | 9 | // Graph the factorial function. 10 | draw(graph(factorial,0,10)); 11 | 12 | // Method 1: Draw nodes, but hide line 13 | pair F(int t) {return (t,factorial(t));} 14 | // Graph of factorial function from 0 to 10 15 | //pair[] z=sequence(F,11); 16 | //draw(graph(z),invisible,marker(scale(0.8mm)*unitcircle,blue,Fill,above=true)); 17 | 18 | // Method 2: Nongraphing routines require explicit scaling: 19 | pair dotloc(int t) {return Scale(F(t));} 20 | pair[] dotlocs=sequence(dotloc,11); 21 | dot(dotlocs); 22 | 23 | xaxis("$x$",BottomTop,LeftTicks); 24 | yaxis("$y$",LeftRight,RightTicks); 25 | 26 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-11b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-11b.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-12.asy: -------------------------------------------------------------------------------- 1 | size(12cm,0); 2 | 3 | void distance(picture pic=currentpicture, pair A, pair B, Label L="", real n=0, 4 | pen p=currentpen) 5 | { 6 | real d=3mm; 7 | path g=A--B; 8 | transform T=shift(-n*d*unit(B-A)*I); 9 | pic.add(new void(frame f, transform t) { 10 | picture opic; 11 | path G=T*t*g; 12 | draw(opic,Label(L,Center,UnFill(1)),G,p,Arrows(NoFill),Bars,PenMargins); 13 | add(f,opic.fit()); 14 | }); 15 | pic.addBox(min(g),max(g),T*min(p),T*max(p)); 16 | } 17 | 18 | pair A=(0,0), B=(3,3); 19 | 20 | dot(A); 21 | dot(B); 22 | 23 | distance(A,B,"$\ell$",1); 24 | 25 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-12.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-12.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-14.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | real width=15cm; 4 | real aspect=0.3; 5 | 6 | picture pic1,pic2; 7 | 8 | size(pic1,width,aspect*width,IgnoreAspect); 9 | size(pic2,width,aspect*width,IgnoreAspect); 10 | 11 | scale(pic1,false); 12 | scale(pic2,false); 13 | 14 | real xmin1=6; 15 | real xmax1=9; 16 | real xmin2=8; 17 | real xmax2=16; 18 | 19 | real a1=1; 20 | real a2=0.001; 21 | 22 | real f1(real x) {return a1*sin(x/2*pi);} 23 | real f2(real x) {return a2*sin(x/4*pi);} 24 | 25 | draw(pic1,graph(pic1,f1,xmin1,xmax1)); 26 | draw(pic2,graph(pic2,f2,xmin2,xmax2)); 27 | 28 | xaxis(pic1,Bottom,LeftTicks()); 29 | yaxis(pic1,"$f_1(x)$",Left,RightTicks); 30 | 31 | xaxis(pic2,"$x$",Bottom,LeftTicks(Step=4)); 32 | yaxis(pic2,"$f_2(x)$",Left,RightTicks); 33 | 34 | yequals(pic1,0,Dotted); 35 | yequals(pic2,0,Dotted); 36 | 37 | pair min1=point(pic1,SW); 38 | pair max1=point(pic1,NE); 39 | 40 | pair min2=point(pic2,SW); 41 | pair max2=point(pic2,NE); 42 | 43 | real scale=(max1.x-min1.x)/(max2.x-min2.x); 44 | real shift=min1.x/scale-min2.x; 45 | 46 | transform t1=pic1.calculateTransform(); 47 | transform t2=pic2.calculateTransform(); 48 | transform T=xscale(scale*t1.xx)*yscale(t2.yy); 49 | 50 | add(pic1.fit()); 51 | real height=truepoint(N).y-truepoint(S).y; 52 | add(shift(0,-height)*(shift(shift)*pic2).fit(T)); 53 | 54 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-14.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-14.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-15.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(250,200,IgnoreAspect); 3 | 4 | scale(Linear,Linear(-1)); 5 | 6 | draw(graph(log,0.1,10),red); 7 | 8 | xaxis("$x$",LeftTicks); 9 | yaxis("$y$",RightTicks); 10 | 11 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-15.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-15.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-19.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(10cm,0); 3 | pair[] z={(0,0),(0.5,0.5),(1,1)}; 4 | path g=graph(z); 5 | 6 | draw(shift(0,.5)*g,marker(scale(5)*unitcircle,FillDraw(white))); 7 | 8 | xaxis(BottomTop,LeftTicks); 9 | yaxis(LeftRight,RightTicks); 10 | 11 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-19.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-19.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-2.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | import graph; 3 | 4 | size(250,200,IgnoreAspect); 5 | 6 | draw(graph(exp,-1,1),red); 7 | 8 | xaxis(Label("$x$",0.75),LeftTicks); 9 | yaxis("$y$",RightTicks); 10 | 11 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-2.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-3.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(250,200,IgnoreAspect); 3 | 4 | draw(graph(exp,-1,1),red); 5 | 6 | xaxis(shift(0,-10)*"$x$",LeftTicks); 7 | yaxis("$y$",RightTicks); 8 | 9 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-3.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-4.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(300,200,IgnoreAspect); 3 | 4 | xlimits(-50,50); 5 | ylimits(0,100); 6 | 7 | xaxis(Label("$x$",MidPoint,red),Bottom,blue,LeftTicks(green)); 8 | yaxis("$y$",Left,RightTicks); 9 | 10 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-4.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-5.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(300,200,IgnoreAspect); 3 | 4 | xlimits(-50,50); 5 | ylimits(0,100); 6 | 7 | xaxis("x",Bottom,Courier("m","n"),LeftTicks); 8 | yaxis("$y$",Left,RightTicks); 9 | 10 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-5.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-6.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(300,200,IgnoreAspect); 3 | 4 | xlimits(-50,50); 5 | ylimits(0,100); 6 | 7 | xaxis("$x$",Bottom,LeftTicks("%.4g",Courier("m","n")+fontsize(12))); 8 | yaxis("$y$",Left,RightTicks); 9 | 10 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-6.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-7b.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(10cm); 4 | 5 | real f(real x) {return x^2;} 6 | 7 | draw(graph(f,-2,2)); 8 | 9 | xaxis(Ticks(NoZero)); 10 | yaxis(Ticks(NoZero)); 11 | 12 | label("$0$",(0,0),SW); 13 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-7b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-7b.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-7c.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(10cm); 4 | 5 | real f(real x) {return x^2;} 6 | 7 | draw(graph(f,-2,2)); 8 | 9 | xaxis(Ticks(NoZeroFormat)); 10 | yaxis(Ticks(NoZeroFormat)); 11 | 12 | label("$0$",(0,0),SW); 13 | 14 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-7c.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-7c.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-8b.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | real[] x={0,1,2,3}; 3 | real[] y=x^2; 4 | draw(graph(x,y),red); 5 | xaxis("$x$",BottomTop,LeftTicks); 6 | yaxis("$y$",LeftRight,RightTicks); 7 | 8 | size(5cm,5cm,point(SW),point(NE)); 9 | 10 | label("$f_\mathrm{T}$",point(N),2N); 11 | 12 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-8b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-8b.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-8c.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(250,200,IgnoreAspect); 4 | 5 | draw(graph(exp,-1,1),red); 6 | 7 | xaxis("$x$",BottomTop,LeftTicks); 8 | yaxis("$y$",LeftRight,RightTicks); 9 | 10 | fixedscaling((-1.5,-0.5),(1.5,3.5)); 11 | 12 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-8c.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-8c.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-9.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | 3 | size(250,200,IgnoreAspect); 4 | 5 | draw(graph(exp,-1,1),red); 6 | 7 | limits((0,0),(1,2),Crop); 8 | 9 | xaxis("$x$",BottomTop,LeftTicks); 10 | yaxis("$y$",LeftRight,RightTicks); 11 | 12 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/6-9.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/6-9.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-4.asy: -------------------------------------------------------------------------------- 1 | size(100); 2 | pair z0=(0,0); 3 | pair z1=(1,0.25); 4 | pair z2=(2,0); 5 | draw(z0{up}::z1{right}::z2{down}); 6 | 7 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-4.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8a.asy: -------------------------------------------------------------------------------- 1 | unitsize(1cm); 2 | draw(unitsquare); 3 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-8a.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8b.asy: -------------------------------------------------------------------------------- 1 | unitsize(x=1cm,y=2cm); 2 | draw(unitsquare); 3 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-8b.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8c.asy: -------------------------------------------------------------------------------- 1 | path p=(0,0)--(1,0); 2 | frame object; 3 | draw(object,scale(100)*p); 4 | 5 | add(object); 6 | add(object,(0,-10)); 7 | 8 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8c.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-8c.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8d.asy: -------------------------------------------------------------------------------- 1 | size(300,300); 2 | 3 | path p=(0,0)--(1,0); 4 | picture object; 5 | draw(object,scale(100)*p); 6 | 7 | add(object); 8 | add(object,(0,-10)); // Adds truesize object to currentpicture 9 | 10 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-8d.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-8d.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-9a.asy: -------------------------------------------------------------------------------- 1 | fill((0,0)--(100,100)--(200,0)--cycle); 2 | 3 | pair center(picture pic=currentpicture) {return 0.5*(pic.min()+pic.max());} 4 | 5 | real height=100; 6 | real width=100; 7 | pair delta=0.5(width,height); 8 | pair c=center(); 9 | clip(box(c-delta,c+delta)); 10 | 11 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-9a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-9a.pdf -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-9b.asy: -------------------------------------------------------------------------------- 1 | size(200,100); 2 | fill((0,0)--(1,1)--(2,0)--cycle); 3 | 4 | void clip(picture pic=currentpicture, real width, real height) 5 | { 6 | pic.clip(new void (frame f, transform) { 7 | pair center=0.5(min(f)+max(f)); 8 | pair delta=0.5(width,height); 9 | clip(f,box(center-delta,center+delta)); 10 | }); 11 | } 12 | 13 | clip(100,100); 14 | 15 | -------------------------------------------------------------------------------- /asymptote-faq-zh-cn/src/figures/8-9b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/asymptote-faq-zh-cn/src/figures/8-9b.pdf -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/README: -------------------------------------------------------------------------------- 1 | This is a (incomplete) Chinese translation of Asymptote Manual (original English version can be found on http://asymptote.sourceforge.net) by milksea at ctex.org. 2 | 3 | This translation is still unfinished, we welcome contributions from the Asymptote community. 4 | 5 | If you are interested in the process of development you may observe 6 | 7 | http://code.google.com/p/ctex-doc/updates/list 8 | 9 | Report feedback in the Issues section of ctex-doc project, 10 | or in http://bbs.ctex.org forum. 11 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/CDlabel.asy: -------------------------------------------------------------------------------- 1 | size(11.7cm,11.7cm); 2 | asy(nativeformat(),"logo"); 3 | fill(unitcircle^^(scale(2/11.7)*unitcircle), 4 | evenodd+rgb(124/255,205/255,124/255)); 5 | label(scale(1.1)*minipage( 6 | "\centering\scriptsize \textbf{\LARGE {\tt Asymptote}\\ 7 | \smallskip 8 | \small The Vector Graphics Language}\\ 9 | \smallskip 10 | \textsc{Andy Hammerlindl, John Bowman, and Tom Prince} 11 | http://asymptote.sourceforge.net\\ 12 | ",8cm),(0,0.6)); 13 | label(graphic("logo."+nativeformat(),"height=7cm"),(0,-0.22)); 14 | clip(unitcircle^^(scale(2/11.7)*unitcircle),evenodd); 15 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/CLEAN.bat: -------------------------------------------------------------------------------- 1 | del *.???~ *.bak *.log *.toc *.aux *.out *.xdv *.ind *.ilg *.idx -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/Coons.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | 3 | pen[] p={red,green,blue,magenta}; 4 | path g=(0,0){dir(45)}..(1,0)..(1,1)..(0,1)..cycle; 5 | tensorshade(g,p); 6 | dot(g); 7 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/Gouraud.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | 3 | pen[] p={red,green,blue,magenta}; 4 | pair[] z={(-1,0),(0,0),(0,1),(1,0)}; 5 | int[] edges={0,0,0,1}; 6 | gouraudshade(z[0]--z[2]--z[3]--cycle,p,z,edges); 7 | 8 | draw(z[0]--z[1]--z[2]--cycle); 9 | draw(z[1]--z[3]--z[2],dashed); 10 | 11 | dot(Label,z[0],W); 12 | dot(Label,z[1],S); 13 | dot(Label,z[2],N); 14 | dot(Label,z[3],E); 15 | 16 | label("0",z[0]--z[1],S,red); 17 | label("1",z[1]--z[2],E,red); 18 | label("2",z[2]--z[0],NW,red); 19 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/MAKEPDF.bat: -------------------------------------------------------------------------------- 1 | if not exist logo.pdf asy -noV -tex xelatex -f pdf logo.asy 2 | for %%I in (*.asy) do ( 3 | if not exist %%~nI.pdf ( 4 | asy -noV -tex xelatex -f pdf -noprc -render=0 %%I 5 | ) 6 | ) 7 | xelatex main 8 | makeindex main 9 | xelatex main 10 | xelatex main 11 | move /y main.pdf asymptote-zh.pdf -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/Pythagoras.asy: -------------------------------------------------------------------------------- 1 | size(0,150); 2 | import geometry; 3 | 4 | real a=3; 5 | real b=4; 6 | real c=hypot(a,b); 7 | 8 | pair z1=(0,b); 9 | pair z2=(a,0); 10 | pair z3=(a+b,0); 11 | perpendicular(z1,NE,z1--z2,blue); 12 | perpendicular(z3,NW,blue); 13 | draw(square((0,0),z3)); 14 | draw(square(z1,z2)); 15 | 16 | real d=0.3; 17 | pair v=unit(z2-z1); 18 | draw(baseline("$a$"),-d*I--z2-d*I,red,Bars,Arrows,PenMargins); 19 | draw(baseline("$b$"),z2-d*I--z3-d*I,red,Arrows,Bars,PenMargins); 20 | draw("$c$",z3+z2*I-d*v--z2-d*v,red,Arrows,PenMargins); 21 | draw("$a$",z3+d--z3+z2*I+d,red,Arrows,Bars,PenMargins); 22 | draw("$b$",z3+z2*I+d--z3+z3*I+d,red,Arrows,Bars,PenMargins); 23 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/adobefonts.tex: -------------------------------------------------------------------------------- 1 | \usepackage[BoldFont,SlantFont,CJKnumber]{xeCJK} 2 | \usepackage{CJKfntef} 3 | 4 | % Adobe OTF 字体设置,部分字体沿用 Windows 字体 5 | \setCJKmainfont[BoldFont={Adobe Heiti Std}, ItalicFont={Adobe Kaiti Std}]{Adobe Song Std} 6 | \setCJKsansfont{Microsoft YaHei} 7 | \setCJKmonofont{Adobe Fangsong Std} 8 | 9 | \setCJKfamilyfont{rm}[BoldFont={Adobe Heiti Std}, ItalicFont={Adobe Kaiti Std}]{Adobe Song Std} % 同 main 10 | \setCJKfamilyfont{sf}{Microsoft YaHei} % 同 sans 11 | \setCJKfamilyfont{tt}{FangSong_GB2312} % 同 mono 12 | 13 | \setCJKfamilyfont{song}{Adobe Song Std} 14 | \setCJKfamilyfont{kai}{Adobe Kaiti Std} 15 | \setCJKfamilyfont{hei}{Adobe Heiti Std} 16 | \setCJKfamilyfont{fs}{Adobe Fangsong Std} 17 | 18 | \setCJKfamilyfont{you}{YouYuan} 19 | \setCJKfamilyfont{li}{LiSu} 20 | 21 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/asycolors.sty: -------------------------------------------------------------------------------- 1 | \usepackage{color} 2 | \definecolor{cyan}{cmyk}{1,0,0,0} 3 | \definecolor{magenta}{cmyk}{0,1,0,0} 4 | \definecolor{yellow}{cmyk}{0,0,1,0} 5 | \definecolor{black}{cmyk}{0,0,0,1} 6 | 7 | \definecolor{white}{cmyk}{0,0,0,0} 8 | \definecolor{gray}{cmyk}{0,0,0,0.5} 9 | 10 | \definecolor{red}{cmyk}{0,1,1,0} 11 | \definecolor{green}{cmyk}{1,0,1,0} 12 | \definecolor{blue}{cmyk}{1,1,0,0} 13 | 14 | \definecolor{palered}{cmyk}{0,0.25,0.25,0} 15 | \definecolor{palegreen}{cmyk}{0.25,0,0.25,0} 16 | \definecolor{paleblue}{cmyk}{0.25,0.25,0,0} 17 | \definecolor{palecyan}{cmyk}{0.25,0,0,0} 18 | \definecolor{palemagenta}{cmyk}{0,0.25,0,0} 19 | \definecolor{paleyellow}{cmyk}{0,0,0.25,0} 20 | \definecolor{palegray}{cmyk}{0,0,0,0.05} 21 | \definecolor{lightred}{cmyk}{0,0.5,0.5,0} 22 | \definecolor{lightgreen}{cmyk}{0.5,0,0.5,0} 23 | \definecolor{lightblue}{cmyk}{0.5,0.5,0,0} 24 | \definecolor{lightcyan}{cmyk}{0.5,0,0,0} 25 | \definecolor{lightmagenta}{cmyk}{0,0.5,0,0} 26 | \definecolor{lightyellow}{cmyk}{0,0,0.5,0} 27 | \definecolor{lightgray}{cmyk}{0,0,0,0.1} 28 | \definecolor{mediumred}{cmyk}{0,0.75,0.75,0} 29 | \definecolor{mediumgreen}{cmyk}{0.75,0,0.75,0} 30 | \definecolor{mediumblue}{cmyk}{0.75,0.75,0,0} 31 | \definecolor{mediumcyan}{cmyk}{0.75,0,0,0} 32 | \definecolor{mediummagenta}{cmyk}{0,0.75,0,0} 33 | \definecolor{mediumyellow}{cmyk}{0,0,0.75,0} 34 | \definecolor{mediumgray}{cmyk}{0,0,0,0.25} 35 | \definecolor{heavyred}{cmyk}{0,1,1,0.25} 36 | \definecolor{heavygreen}{cmyk}{1,0,1,0.25} 37 | \definecolor{heavyblue}{cmyk}{1,1,0,0.25} 38 | \definecolor{heavycyan}{cmyk}{1,0,0,0.25} 39 | \definecolor{heavymagenta}{cmyk}{0,1,0,0.25} 40 | \definecolor{lightolive}{cmyk}{0,0,1,0.25} 41 | \definecolor{heavygray}{cmyk}{0,0,0,0.75} 42 | \definecolor{deepred}{cmyk}{0,1,1,0.5} 43 | \definecolor{deepgreen}{cmyk}{1,0,1,0.5} 44 | \definecolor{deepblue}{cmyk}{1,1,0,0.5} 45 | \definecolor{deepcyan}{cmyk}{1,0,0,0.5} 46 | \definecolor{deepmagenta}{cmyk}{0,1,0,0.5} 47 | \definecolor{olive}{cmyk}{0,0,1,0.5} 48 | \definecolor{deepgray}{cmyk}{0,0,0,0.9} 49 | \definecolor{darkred}{cmyk}{0,1,1,0.75} 50 | \definecolor{darkgreen}{cmyk}{1,0,1,0.75} 51 | \definecolor{darkblue}{cmyk}{1,1,0,0.75} 52 | \definecolor{darkcyan}{cmyk}{1,0,0,0.75} 53 | \definecolor{darkmagenta}{cmyk}{0,1,0,0.75} 54 | \definecolor{darkolive}{cmyk}{0,0,1,0.75} 55 | \definecolor{darkgray}{cmyk}{0,0,0,0.95} 56 | \definecolor{orange}{cmyk}{0,0.5,1,0} 57 | \definecolor{fuchsia}{cmyk}{0,1,0.5,0} 58 | \definecolor{chartreuse}{cmyk}{0.5,0,1,0} 59 | \definecolor{springgreen}{cmyk}{1,0,0.5,0} 60 | \definecolor{purple}{cmyk}{0.5,1,0,0} 61 | \definecolor{royalblue}{cmyk}{1,0.5,0,0} 62 | \definecolor{salmon}{cmyk}{0,0.5,0.5,0} 63 | \definecolor{brown}{cmyk}{0,1,1,0.5} 64 | \definecolor{darkbrown}{cmyk}{0,1,1,0.75} 65 | \definecolor{pink}{cmyk}{0,0.25,0,0} 66 | \definecolor{palegrey}{cmyk}{0,0,0,0.05} 67 | \definecolor{lightgrey}{cmyk}{0,0,0,0.1} 68 | \definecolor{mediumgrey}{cmyk}{0,0,0,0.25} 69 | \definecolor{grey}{cmyk}{0,0,0,0.5} 70 | \definecolor{heavygrey}{cmyk}{0,0,0,0.5} 71 | \definecolor{deepgrey}{cmyk}{0,0,0,0.9} 72 | \definecolor{darkgrey}{cmyk}{0,0,0,0.95} 73 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/axialshade.asy: -------------------------------------------------------------------------------- 1 | unitsize(1cm); 2 | path g = ellipse((0,0), 4, 1); 3 | axialshade(g, green, (-4,0), yellow, (4,0)); 4 | axialshade(shift(0,-2.5)*g, stroke=true, 5 | green+linewidth(2mm), (-4,0), yellow, (4,0)); 6 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/bezier2.asy: -------------------------------------------------------------------------------- 1 | import beziercurve; 2 | 3 | pair midpoint(pair a, pair b) {return interp(a,b,0.5);} 4 | 5 | pair m0=midpoint(z0,c0); 6 | pair m1=midpoint(c0,c1); 7 | pair m2=midpoint(c1,z1); 8 | 9 | draw(m0--m1--m2,dashed); 10 | dot("$m_0$",m0,NW,red); 11 | dot("$m_1$",m1,N,red); 12 | dot("$m_2$",m2,red); 13 | 14 | pair m3=midpoint(m0,m1); 15 | pair m4=midpoint(m1,m2); 16 | pair m5=midpoint(m3,m4); 17 | 18 | draw(m3--m4,dashed); 19 | dot("$m_3$",m3,NW,red); 20 | dot("$m_4$",m4,NE,red); 21 | dot("$m_5$",m5,N,red); 22 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/beziercurve.asy: -------------------------------------------------------------------------------- 1 | size(400); 2 | pair z0=(0,0); 3 | pair c0=(1,1); 4 | pair c1=(2,1); 5 | pair z1=(3,0); 6 | draw(z0..controls c0 and c1 .. z1,blue); 7 | 8 | draw(z0--c0--c1--z1,dashed); 9 | dot("$z_0$",z0,W,red); 10 | dot("$c_0$",c0,NW,red); 11 | dot("$c_1$",c1,NE,red); 12 | dot("$z_1$",z1,red); 13 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/bigdiagonal.asy: -------------------------------------------------------------------------------- 1 | size(0,100.5); 2 | draw((0,0)--(2,1),Arrow); 3 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/bigsquare.asy: -------------------------------------------------------------------------------- 1 | size(0,3cm); 2 | draw(unitsquare); 3 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/cleantmp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | rm *.???~ *.bak *.log *.toc *.aux *.out *.xdv *.ind *.ilg *.idx 3 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/clippath.asy: -------------------------------------------------------------------------------- 1 | picture pic; 2 | path C1 = circle((0,0), 1cm), C2 = circle((1cm,0), 1cm); 3 | fill(C1, paleblue); draw(pic, C2, linewidth(2mm)); 4 | fill(pic, C1, heavyblue); clip(pic, C2); 5 | add(pic); 6 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/colons.asy: -------------------------------------------------------------------------------- 1 | draw((0,0){up}::(100,25){right}::(200,0){down}); 2 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/colors.asy: -------------------------------------------------------------------------------- 1 | int i=0; 2 | int j=0; 3 | 4 | bool components=false; 5 | 6 | pen p; 7 | 8 | void col(bool fill=false ... string[] s) { 9 | for(int n=0; n < s.length; ++n) { 10 | j -= 10; 11 | string s=s[n]; 12 | eval("p="+s+";",true); 13 | if(components) { 14 | real[] a=colors(p); 15 | for(int i=0; i < a.length; ++i) 16 | s += " "+(string) a[i]; 17 | } 18 | if(fill) label(s,(i+10,j),E,p,Fill(gray)); 19 | else label(s,(i+10,j),E,p); 20 | fill(box((i,j-5),(i+10,j+5)),p); 21 | } 22 | } 23 | 24 | col("palered"); 25 | col("lightred"); 26 | col("mediumred"); 27 | col("red"); 28 | col("heavyred"); 29 | col("brown"); 30 | col("darkbrown"); 31 | j -= 10; 32 | 33 | col("palegreen"); 34 | col("lightgreen"); 35 | col("mediumgreen"); 36 | col("green"); 37 | col("heavygreen"); 38 | col("deepgreen"); 39 | col("darkgreen"); 40 | j -= 10; 41 | 42 | col("paleblue"); 43 | col("lightblue"); 44 | col("mediumblue"); 45 | col("blue"); 46 | col("heavyblue"); 47 | col("deepblue"); 48 | col("darkblue"); 49 | j -= 10; 50 | 51 | i += 150; 52 | j=0; 53 | 54 | col("palecyan"); 55 | col("lightcyan"); 56 | col("mediumcyan"); 57 | col("cyan"); 58 | col("heavycyan"); 59 | col("deepcyan"); 60 | col("darkcyan"); 61 | j -= 10; 62 | 63 | col("pink"); 64 | col("lightmagenta"); 65 | col("mediummagenta"); 66 | col("magenta"); 67 | col("heavymagenta"); 68 | col("deepmagenta"); 69 | col("darkmagenta"); 70 | j -= 10; 71 | 72 | col("paleyellow"); 73 | col("lightyellow"); 74 | col("mediumyellow"); 75 | col("yellow"); 76 | col("lightolive"); 77 | col("olive"); 78 | col("darkolive"); 79 | j -= 10; 80 | 81 | col("palegray"); 82 | col("lightgray"); 83 | col("mediumgray"); 84 | col("gray"); 85 | col("heavygray"); 86 | col("deepgray"); 87 | col("darkgray"); 88 | j -= 10; 89 | 90 | i += 150; 91 | j=0; 92 | 93 | col("black"); 94 | col("white",fill=true); 95 | j -= 10; 96 | 97 | col("orange"); 98 | col("fuchsia"); 99 | j -= 10; 100 | col("chartreuse"); 101 | col("springgreen"); 102 | j -= 10; 103 | col("purple"); 104 | col("royalblue"); 105 | j -= 10; 106 | 107 | col("Cyan"); 108 | col("Magenta"); 109 | col("Yellow"); 110 | col("Black"); 111 | 112 | j -= 10; 113 | 114 | col("cmyk(red)"); 115 | col("cmyk(blue)"); 116 | col("cmyk(green)"); 117 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/cube.asy: -------------------------------------------------------------------------------- 1 | import three; 2 | dotgranularity=0; // Render dots as spheres. 3 | 4 | currentprojection=orthographic(5,4,2,center=true); 5 | 6 | size(5cm); 7 | size3(3cm,5cm,8cm); 8 | 9 | draw(unitbox); 10 | 11 | dot(unitbox,red); 12 | 13 | label("$O$",(0,0,0),NW); 14 | label("(1,0,0)",(1,0,0),S); 15 | label("(0,1,0)",(0,1,0),E); 16 | label("(0,0,1)",(0,0,1),Z); 17 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/diagonal.asy: -------------------------------------------------------------------------------- 1 | draw((0,0)--(100,100)); 2 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/dots.asy: -------------------------------------------------------------------------------- 1 | draw((0,0){up}..(100,25){right}..(200,0){down}); 2 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/fzfonts.tex: -------------------------------------------------------------------------------- 1 | % 方正系列字体设置 2 | \setCJKmainfont[BoldFont={FZXiaoBiaoSong-B05}, ItalicFont={FZKai-Z03}]{FZShuSong_GB18030-Z01} % 书宋、小标宋、楷体 3 | \setCJKsansfont[BoldFont={FZHei-B01}]{FZXiHei I-Z08} % 细黑、黑体 4 | \setCJKmonofont{FZFangSong-Z02} % 仿宋 5 | 6 | \setCJKfamilyfont{rm}[BoldFont={FZXiaoBiaoSong-B05}, ItalicFont={FZKai-Z03}]{FZShuSong_GB18030-Z01} % 同 main 7 | \setCJKfamilyfont{sf}[BoldFont={FZHei-B01}]{FZXiHei I-Z08} % 同 sans 8 | \setCJKfamilyfont{tt}{FZFangSong-Z02} % 同 mono 9 | 10 | \setCJKfamilyfont{song}[BoldFont={FZXiaoBiaoSong-B05}]{FZShuSong_GB18030-Z01} % 书宋和小标宋(除无楷体外同 main) 11 | \setCJKfamilyfont{kai}{FZKai-Z03} % 楷体 12 | \setCJKfamilyfont{hei}[BoldFont={FZHei-B01}]{FZXiHei I-Z08} % 细黑、黑体(同 sans) 13 | \setCJKfamilyfont{fs}{FZFangSong-Z02} % 仿宋(同 mono) 14 | 15 | \setCJKfamilyfont{you}[BoldFont={FZZhunYuan-M02}]{FZXiYuan-M01} % 细圆、准圆 16 | \setCJKfamilyfont{li}[ItalicFont={FZLiShu II-S06}]{FZLiShu-S01} % 隶书、隶二(italic) 17 | 18 | \def\heiti{\CJKfamily{hei}\bfseries} 19 | 20 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/hatch.asy: -------------------------------------------------------------------------------- 1 | size(0,100); 2 | import patterns; 3 | 4 | add("hatch",hatch()); 5 | add("hatchback",hatch(NW)); 6 | add("crosshatch",crosshatch(3mm)); 7 | 8 | real s=1.25; 9 | filldraw(unitsquare,pattern("hatch")); 10 | filldraw(shift(s,0)*unitsquare,pattern("hatchback")); 11 | filldraw(shift(2s,0)*unitsquare,pattern("crosshatch")); 12 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/join.asy: -------------------------------------------------------------------------------- 1 | size(300,0); 2 | pair[] z=new pair[10]; 3 | 4 | z[0]=(0,100); z[1]=(50,0); z[2]=(180,0); 5 | 6 | for(int n=3; n <= 9; ++n) 7 | z[n]=z[n-3]+(200,0); 8 | 9 | path p=z[0]..z[1]---z[2]::{up}z[3] 10 | &z[3]..z[4]--z[5]::{up}z[6] 11 | &z[6]::z[7]---z[8]..{up}z[9]; 12 | 13 | draw(p,grey+linewidth(4mm)); 14 | 15 | dot(z); 16 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/labelalign.asy: -------------------------------------------------------------------------------- 1 | // labelalign.asy 2 | // 在路径上标注的标签 Label 的 position 和 align 参数示例 3 | // milksea 4 | // 2009-02-20 5 | 6 | // XeLaTeX 中文设置 7 | usepackage("xeCJK"); 8 | texpreamble("\input{fzfonts.tex}"); 9 | 10 | // pdfTeX 中文设置 11 | // usepackage("ctexutf8"); 12 | // texpreamble("\pdfpkresolution2400"); // 如果使用 pk 字体,用较高精度。 13 | 14 | usepackage("asycolors"); 15 | size(0,100); 16 | 17 | defaultpen(fontsize(7.5bp/pt)); 18 | pen alignpen = heavyblue; 19 | pen pospen = heavygreen; 20 | 21 | path p = (0,0) .. tension 1.1 .. (1,1) .. tension 0.9 .. (2,0); 22 | draw(p, brown+1); 23 | 24 | 25 | real len = length(p); 26 | for (int i = 0; i <= len; ++i) { 27 | label(Label(format("%d",i), position=i), p, pospen); 28 | draw(point(p,i)+rotate(-90)*0.02dir(p,i) -- point(p,i)+rotate(90)*0.02dir(p,i), pospen); 29 | } 30 | label(Label("\tt Relative(0.5)=MidPoint", MidPoint, NE), p, pospen); 31 | draw(midpoint(p)+rotate(-90)*0.02dir(p,reltime(p,1/2)) 32 | -- midpoint(p)+rotate(90)*0.02dir(p,reltime(p,1/2)), pospen); 33 | 34 | 35 | pair d = relpoint(p, 0.8); 36 | 37 | draw(Label("\tt Relative(0.8)",BeginPoint), d+0.1NE -- d, pospen); 38 | //label(Label("弧长相对位置", Relative(0.8), 10NE), p, pospen); 39 | 40 | label(Label("\tt N", Relative(0.8), 2N), p, alignpen); 41 | label(Label("\tt S", Relative(0.8), 2S), p, alignpen); 42 | label(Label("\tt W", Relative(0.8), 2W), p, alignpen); 43 | label(Label("\tt E", Relative(0.8), 2E), p, alignpen); 44 | //label(Label("绝对对齐方位", Relative(0.8), 6S, Fill(white+opacity(0.7))), p, alignpen); 45 | dot(d,red); 46 | 47 | 48 | 49 | pair c = point(p,0.5); 50 | 51 | draw(Label("0.5",BeginPoint), c+0.1N -- c, pospen); 52 | //label(Label("时间参数绝对位置", position=0.5, 2W+10N), p, pospen); 53 | 54 | draw(Label("相对北极轴",position=EndPoint,align=Relative(N),Fill(white+opacity(0.7))), 55 | c--c+0.3dir(p,0.5), alignpen+linewidth(0.6), Arrow); 56 | label(Label("\tt LeftSide", position=0.5, 2LeftSide), p, alignpen); 57 | label(Label("\tt RightSide", position=0.5, 2RightSide), p, alignpen); 58 | label(Label("\tt Relative(S)", position=0.5, 2Relative(S), Rotate(dir(p,0.5)), Fill(white+opacity(0.7))), p, alignpen); 59 | //label(Label("相对对齐方位", 0.5, 2E + 10S), p, alignpen); 60 | 61 | dot(c,red); 62 | 63 | 64 | label(minipage("\centering 使用~\texttt{Label}~函数在路径上标注\\\texttt{\color{heavygreen}position}~和~\texttt{\color{heavyblue}align}~参数示意", 5cm), (1,0)); 65 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/labelsquare.asy: -------------------------------------------------------------------------------- 1 | size(3cm); 2 | draw(unitsquare); 3 | label("$A$",(0,0),SW); 4 | label("$B$",(1,0),SE); 5 | label("$C$",(1,1),NE); 6 | label("$D$",(0,1),NW); 7 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/latticeshading.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | 3 | pen[][] p={{white,grey,black}, 4 | {red,green,blue}, 5 | {cyan,magenta,yellow}}; 6 | 7 | latticeshade(unitsquare,p); 8 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/linecap.asy: -------------------------------------------------------------------------------- 1 | // 线端(line cap)测试 2 | // milksea 3 | 4 | string[] capname = {"squarecap", "roundcap", "extendcap"}; 5 | for (int i = 0; i < 3; ++i) { 6 | path p = shift(0,-i*.5cm) * ((0,0) -- (5cm,0)); 7 | draw(p, linewidth(3mm)+linecap(i)+mediumgray); 8 | draw(p, linewidth(0.6pt)+squarecap); 9 | label(Label(capname[i], BeginPoint), p, 2W, 10 | fontsize(7.5bp/pt)+fontcommand("\ttfamily")); // 六号字 11 | } 12 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/linejoin.asy: -------------------------------------------------------------------------------- 1 | // 线连接(line join)测试 2 | // milksea 3 | 4 | string[] capname = {"miterjoin", "roundjoin", "beveljoin"}; 5 | for (int i = 0; i < 3; ++i) { 6 | path p = shift(i*3cm,0) * ((0,0) -- (-1cm,.5cm) -- (0,1cm)); 7 | draw(p, linewidth(3mm)+linejoin(i)+mediumgray); 8 | draw(p, linewidth(0.6pt)+squarecap); 9 | label(Label(capname[i], MidPoint), p, 4W, 10 | fontsize(7.5bp/pt)+fontcommand("\ttfamily")); // 六号字 11 | } 12 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/linetype.asy: -------------------------------------------------------------------------------- 1 | void testline(real y) { 2 | draw((0,y)--(100,y),currentpen+solid); 3 | draw((0,y-10)--(100,y-10),currentpen+dotted); 4 | draw((0,y-20)--(100,y-20),currentpen+dashed); 5 | draw((0,y-30)--(100,y-30),currentpen+longdashed); 6 | draw((0,y-40)--(100,y-40),currentpen+dashdotted); 7 | draw((0,y-50)--(100,y-50),currentpen+longdashdotted); 8 | draw((0,y-60)--(100,y-60),currentpen+Dotted); 9 | } 10 | 11 | currentpen=linewidth(0.5); 12 | testline(100); 13 | 14 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/logo.asy: -------------------------------------------------------------------------------- 1 | size(140,80,IgnoreAspect); 2 | 3 | picture logo(pair s=0, pen q) 4 | { 5 | picture pic; 6 | pen p=linewidth(2)+fontsize(24pt)+q; 7 | real a=-0.4; 8 | real b=0.95; 9 | real y1=-5; 10 | real y2=-3y1/2; 11 | path A=(a,0){dir(10)}::{dir(89.5)}(0,y2); 12 | draw(pic,A,p); 13 | draw(pic,(0,y1){dir(88.3)}::{dir(20)}(b,0),p); 14 | real c=0.5*a; 15 | pair z=(0,2.5); 16 | label(pic,"{\it symptote}",z,0.25*E+0.169S,p); 17 | pair w=(0,1.7); 18 | draw(pic,intersectionpoint(A,w-1--w)--w,p); 19 | draw(pic,(0,y1)--(0,y2),p); 20 | draw(pic,(a,0)--(b,0),p); 21 | return shift(s)*pic; 22 | } 23 | 24 | pair z=(-0.015,0.08); 25 | for(int x=0; x < 10; ++x) 26 | add(logo(0.1*x*z,gray(0.04*x))); 27 | 28 | add(logo(red)); 29 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/makepdf: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | asy -noV -tex xelatex -f pdf logo.asy 3 | asy -noV -tex xelatex -f pdf -noprc -render=0 *.asy 4 | xelatex main 5 | makeindex main 6 | xelatex main 7 | xelatex main 8 | mv main.pdf asymptote-zh.pdf 9 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/makepen.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | pen convex=makepen(scale(10)*polygon(8))+grey; 3 | draw((1,0.4),convex); 4 | draw((0,0)---(1,1)..(2,0)--cycle,convex); 5 | 6 | pen nonconvex=scale(10)* 7 | makepen((0,0)--(0.25,-1)--(0.5,0.25)--(1,0)--(0.5,1.25)--cycle)+red; 8 | draw((0.5,-1.5),nonconvex); 9 | draw((0,-1.5)..(1,-0.5)..(2,-1.5),nonconvex); 10 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/mexicanhat.asy: -------------------------------------------------------------------------------- 1 | size(200); 2 | 3 | real mexican(real x) {return (1-8x^2)*exp(-(4x^2));} 4 | 5 | int n=30; 6 | real a=1.5; 7 | real width=2a/n; 8 | 9 | guide hat; 10 | path solved; 11 | 12 | for(int i=0; i < n; ++i) { 13 | real t=-a+i*width; 14 | pair z=(t,mexican(t)); 15 | hat=hat..z; 16 | solved=solved..z; 17 | } 18 | 19 | draw(hat); 20 | dot(hat,red); 21 | draw(solved,dashed); 22 | 23 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/quartercircle.asy: -------------------------------------------------------------------------------- 1 | size(100,0); 2 | draw((1,0){up}..{left}(0,1),Arrow); 3 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/shadedtiling.asy: -------------------------------------------------------------------------------- 1 | size(0,100); 2 | import patterns; 3 | 4 | real d=4mm; 5 | picture tiling; 6 | path square=scale(d)*unitsquare; 7 | axialshade(tiling,square,white,(0,0),black,(d,d)); 8 | fill(tiling,shift(d,d)*square,blue); 9 | add("shadedtiling",tiling); 10 | 11 | filldraw(unitcircle,pattern("shadedtiling")); 12 | 13 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/shadestroke.asy: -------------------------------------------------------------------------------- 1 | size(100); 2 | 3 | radialshade(W..N..E--(0,0),stroke=true, 4 | red+linewidth(30),(0,0),0.25,yellow,(0,0),1); 5 | 6 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/square.asy: -------------------------------------------------------------------------------- 1 | size(100,100); 2 | draw((0,0)--(1,0)--(1,1)--(0,1)--cycle); 3 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/subpictures.asy: -------------------------------------------------------------------------------- 1 | picture pic1; 2 | real size=50; 3 | size(pic1,size); 4 | fill(pic1,(0,0)--(50,100)--(100,0)--cycle,red); 5 | 6 | picture pic2; 7 | size(pic2,size); 8 | fill(pic2,unitcircle,green); 9 | 10 | picture pic3; 11 | size(pic3,size); 12 | fill(pic3,unitsquare,blue); 13 | 14 | picture pic; 15 | add(pic,pic1.fit(),(0,0),N); 16 | add(pic,pic2.fit(),(0,0),10S); 17 | 18 | add(pic.fit(),(0,0),N); 19 | add(pic3.fit(),(0,0),10S); 20 | 21 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/superpath.asy: -------------------------------------------------------------------------------- 1 | size(0,100); 2 | path unitcircle=E..N..W..S..cycle; 3 | path g=scale(2)*unitcircle; 4 | filldraw(unitcircle^^g,evenodd+yellow,black); 5 | 6 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/tile.asy: -------------------------------------------------------------------------------- 1 | size(0,90); 2 | import patterns; 3 | 4 | add("tile",tile()); 5 | add("filledtilewithmargin",tile(6mm,4mm,red,Fill),(1mm,1mm),(1mm,1mm)); 6 | add("checker",checker()); 7 | add("brick",brick()); 8 | 9 | real s=2.5; 10 | filldraw(unitcircle,pattern("tile")); 11 | filldraw(shift(s,0)*unitcircle,pattern("filledtilewithmargin")); 12 | filldraw(shift(2s,0)*unitcircle,pattern("checker")); 13 | filldraw(shift(3s,0)*unitcircle,pattern("brick")); 14 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/transparency.asy: -------------------------------------------------------------------------------- 1 | size(0,150); 2 | 3 | if(settings.outformat == "") 4 | settings.outformat="pdf"; 5 | 6 | begingroup(); 7 | fill(shift(1.5dir(120))*unitcircle,green+opacity(0.75)); 8 | fill(shift(1.5dir(60))*unitcircle,red+opacity(0.75)); 9 | fill(unitcircle,blue+opacity(0.75)); 10 | endgroup(); 11 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/windingnumber.asy: -------------------------------------------------------------------------------- 1 | path p2 = 2 | (-89,2)..controls(-86.8188470497,44.0983279574)and(-45.9938314745,72.3882023306)..(-2,69) 3 | ..controls(37.3564255309,65.9689493222)and(71.1986829486,38.501250568)..(76,0) 4 | ..controls(81.6314985122,-45.1583873691)and(46.3165401516,-84.2754685726)..(0,-92) 5 | ..controls(-60.1996040054,-102.039906511)and(-116.438157081,-59.1028090769)..(-116,0) 6 | ..controls(-115.569614418,58.0545150815)and(-60.8290914438,99.2504221041)..(0,97) 7 | ..controls(56.1281494698,94.923493098)and(100.064478245,53.1265690797)..(102,0) 8 | ..controls(107.052588053,-138.684397375)and(-95.2410532598,-118.458268134)..cycle; 9 | 10 | import fontsize; 11 | defaultpen(linewidth(1.5)); 12 | 13 | // XeLaTeX 设置 14 | usepackage("xeCJK"); 15 | texpreamble("\input{fzfonts.tex}"); 16 | 17 | // pdfTeX 设置 18 | // usepackage("ctexutf8"); 19 | // texpreamble("\pdfpkresolution2400"); // 如果使用 pk 字体,用较高精度。 20 | 21 | picture windpic(int windnum, path p ... int[] patition) 22 | { 23 | picture pic; 24 | dot(pic, (0,0), linewidth(4pt)); 25 | label(pic, "\LARGE$\hbox{卷绕数}="+string(windnum)+"$", (0,0), 3S); 26 | patition.insert(0,0); 27 | int n = patition.length; 28 | for (int i = 0; i < n-1; ++i) 29 | draw(pic, subpath(p, patition[i], patition[i+1]), heavyred, Arrow(TeXHead)); 30 | draw(pic, subpath(p, patition[n-1], length(p)), heavyred); 31 | return pic; 32 | } 33 | 34 | add(currentpicture, windpic(-2, p2, 2, 6).fit(), (0,0), 10W); 35 | add(currentpicture, windpic(-1, scale(100)*(N..E..S..W..cycle), 1).fit(), (0,0), 10E); 36 | add(currentpicture, windpic(0, shift(80,0)*scale(50)*(N..E..S..W..cycle), 1).fit(), (200,0), 40E); 37 | add(currentpicture, windpic(1, scale(100)*(S..E..N..W..cycle), 1).fit(), (450,0), 20E); 38 | add(currentpicture, windpic(2, reverse(p2), 1, 5).fit(), (700,0), 10E); 39 | 40 | add(bbox(xmargin=10,ymargin=0,p=invisible)); 41 | 42 | -------------------------------------------------------------------------------- /asymptote-manual-zh-cn/src/winfonts.tex: -------------------------------------------------------------------------------- 1 | \usepackage[BoldFont,SlantFont,CJKnumber]{xeCJK} 2 | \usepackage{CJKfntef} 3 | 4 | % Windows 预装字体设置 5 | \setCJKmainfont[BoldFont={SimHei}, ItalicFont={KaiTi_GB2312}]{SimSun} 6 | \setCJKsansfont{Microsoft YaHei} 7 | \setCJKmonofont{FangSong_GB2312} 8 | 9 | \setCJKfamilyfont{rm}[BoldFont={SimHei}, ItalicFont={KaiTi_GB2312}]{SimSun} % 同 main 10 | \setCJKfamilyfont{sf}{Microsoft YaHei} % 同 sans 11 | \setCJKfamilyfont{tt}{FangSong_GB2312} % 同 mono 12 | 13 | \setCJKfamilyfont{song}{SimSun} 14 | \setCJKfamilyfont{kai}{KaiTi_GB2312} 15 | \setCJKfamilyfont{hei}{SimHei} 16 | \setCJKfamilyfont{fs}{FangSong_GB2312} 17 | 18 | \setCJKfamilyfont{you}{YouYuan} 19 | \setCJKfamilyfont{li}{LiSu} 20 | 21 | -------------------------------------------------------------------------------- /context-notes-zh-cn/README: -------------------------------------------------------------------------------- 1 | This is an introductory tutorial on ConTeXt in Chinese written by Yanrui Li. 2 | 3 | ConTeXt installation, fonts, layout design, cross-reference, project structure, metafun are covered in this tutorial. 4 | 5 | This package is licensed in GFDL (GNU Free Documentation License). 6 | 7 | If you are interested in the process of development you may observe 8 | 9 | http://code.google.com/p/ctex-doc/updates/list 10 | 11 | Report feedback in the Issues section of ctex-doc project, 12 | or in http://bbs.ctex.org forum. 13 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/Makefile: -------------------------------------------------------------------------------- 1 | PRODUCT=ctxnotes 2 | READER=evince 3 | 4 | all: 5 | context --mode=screen $(PRODUCT) 6 | 7 | print: 8 | context --mode=print $(PRODUCT) 9 | context --purge 10 | 11 | bib: 12 | context --mode=screen --once $(PRODUCT) \ 13 | && bibtex $(PRODUCT) \ 14 | && context --mode=screen $(PRODUCT) 15 | 16 | pdf: 17 | $(READER) $(PRODUCT).pdf & 18 | 19 | clean: 20 | context --purge 21 | rm -f *.aux *.bbl *.blg 22 | rm -f *.pdf 23 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/bibl-lyr.tex: -------------------------------------------------------------------------------- 1 | \setupcite[num][inbetween={, }, lastpubsep={, },compress=yes] 2 | 3 | \def\withbrackets#1{[#1]~~} 4 | \setuppublications 5 | [sorttype=, 6 | criterium=, 7 | refcommand=num, 8 | numbering=yes, 9 | numbercommand=\withbrackets, 10 | autohang=yes] 11 | 12 | \setuppublicationlist 13 | [artauthor=\normalauthor, 14 | editor=\normalauthor, 15 | author=\normalauthor, 16 | namesep={,}, 17 | lastnamesep={ and }, 18 | finalnamesep={ and }, 19 | firstnamesep={ }, 20 | juniorsep={ }, 21 | vonsep={ }, 22 | surnamesep={ }, 23 | authoretallimit=5, 24 | editoretallimit=5, 25 | artauthoretallimit=5, 26 | authoretaldisplay=5, 27 | editoretaldisplay=5, 28 | artauthoretaldisplay=5, 29 | authoretaltext={ etc}, 30 | editoretaltext={ etc}, 31 | artauthoretaltext={ etc}, 32 | ] 33 | 34 | \setuppublicationlayout[article]{% 35 | \insertartauthors{}{\unskip.}{}% 36 | \insertarttitle{\bgroup }{\egroup[J].}{}% 37 | \insertjournal{\bgroup }{\egroup}{}% 38 | \insertpubyear{,}{}{}% 39 | \insertvolume{,}{}{}% 40 | \insertissue{(}{)}{}% 41 | \insertpages{:}{.}{}% 42 | } 43 | 44 | \setuppublicationlayout[phdthesis]{% 45 | \insertauthors{}{\unskip.}{}% 46 | \inserttitle{}{\unskip[D].}{}% 47 | \insertpubname{}{,}{}% 48 | \insertpubyear{}{.}{}% 49 | } 50 | 51 | \setuppublicationlayout[techreport]{% 52 | \insertauthors{}{.}{}% 53 | \inserttitle{}{[R].}{}% 54 | \insertpubname{}{}{}% 55 | \insertpubyear{,}{.}{}% 56 | } 57 | 58 | \setuppublicationlayout[inproceedings]{% 59 | \insertauthors{}{.}{}% 60 | \insertarttitle{}{[C].}{}%% 61 | \inserttitle{}{}{}% 62 | \insertpubyear{,}{.}{}% 63 | } 64 | 65 | \setuppublicationlayout[book]{% 66 | \insertauthors{}{.}{}% 67 | \inserttitle{}{[M].}{}% 68 | \insertpubname{}{}{}% 69 | \insertpubyear{,}{.}{}% 70 | \insertnote{}{}{}% 71 | } 72 | 73 | \setuppublicationlayout[unpublished]{% 74 | \insertauthors{}{.}{}% 75 | \inserttitle{}{.}{}% 76 | \inserturl{}{}{}% 77 | } 78 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/bibliography.bib: -------------------------------------------------------------------------------- 1 | @unpublished{bibtex, 2 | title = {{Tame the BeaST: The B to X of Bib\TeX}}, 3 | author = {Nicolas Markey}, 4 | url = {http://www.ctan.org/tex-archive/info/bibtex/tamethebeast/}, 5 | } 6 | 7 | @unpublished{fonts, 8 | title = {{Fonts in \ConTeXt}}, 9 | author = {PRAGMA}, 10 | url = {http://context.aanhet.net/svn/contextman/context-reference/en/co-fonts.pdf}, 11 | } 12 | 13 | @unpublished{Taco, 14 | title = {{Bibliographies}}, 15 | author = {Taco Hoekwater}, 16 | url = {http://modules.contextgarden.net/bib}, 17 | } 18 | 19 | @unpublished{TacoCTXWiki, 20 | title = {{Bibliography}}, 21 | author = {Taco Hoekwater}, 22 | url = {http://wiki.contextgarden.net/Bibliography}, 23 | } 24 | 25 | @unpublished{widgets, 26 | title = {{WIDGETS uncovered}}, 27 | author = {PRAGMA}, 28 | url = {http://pragma-ade.com/general/manuals/mwidget-s.pdf}, 29 | } 30 | 31 | @unpublished{cont-eni, 32 | title = {{\ConTeXt the manual}}, 33 | author = {PRAGMA}, 34 | url = {http://www.pragma-ade.com/general/manuals/cont-eni.pdf}, 35 | } 36 | 37 | @unpublished{ms-cb-en, 38 | title = {{\ConTeXt an excursion}}, 39 | author = {PRAGMA}, 40 | url = {http://www.pragma-ade.com/general/manuals/ms-cb-en.pdf}, 41 | } 42 | 43 | @unpublished{metafun, 44 | title = {{METAFUN}}, 45 | author = {Hans Hagen}, 46 | url = {http://www.pragma-ade.com/general/manuals/metafun-s.pdf}, 47 | } 48 | 49 | @unpublished{lnotes, 50 | title = {{\LATEX 学习笔记}}, 51 | author = {Alpha Huang}, 52 | url = {http://www.ctan.org/tex-archive/info/lnotes/lnotes.pdf}, 53 | } 54 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/ctxnotes.tex: -------------------------------------------------------------------------------- 1 | \environment doc-env 2 | %\startproduct ctxnotes 3 | \starttext 4 | 5 | % 封面 6 | \startMPinclusions 7 | def random_hash_frame (expr width, height, offset, linewidth ) = 8 | 9 | def delta = ((uniformdeviate .5offset) + .25offset) enddef ; 10 | x1 := offset ; y1 := offset ; x2 := width-offset ; y2 := height-offset ; 11 | 12 | drawoptions(withpen pencircle scaled linewidth withcolor transparent(1,.8,\MPcolor{BackgroundColor})) ; 13 | fill z1--(x2,y1)--z2--(x1,y2)--cycle ; 14 | 15 | drawoptions(withpen pencircle scaled linewidth withcolor \MPcolor{OrnamentColor}) ; 16 | draw (x1-delta,y1)--(x2+delta,y1) ; 17 | draw (x2,y1-delta)--(x2,y2+delta) ; 18 | draw (x2+delta,y2)--(x1-delta,y2) ; 19 | draw (x1,y2+delta)--(x1,y1-delta) ; 20 | 21 | drawoptions(); 22 | setbounds currentpicture to unitsquare xscaled width yscaled height ; 23 | enddef ; 24 | \stopMPinclusions 25 | 26 | \startuseMPgraphic{TitleGraphic} 27 | for i=1 upto 400 : 28 | offset := uniformdeviate 10pt ; 29 | width := 2*offset + 40pt + uniformdeviate 30pt ; 30 | height := 2*offset + 30pt + uniformdeviate 10pt ; 31 | addto currentpicture also 32 | image(random_hash_frame(width,height,offset,1pt)) shifted 33 | (uniformdeviate OverlayWidth, uniformdeviate OverlayHeight) ; 34 | endfor ; 35 | \stopuseMPgraphic 36 | 37 | \defineoverlay [TitleGraphic] [\useMPgraphic{TitleGraphic}] 38 | 39 | % 前文 40 | \startfrontmatter 41 | \setupbackgrounds [page][background=TitleGraphic] 42 | \startstandardmakeup 43 | \startcolor[white] 44 | \startframedtext[middle][width=.8\textwidth,height=5cm] 45 | \dontleavehmode 46 | \blank[.5cm] 47 | \hfil\bfd\ConTeXt\ 学习笔记\hfil 48 | \blank[.5cm] 49 | \hfil\bfc Using MkIV\hfil 50 | \blank[1cm] 51 | \hfil\bfa Li Yanrui (liyanrui.m2@gmail.com)\hfil 52 | \stopframedtext 53 | \stopcolor 54 | \blank[14cm] 55 | \stopstandardmakeup 56 | \setupbackgrounds [page][background=] 57 | \setuppagenumbering[conversion=romannumerals] 58 | \setuppagenumber[number=1] 59 | \title{目\;\;录}\blank 60 | \placecontent 61 | \stopfrontmatter 62 | 63 | % 正文 64 | \startbodymatter 65 | \setuppagenumbering[conversion=number] 66 | \setuppagenumber[number=1] 67 | \setups{HeaderFooter} 68 | \component basis 69 | \component fonts 70 | \component layout 71 | \component references 72 | \component project 73 | \component metafun 74 | \stopbodymatter 75 | 76 | % 附录 77 | \startappendices 78 | \title{参考文献} 79 | \placepublications[criterium=all] 80 | \stopappendices 81 | 82 | % 后文 83 | \startbackmatter 84 | 未完成…… 85 | \stopbackmatter 86 | 87 | %\stopproduct 88 | \stoptext 89 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/doc-env.tex: -------------------------------------------------------------------------------- 1 | \startenvironment doc-env 2 | 3 | \usemodule[zhfonts] 4 | 5 | \usemodule[chart] 6 | \usemodule[t][layout] 7 | 8 | \setupcolor[hex] 9 | \definecolor [BackgroundColor] [h=cccccc] 10 | \definecolor [OrnamentColor] [h=99ccff] 11 | \definecolor [TitleColor] [h=336699] 12 | 13 | \setupinteraction 14 | [state=start, 15 | focus=standard, 16 | color=darkblue, 17 | title={ConTeXt 学习笔记}, 18 | subtitle={Using MkIV}, 19 | author={Li Yanrui}, 20 | keyword={TeX, ConTeXt, MkIV, LuaTeX}] 21 | 22 | %\setupinteractionscreen[option=max] 23 | 24 | \setuppapersize[A4][A4] 25 | \setuplayout[width=fit,height=middle, 26 | leftmargin=2cm,rightmargin=2cm, 27 | backspace=2.5cm,topspace=2cm, 28 | headerdistance=.5cm,footerdistance=.5cm, 29 | leftmargindistance=.5cm,rightmargindistance=.5cm, 30 | header=1cm,footer=1cm] 31 | \setuppagenumbering[style=\tfx,location=] 32 | 33 | \setuptolerance[horizontal, stretch] 34 | 35 | % 图片目录 36 | \setupexternalfigures[directory={./figures}] 37 | 38 | %-------- 标题设置 -------- 39 | \setupheads[indentnext=yes] 40 | 41 | \setuphead[title][style=\bfb,align={broad,middle},header=empty,foote=empty] 42 | \setuphead[chapter][style=\bfb,header=empty,footer=empty] 43 | \setuphead[section][style=\bfa] 44 | \setuphead[subsubject][style=\bf] 45 | 46 | % 代码环境 47 | \setuplinenumbering[color=darkgray,style=small] 48 | \setuptyping[option=color,palet=graypretty, 49 | before={\blank[.5em]\setupinterlinespace[line=1.2em]}, 50 | after={\blank[.5em]}] 51 | 52 | \definetyping[niceTEX][option=TEX] 53 | 54 | %-------- 中文化 -------- 55 | \setuplabeltext [en] [chapter={第\;,\;章}] 56 | \setuplabeltext [en] [figure=图\;] 57 | \setuplabeltext [en] [table=表\;] 58 | \setupheadtext[en][pubs={\bfc 参考文献}] 59 | \setupheadtext[en][content={\bfc 目录}] 60 | 61 | %% 目录 %% 62 | \def\ChapterNumber#1{\doiftext{#1}{第\;#1\;章\quad}} 63 | \setuplist 64 | [chapter] 65 | [alternative=a, 66 | before=\blank, 67 | after=\blank, 68 | style=\bf, 69 | width=fit, 70 | pagestyle=boldslanted, 71 | pagenumber=no, 72 | numbercommand=\ChapterNumber] 73 | 74 | \def\PageNumber#1{\underbars{#1}.} 75 | \setuplist 76 | [section] 77 | [alternative=d, 78 | style=normal, 79 | pagecommand=\PageNumber, 80 | pagestyle=\itx] 81 | 82 | % 页眉页脚 83 | \startsetups HeaderFooter 84 | \def\CurrentChapter{% 85 | 第 \headnumber[chapter]\ 章% 86 | \hbox to 2em{}% 87 | \getmarking[chapter]% 88 | } 89 | \def\CurrentSection{% 90 | \headnumber[section]% 91 | \hbox to 2em{}% 92 | \getmarking[section]% 93 | } 94 | \setupheadertexts 95 | [\CurrentChapter][pagenumber] 96 | [pagenumber][\CurrentSection] 97 | \setupheader[style=\bfx,color=darkgray] 98 | \stopsetups 99 | 100 | % 书签 101 | \setupinteractionscreen[option=bookmark] 102 | \placebookmarks[chapter,section][chapter] 103 | 104 | % 参考文献 105 | \setupbibtex[database=bibliography] 106 | \setuppublications[alternative=lyr] 107 | 108 | %---- 其它一些零碎设置 ---- 109 | \setupinterlinespace[line=1.5em] 110 | \setupwhitespace[big] 111 | 112 | \setupfloats[indentnext=yes] 113 | \setupcaptions[style=\tfx, headstyle=\normal] 114 | 115 | \setupitemize[each][packed,serried,inmargin][margin=2em] 116 | 117 | \setupfootnotes[way=bychapter] 118 | 119 | \setupinmargin[left,right][style=\tfx] 120 | 121 | \definedescription[definition] 122 | [location=top,hang=20,width=broad,indenting=always,style=\ss,headstyle=\bf] 123 | 124 | \def\mycite#1{\cite[#1]} 125 | 126 | %% 阴影盒 127 | 128 | \startuniqueMPgraphic{shade box} 129 | path p; 130 | u := 1cm; w := \overlaywidth; h := \overlayheight; 131 | roundcorner := 8pt; offset := 12pt; 132 | 133 | color shade; 134 | shade := (.6,.6,.6); 135 | 136 | for i = 0 step .02 until 1: 137 | fill unitsquare xyscaled (w-i*u,h-i*u) squeezed (8pt,6pt) 138 | shifted (offset+i*u/2,-offset+i*u/2) 139 | withcolor transparent (1,.1,shade); 140 | endfor; 141 | 142 | p := unitsquare xyscaled (w, h); 143 | draw p withcolor transparent (1,0,white); 144 | 145 | p := p shifted (offset/2, -offset/2) squeezed (8pt,6pt); 146 | fill p withcolor \MPcolor{darkgray}; 147 | draw p withcolor \MPcolor{OrnamentColor}; 148 | \stopuniqueMPgraphic 149 | 150 | \defineoverlay[shade box][\uniqueMPgraphic{shade box}] 151 | \setupframedtexts[frame=off,background={shade box}] 152 | 153 | \stopenvironment 154 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/figures/bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-notes-zh-cn/src/figures/bookmark.png -------------------------------------------------------------------------------- /context-notes-zh-cn/src/figures/cow.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-notes-zh-cn/src/figures/cow.pdf -------------------------------------------------------------------------------- /context-notes-zh-cn/src/figures/gardeninglion.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-notes-zh-cn/src/figures/gardeninglion.jpg -------------------------------------------------------------------------------- /context-notes-zh-cn/src/figures/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-notes-zh-cn/src/figures/header.png -------------------------------------------------------------------------------- /context-notes-zh-cn/src/fonts.tex: -------------------------------------------------------------------------------- 1 | \startcomponent fonts 2 | \environment doc-env 3 | \product ctxnotes 4 | 5 | \chapter{在字体中挣扎} 6 | 7 | 当我刚开始学用 \LATEX\ 时,就患上了字体恐惧症。如果只是写英文文档,那么对于初学者而言实在是太简单了,基本上不需要怎么关心字体的问题;但是对于中文或者其它非西语文字而言,\TEX\ 的易用性依然很弱,以至于用户不得不去弄清楚诸多有关字体方面的知识及其配置方法。我很憎恶这些东西,但是也没有办法,排版本来就不是一件易事,只好秉承“为之,则难者易易也”的精神去摸索一下。我开始阅读 \CONTEXT\ Fonts 文档\mycite{fonts},这一章内容就是我的阅读笔记。 8 | 9 | \section{字体、别名与特征} 10 | 11 | 为字体文件取个别名,这是 \CONTEXT\ 字体机制推荐的做法。比如,我们可以将 AdobeSongStd-Light.otf 字体取名为 Song: 12 | 13 | \startniceTEX 14 | \definefontsynonym 15 | [Song][AdobeSongStd-Light][features=zh] 16 | \stopniceTEX 17 | 18 | \noindent \type{features=zh} 参数是用来告诉 \CONTEXT\ MkIV 应当采用中文 (zh) 方式来处理这款字体。\type{features} 的值并非 \CONTEXT\ 提供的标准值,而是要用户自己定义: 19 | 20 | \startniceTEX 21 | \definefontfeature 22 | [zh][mode=node,script=hang,lang=zhs] 23 | \stopniceTEX 24 | 25 | \noindent \type{zh} 这个 font feature 名字可根据自己的嗜好来定;至于第二组参数,对于简体中文用户,通常这样设置就可以。 26 | 27 | \tex{definefontfeature} 与 \tex{definefontsynonym} 命令的用法在与本文档一同发布的 zhfonts.tex 文件中均有体现,可参照理解。 28 | 29 | 这里需要注意一下字体别名定义中的字体名称。上面的示例中,我直接使用 \type{AdobeSongStd-Light} 告诉 MkIV:我使用的是 AdobeSongStd-Light.otf 字体。实际上,这样的效率会有点低。因为 MkIV 有两种搜索字体的方式,第一种是根据字体开发商给出的字体名 (name),第二种是字体的文件名 (file)。字体名可以使用 \type{fc-list} 命令来查,譬如查询搜索 AdobeSongStd-Light.otf 的字体名: 30 | 31 | \starttyping 32 | > fc-list | grep Song 33 | Adobe 宋体 Std L,Adobe Song Std,Adobe 宋体 Std, 34 | Adobe Song Std L:style=L,Regular 35 | \stoptyping 36 | 37 | \noindent 我们可以得到许多字体名,推荐从中选择一个纯英文的供给 MkIV,譬如: 38 | 39 | \startniceTEX 40 | \definefontsynonym 41 | [Song][name:Adobe Song Std][features=zh] 42 | \stopniceTEX 43 | 44 | 如果想使用字体文件名,可以为其冠以 \type{file} 前缀: 45 | 46 | \startniceTEX 47 | \definefontsynonym 48 | [Song][file:AdobeSongStd-Light][features=zh] 49 | \stopniceTEX 50 | 51 | 在本节最初的那个例子中,既没有 \type{name} 前缀,也没有 \type{file} 前缀,那么 MkIV 就只好先尝试字体名;如果找不到字体,再去尝试字体文件名。 52 | 53 | 我觉得使用字体名比较正规一些,因为字体的文件名很容易被改掉;字体名是由开发商设定的,一般用户不会想到去修改它,因此使用它可以提高文档的可移植性。 54 | 55 | \CONTEXT\ 预定义了一些标准的字体别名,我们常用的是\crlf\type{[Serif|Sans|Mono][Bold|Italic|BoldItalic]},它们在 zhfonts.tex 中均出现了。 56 | 57 | 还值得注意的一个问题就是:我们可以定义字体别名的别名。 58 | 59 | \section{简单的字体定义} 60 | 61 | 使用 \tex{definefont} 命令可以实现最快捷、最容易理解的字体定义与使用。比如我想定义 Adobe 宋体并使用它: 62 | 63 | \startniceTEX 64 | \definefont 65 | [Song] 66 | [{name:Adobe Song Std*zh} at 14pt] 67 | 68 | \starttext 69 | \Song 我使用的是 Adobe 宋体 70 | \stoptext 71 | \stopniceTEX 72 | 73 | 或许上面这个例子看起来有点古怪,我将字体定义的部分改写一下,或许就会清楚一些: 74 | 75 | \startniceTEX 76 | \definefontsynonym 77 | [SongTi][name:Adobe Song Std][features=zh] 78 | 79 | \definefont 80 | [Song][SongTi at 14pt] 81 | \stopniceTEX 82 | 83 | 如果在定义字体时,不去硬性地设定字体尺寸,那么 \CONTEXT\ 可以根据具体的排版环境自动为字体设定合适的尺寸。 84 | 85 | \section{Typescript 与 typeface} 86 | 87 | 说实在的,typescript 的中文意思我真的说不出来,词典上可以查到的解释是“用打字机打的文件”。我在中文里也实在找不出简洁、准确的翻译,所以还是直称 typescript 为好。 88 | 89 | 简单来说,typescript 是 \CONTEXT\ 的最上层的字体配置文件。目前,MkIV 没有提供面向中文用户的 typescript 文件,这就需要我们自行去实现,因此掌握 typescript 文件的写法非常重要。 90 | 91 | 在只针对 MkIV 的 typescript 配置与使用中,常用命令如下: 92 | 93 | \startitemize 94 | \item typescript 环境 95 | \item \tex{definefontsynonym} 96 | \item \tex{definetypeface} 97 | \item \tex{usetypescriptfile} 98 | \item \tex{usetypescript} 99 | \stopitemize 100 | 101 | \noindent 下面我将结合 zhfonts.tex 中的部分内容来理解这些命令的用法。 102 | 103 | 在 zhfonts.tex 文件中可以看到,typescript 文件内容是被 typescript 环境分为多个小节的,每个小节实现了一组字体的配置: 104 | 105 | \startniceTEX 106 | \definefontfeature 107 | [zh][mode=node,script=hang,lang=zhs] 108 | 109 | \starttypescript[serif] [zhfont] 110 | ... ... 111 | \stoptypescript 112 | 113 | \starttypescript[sans][zhfont] 114 | ... ... 115 | \stoptypescript 116 | 117 | \starttypscript[mono][zhfont] 118 | ... ... 119 | \stoptypescript 120 | 121 | \starttypescript[myfont] 122 | ... ... 123 | \stoptypescript 124 | \stopniceTEX 125 | 126 | 上述代码,我设置了三种字样 (typeface):衬线 (serif)、非衬线 (sans) 与等宽 (mono)。最后的那个 typescript 环境是打算用来定义字样集合的。有关这里的字样的概念,可参考黄老师的《\LATEX\ 学习笔记》\mycite{lnotes}的第 8 章来理解,同时你也可以从中额外获得一些 \TEX\ 字体的常识。 127 | 128 | 我们是在 typescript 环境中定义具体的字体,比如下面定义衬线字样的一组字体: 129 | 130 | \startniceTEX 131 | \starttypescript[serif] [zhfont] 132 | \definefontsynonym 133 | [Serif][name:adobesongstd] 134 | \definefontsynonym 135 | [SerifBold][name:adobeheitistd] 136 | \definefontsynonym 137 | [SerifItalic][name:adobekaitistd] 138 | \definefontsynonym 139 | [SerifBoldItalic][name:adobeheitistd] 140 | \stoptypescript 141 | \stopniceTEX 142 | 143 | \noindent 因为已经知道了 \tex{definefontsynonym} 命令的作用,因此上述字体的定义看起来就非常简单了,就是用我们所指定的一组字体去替换 \ConTeXt\ 标准字体别名默认所使用的字体而已。我们可以按照这样的方式完成非衬线与等宽字样的字体定义,不再赘述。 144 | 145 | 下面来看一下字样的定义: 146 | 147 | \startniceTEX 148 | \starttypescript[myfont] 149 | \definetypeface[myfont][rm][serif][zhfont][features=zh] 150 | \definetypeface[myfont][ss][sans][zhfont][features=zh] 151 | \definetypeface[myfont][tt][mono][zhfont] 152 | \stoptypescript 153 | \stopniceTEX 154 | 155 | \noindent \tex{definetypeface} 命令的第三个参数与第四个参数是与前面的 typescript 环境参数对应一致的,比如: 156 | 157 | \startniceTEX 158 | \definetypeface 159 | [adobe][rm][serif][zhfont] 160 | \stopniceTEX 161 | \noindent 对应: 162 | \startniceTEX 163 | \starttypescript[serif][zhfont] 164 | ... ... ... 165 | \stoptypescript 166 | \stopniceTEX 167 | \noindent 其中含义就是将 adobe 字样集合的衬线 (rm) 字样设为该 typescript 文件中具有 \type{[serif][zhfont]} 参数的 typescript 环境所定义的字体集;也就是说,\CONTEXT\ 可以根据 \tex{definetypeface} 的第三、四个参数来匹配对应的 typescript 环境。不知我有没有说明白。总之,在此要认真体会一下 typescript 环境参数的作用,姑且可以将其当作是对应 typescript 环境唯一的标识符号。至于 \tex{definetypeface} 前两个参数,其实也是作为一个标识符来用的,这在使用 typescript 文件时就可以看到。 168 | 169 | 将上述的知识汇在一起,就可以写出类似 zhfonts.tex 这样的 typescript 文件,若将其投入到 \TEX\ 目录树中,就可以在排版时使用它了,譬如: 170 | 171 | \startniceTEX 172 | \usetypescriptfile[zhfonts] 173 | \usetypescript[myfont] 174 | \setupbodyfont[adobe,rm,11pt] 175 | \stopniceTEX 176 | 177 | \noindent 首先 \tex{usetypescriptfile} 命令驱使 \CONTEXT\ 在 \TEX\ 目录树中找到 zhfonts.tex 这个 typescript 文件;然后 \tex{usetypescript} 命令可以在 zhfonts.tex 文件中匹配含有一个参数为 myfont 的 typescript 环境,并读取该环境所定义的字样信息;最后使用 \tex{setupbodyfont} 命令将 typescript 文件中所定义的某种字样其定位文档的默认字体集,\tex{definetypeface} 命令的前两个参数的用途再次便得以体现出来。 178 | 179 | \section{混合字体} 180 | 181 | 从概念上讲,混合字体就是将两种或更多的字体的不同编码部分合成到一起,形成一种新的字体。比如,中文字体往往也会包含了英文部分,偏偏这部分字体设计的又太差。所以,目前对于中文用户而言,混合字体机制实在是重之又重,因为我们可以利用这套机制来实现将一部分好看的英文字体注入到中文字体中,以此来实现美观的中英文混合文本排版。 182 | 183 | 下面展示一个小例子,用以说明如何使用 MkIV 的混合字体机制: 184 | 185 | \startniceTEX 186 | \definefontsynonym 187 | [zhserif][name:adobesongstd] 188 | \definefontfallback 189 | [serifwhatever][lmroman10-regular][0x0000-0x0400][force=yes] 190 | \definefontsynonym 191 | [ZhSerif][zhserif][fallbacks=serifwhatever] 192 | \definefont[FbSong][ZhSerif at 12pt] 193 | \definefont[Song][name:adobesongstd at 12pt] 194 | 195 | \starttext 196 | \FbSong 197 | 中英文混合:To do or not to do, this is the question! 198 | 199 | \Song 200 | 中英文混合:To do or not to do, this is the question! 201 | \stoptext 202 | \stopniceTEX 203 | 204 | 字体切换命令 \tex{ZhSerif} 使用的是混合字体,是 Adobe 宋体的 \type{0x0000-0x0400} 区域中掺入了 lmroman10 字体的对应区域;而 \tex{Song} 命令使用的则是纯的 Adobe 宋体。上面的例子也许看不出来混合字体的优势所在,这主要是因为 Adobe 宋体中的英文部分设计的还算不错。如果将 Adobe 宋体换成 SimSun,对比效果会更明显一些。 205 | 206 | 我们可以将这种混合字体机制与 MkIV 的 typescript 机制相结合,在不同风格的中文字体中掺入类似风格的英文字符,这样中英文混合排版的问题就能够得到较好的解决。 207 | 208 | \section{更多阅读……} 209 | 210 | 如果上述内容有误或者你认为讲述的不够细致,那么请阅读以下文档: 211 | 212 | \startitemize 213 | \item “不仅仅是为了中文”,详细介绍了 \CONTEXT\ 的 Typescript 机制:\crlf \hbox{\tt http://liyanrui.is-programmer.com/2009/10/21/not-just-for-chinese.12264.html} 214 | \item “zhfonts 模块的用法”,zhfonts 模块可支持中文字体加载、标点间距调整等功能:\crlf \hbox{\tt http://garfileo.is-programmer.com/2011/1/10/zhfonts-usage.23740.html} 215 | \stopitemize 216 | 217 | 我计划今年年底将这些外部文档归整到这份文档中。 218 | 219 | \stopcomponent 220 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/layout.tex: -------------------------------------------------------------------------------- 1 | \startcomponent layout 2 | \product ctxnotes 3 | 4 | \chapter{版面设计} 5 | 6 | 其实我不懂排版,我只是希望这份文档的版面看上去不那么丑陋,所以我经常留意有关排版的知识,并乐于使用 \CONTEXT\ 来实践。我将这个实践的过程整理出来,就是本章所记述的内容,并且每当我修改本文档的版面风格时,这一章的内容也会适应性的变动。可以将本章看作是这份笔记版面设计的说明书。 7 | 8 | \section{页面与纸张} 9 | 10 | 页面尺寸就是文档的版面尺寸,而纸张尺寸是指文档印刷用纸的规格,它们的取值一般是相同的;只有在要求每张印刷用纸上实现多页排版时,二者的取值才不一样。这份笔记的屏幕阅读文档页面与纸张尺寸设定如下: 11 | 12 | \startniceTEX 13 | \definepapersize[SCREEN][width=24cm,height=18cm] 14 | \setuppapersize[SCREEN][SCREEN] 15 | \stopniceTEX 16 | 17 | \noindent 其意是指页面与纸张的尺寸的宽高分别为 24cm 与 18cm,这是考虑到显示屏幕尺寸的宽高比一般为 4:3,这样可以充分利用屏幕区域,并且翻页方便。 18 | 19 | 页面与纸张的规格可以采用 \CONTEXT\ 已经预定义好的国际标准规格,如 A0~A10、B0~B5 等;也可以采用自定义尺寸: 20 | 21 | \startniceTEX 22 | \definepapersize[I18][width=18.5cm,height=23cm] 23 | \setuppapersize[I18][I18] 24 | \stopniceTEX 25 | 26 | \noindent 这里定义的 I18 规格的页面与纸张尺寸,是近年来计算机技术书籍排版常用的纸张规格。 27 | 28 | \section{版面布局} 29 | 30 | \CONTEXT\ 将版面划分为 25 个区域,具体的区域划分在 {\it\CONTEXT, an excursion}\cite[ms-cb-en]文档的第 32 章 {\it Page Layout} 中可以看到,也可以在 \CONTEXT\ Wiki 的 {\it Layout} 页面看到\footnote{http://wiki.contextgarden.net/Layout}。 31 | 32 | 我为这份文档所规划的版面布局如下: 33 | 34 | \startmode[print] 35 | \startniceTEX 36 | \setuplayout 37 | [leftmargin=2cm, 38 | rightmargin=3cm, 39 | width=fit, 40 | height=fit, 41 | topspace=1cm, 42 | header=1.5cm, 43 | footer=1.5cm] 44 | \stopniceTEX 45 | \stopmode 46 | 47 | \startmode[screen] 48 | \startniceTEX 49 | \setuplayout 50 | [width=fit, 51 | height=middle, 52 | leftmargin=3cm, 53 | rightmargin=3cm, 54 | backspace=4cm, 55 | topspace=.5cm, 56 | headerdistance=.4cm, 57 | footerdistance=.4cm, 58 | header=1cm, 59 | footer=1cm] 60 | \stopniceTEX 61 | \stopmode 62 | 63 | \noindent 下一页的插图显示了这些参数的布局效果,这里交代一下,那幅插图是利用了 Patrick 写的一个模块 (Module)\footnote{\type{http://modules.contextgarden.net/t-layout}}绘制的。 64 | 65 | \type{\setuplayout} 命令所具有的参数,在数量上堪称是 \ConTeXt\ 命令之最,如果我没有数错,应该是 44 个,常用的参数也就是下一页插图中所示的那些了。通过这些参数,\ConTeXt\ 可实现各种复杂的版面布局。 66 | 67 | 说点闲话。如果我没记错的话,MS Word 用来设置版面布局的参数不超过 10 个。在 \LATEX\ 中,需要借助一些宏包才可以比较方便地实现版面布局控制。复杂与统一,也许这是 \CONTEXT\ 的一个很重要的特征,复杂是追求功能强大的必然结果,而统一可以让用户只需一份官方提供的技术手册就可以毫无争议地使用这些功能。 68 | 69 | 注意,将 \type{\setuplayout} 的 \type{width} 与 \type{height} 参数设为 \type{fit} 或 \type{middle} 都可以让 \CONTEXT\ 自动为我们确定它们的值。\type{fit} 参数的确定是根据周边邻域参数计算出来的,而 \type{middle} 不是很关心周边参数,它只需要将 \type{width} 或 \type{height} 所确定的尺度相对于同一维向的页面尺度是居中的。 70 | 71 | \type{location} 这个参数让我费解了许久,历经多次尝试,总算知道一点所以然。当我们将版面尺寸与纸张尺寸设为相同时,\type{location} 这个参数无论如何设定都是看不到效果的。当纸张尺寸大于版面尺寸时,\type{location} 的值可以表示版面在纸张的位置,譬如 left、right、middle、singlesided 以及 doublesided。 72 | 73 | \page 74 | \ShowLayout[digit=1,showmore=0] 75 | \page 76 | 77 | \section[HFer]{页眉、页脚} 78 | 79 | 对于这份文档的页眉,我将奇数页的页眉设为当前章标题(左)+ 页码(右);偶数页的页眉设为当前节标题(左)+ 页码(右): 80 | 81 | \startniceTEX 82 | \def\CurrentChapter{% 83 | 第 \headnumber[chapter]\ 章% 84 | \hbox to wem{}% 85 | \getmarking[chapter]% 86 | } 87 | 88 | \def\CurrentSection{% 89 | \headnumber[section]% 90 | \hbox to 2em{}% 91 | \getmarking[section]% 92 | } 93 | 94 | \setupheadertexts 95 | [\CurrentChapter][pagenumber] 96 | [pagenumber][\CurrentSection] 97 | \stopniceTEX 98 | 99 | \tex{setupheadertexts} 命令的参数设置的有些古怪,按手册上讲的,前两个参数分别用于设置奇数页的页眉左侧与右侧内容,后两个参数则用于设置偶数页的页眉左侧与右侧内容,但是在上述的页眉设置语句中,我只有将偶数页的页眉内容的左右位置掉换过来才可以得到这份文档的页眉结构。我并不知道为什么要这样设置,只是多次尝试才知道只有如此才能实现我的要求。 100 | 101 | 由于设置在页眉中显示页码,所以应当引去 \CONTEXT\ 自动为页面添加的页码,顺便把页码的字号也设置一下: 102 | 103 | \startniceTEX 104 | \setuppagenumbering 105 | [style=\tfx,location=] 106 | \stopniceTEX 107 | 108 | 我感觉 \CONTEXT\ 是有点另类,居然让 \tex{setuppagenumbering} 来设置双面打印文档模式。如果,我想将本文档的页眉结构变成:奇数页的页眉设为当前章标题(左)+ 页码(右);偶数页的页眉设为当前节标题(右)+ 页码(左),只需在 \tex{setuppagenumbering} 命令中设定 \type{alternative} 参数即可: 109 | 110 | \startniceTEX 111 | \setuppagenumbering 112 | [alternative=doublesided,style=\tfx,location=] 113 | \stopniceTEX 114 | 115 | \noindent 感觉有点莫名其妙,也许因为我还未发现正确的页眉设置方法的缘故。 116 | 117 | 页脚的设定方法与页眉类似,我在页脚的左侧设置了显示这份文档的名称,在其右侧显示可以跳往目录页的链接: 118 | 119 | \startniceTEX 120 | \startmode[screen] 121 | \setupfootertexts 122 | [{\ConTeXt\ MkIV 学习笔记}][{\goto{回目录}[content]}] 123 | [{\goto{回目录}[content]}][{\ConTeXt\ MkIV 学习笔记}] 124 | \stopmode 125 | \stopniceTEX 126 | 127 | \noindent 用到了 \CONTEXT\ 的 mode 环境,这就像 C 语言中的编译宏。只有在 \CONTEXT\ 编译命令中设定对应的 mode 值,对应 mode 环境中的语句才是有效的。要让 screen mode 环境生效,可: 128 | 129 | \starttyping 130 | $ context --mode=screen ctxnotes 131 | \stoptyping 132 | 133 | \noindent \CONTEXT\ 的 mode 环境非常有用,许多 \CONTEXT\ 官方制作的文档都是利用 mode 环境同时产生屏幕阅读版本与打印版本。将来,我打算将这一环境用于制作演示文档与讲稿。 134 | 135 | 在页脚右侧显示的“回目录”的链接需要设置目录代码的支持,因为这需要利用 \ConTeXt\ 的引用机制: 136 | 137 | \startniceTEX 138 | % 我的目录页 139 | \title[content]{目录} 140 | \placecontent 141 | \stopniceTEX 142 | 143 | \noindent 有关文档目录设置的细节,准备单独开一个章节来记述。 144 | 145 | \section{封面设计} 146 | 147 | \CONTEXT\ 没有像 \LATEX\ 那样提供了专用于封面制作的命令,只是提供了一个 \type{standardmakeup} 环境,该环境的作用就是建立一个不增加页码计数的页面,使得用户可以在其中排版封面、扉页之类的页面。这份文档的封面的具体设计如下: 148 | 149 | \startniceTEX 150 | \startstandardmakeup 151 | \startcolor[mydarkred] 152 | \switchtobodyfont[14pt] 153 | \hfil\bfd\ConTeXt 学习笔记\hfil 154 | \blank[1.5cm] 155 | \hfil\bfc Using MkIV\hfil 156 | \blank[12cm] 157 | 158 | \startalignment[flushright] 159 | \ssa 160 | \bTABLE 161 | \setupTABLE[r][each][frame=off] 162 | \bTR \bTD Athor: Li Yanrui\eTD \eTR 163 | \bTR \bTD Email: lyanry@gmail.com\eTD \eTR 164 | \bTR \bTD \date \eTD \eTR 165 | \eTABLE 166 | \stopalignment 167 | \stopcolor 168 | \stopstandardmakeup 169 | \stopniceTEX 170 | 171 | 请宽恕我在上述语句中很可耻地使用了 1.5cm、12cm 这样确定的长度。因为我还不怎么会驾驭 \CONTEXT,还无法灵活地实现可根据版面的变化自适应调整的封面设计。 172 | 173 | 要设计一个美观的封面真得很难,而且这也不是我所擅长的。现在,拥有这样一个简单的封面,我已经心满意足。也许等我以后渐渐熟悉 \METAFUN\ 之时,会让它再美观一些。 174 | 175 | \section{标题样式} 176 | 177 | 惯见的文档章、节标题一般都是采用黑体,字号通常也比正文字号大一些,另外标题前后也留出了一些垂直间距。这些设置无非是为了告诉读者,它们是标题,而不是正文。这份文档的标题样式设置如下: 178 | 179 | \startniceTEX 180 | \setupheads[indentnext=yes] 181 | \setuphead 182 | [chapter] 183 | [style=\bfc,header=empty,footer=empty] 184 | \setuphead 185 | [section] 186 | [style=\bfa] 187 | \setuphead 188 | [title] 189 | [style=\bfb,header=empty,foote=empty] 190 | \setuphead 191 | [subsubject] 192 | [style=\bf] 193 | \stopniceTEX 194 | 195 | \noindent\tex{setupheads} 命令可以设置所有类型的章节标题默认状态。在设置章标题时,由于其所在页面通常不需要页眉与页脚,所以 \type{header} 与 \type{footer} 都应设为 \type{empty}。 196 | 197 | 现在使用 MkIV 排版中文,要想实现章节的编号格式为“第 x 章”、“第 x 节”,或者实现图、表标题格式为“图 x”、“表 x”,可能需要自己来做一些有些 dirty 工作。\ConTeXt\ 提供了 \tex{setuplabeltext} 命令,可用于设置表格、图、章节、附录的编号格式。譬如,要设置中文的章节编号: 198 | 199 | \startniceTEX 200 | \setuplabeltext [en] [chapter={第\;,\;章}] 201 | \setuplabeltext [en] [section={第\;,\;节}] 202 | \stopniceTEX 203 | 204 | \noindent 遗憾的是,我不知道怎样将编号中的数字也使用中文来表示,这在 MkII 中是可以的。 205 | 206 | \section{段落与行} 207 | 208 | 中文排版,段落间距通常等于行间距,因为中文段落是通过首行缩进来标示的,下面代码可将段落文本首行缩进 2 个汉字距离: 209 | 210 | \startniceTEX 211 | \setupindenting[always,2em,first] 212 | \stopniceTEX 213 | 214 | \ConTeXt\ 默认是将段间距设置为 0,这碰巧符合中文的排版规范。如果有设定段间距的需求,就查一下 \tex{setupwhitespace} 命令的用法。 215 | 216 | 对文档正文而言,行间距的设置对于排版的美观性是至关重要的:行间距过小则阅读困难;行间距过大又显得版面稀疏,浪费纸张。\ConTeXt\ 默认的文本行间距的值对于中文排版而言过小,可通过 \tex{setupinterlinespace} 命令结合自己的审美嗜好对行间距进行调整。我习惯将行高设为 1.5em: 217 | 218 | \startniceTEX 219 | \setupinterlinespace[line=1.5em] 220 | \stopniceTEX 221 | 222 | \section{更多阅读……} 223 | 224 | 如果上述内容有误或者你认为讲述的不够细致,那么请阅读以下文档: 225 | 226 | \startitemize 227 | \item “页面布局控制”:\crlf \hbox{\tt http://garfileo.is-programmer.com/2011/1/19/layout-control.23895.html} 228 | \item “\CONTEXT\ 文稿的逻辑结构”:\crlf \hbox{\tt http://garfileo.is-programmer.com/2011/1/16/context-manuscript-logic-structure.23826.html} 229 | \stopitemize 230 | 231 | 我计划今年年底将这些外部文档归整到这份文档中。 232 | 233 | \stopcomponent 234 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/presentation.tex: -------------------------------------------------------------------------------- 1 | \startcomponent presentation 2 | \product ctxnotes 3 | 4 | \chapter{制作演示文档} 5 | 6 | 似乎很久都没有继续写这份笔记,因为很忙。即使不忙,也总能找到很忙的借口消耗掉继续写下去的动力。现在,开始写有关 \CONTEXT\ 演示文档制作的内容,是因为真正地要用到它。最近,一群领导们来学校视察工作,据说要顺便关怀一下我们的项目,因此我要准备一份 3~5 分钟的项目汇报。感觉有点滑稽,做了快 2 年的项目,只需要不到 5 分钟的时间就能汇报完。且不发牢骚了,利用这个机会学用一下 \CONTEXT\ 演示文档制作。 7 | 8 | \section{不用 \CONTEXT\ 的模板} 9 | \bookmark{不用 ConTeXt 的模板} 10 | 11 | 不为别的,因为太难看了,我不认为它们中的哪一个适合我这一次的项目报告。 12 | 13 | \section{屏幕} 14 | 15 | 演示文档的版面与用纸尺寸应当根据屏幕的宽高比例进行设置,通常是 4:3,具体情况可根据系统分辨率来确定。推荐的文档版面与用纸尺寸为 \CONTEXT\ 内建的用纸规格 S6,它的宽度接近 A4 纸宽,高度大约是 A4 纸高的一半。 16 | 17 | \startniceTEX 18 | \setuppapersize[S6][S6] 19 | \stopniceTEX 20 | 21 | 22 | 23 | \stopcomponent -------------------------------------------------------------------------------- /context-notes-zh-cn/src/project.tex: -------------------------------------------------------------------------------- 1 | \startcomponent project 2 | \environment doc-env 3 | \product ctxnotes 4 | 5 | \chapter{大文档项目} 6 | 7 | 对于规模比较大的文档项目而言,采用 \TEX\ 的优越性要高于 WYSIWYG 的字处理器 (MS Word)。众人谓之曰字处理器使用起来比较方便,实际这只不过表面现象,在其背后是文档更新方面的困难——难以进行多人协同撰写与版本维护。本章主要介绍 \CONTEXT\ 所提供的文档项目管理功能,探讨如何在文档项目中布置版本控制系统,建立一种比较稳定的大文档项目撰写模式。 8 | 9 | \section{项目的部署} 10 | 11 | 一个 \TeX\ 文档项目,通常可以将文档结构分为:环境、宏、文档主体内容。这样划分的意图就是让文档的样式与内容分离开。环境,主要用于定制版面样式。宏,主要是封装一些排版命令,实现一些特定的排版功能。在 \CONTEXT\ 中,环境或宏可以由一份或多份专门的环境文件来定义,环境文件的格式如下: 12 | 13 | \startniceTEX 14 | \startenvironment 环境文件名 15 | ... 环境内容 ... 16 | \stopenvironment 17 | \stopniceTEX 18 | 19 | 如果不对文档的主体内容进行划分的话,那么它就与普通的 \CONTEXT\ 文档无异,只是多了加载环境文件的命令: 20 | 21 | \startniceTEX 22 | \environment 环境文档名 23 | ... ... ... 24 | \starttext 25 | ... 文档内容 26 | \stoptext 27 | \stopniceTEX 28 | 29 | 如果对文档的主体内容细分下去,可以有封面、前言、正文章节、附录、封底等。文档结构划分的深浅程度,这个主要由用户来把握,主要视文档的规模而定。对于 \CONTEXT\ 而言,文档的主体内容实际上只有产品 (product) 与 组件 (component) 这两种划分\footnote{事实上还有比产品更高层的结构,就是项目 (project),不过我们写文档一般用不到它,如果是出版期刊杂志倒是有可能用到它。}\;。对于产品与组件之间的关系,这在产品文档中便可以直观地看到,譬如: 30 | 31 | \startniceTEX 32 | \startproduct 产品文档名 33 | \environment 环境文档名 34 | 35 | \component 组件文档 1 36 | \component 组件文档 2 37 | ... ... ... 38 | \stopproduct 39 | \stopniceTEX 40 | 41 | 产品文档将环境与组件的信息都记录了下来,因此当我们在使用 \CONTEXT\ 编译一个文档项目时,只需要编译产品文档即可。 42 | 43 | 组件文档的格式如下: 44 | 45 | \startniceTEX 46 | \startcomponent 组件文档名 47 | \environment 环境文档名 48 | \product 所属产品名 49 | 50 | ... 组件内容 ... 51 | 52 | \stopcomponent 53 | \stopniceTEX 54 | 55 | 也可以直接编译组件文档,因为在组件文档中已经记录了所使用的环境文档信息;在撰写文档的过程中,推荐使用编译组件文档的方式来查看排版效果。 56 | 57 | \section{更多阅读……} 58 | 59 | 如果上述内容有误或者你认为讲述的不够细致,那么请阅读以下文档: 60 | 61 | \startitemize 62 | \item “\CONTEXT\ 文稿的物理结构”:\crlf \hbox{\tt http://garfileo.is-programmer.com/2011/1/12/project-structure.23773.html} 63 | \stopitemize 64 | 65 | 我计划今年年底将这些外部文档归整到这份文档中。 66 | 67 | \stopcomponent 68 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/t-zhfonts.mkiv: -------------------------------------------------------------------------------- 1 | %D \module 2 | %D [ file=t-zhfonts, 3 | %D version=2010.01.06, 4 | %D title=\CONTEXT\ User Module, 5 | %D subtitle=zhfonts, 6 | %D author=Li Yanrui, 7 | %D date=\currentdate, 8 | %D copyright=Li Yanrui, 9 | %D email=liyanrui.m2@gmail.com, 10 | %D license=Public Domain] 11 | 12 | \writestatus{loading}{ConTeXt User Module / zhfonts} 13 | \startmodule[zhfonts] 14 | \unprotect 15 | \setupmodule[style=rm,size=11pt] 16 | 17 | %D Lua code 18 | \ctxloadluafile{t-zhfonts} 19 | \ctxloadluafile{t-zhspuncs} 20 | 21 | \def\setupzhfonts{\dodoubleempty\dosetupzhfonts} 22 | \def\dosetupzhfonts[#1][#2]{% 23 | \ctxlua{zhfonts.setup ('#1', '#2')} 24 | } 25 | 26 | \def\zhfonts[#1]{% 27 | \ctxlua{zhfonts.use ("#1")} 28 | } 29 | 30 | \edef\@@@@??style{\currentmoduleparameter{style}} 31 | \edef\@@@@??size{\currentmoduleparameter{size}} 32 | \prependtoks \zhfonts[\@@@@??style, \@@@@??size] \to \everystarttext 33 | 34 | \protect 35 | \stopmodule 36 | \endinput 37 | 38 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/t-zhspuncs.lua: -------------------------------------------------------------------------------- 1 | zhspuncs = zhspuncs or {} 2 | 3 | local glyph = nodes.pool.register (node.new ("glyph", 0)) 4 | 5 | local glyph_flag = node.id ('glyph') 6 | local glue_flag = node.id ('glue') 7 | local hlist_flag = node.id ('hlist') 8 | local kern_flag = node.id ('kern') 9 | local penalty_flag = node.id ('penalty') 10 | local math_flag = node.id ('math') 11 | 12 | local fonthashes = fonts.hashes 13 | local fontdata = fonthashes.identifiers 14 | local quaddata = fonthashes.quads 15 | 16 | local node_count = node.count 17 | local node_dimensions = node.dimensions 18 | local node_traverse_id = node.traverse_id 19 | local node_slide = node.slide 20 | local list_tail = node.tail 21 | local insert_before = node.insert_before 22 | local insert_after = node.insert_after 23 | local new_glue = nodes.pool.glue 24 | local new_kern = nodes.pool.kern 25 | local new_glue_spec = nodes.pool.glue_spec 26 | local new_penalty = nodes.pool.penalty 27 | local new_rule = nodes.pool.rule 28 | 29 | local tasks = nodes.tasks 30 | 31 | 32 | local puncs = { 33 | [0x2018] = {0.5, 0.1, 1.0, 1.0}, -- ‘ 34 | [0x201C] = {0.5, 0.1, 0.5, 1.0}, -- “ 35 | [0x3008] = {0.5, 0.1, 1.0, 1.0}, -- 〈 36 | [0x300A] = {0.5, 0.1, 1.0, 1.0}, -- 《 37 | [0x300C] = {0.5, 0.1, 1.0, 1.0}, -- 「 38 | [0x300E] = {0.5, 0.1, 1.0, 1.0}, -- 『 39 | [0x3010] = {0.5, 0.1, 1.0, 1.0}, -- 【 40 | [0x3014] = {0.5, 0.1, 1.0, 1.0}, -- 〔 41 | [0x3016] = {0.5, 0.1, 1.0, 1.0}, -- 〖 42 | [0xFF08] = {0.5, 0.1, 1.0, 1.0}, -- ( 43 | [0xFF3B] = {0.5, 0.1, 1.0, 1.0}, -- [ 44 | [0xFF5B] = {0.5, 0.1, 1.0, 1.0}, -- { 45 | [0x2019] = {0.1, 0.5, 1.0, 0.0}, -- ’ 46 | [0x201D] = {0.1, 0.5, 1.0, 0.0}, -- ” 47 | [0x3009] = {0.1, 0.5, 1.0, 0.5}, -- 〉 48 | [0x300B] = {0.1, 0.5, 1.0, 0.5}, -- 》 49 | [0x300D] = {0.1, 0.5, 1.0, 0.5}, -- 」 50 | [0x300F] = {0.1, 0.5, 1.0, 0.5}, -- 』 51 | [0x3011] = {0.1, 0.5, 1.0, 0.5}, -- 】 52 | [0x3015] = {0.1, 0.5, 1.0, 0.5}, -- 〕 53 | [0x3017] = {0.1, 0.5, 1.0, 0.5}, -- 〗 54 | [0xFF09] = {0.1, 0.5, 1.0, 0.5}, -- ) 55 | [0xFF3D] = {0.1, 0.5, 1.0, 0.5}, -- ] 56 | [0xFF5D] = {0.1, 0.5, 1.0, 0.5}, -- } 57 | -- 需要特殊处理 58 | [0x2014] = {0.0, 0.0, 1.0, 1.0}, -- — 59 | [0x2026] = {0.1, 0.1, 1.0, 1.0}, -- … 60 | [0x2500] = {0.0, 0.0, 1.0, 1.0}, -- ─ 61 | [0x3001] = {0.15, 0.5, 1.0, 0.5}, -- 、 62 | [0x3002] = {0.15, 0.6, 1.0, 0.3}, -- 。 63 | [0xFF01] = {0.15, 0.5, 1.0, 0.5}, -- ! 64 | [0xFF05] = {0.0, 0.0, 1.0, 0.5}, -- % 65 | [0xFF0C] = {0.15, 0.5, 1.0, 0.3}, -- , 66 | [0xFF0E] = {0.15, 0.5, 1.0, 0.5}, -- . 67 | [0xFF1A] = {0.15, 0.5, 1.0, -0.1}, -- : 68 | [0xFF1B] = {0.15, 0.5, 1.0, 0.5}, -- ; 69 | [0xFF1F] = {0.15, 0.5, 1.0, 0.5}, -- ? 70 | } 71 | 72 | local function is_zhcnpunc_node (n) 73 | local n_is_punc = 0 74 | if puncs[n.char] then 75 | return true 76 | end 77 | return false 78 | end 79 | 80 | local function is_zhcnpunc_node_group (n) 81 | local n_is_punc = 0 82 | if puncs[n.char] then 83 | n_is_punc = 1 84 | end 85 | local nn = n.next 86 | local nn_is_punc = 0 87 | -- 还需要穿越那些非 glyph 结点 88 | while nn_is_punc == 0 and nn and n_is_punc == 1 do 89 | if nn.id == glyph_flag then 90 | if puncs[nn.char] then nn_is_punc = 1 end 91 | break 92 | end 93 | nn = nn.next 94 | end 95 | return n_is_punc + nn_is_punc 96 | end 97 | 98 | local function is_cjk_ideo (n) 99 | -- CJK Ext A 100 | if n.char >= 13312 and n.char <= 19893 then 101 | return true 102 | -- CJK 103 | elseif n.char >= 19968 and n.char <= 40891 then 104 | return true 105 | -- CJK Ext B 106 | elseif n.char >= 131072 and n.char <= 173782 then 107 | return true 108 | else 109 | return false 110 | end 111 | end 112 | 113 | local function quad_multiple (font, r) 114 | local quad = quaddata[font] 115 | return r * quad 116 | end 117 | 118 | local function process_punc (head, n, punc_flag, punc_table) 119 | local desc = fontdata[n.font].descriptions[n.char] 120 | if not desc then return end 121 | local quad = quad_multiple (n.font, 1) 122 | 123 | -- 像 $\ldots$ 这样的符号竟然没有边界盒,只好忽略并返回 124 | -- if desc.boundingbox == nil then return end 125 | 126 | local l_space = desc.boundingbox[1] / desc.width 127 | local r_space = (desc.width - desc.boundingbox[3]) / desc.width 128 | local l_kern, r_kern = 0.0, 0.0 129 | 130 | if punc_flag == 1 then 131 | l_kern = (punc_table[n.char][1] - l_space) * quad 132 | r_kern = (punc_table[n.char][2] - r_space) * quad 133 | elseif punc_flag == 2 then 134 | l_kern = (punc_table[n.char][1] * punc_table[n.char][3] - l_space) * quad 135 | r_kern = (punc_table[n.char][2] * punc_table[n.char][4] - r_space) * quad 136 | end 137 | 138 | insert_before (head, n, new_kern (l_kern)) 139 | insert_after (head, n, new_kern (r_kern)) 140 | end 141 | 142 | local function compress_punc (head) 143 | for n in node_traverse_id (glyph_flag, head) do 144 | local n_flag = is_zhcnpunc_node_group (n) 145 | if n_flag ~= 0 then 146 | process_punc (head, n, n_flag, puncs) 147 | end 148 | end 149 | end 150 | 151 | function zhspuncs.my_linebreak_filter (head, is_display) 152 | compress_punc (head) 153 | return head, true 154 | end 155 | 156 | function zhspuncs.opt () 157 | tasks.appendaction("processors","after","zhspuncs.my_linebreak_filter") 158 | end 159 | 160 | fonts.protrusions.vectors['myvector'] = { 161 | [0xFF0c] = { 0, 0.60 }, -- , 162 | [0x3002] = { 0, 0.60 }, -- 。 163 | [0x2018] = { 0.60, 0 }, -- ‘ 164 | [0x2019] = { 0, 0.60 }, -- ’ 165 | [0x201C] = { 0.60, 0 }, -- “ 166 | [0x201D] = { 0, 0.60 }, -- ” 167 | [0xFF1F] = { 0, 0.60 }, -- ? 168 | [0x300A] = { 0.60, 0 }, -- 《 169 | [0x300B] = { 0, 0.60 }, -- 》 170 | [0xFF08] = { 0.50, 0 }, -- ( 171 | [0xFF09] = { 0, 0.50 }, -- ) 172 | [0x3001] = { 0, 0.50 }, -- 、 173 | [0xFF0E] = { 0, 0.50 }, -- . 174 | } 175 | fonts.protrusions.classes['myvector'] = { 176 | vector = 'myvector', factor = 1 177 | } 178 | 179 | -------------------------------------------------------------------------------- /context-notes-zh-cn/src/zhfonts.tex: -------------------------------------------------------------------------------- 1 | % engine=luatex 2 | % \ctxlua{fonts.collections.trace = true} 3 | \definefontfeature[zh][mode=node,script=hang,lang=zhs] 4 | 5 | \starttypescript [serif] [zhfont] 6 | \definefontsynonym [zhserif] 7 | [AdobeSongStd-Light][features=zh] 8 | \definefontsynonym [zhserifbold] 9 | [AdobeHeitiStd-Regular][features=zh] 10 | \definefontsynonym [zhserifitalic][AdobeKaitiStd-Regular] 11 | [features=zh] 12 | \definefontsynonym [zhserifbolditalic] 13 | [AdobeHeitiStd-Regular][features=zh] 14 | \definefontfallback[serifwhatever] 15 | [lmroman10-regular][0x0000-0x0400][force=yes] 16 | \definefontfallback[serifboldwhatever] 17 | [lmroman10-bold][0x0000-0x0400][force=yes] 18 | \definefontfallback[serifitalicwhatever] 19 | [lmroman10-italic][0x0000-0x0400][force=yes] 20 | \definefontfallback[serifbolditalicwhatever] 21 | [lmroman10-bolditalic][0x0000-0x0400][force=yes] 22 | \stoptypescript 23 | 24 | \starttypescript [serif][zhfont][name] 25 | \definefontsynonym[Serif] 26 | [zhserif][fallbacks=serifwhatever] 27 | \definefontsynonym[SerifBold] 28 | [zhserifbold][fallbacks=serifboldwhatever] 29 | \definefontsynonym[SerifItalic] 30 | [zhserifitalic][fallbacks=serifitalicwhatever] 31 | \definefontsynonym[SerifBoldItalic] 32 | [zhserifbolditalic][fallbacks=serifbolditalicwhatever] 33 | \stoptypescript 34 | 35 | \starttypescript [sans][zhfont] 36 | \definefontsynonym [zhsans] 37 | [AdobeKaitiStd-Regular][features=zh] 38 | \definefontsynonym [zhsansbold] 39 | [AdobeHeitiStd-Regular][features=zh] 40 | \definefontsynonym [zhsansitalic] 41 | [AdobeKaitiStd-Regular][features=zh] 42 | \definefontsynonym [zhsansbolditalic] 43 | [AdobeHeitiStd-Regular][features=zh] 44 | \definefontfallback[sanswhatever] 45 | [lmsans10-regular][0x0000-0x0400][force=yes] 46 | \definefontfallback[sansboldwhatever] 47 | [lmsans10-Bold][0x0000-0x0400][force=yes] 48 | \definefontfallback[sansitalicwhatever] 49 | [lmsans10-italic][0x0000-0x0400][force=yes] 50 | \definefontfallback[sansbolditalicwhatever] 51 | [lmsans10-bolditalic][0x0000-0x0400][force=yes] 52 | \stoptypescript 53 | 54 | \starttypescript [sans][zhfont][name] 55 | \definefontsynonym[Sans] 56 | [zhsans][fallbacks=sanswhatever] 57 | \definefontsynonym[SansBold] 58 | [zhsansbold][fallbacks=sansboldwhatever] 59 | \definefontsynonym[SansItalic] 60 | [zhsansitalic][fallbacks=sansitalicwhatever] 61 | \definefontsynonym[SansBoldItalic] 62 | [zhsansbolditalic][fallbacks=sansbolditalicwhatever] 63 | \stoptypescript 64 | 65 | \starttypescript [mono][zhfont] 66 | \definefontsynonym [zhmono] 67 | [AdobeKaitiStd-Regular][features=zh] 68 | \definefontsynonym [zhmonobold] 69 | [AdobeHeitiStd-Regular][features=zh] 70 | \definefontsynonym [zhmonoitalic] 71 | [AdobeKaitiStd-Regular][features=zh] 72 | \definefontsynonym [zhmonobolditalic] 73 | [AdobeHeitiStd-Regular][features=zh] 74 | \definefontfallback[monowhatever] 75 | [lmmono10-regular][0x0000-0x0400][force=yes] 76 | \definefontfallback[monoboldwhatever] 77 | [lmmonolt10-bold][0x0000-0x0400][force=yes] 78 | \definefontfallback[monoitalicwhatever] 79 | [lmmono10-italic][0x0000-0x0400][force=yes] 80 | \definefontfallback[monobolditalicwhatever] 81 | [lmmonolt10-boldoblique][0x0000-0x0400][force=yes] 82 | \stoptypescript 83 | 84 | \starttypescript [mono][zhfont][name] 85 | \definefontsynonym[Mono] 86 | [zhmono][fallbacks=monowhatever] 87 | \definefontsynonym[MonoBold] 88 | [zhmonobold][fallbacks=monoboldwhatever] 89 | \definefontsynonym[MonoItalic] 90 | [zhmonoitalic][fallbacks=monoitalicwhatever] 91 | \definefontsynonym[MonoBoldItalic] 92 | [zhmonobolditalic][fallbacks=monobolditalicwhatever] 93 | \stoptypescript 94 | 95 | \starttypescript[myfont] 96 | \definetypeface[myfont][rm][serif][zhfont] 97 | \definetypeface[myfont][ss][sans][zhfont] 98 | \definetypeface[myfont][tt][mono][zhfont] 99 | \stoptypescript 100 | -------------------------------------------------------------------------------- /context-top-ten/README: -------------------------------------------------------------------------------- 1 | This is an introductory document on ConTeXt (www.pragma-ade.nl) frequently used commands written by Corsair . 2 | 3 | In the beginning of the ConTEXt manual (see cont-eni.pdf on ConTeXt official site), Hans Hagen listed ten groups of them which are considered most frequently used, and this short document tries to explain these commands in detail. 4 | 1. \starttext, stoptext 5 | 2. \chapter, \section, \title, \subject, \setuphead, \completecontent 6 | 3. \em, \bf, \cap 7 | 4. \startitemize, \stopitemize, \item, \head 8 | 5. \abbreviation, \infull, \completelistofabbreviations 9 | 6. \placefigure, \externalfigure, \useexternalfigures 10 | 7. \placetable, \starttable, \stoptable 11 | 8. \definedescription, \defineenumeration 12 | 9. \index, \completeindex 13 | 10. \setuplayout, \setupfootertexts, \setupheadertexts 14 | 15 | If you are interested in the process of development you may observe 16 | 17 | http://code.google.com/p/ctex-doc/updates/list 18 | 19 | Report feedback in the Issues section of ctex-doc project, 20 | or in http://bbs.ctex.org forum. 21 | -------------------------------------------------------------------------------- /context-top-ten/src/Makefile: -------------------------------------------------------------------------------- 1 | TEXOPT = --purgeall --xtx 2 | NONSRC = cmds.pdf ../cmds.pdf 3 | TEMP = cmds.tui cmds.log cmds.tmp cmds.tuo *.mp 4 | 5 | cmds.pdf: cmds.tex 6 | @echo "ConTeXting..." 7 | @texexec $(TEXOPT) cmds.tex 8 | @mv cmds.pdf ../ 9 | @echo "Done." 10 | 11 | all: cmds.pdf 12 | @echo "All done." 13 | 14 | clean: cleantemp 15 | @echo "Cleaning pdf..." 16 | @rm -fv $(NONSRC) 17 | @echo "Done." 18 | 19 | cleantemp: 20 | @echo "Cleaning..." 21 | @rm -fv $(TEMP) 22 | @echo "Done." 23 | -------------------------------------------------------------------------------- /context-top-ten/src/apple.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/apple.pdf -------------------------------------------------------------------------------- /context-top-ten/src/bg-slide.asy: -------------------------------------------------------------------------------- 1 | int Width = 600; 2 | int Height = 450; 3 | int LEFT = 30; 4 | int RIGHT = 30; 5 | int TOP = 35; 6 | int BOTTOM = 40; 7 | pen BG = rgb(0.44531, 0.625, 0.80859); 8 | pen FG = rgb(0.33203125, 0.33984375, 0.324121875); 9 | pen TEXT_BG = rgb(255,255,255) + opacity(0.8); 10 | pen BGW = linewidth(16); 11 | pen FGW = linewidth(12); 12 | path OUTLINE = (0,0)--(Width,0)--(Width,Height)--(0, Height)--cycle; 13 | path TEXT_AREA = (LEFT,BOTTOM)--(Width-RIGHT, BOTTOM)-- 14 | (Width-RIGHT,Height-TOP)--(LEFT,Height-TOP)--cycle; 15 | size(Width, Height); 16 | 17 | srand(0); 18 | fill(OUTLINE, BG); 19 | 20 | path drawRandCircle(); 21 | path simpleCircle(pair center, real r); 22 | 23 | simpleCircle = new path(pair center, real r) 24 | { 25 | path temp = (center.x, center.y - r) .. (center.x + r, center.y) .. (center.x, center.y + r) .. (center.x - r, center.y) .. cycle; 26 | return temp; 27 | }; 28 | 29 | drawRandCircle = new path() 30 | { 31 | real Xx = rand() * ((real)(Width) / randMax); 32 | real Yy = rand() * ((real)(Height) / randMax); 33 | real R = rand() * (Height/3.0 / randMax); 34 | path temp = simpleCircle((Xx, Yy), R); 35 | draw(temp, BG + BGW); 36 | draw(temp, FG + FGW); 37 | return temp; 38 | }; 39 | 40 | path Circle; 41 | for(int i = 0; i <= 15; ++i) 42 | drawRandCircle(); 43 | fill(TEXT_AREA, TEXT_BG); 44 | clip(OUTLINE); 45 | -------------------------------------------------------------------------------- /context-top-ten/src/bg-slide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/bg-slide.pdf -------------------------------------------------------------------------------- /context-top-ten/src/ctanlion.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/ctanlion.pdf -------------------------------------------------------------------------------- /context-top-ten/src/fish.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/fish.pdf -------------------------------------------------------------------------------- /context-top-ten/src/gnu.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/gnu.pdf -------------------------------------------------------------------------------- /context-top-ten/src/hacker.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/hacker.pdf -------------------------------------------------------------------------------- /context-top-ten/src/post.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/post.pdf -------------------------------------------------------------------------------- /context-top-ten/src/sin.asy: -------------------------------------------------------------------------------- 1 | import graph; 2 | size(7cm,0); 3 | 4 | real f(real x) 5 | { 6 | return sin(x)+ 0.1*sin(x*8); 7 | } 8 | 9 | xaxis(p=black+linewidth(2mm)); 10 | yaxis(p=black+linewidth(2mm)); 11 | 12 | draw(graph(f,-4,4,operator ..),red+linewidth(2mm)+opacity(0.5)); 13 | -------------------------------------------------------------------------------- /context-top-ten/src/sin.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/sin.pdf -------------------------------------------------------------------------------- /context-top-ten/src/slide-bg.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/slide-bg.pdf -------------------------------------------------------------------------------- /context-top-ten/src/title-slide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/context-top-ten/src/title-slide.pdf -------------------------------------------------------------------------------- /ctex-faq/README: -------------------------------------------------------------------------------- 1 | This is a set of Frequently Asked Questions for Chinese-speaking LaTeX users. 2 | 3 | The document was written by LingYun Wu. Most questions were collected on the bbs.ctex.org forum, and answered elaborately by the author. 4 | 5 | If you are interested in the process of development you may observe 6 | 7 | http://code.google.com/p/ctex-doc/updates/list 8 | 9 | Report feedback in the Issues section of ctex-doc project, 10 | or in http://bbs.ctex.org forum. 11 | -------------------------------------------------------------------------------- /ctex-faq/src/make.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | latex ctex-faq.tex 3 | makeindex -o ctex-faq.ind ctex-faq.idx 4 | latex ctex-faq.tex 5 | makeindex -o ctex-faq.ind ctex-faq.idx 6 | latex ctex-faq.tex 7 | latex ctex-faq.tex 8 | dvipdfmx ctex-faq.dvi 9 | del *.aux 10 | del *.toc 11 | del *.lon 12 | del *.lor 13 | del *.ilg 14 | del *.idx 15 | del *.ind 16 | del *.out 17 | del *.log 18 | del *.exa 19 | @echo on 20 | pause 21 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/README: -------------------------------------------------------------------------------- 1 | LaTeX Notes 2 | 3 | This Chinese document is an introduction to TeX/LaTeX. It covers basic text 4 | typesetting, math, graphics, table, Chinese language & fonts, and some 5 | miscellaneous features (hyperlink, long document, bibliography, index, page 6 | layout). 7 | 8 | This package contains five major files: readme.txt, history.txt, license.txt, 9 | lnotes.dvi, lnotes.pdf, and the following source files, 10 | 11 | src 12 | │ basics.tex 13 | │ dscf4684.jpg 14 | │ fonts.tex 15 | │ graphics.tex 16 | │ i18n.tex 17 | │ introduction.tex 18 | │ lnotes.tex 19 | │ math.tex 20 | │ misc.tex 21 | │ postcript.tex 22 | │ preface.tex 23 | │ reading.bib 24 | │ tables.tex 25 | │ 26 | └─examples 27 | arrow.mps 28 | color.mps 29 | colors.mps 30 | curve.mps 31 | dashed.mps 32 | dot.mps 33 | fill.mps 34 | label.mps 35 | line.mps 36 | loop.mps 37 | path.mps 38 | predefined.mps 39 | pst_arc.eps 40 | pst_arrow.eps 41 | pst_axis.eps 42 | pst_bezier.eps 43 | pst_circle.eps 44 | pst_color.eps 45 | pst_curve.eps 46 | pst_dot.eps 47 | pst_fill.eps 48 | pst_frame.eps 49 | pst_grid.eps 50 | pst_label.eps 51 | pst_line.eps 52 | pst_linestyle.eps 53 | pst_origin.eps 54 | pst_parabola.eps 55 | pst_polygon.eps 56 | pst_rput.eps 57 | pst_uput.eps 58 | subfig.mps 59 | subfig_left.mps 60 | subfig_right.mps 61 | transform.mps 62 | uline.mps 63 | 64 | The source files are encoded in UTF-8. 65 | 66 | This readme is in English because CTAN websites support only ASCII readmes. 67 | 68 | Any comments are welcome. I could be accessed at TeX board of smth.org or by email. 69 | 70 | Alpha Huang 71 | huang.xingang@gmail.com -------------------------------------------------------------------------------- /latex-notes-zh-cn/history.txt: -------------------------------------------------------------------------------- 1 | 原文链接: 2 | http://www.dralpha.com/chs/tech/lnotes.pdf 3 | http://www.dralpha.com/chs/tech/lnotes_src.zip 4 | 5 | 感谢各位同学的帮助和支持,群众的眼睛是贼亮的:) 6 | 7 | 无以为报,只好为每位同学的意见增加一个版本号。 8 | 9 | v1.20 2008/07/26 10 | - 更正了29、30页两处multline的拼写错误。感谢贾朋。 11 | - 20页表2.5中ex更正为“当前字体中字母x的高度”。感谢张晓南。 12 | - 92页的得隆望蜀更正为得陇望蜀。感谢Kov Chai。 13 | - 序中DreamWeaver更正为Dreamweaver,第4页RedHat更正为Red Hat,Unbuntu更正为Ubuntu;第2页和跋中的象字更正为像;33页Shakespear更正为Shakespeare;80页的编字更正为遍。感谢hkkhhk。 14 | - 第二章中对齐方式术语统一改为居左、居中、居右、居顶、居底;90页表8.1中的Times Roman更正为Times;跋中挥手改为挥衣袖,家里有本徐志摩诗集,基本没看过。感谢yakun@smth.org。 15 | - 跋加到了目录中,以前漏掉了一个\backmatter。 16 | - 43页MetaPost版本号更新为1.005。感谢Xubuntu@smth.org。 17 | - 去掉了58页多余的一个句号。感谢tex@smth.org。 18 | - 去掉了27页表3.3中重复的\ddot;28页两处分割改为分隔;补上了29页漏掉的对齐两字;42页gnulot更正为gnuplot。再次感谢IMB@smth.org。 19 | - 关于披阅和批阅,当代多用批阅,但是我手头的《红楼梦》庚辰本和程乙本用的都是披阅,故不更改。感谢yyzz11@smth.org。 20 | - 插图和字体两章中Bezier的翻译更正为贝塞尔。感谢careworn@smth.org。 21 | - 第二章和第六章中cross-reference的翻译改为交叉引用;20页小节标题和23页脚注中英文单词之间加入空格;43页MetaPost版本号更新为1.004;更正了80页图6.2的标题;跋中采用了XeTeX和LuaTeX的logo。感谢LittleLeo@smth.org。 22 | - 86页脚注中张林波的单位更正为计算数学所。感谢yli@smth.org。 23 | - 更正了78页图6.1的标题。感谢meteorrain@smth.org。 24 | - 去掉了94页多余的\verb。感谢snoopyzhao@smth.org。 25 | - 24页两个\sigma中后一个更正为\varsigma;87页一脚注加了句号。感谢primenumber@smth.org。 26 | - 更正了9页脚注中Fuchs的名字;11页去掉一个重复的“用”字。感谢IMB@smth.org。 27 | - 去掉了35页\latex的反斜杠。感谢PiscesGold@smth.org。 28 | - 去掉了c70usong.fd中utf8hei的\CJKbold,黑体原本不该再加粗。感谢PaladinHL@smth.org。 29 | 30 | v1.0 2008/05/15 31 | - 大约花了两个半月。 32 | - 感谢jjgod@smth.org的“kpsewhich cid-x.map”。 33 | - 感谢Langpku@smth.org的“initexmf --edit-config-file=dvipdfmx”。 -------------------------------------------------------------------------------- /latex-notes-zh-cn/license.txt: -------------------------------------------------------------------------------- 1 | %% LaTeX Notes 2 | %% Copyright 2008 Alpha Huang 3 | % 4 | % This work may be distributed and/or modified under the 5 | % conditions of the LaTeX Project Public License, either version 1.3 6 | % of this license or (at your option) any later version. 7 | % The latest version of this license is in 8 | % http://www.latex-project.org/lppl.txt 9 | % and version 1.3 or later is part of all distributions of LaTeX 10 | % version 2005/12/01 or later. 11 | % 12 | % This work has the LPPL maintenance status `maintained'. 13 | % 14 | % The Current Maintainer of this work is Alpha Huang. 15 | % 16 | % This work contains five major files: readme.txt, history.txt, license.txt, 17 | % lnotes.dvi, lnotes.pdf, and the following source files, 18 | % 19 | % src 20 | % │ basics.tex 21 | % │ dscf4684.jpg 22 | % │ fonts.tex 23 | % │ graphics.tex 24 | % │ i18n.tex 25 | % │ introduction.tex 26 | % │ lnotes.tex 27 | % │ math.tex 28 | % │ misc.tex 29 | % │ postcript.tex 30 | % │ preface.tex 31 | % │ reading.bib 32 | % │ tables.tex 33 | % │ 34 | % └─examples 35 | % arrow.mps 36 | % color.mps 37 | % colors.mps 38 | % curve.mps 39 | % dashed.mps 40 | % dot.mps 41 | % fill.mps 42 | % label.mps 43 | % line.mps 44 | % loop.mps 45 | % path.mps 46 | % predefined.mps 47 | % pst_arc.eps 48 | % pst_arrow.eps 49 | % pst_axis.eps 50 | % pst_bezier.eps 51 | % pst_circle.eps 52 | % pst_color.eps 53 | % pst_curve.eps 54 | % pst_dot.eps 55 | % pst_fill.eps 56 | % pst_frame.eps 57 | % pst_grid.eps 58 | % pst_label.eps 59 | % pst_line.eps 60 | % pst_linestyle.eps 61 | % pst_origin.eps 62 | % pst_parabola.eps 63 | % pst_polygon.eps 64 | % pst_rput.eps 65 | % pst_uput.eps 66 | % subfig.mps 67 | % subfig_left.mps 68 | % subfig_right.mps 69 | % transform.mps 70 | % uline.mps 71 | % -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/dscf4684.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/latex-notes-zh-cn/src/dscf4684.jpg -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/arrow.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -3 91 42 3 | %%HiResBoundingBox: -0.49814 -2.02908 90.16168 41.87955 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 39.85046 moveto 13 | 89.66354 39.85046 lineto stroke 14 | newpath 85.96759 38.31952 moveto 15 | 89.66354 39.85046 lineto 16 | 85.96759 41.38141 lineto 17 | closepath 18 | gsave fill grestore stroke 19 | newpath 89.66354 19.92523 moveto 20 | 0 19.92523 lineto stroke 21 | newpath 3.69595 21.45618 moveto 22 | 0 19.92523 lineto 23 | 3.69595 18.39429 lineto 24 | closepath 25 | gsave fill grestore stroke 26 | newpath 0 0 moveto 27 | 89.66354 0 lineto stroke 28 | newpath 85.96759 -1.53094 moveto 29 | 89.66354 0 lineto 30 | 85.96759 1.53094 lineto 31 | closepath 32 | gsave fill grestore stroke 33 | newpath 3.69595 1.53094 moveto 34 | 0 0 lineto 35 | 3.69595 -1.53094 lineto 36 | closepath 37 | gsave fill grestore stroke 38 | showpage 39 | %%EOF 40 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/color.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 91 41 3 | %%HiResBoundingBox: -0.49814 -0.49814 90.16168 40.3486 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 1 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 39.85046 moveto 13 | 89.66354 39.85046 lineto stroke 14 | 0 1 0 setrgbcolor 15 | newpath 0 19.92523 moveto 16 | 89.66354 19.92523 lineto stroke 17 | 0 0 1 setrgbcolor 18 | newpath 0 0 moveto 19 | 89.66354 0 lineto stroke 20 | showpage 21 | %%EOF 22 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/colors.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: 0 0 200 18 3 | %%HiResBoundingBox: 0 0 200 17.31995 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.04.29:1049 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 1 1 0 setrgbcolor 11 | newpath 0 0 moveto 12 | 20 0 lineto 13 | 10 17.31995 lineto 14 | closepath fill 15 | 0 1 1 setrgbcolor 16 | newpath 30 0 moveto 17 | 50 0 lineto 18 | 40 17.31995 lineto 19 | closepath fill 20 | 1 0 1 setrgbcolor 21 | newpath 60 0 moveto 22 | 80 0 lineto 23 | 70 17.31995 lineto 24 | closepath fill 25 | 0.6 0.6 0.6 setrgbcolor 26 | newpath 90 0 moveto 27 | 110 0 lineto 28 | 100 17.31995 lineto 29 | closepath fill 30 | 0.6 0 0 setrgbcolor 31 | newpath 120 0 moveto 32 | 140 0 lineto 33 | 130 17.31995 lineto 34 | closepath fill 35 | 0 0.6 0 setrgbcolor 36 | newpath 150 0 moveto 37 | 170 0 lineto 38 | 160 17.31995 lineto 39 | closepath fill 40 | 0 0 0.6 setrgbcolor 41 | newpath 180 0 moveto 42 | 200 0 lineto 43 | 190 17.31995 lineto 44 | closepath fill 45 | showpage 46 | %%EOF 47 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/curve.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 37 3 | %%HiResBoundingBox: -0.99626 -0.99626 100.62242 36.13666 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 4.98131 moveto 13 | 16.40726 13.67198 33.01619 21.97644 49.81308 29.88785 curveto 14 | 75.80037 42.12796 102.70006 33.749 99.62616 14.94392 curveto 15 | 97.65355 2.87622 83.23093 -0.60013 69.73831 0 curveto 16 | 58.50563 0.49962 47.8245 5.95982 49.81308 14.94392 curveto 17 | 52.17368 25.60869 67.37772 25.60869 69.73831 14.94392 curveto stroke 18 | newpath 0.99626 4.98131 moveto 19 | 0.99626 5.24553 0.8913 5.49895 0.70447 5.68578 curveto 20 | 0.51764 5.8726 0.26422 5.97757 0 5.97757 curveto 21 | -0.26422 5.97757 -0.51764 5.8726 -0.70447 5.68578 curveto 22 | -0.8913 5.49895 -0.99626 5.24553 -0.99626 4.98131 curveto 23 | -0.99626 4.71709 -0.8913 4.46367 -0.70447 4.27684 curveto 24 | -0.51764 4.09001 -0.26422 3.98505 0 3.98505 curveto 25 | 0.26422 3.98505 0.51764 4.09001 0.70447 4.27684 curveto 26 | 0.8913 4.46367 0.99626 4.71709 0.99626 4.98131 curveto closepath fill 27 | newpath 50.80934 29.88785 moveto 28 | 50.80934 30.15207 50.70438 30.40549 50.51755 30.59232 curveto 29 | 50.33072 30.77914 50.0773 30.88411 49.81308 30.88411 curveto 30 | 49.54886 30.88411 49.29544 30.77914 49.10861 30.59232 curveto 31 | 48.92178 30.40549 48.81682 30.15207 48.81682 29.88785 curveto 32 | 48.81682 29.62363 48.92178 29.37021 49.10861 29.18338 curveto 33 | 49.29544 28.99655 49.54886 28.89159 49.81308 28.89159 curveto 34 | 50.0773 28.89159 50.33072 28.99655 50.51755 29.18338 curveto 35 | 50.70438 29.37021 50.80934 29.62363 50.80934 29.88785 curveto closepath fill 36 | newpath 100.62242 14.94392 moveto 37 | 100.62242 15.20815 100.51746 15.46156 100.33063 15.64839 curveto 38 | 100.1438 15.83522 99.89038 15.94019 99.62616 15.94019 curveto 39 | 99.36194 15.94019 99.10852 15.83522 98.92169 15.64839 curveto 40 | 98.73486 15.46156 98.6299 15.20815 98.6299 14.94392 curveto 41 | 98.6299 14.6797 98.73486 14.42628 98.92169 14.23946 curveto 42 | 99.10852 14.05263 99.36194 13.94766 99.62616 13.94766 curveto 43 | 99.89038 13.94766 100.1438 14.05263 100.33063 14.23946 curveto 44 | 100.51746 14.42628 100.62242 14.6797 100.62242 14.94392 curveto closepath fill 45 | newpath 70.73457 0 moveto 46 | 70.73457 0.26422 70.62961 0.51764 70.44278 0.70447 curveto 47 | 70.25595 0.8913 70.00253 0.99626 69.73831 0.99626 curveto 48 | 69.47409 0.99626 69.22067 0.8913 69.03384 0.70447 curveto 49 | 68.84702 0.51764 68.74205 0.26422 68.74205 0 curveto 50 | 68.74205 -0.26422 68.84702 -0.51764 69.03384 -0.70447 curveto 51 | 69.22067 -0.8913 69.47409 -0.99626 69.73831 -0.99626 curveto 52 | 70.00253 -0.99626 70.25595 -0.8913 70.44278 -0.70447 curveto 53 | 70.62961 -0.51764 70.73457 -0.26422 70.73457 0 curveto closepath fill 54 | newpath 50.80934 14.94392 moveto 55 | 50.80934 15.20815 50.70438 15.46156 50.51755 15.64839 curveto 56 | 50.33072 15.83522 50.0773 15.94019 49.81308 15.94019 curveto 57 | 49.54886 15.94019 49.29544 15.83522 49.10861 15.64839 curveto 58 | 48.92178 15.46156 48.81682 15.20815 48.81682 14.94392 curveto 59 | 48.81682 14.6797 48.92178 14.42628 49.10861 14.23946 curveto 60 | 49.29544 14.05263 49.54886 13.94766 49.81308 13.94766 curveto 61 | 50.0773 13.94766 50.33072 14.05263 50.51755 14.23946 curveto 62 | 50.70438 14.42628 50.80934 14.6797 50.80934 14.94392 curveto closepath fill 63 | newpath 70.73457 14.94392 moveto 64 | 70.73457 15.20815 70.62961 15.46156 70.44278 15.64839 curveto 65 | 70.25595 15.83522 70.00253 15.94019 69.73831 15.94019 curveto 66 | 69.47409 15.94019 69.22067 15.83522 69.03384 15.64839 curveto 67 | 68.84702 15.46156 68.74205 15.20815 68.74205 14.94392 curveto 68 | 68.74205 14.6797 68.84702 14.42628 69.03384 14.23946 curveto 69 | 69.22067 14.05263 69.47409 13.94766 69.73831 13.94766 curveto 70 | 70.00253 13.94766 70.25595 14.05263 70.44278 14.23946 curveto 71 | 70.62961 14.42628 70.73457 14.6797 70.73457 14.94392 curveto closepath fill 72 | showpage 73 | %%EOF 74 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/dashed.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 31 3 | %%HiResBoundingBox: -0.49814 -0.49814 100.1243 30.38599 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 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 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/dot.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 41 3 | %%HiResBoundingBox: -0.99626 -0.99626 100.62242 40.84673 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 99.62616 39.85046 lineto stroke 14 | newpath 0.99626 0 moveto 15 | 0.99626 0.26422 0.8913 0.51764 0.70447 0.70447 curveto 16 | 0.51764 0.8913 0.26422 0.99626 0 0.99626 curveto 17 | -0.26422 0.99626 -0.51764 0.8913 -0.70447 0.70447 curveto 18 | -0.8913 0.51764 -0.99626 0.26422 -0.99626 0 curveto 19 | -0.99626 -0.26422 -0.8913 -0.51764 -0.70447 -0.70447 curveto 20 | -0.51764 -0.8913 -0.26422 -0.99626 0 -0.99626 curveto 21 | 0.26422 -0.99626 0.51764 -0.8913 0.70447 -0.70447 curveto 22 | 0.8913 -0.51764 0.99626 -0.26422 0.99626 0 curveto closepath fill 23 | newpath 100.62242 39.85046 moveto 24 | 100.62242 40.11469 100.51746 40.3681 100.33063 40.55493 curveto 25 | 100.1438 40.74176 99.89038 40.84673 99.62616 40.84673 curveto 26 | 99.36194 40.84673 99.10852 40.74176 98.92169 40.55493 curveto 27 | 98.73486 40.3681 98.6299 40.11469 98.6299 39.85046 curveto 28 | 98.6299 39.58624 98.73486 39.33282 98.92169 39.146 curveto 29 | 99.10852 38.95917 99.36194 38.8542 99.62616 38.8542 curveto 30 | 99.89038 38.8542 100.1438 38.95917 100.33063 39.146 curveto 31 | 100.51746 39.33282 100.62242 39.58624 100.62242 39.85046 curveto closepath fill 32 | showpage 33 | %%EOF 34 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/fill.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: 0 0 110 18 3 | %%HiResBoundingBox: 0 0 109.58878 17.2552 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 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 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/label.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -44 -11 151 51 3 | %%HiResBoundingBox: -43.91557 -10.95567 150.48793 50.91548 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %*Font: cmr10 9.96265 9.96265 20:800000040000000027cdad 8 | %*Font: cmmi10 9.96265 9.96265 45:80000002008 9 | %*Font: cmr7 6.97385 6.97385 32:8 10 | %%BeginProlog 11 | %%EndProlog 12 | %%Page: 1 1 13 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 14 | [] 0 setdash 1 setlinejoin 10 setmiterlimit 15 | newpath 0 0 moveto 16 | 99.62616 0 lineto 17 | 99.62616 39.85046 lineto 18 | 0 39.85046 lineto 19 | closepath stroke 20 | 42.61781 44.78766 moveto 21 | (top) cmr10 9.96265 fshow 22 | 34.03883 -9.9185 moveto 23 | (bottom) cmr10 9.96265 fshow 24 | -17.1138 16.46597 moveto 25 | (left) cmr10 9.96265 fshow 26 | 102.62616 17.43457 moveto 27 | (right) cmr10 9.96265 fshow 28 | -43.91557 43.88763 moveto 29 | (upper\040left) cmr10 9.96265 fshow 30 | 101.72615 43.88763 moveto 31 | (upper\040right) cmr10 9.96265 fshow 32 | -42.25513 -9.0185 moveto 33 | (lower\040left) cmr10 9.96265 fshow 34 | 101.72615 -9.0185 moveto 35 | (lower\040right) cmr10 9.96265 fshow 36 | 32.88785 15.87042 moveto 37 | (E) cmmi10 9.96265 fshow 38 | 43.58376 15.87042 moveto 39 | (=) cmr10 9.96265 fshow 40 | 54.09985 15.87042 moveto 41 | (mc) cmmi10 9.96265 fshow 42 | 67.15855 19.48582 moveto 43 | (2) cmr7 6.97385 fshow 44 | showpage 45 | %%EOF 46 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/line.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 91 31 3 | %%HiResBoundingBox: -0.49814 -0.49814 90.16168 30.49814 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 40 0 lineto 14 | 20 30 lineto 15 | 0 0 lineto stroke 16 | newpath 49.81308 0 moveto 17 | 89.66354 0 lineto 18 | 69.73831 29.88785 lineto 19 | closepath stroke 20 | showpage 21 | %%EOF 22 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/loop.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -3 -3 101 41 3 | %%HiResBoundingBox: -2.02885 -2.02873 100.1243 40.3486 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 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.99626 0 dtransform exch truncate exch idtransform pop setlinewidth 20 | newpath 0 0 moveto 21 | 0 39.85046 lineto stroke 22 | 0 0.99626 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.4489 4.09131 5.8713 7.51372 9.96262 9.96262 curveto 30 | 13.81606 12.26913 18.12555 13.63078 22.4159 14.94392 curveto 31 | 28.19601 16.71304 33.99623 18.41885 39.85046 19.92523 curveto 32 | 47.26486 21.83307 54.75665 23.4187 62.26636 24.90654 curveto 33 | 71.37206 26.71059 80.50558 28.37123 89.66354 29.88785 curveto stroke 34 | showpage 35 | %%EOF 36 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/path.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 91 21 3 | %%HiResBoundingBox: -0.25 -0.25 90.25 20.25 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.04.24:1054 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.5 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 40 0 lineto 14 | 20 20 lineto 15 | 0 0 lineto stroke 16 | newpath 50 0 moveto 17 | 90 0 lineto 18 | 70 20 lineto 19 | closepath stroke 20 | showpage 21 | %%EOF 22 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/predefined.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -11 -11 190 11 3 | %%HiResBoundingBox: -10.46075 -10.46075 189.78784 10.46075 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinejoin 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 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/subfig.mps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%BoundingBox: -5 -12 5 12 3 | %%HiResBoundingBox: -4.98131 -11.43991 4.9813 11.0467 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1559 6 | %%Pages: 1 7 | %%DocumentResources: procset mpost-minimal 8 | %%+ font gkaiu53 gkaiu59 9 | %%DocumentSuppliedResources: procset mpost-minimal 10 | %%DocumentNeededResources: font gkaiu53 gkaiu59 11 | %%IncludeResource: font gkaiu53 12 | %%IncludeResource: font gkaiu59 13 | %%EndComments 14 | %%BeginProlog 15 | %%BeginResource: procset mpost-minimal 16 | /bd{bind def}bind def/fshow {exch findfont exch scalefont setfont show}bd 17 | /fcp{findfont dup length dict begin{1 index/FID ne{def}{pop pop}ifelse}forall}bd 18 | /fmc{FontMatrix dup length array copy dup dup}bd/fmd{/FontMatrix exch def}bd 19 | /Amul{4 -1 roll exch mul 1000 div}bd/ExtendFont{fmc 0 get Amul 0 exch put fmd}bd 20 | /SlantFont{fmc 2 get dup 0 eq{pop 1}if Amul FontMatrix 0 get mul 2 exch put fmd}bd 21 | %%EndResource 22 | %%EndProlog 23 | %%BeginSetup 24 | /gkaiu53 /gkaiu53 def 25 | /gkaiu59 /gkaiu59 def 26 | %%EndSetup 27 | %%Page: 1 1 28 | 0 0 0 setrgbcolor 29 | -4.98131 3 moveto 30 | (\315) gkaiu53 9.96265 fshow 31 | -4.98131 -11.2678 moveto 32 | (\015) gkaiu59 9.96265 fshow 33 | showpage 34 | %%EOF 35 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/subfig_left.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -5 -11 5 13 3 | %%HiResBoundingBox: -4.98131 -10.8925 4.9813 12.14189 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %*Font: gkaiu6e 9.96265 9.96265 05:8 8 | %*Font: gkaiu66 9.96265 9.96265 0e:8 9 | %%BeginProlog 10 | %%EndProlog 11 | %%Page: 1 1 12 | 0 0 0 setrgbcolor 13 | -4.98131 3.7338 moveto 14 | (\005) gkaiu6e 9.96265 fshow 15 | -4.98131 -10.7786 moveto 16 | (\016) gkaiu66 9.96265 fshow 17 | showpage 18 | %%EOF 19 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/subfig_right.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -5 -12 5 12 3 | %%HiResBoundingBox: -4.98131 -11.43991 4.9813 11.0467 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %*Font: gkaiu53 9.96265 9.96265 cd:8 8 | %*Font: gkaiu59 9.96265 9.96265 0d:8 9 | %%BeginProlog 10 | %%EndProlog 11 | %%Page: 1 1 12 | 0 0 0 setrgbcolor 13 | -4.98131 3 moveto 14 | (\315) gkaiu53 9.96265 fshow 15 | -4.98131 -11.2678 moveto 16 | (\015) gkaiu59 9.96265 fshow 17 | showpage 18 | %%EOF 19 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/transform.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 91 18 3 | %%HiResBoundingBox: -0.49814 -0.49814 90.16168 17.75394 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.05.02:1619 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.99626 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 19.92523 0 lineto 14 | 9.96262 17.2552 lineto 15 | closepath stroke 16 | newpath 29.88785 0 moveto 17 | 69.73831 0 lineto 18 | 49.81308 17.2552 lineto 19 | closepath stroke 20 | newpath 79.70093 0 moveto 21 | 89.66354 17.2558 lineto 22 | 69.73875 17.25551 lineto 23 | closepath stroke 24 | showpage 25 | %%EOF 26 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/examples/uline.mps: -------------------------------------------------------------------------------- 1 | %!PS 2 | %%BoundingBox: -1 -1 101 51 3 | %%HiResBoundingBox: -0.25 -0.25 100.25 50.25 4 | %%Creator: MetaPost 1.003 5 | %%CreationDate: 2008.04.24:1054 6 | %%Pages: 1 7 | %%BeginProlog 8 | %%EndProlog 9 | %%Page: 1 1 10 | 0 0 0 setrgbcolor 0 0.5 dtransform truncate idtransform setlinewidth pop 11 | [] 0 setdash 1 setlinecap 1 setlinejoin 10 setmiterlimit 12 | newpath 0 0 moveto 13 | 100 50 lineto stroke 14 | showpage 15 | %%EOF 16 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/fonts.tex: -------------------------------------------------------------------------------- 1 | \chapter{字体} 2 | 3 | 关于字体有三个重要概念:glyph、typeface、font。glyph~通常被翻译为字形,也有翻译为字体的;typeface~是一个书法和印刷领域的概念,它通常被翻译为字体或书体;font~曾经和~typeface~混用,但现在一般用作电脑领域的概念,在中国大陆被翻译为字体,在台湾被翻译为字型。 4 | 5 | 上述翻译的混乱令人十分无奈,包老师决定在本文中把它们分别翻译为字形、字样、字体,以正视听。 6 | 7 | 字形是一个字符的具体图形表现形式,一个字符可以有多个字形,比如汉字中的“強/强”、“戶/户/戸”;字样是一组相同风格样式的字形的集合,比如中文字样有宋、仿、楷、黑、隶、篆等;一种字样可以对应电脑上的几种字体。 8 | 9 | \section{字样} 10 | \label{sec:typeface} 11 | 拉丁字母的字样主要有三大类:Serif(Roman)、Sans Serif~和~Mono-space~(Typewriter)。Serif~的笔画边缘部分有些装饰,类似于中文的宋体、仿宋、楷体、魏书等。Sans Serif~的笔画则是平滑的,类似于中文的黑体。Sans~这个词来源于法语,就是“没有”的意思。Monospace~则是等宽字样。 12 | 13 | 每一类字样都可以有加粗(bold)、斜体(italic)、倾斜(oblique)等修饰效果。Italic~通常对原字样进行过重新设计,它修饰精细,多用于~Serif;~Oblique~也称作~slanted,基本上是把正体倾斜,多用于~Sans Serif。通常~oblique~看起来比~italic~要宽一些。 14 | 15 | \Fref{tab:typeface}列出了几种常见的字样。 16 | 17 | \begin{table}[htbp] 18 | \caption{常见字样} 19 | \label{tab:typeface} 20 | \centering 21 | \begin{tabular}{llll} 22 | \toprule 23 | 操作系统 & Serif & Sans Serif & Monospace \\ 24 | \midrule 25 | Mac OS & Times & Helvetica & Courier \\ 26 | Windows & Times New Roman & Arial & Courier New \\ 27 | \bottomrule 28 | \end{tabular} 29 | \end{table} 30 | 31 | \section{字体格式} 32 | \label{sec:font} 33 | 34 | \subsection{点阵字体和矢量字体} 35 | 电脑上用的字体(font)按数据格式可以分为三大类:点阵字体(bitmap)、轮廓(outline)字体和笔画(stroke-based)字体。 36 | 37 | 点阵字体通过点阵来描述字形。早期的电脑受到容量和绘图速度的限制,多采用点阵字体。点阵字体后来渐渐被轮廓字体所取代,但是很多小字号字体仍然使用它,因为这种情况下轮廓字体缩放太多会导致笔画不清晰。 38 | 39 | 轮廓字体又称作矢量字体,它通过一组直线段和曲线来描述字形。轮廓字体易于通过数学函数进行缩放等变换,形成平滑的轮廓。轮廓字体的主要缺陷在于它所采用的贝塞尔曲线(Bézier curves)在光栅(raster)设备(比如显示器和打印机)上不能精确渲染,因而需要额外的补偿处理比如字体微调(font hinting)。但是随着电脑硬件的发展,人们一般不在意它比点阵字体多出的处理时间。 40 | 41 | 笔画字体其实也是轮廓字体,不过它描述的不是完整的字形,而是笔画。它多用于东亚文字。 42 | 43 | \subsection{常见字体} 44 | 45 | 常见的轮廓字体技术有:Type 1~和~Type 3、TrueType、OpenType、~\MF~等。 46 | 47 | Adobe~的~Type 1~和~Type 3~基于~PS,它们采用三次贝塞尔曲线。Type 1~支持微调,它使用一个简化的~PS~子集;Type 3~不支持微调,但它可以使用全部~PS~功能,因此既可以包含轮廓字体也可以包含点阵字体信息。 48 | 49 | 1991~年,Apple~发布了~TrueType,它采用二次贝塞尔曲线。二次曲线处理起来比三次曲线快,但是需要更多的点来描述。所以从~TrueType~到~Type 1的转换是无损的,反之是有损的。1994~年,Apple~着手研究~TrueType~的下一代技术:TrueType GX,它后来演变为Apple Advanced Typography(AAT)。 50 | 51 | 1996~年,微软和~Adobe~联合发布了~OpenType。它比起~AAT~的优势有:跨平台、开放和易于开发、支持更多的语言比如阿拉伯语。 52 | 53 | 早在~1984~年~Knuth~就发布了~\MF,它与~TrueType~和~OpenType的区别是,不直接描述字形轮廓,而描述生成轮廓的笔的轨迹。笔的形状可以是椭圆形或多边形,尺寸缩放自如,字形边缘也柔和一些。两种字体可以用同一个~\MF~文件,当然还有不同的参数。\MF~技术如此先进,却没有流行开来。对此~Knuth~解释道,要求一位设计字体的艺术家掌握~60~个参数太变态了,那是用来折磨数学家的。 54 | 55 | Type 1~和~Type 3~把字体信息存储在两种文件里:metrics~和~glyph~文件。metrics~文件有~AFM(Adobe font metrics)和~PFM(printer font metrics),glyph~文件有~PFA(printer font ASCII)和~PFB(printer font binary)。~\LaTeX~使用的~metrics~格式是~TFM(TeX Font Metrics)。 56 | 57 | TrueType~的文件后缀是~.ttf,OpenType~的是~.ttf~和~.otf。\MF~虽然用矢量图形来定义字形,实际输出的却是一种点阵格式:PK~(packed raster)。 58 | 59 | 上述字体按技术的先进性,从高到低的排序为:OpenType、~TrueType、Type 1、Type 3、PK,我们应优先选用~OpenType~和~TrueType。 60 | 61 | \subsection{合纵连横} 62 | Adobe~收取的~Type 1~专利许可费一度十分昂贵,穷人们只好用免费的~Type 3。为了打破这种垄断,Apple~开发了~TrueType。1991~年~TrueType~发布之后,Adobe随即公开了~Type 1~的规范,~Type 1~字体从贵族堕落为平民,因而流行开来。 63 | 64 | 1980~年代中后期,Adobe~的大部分盈利来自于~PS~解释器的许可费。面对这种垄断局面,微软和~Apple~联合了起来。微软把买来的~PS~解释器~TrueImage~授权给~Apple,Apple~则把~TrueType~授权给微软。 65 | 66 | 微软得陇望蜀,又企图获得~AAT~的许可证,未遂。为了打破~Apple~的垄断,微软联合~Adobe~在1996年发布了~OpenType。Adobe~在2002~年末将其字体库全面转向~OpenType。 67 | 68 | 上面这几出精彩好戏充分展示了商场上的勾心斗角、尔虞我诈,没有永恒的伙伴,只有永恒的利益。但它同时也告诉我们,市场竞争中受益的还是广大的消费者。 69 | 70 | \section{字体应用} 71 | 72 | PS~支持~Type 1~和~Type 3,而~PDF~除了这两种还支持~TrueType~和~OpenType。\verb|latex|、DVI浏览器、各种~driver~分别采用不同的字体技术。 73 | 74 | \subsection{DVI} 75 | \verb|latex|~编译~\LaTeX~源文件生成~DVI~时只需要\verb|.tfm|~文件,因为~DVI~并不包含字形信息,而只包含对字体的引用。DVI~浏览器显示~DVI~时一般使用~PK,它在系统中查找相应的~\verb|.pk|~文件,若找不到就调用~\MF~在后台自动生成。 76 | 77 | \subsection{dvips} 78 | 缺省情况下,\verb|dvips|~也会查找~\verb|.pk|~,或调用~\MF~自动生成;然后把~PK~转换成包含点阵字体的~Type 3,它的参数~\verb|-D|~可以用来控制该点阵字体的分辨率。用~\verb|ps2pdf|~处理含~Type 3~的~PS~时,输出的自然是含~Type 3~的~PDF。 79 | 80 | GSview~在低分辨率下可以很好地渲染~Type 3,Adobe Reader~或~Acrobat~却不能,因为它们使用的~Adobe Type Manager~不支持包含完整~PS~的~Type 3。含~Type 3~的~PDF~看起来会有些模糊,所以应尽量避免使用。 81 | 82 | \verb|dvips|~的另一个参数~\verb|-Ppdf|~把~Type 1~嵌入生成的~PS,这样再~\verb|ps2pdf|~就能生成含~Type 1~的~PDF。 83 | 84 | \verb|dvips|~不支持真正的(native)TrueType,用户只能把~TrueType~先转成~PK~或~Type 1,这样绕了个弯效果总会打些折扣。 85 | 86 | \verb|dvips|~的字体详细使用方法可查阅其手册\citep{Rokicki_2005}第~6~章,此处不赘述。 87 | 88 | \subsection{dvipdfm(x)} 89 | \verb|dvipdfm|~支持~PK~和~Type 1,它可以用一个~\verb|t1fonts.map|~文件建立~PK~文件和~Type 1~文件之间的映射,这样生成的~PDF~用的就是~Type 1。\verb|dvipdfm|~也不支持真正的~TrueType。 90 | 91 | \verb|dvipdfmx|~通过正确的设置可以使用真正的~TrueType,它对中日韩等东亚文字的支持也较好,所以它对我们来说是~Driver~的首选。 92 | 93 | \section{TrueType~字体安装配置} 94 | CJK~自带的~UTF-8~编码字体~gbsn~和~gkai只包含~GB2312~字符集,而~CTeX~只提供~GBK~编码字体,因此中文用户通常需要自己安装配置~UTF-8~编码的~TrueType~字体。 95 | 96 | 在使用~TrueType~之前,用户通常需要作以下准备工作: 97 | \begin{enumerate} 98 | \item 用转换程序~\verb|ttf2tfm|~生成~TFM。 99 | \item 配置字体定义文件~\verb|.fd|。 100 | \item 配置~\verb|ttf2pk|~,因为~DVI~浏览器和~\verb|dvips|~都会自动调用~\verb|ttf2pk|~来生成~PK。 101 | \item 配置~\verb|dvipdfmx|。 102 | \end{enumerate} 103 | 104 | \subsection{目录和文件} 105 | 通常每个发行包都会参照~TDS~建立自己的目录系统,把各种文件发在固定的位置。比如~MiKTeX~顶层目录如下,在本节后面的示例中我们将使用这些目录的缩写。 106 | \begin{code} 107 | Install: D:\edit\MiKTeX 2.7 108 | UserData: C:\Documents and Settings\Alpha\Local Settings\ 109 | Application Data\MiKTeX\2.7 110 | UserConfig: C:\Documents and Settings\Alpha\ 111 | Application Data\MiKTeX\2.7 112 | \end{code} 113 | 114 | 目录多了有个缺点,文件不知道放在哪里好。MiKTeX~中有的配置文件居然在四个目录下各有一份,实在是令人发指。幸好我们可以用下面的命令检查配置文件的具体名字和路径。 115 | 116 | \begin{code} 117 | initexmf --edit-config-file=ttf2pk 118 | \end{code} 119 | 120 | \subsection{ttf2tfm} 121 | 比如我们想把~\verb|SimSun18030.ttc|(18030~字符集的新宋体)转换为~UTF8~编码的字体文件,我们需要执行以下步骤。 122 | 123 | \begin{enumerate} 124 | \item 把需要的~\verb|.ttf|~文件复制到~\verb|UserData/fonts/truetype/chinese/|。 125 | \item 用下面的命令生成\verb|.tfm|~和~\verb|.enc|~文件。 126 | \item 把~\verb|*.tfm|~复制到~\verb|UserData/fonts/tfm/chinese/utf8song/|。 127 | \item 把~\verb|*.enc|~复制到~\verb|UserData/fonts/enc/chinese/utf8song/|。 128 | \end{enumerate} 129 | 130 | \begin{code} 131 | ttf2tfm SimSun18030.ttc -q -w utf8song@Unicode@ 132 | \end{code} 133 | 134 | \subsection{字体定义文件} 135 | 字体定义文件将字体引用名和实际的字体文件联系起来,比如我们在~\verb|CJK|~环境中引用~\verb|usong|~时,系统将会找到并使用~\verb|utf8song*.tfm|。 136 | 137 | \begin{code} 138 | %UserData\tex\latex\CJK\UTF8\C70usong.fd 139 | \ProvidesFile{c70usong.fd} 140 | %character set: GB18030 141 | %font encoding: Unicode 142 | \DeclareFontFamily{C70}{usong}{\hyphenchar \font\m@ne} 143 | \DeclareFontShape{C70}{usong}{m}{n}{<-> CJK * utf8song}{} 144 | \DeclareFontShape{C70}{usong}{m}{it}{<-> CJK * utf8song}{} 145 | \DeclareFontShape{C70}{usong}{bx}{n}{<-> CJKb * utf8song}{ 146 | \CJKbold} 147 | \endinput 148 | \end{code} 149 | 150 | \subsection{配置~\texttt{ttf2pk}} 151 | MiKTeX~中~\verb|ttf2pk|~的配置文件是~\verb|ttf2pk.ini|~,在其它的发行包中可能是~\verb|ttf2pk.cfg|。 152 | 153 | \verb|ttf2pk.ini|~中有一个~\verb|.map|~文件列表,后者定义了~TrueType~应该按编码转为~PK~等信息。 154 | 155 | 比如下面这个文件列表会让~\verb|ttf2pk|~读取~\verb|foo.map|~和~\verb|bar.map|。 156 | 157 | \begin{code} 158 | map foo.map 159 | map bar.map 160 | \end{code} 161 | 162 | 如果系统找不到~\verb|ttf2pk.ini|,它会缺省使用~\verb|ttfonts.map|。 163 | \begin{code} 164 | %UserData\ttf2tfm\base\ttfonts.map 165 | utf8song@Unicode@ SimSun18030.ttc 166 | \end{code} 167 | 168 | \subsection{配置~\texttt{dvipdfmx}} 169 | 配置~\verb|dvipdfmx|~是为了让~PDF~正确地嵌入~TrueType,否则生成的文件中的内容不能复制、粘贴。 170 | 171 | \begin{code} 172 | %UserConfig\dvipdfm\config\dvipdfmx.cfg 173 | f cid-x.map 174 | \end{code} 175 | 176 | \begin{code} 177 | %UserData\dvipdfm\config\cid-x.map 178 | utf8song@Unicode@ unicode SimSun18030.ttc 179 | \end{code} 180 | 181 | \bibliographystyle{unsrtnat} 182 | \bibliography{reading} 183 | \newpage 184 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/i18n.tex: -------------------------------------------------------------------------------- 1 | \chapter{中文} 2 | 3 | \section{字符集和编码} 4 | \label{sec:encoding} 5 | 6 | 众所周知电脑内部采用二进制编码,因为它易于用电子电路实现。所有字符(包括字母、数字、符号、控制码等)在电脑内部都是用二进制表示的,字符集(Character Set)的二进制编码被称为字符编码(Character Encoding),有时人们也会混用这两个术语。 7 | 8 | 1963~年发布的~American Standard Code for Information Interchange(~ASCII)是最早出现的字符编码,它用~7~位(bit)表示了~$2^7=128$个字符,只能勉强覆盖英文字符。 9 | 10 | 美国人发明了电脑,英语被优先考虑是很自然的事情。随着电脑技术的传播,人们呼吁把字符编码扩充到~8~位也就是一个字节(byte),于是国际标准化组织(International Organization for Standardization,ISO)推出了~ISO 8859。$2^8=256$个字符显然也不能满足需要,所以~8859~被分为十几个部分,从~8859-1(西欧语言)、8859-2(中欧语言),直到~8859-16(东南欧语言),覆盖了大部分使用拉丁字母的语言文字。 11 | 12 | 在~ISO~标准完全定型之前,IBM~就有一系列自己的字符编码,他们称之为代码页(Code Page),其中著名的有~1981~年就被用于~IBM PC~的~437(扩展~ASCII)、850(西欧语言)、852(东欧语言)。IBM~代码页通常被用于控制台(Console)环境,也就是~MS-DOS~或~Unix Shell~那样的命令行环境。 13 | 14 | 微软将~IBM~代码页称为~OEM~代码页,自己定义的称为~ANSI~代码页,后者中著名的有1252(西欧语言)、1250(东欧语言)、936(GBK~简体中文)、950(Big5~繁体中文)、932(SJIS~日文)、949(EUC-KR~韩文)等。 15 | 16 | 1981~年,中国大陆推出了第一个自己的字符集标准~GB2312,它是一个~$94*94$~的表,包括~7445~个字符(含~6763~个汉字)。GB2312~通常采用双字节的EUC-CN编码,所以后者也常常被称为~GB2312~编码;其实~GB2312~还有另一种编码方式~HZ,只是不常用。GB2312~不包含朱镕基的“镕”字,政府、新闻、出版、印刷等行业和部门在使用中感到十分不便,于是它在~1993~年被扩展为~GBK,后者包括~21886~个字符(含~21003~个汉字),没有形成正式标准。2000~年发布的~GB18030~包含~70244~个字符(含~27533~个汉字),采用四字节编码。GB18030~之前还出现过一个~GB13000,没有形成气候。 17 | 18 | 1990~年ISO~推出了通用字符集(Universal Character Set,UCS),即~ISO 10646,意图一统江湖。它有两种编码:双字节的~UCS-2~和四字节的~UCS-4。 19 | 20 | ISO~之外还有个希望一统江湖的组织:统一码联盟(The Unicode Consortium),它于~1991~年推出了~Unicode 1.0。后来两家组织意识到没必要做重复工作,于是开始合并双方的成果,携手奔小康。从~Unicode 2.0~开始,Unicode~采用了与~ISO 10646-1~相同的编码。 21 | 22 | Unicode~主要有三种编码:UTF-8、UTF-16、UTF-32。UTF-8~使用一至四个~8~位编码。互联网工程任务组(Internet Engineering Task Force,~IETF)要求所有网络协议都支持~UTF-8,互联网电子邮件联盟(Internet Mail Consortium,IMC)也建议所有电子邮件软件都支持~UTF-8,所以它已成为互联网上的事实标准。UTF-16~用一或两个~16~位编码,基本上是~UCS-2~的超集,和~ASCII~不兼容。UTF-32~用一个~32~位编码,它是~UCS-4~的一个子集。 23 | 24 | \section{中文解决方案} 25 | \TeX~是基于单字节编码的,因为~Knuth~当初开发~\TeX~时没考虑那么远,也没有现成的标准可以借鉴。 26 | 27 | \LaTeX~对中文的支持主要有两种方法:张林波\footnote{中科院计算数学所某实验室主任。}开发的~\href{ftp://ftp.cc.ac.cn/pub/cct/}{CCT}~和~Werner Lemberg\footnote{1968~年生于奥地利,从维也纳音乐学院获得作曲、指挥、钢琴、乐团管理、歌手教练等五个专业文凭,后自学中文和数学。曾任职于奥地利和德国多家剧院和乐团,现任德国科布伦茨某剧院指挥。}开发的~CJK~宏包。早期~CCT~比较流行,新的~CCT~也可以和~CJK~配合使用,网上可以找到的最后更新是~2003~年的。CJK~是当前主流,它不仅支持中日韩等东亚文字,还支持几十种其他不同语言的多种编码。 28 | 29 | 支持简体中文的~\LaTeX~发行版有吴凌云\footnote{中科院应用数学所研究员。}的~CTeX~和李树钧\footnote{德国哈根函授大学研究员。}的~ChinaTeX,繁体中文的有吴聪敏\footnote{台湾大学电机系学士,美国罗彻斯特大学经济学博士,现任台湾大学经济系教授。}、吴聪慧兄弟的~cwTeX~和蔡奇伟\footnote{美国犹他大学计算机博士,现任台湾静宜大学资讯工程系教授。}的~PUTeX。后面两个台湾的发行版包老师不熟悉,前面两个大陆的发行版都包含~MikTeX、CCT、CJK、WinEdt~等。 30 | 31 | \section{CJK的使用} 32 | CJK~的作者写的使用说明比较凌乱和晦涩,读者可以参阅李果正的《我的CJK》\citep{Lee_2004a}。 33 | 34 | CJK~有两个基本宏包:\verb|CJK|~和~\verb|CJKutf8|,后者面向~UTF-8~编码。CJK~环境的一般使用方法如下: 35 | 36 | \begin{code} 37 | \usepackage{CJK(utf8)} 38 | ... 39 | \begin{document} 40 | \begin{CJK}{}{} 41 | ... 42 | \end{CJK} 43 | \end{document} 44 | \end{code} 45 | 46 | 简体中文常用编码是~GBK~和~UTF8~。family~是指宋体、楷体、隶书等,具体引用要看电脑上安装了什么字体。麻烦的是~GBK~和~UTF8~字体不通用,也就是说每种编码需要自己的字体。CJK~自带的~UTF8~简体字体有~gbsn(宋体)和~gkai(楷体)。CTeX~提供的~GBK~字体有~song(宋体)、fs(仿宋)、kai(楷体)、hei(黑体)、li(隶书)、~you(幼圆)等。 47 | 48 | 注意使用~\verb|CJKutf8|~宏包时,\verb|CJK|~环境的编码最好是~UTF8,否则可能遭遇不测。 49 | 50 | 下面是一个简单的~GBK~示例和一个~UTF8~示例,注意用编辑器保存时要选则相应的编码格式,比如前者用~ANSI,后者用~UTF-8。 51 | \begin{code} 52 | \documentclass{article} 53 | \usepackage{CJK} 54 | \begin{document} 55 | \begin{CJK}{GBK}{song} 56 | 这是一个CJK例子,使用了GBK编码和song字体。 57 | \end{CJK} 58 | \end{document} 59 | \end{code} 60 | 61 | \begin{code} 62 | \documentclass{article} 63 | \usepackage{CJKutf8} 64 | \begin{document} 65 | \begin{CJK}{UTF8}{gbsn} 66 | 这是一个CJK例子,使用了UTF-8编码和gbsn字体。 67 | \end{CJK} 68 | \end{document} 69 | \end{code} 70 | 71 | \bibliographystyle{unsrtnat} 72 | \bibliography{reading} 73 | \newpage 74 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/introduction.tex: -------------------------------------------------------------------------------- 1 | \chapter{简介} 2 | 3 | \begin{quotation} 4 | 滚滚长江东逝水,浪花淘尽英雄。是非成败转头空。青山依旧在,几度夕阳红。 5 | 6 | 白发渔樵江渚上,惯看秋月春风。一壶浊酒喜相逢。古今多少事,都付笑谈中。 7 | \begin{flushright} 8 | ---~杨慎《临江仙》 9 | \end{flushright} 10 | \end{quotation} 11 | 12 | \section{历史回顾} 13 | 14 | \LaTeX~是一种面向数学和其它科技文档的电子排版系统。一般人们提到的~\LaTeX~是一个总称,它包括~\TeX、\LaTeX、\AmS-\LaTeX~等\footnote{一般认为~\TeX~是一种引擎,\LaTeX~是一种格式,而~\AmS-\LaTeX~等是宏集。此处目的是简介,故不展开讨论。}。 15 | 16 | \TeX~的开发始于~1977~年~5~月,Donald E. Knuth\footnote{斯坦福大学计算机系教授,已退休。}开发它的初衷是用于《The Art of Computer Programming》的排版。1962~年~Knuth~开始写一本关于编译器设计的书,原计划是~12~章的单行本。不久~Knuth~觉得此书涉及的领域应该扩大,于是越写越多,如滔滔江水连绵不绝,又如黄河泛滥一发不可收拾。1965~年完成的初稿居然有~3000~页,全是手写的!据出版商估计,这些手稿印刷出来需要~2000~页,出书的计划只好改为七卷,每卷一或两章。1976~年~Knuth~改写第二卷的第二版时,很郁闷地发现第一卷的铅版不见了,而当时电子排版刚刚兴起,质量还差强人意。于是~Knuth~仰天长啸:“我要扼住命运的咽喉”,决定自己开发一个全新的系统,这就是~\TeX。 17 | 18 | 1978~年~\TeX~第一版发布后好评如潮,Knuth~趁热打铁在~1982~年发布了第二版。人们现在使用的~\TeX~基本就是第二版,中间只有一些小的改进。1990~年~\TeX~ v3.0~发布后,Knuth~宣布除了修正~bug~外停止~\TeX~的开发,因为他要集中精力完成那本巨著的后几卷\footnote{已出版的前三卷是:《Fundamental Algorithms》、《Seminumerical Algorithms》、《Sorting and Searching》;第四卷《Combinatorial Algorithms》和第五卷《Syntactic Algorithms》正在写作中,预计~2015~年出版;第六卷《Theory of Context-free Languages》和第七卷《Compiler Techniques》尚未安排上工作日程。}。此后每发布一个修正版,版本号就增加一位小数,使得它趋近于$\pi$(目前是~3.141592)。Knuth~希望将来他离世时,\TeX~的版本号永远固定下来,从此人们不再改动他的代码。他开发的另一个软件~\MF~也作类似处理,它的版本号趋近于$e$,目前是~2.71828。 19 | 20 | \TeX~是一种语言也是一个宏处理器,这使得它很好很强大,但是它同时又很繁琐,让人难以接近。因此~Knuth~提供了一个对~\TeX~进行了封装的宏集~Plain \TeX,里面有一些高级命令,有了它最终用户就无须直接面对枯燥无味的~\TeX。 21 | 22 | 然而~Plain \TeX~还是不够高级,所以~Leslie Lamport\footnote{现供职于微软研究院。}在~80~年代初期开发了另一个基于~\TeX~的宏集~\LaTeX。1992~年~\LaTeX~ v2.09~发布后,Lamport~退居二线,之后的开发活动由~Frank Mittelbach~领导的~The LaTeX Team~接管。此小组发布的最后版本是~1994~年的~\LaTeXe,他们同时还在进行~\LaTeX~3~的开发,只是正式版看起来遥遥无期。 23 | 24 | 起初,美国数学学会(American Mathematical Society,AMS)看着\TeX~是好的,就派~Michael Spivak~写了~\AmS-\TeX,这项基于~Plain \TeX~的开发活动进行了两年(1983--1985)。后来与时俱进的~AMS~又看着~\LaTeX~是好的,就想转移阵地,但是他们的字体遇到了麻烦。恰好~Mittelbach~和~Rainer Schöpf(后者也是~LaTeX Team~的成员)刚刚发布了~New Font Selection Scheme for \LaTeX(NFSS),AMS~看着还不错,就拜托他们把~AMSFonts加入~\LaTeX,继而在~1989~年请他们开发~\AmS-\LaTeX。\AmS-\LaTeX~发布于~1990~年,之后它被整合为~\AmS~宏包,像其它宏包一样可以直接运行于~\LaTeX。 25 | 26 | \section{优点和缺点} 27 | 当前的文字处理系统大致可以分为两种:标记语言(Markup Language)式的,比如\LaTeX;所见即所得(WYSIWYG)式的,比如~MS Word\footnote{其实~Word~也有自己的标记语言域代码(field code),只是一般用户不了解。}。 28 | 29 | 一般而言,\LaTeX~相对于所见即所得系统有如下优点: 30 | \begin{itemize} 31 | \item 高质量\ 它制作的版面看起来更专业,数学公式尤其赏心悦目。 32 | \item 结构化\ 它的文档结构清晰。 33 | \item 批处理\ 它的源文件是文本文件,便于批处理,虽然解释(parse)源文件可能很费劲。 34 | \item 跨平台\ 它几乎可以运行于所有电脑硬件和操作系统平台。 35 | \item 免费\ 多数~\LaTeX~软件都是免费的,虽然也有一些商业软件。 36 | \end{itemize} 37 | 38 | 相应地,\LaTeX~的工作流程、设计原则,资源的缺乏,以及开发人员的历史局限性等种种原因也导致了一些缺陷: 39 | \begin{itemize} 40 | \item 制作过程繁琐,有时需要反复编译,不能直接或实时看到结果。 41 | \item 宏包鱼龙混杂,水准参差不齐,风格不够统一。 42 | \item 排版风格比较统一,但因而缺乏灵活性。 43 | \item 用户支持不够好,文档不完善。 44 | \item 对国际语言和字体的支持很差。 45 | \end{itemize} 46 | 47 | 抛开~MS Word~不谈,即使跟同为标记语言的~HTML/Web~系统相比,\LaTeX~也有一些不足之处。比如~Web~浏览器对~HTML~内容的渲染(render)比~DVI~浏览器对~\LaTeX~内容的渲染要快上许多,基本上可以算是实时。虽然~HTML~内容可能没有~LaTeX~那么复杂,但是~DVI~毕竟是已经被~\LaTeX~编译过的格式。 48 | 49 | 还有一点令人困惑的是,有一部分~\LaTeX~阵营的人士习惯于称对方为“邪恶的”或“出卖灵魂的”,如果昂贵的微软系统应当为人诟病,那么更贵的苹果系统为何却被人追捧? 50 | 51 | 2000~年有记者在采访~Lamport~时问:“为什么当前没有高质量的所见即所得排版系统?”他回答道:“门槛太高了,一个所见即所得系统要做到~\LaTeX~当前的水平,工作量之大不是单枪匹马所能完成\footnote{\TeX/\LaTeX~也不单单是那几个大腕儿完成的,他们背后还有众多默默无闻的小人物,比如当年~Knuth~手下的大批学生。此所谓一将功成万骨枯。}。微软那样的大公司可以做,但是市场太小了。我偶尔也会想加入“Dark Side”,让微软给我一组人马来开发一个这样的系统。”(包老师注:他果然于次年加入微软。) 52 | 53 | 窃以为这两大阵营其实是萝卜青菜的关系,与其抱残守缺、互相攻讦,不如各取所需;甚至可以捐弃前嫌、取长补短,共建和谐社会。 54 | 55 | \section{软件准备} 56 | \label{sec:latexsoft} 57 | 58 | \LaTeX~是一个软件系统,同时也是一套标准。遵照这些标准,实现了(implement)所要求功能的软件集合被称为发行版(distribution)。与此类似的例子有~Java~和~Linux,比如SUN、IBM、BEA~等公司都有自己的~Java~虚拟机(JVM),它们都被称作~Java~的实现;而Linux~有~Red Hat/~Fedora、Ubuntu、SuSE~等众多的发行版。 59 | 60 | \begin{table}[htbp] 61 | \caption{\LaTeX~发行版与编辑器} 62 | \label{tab:latexsoft} 63 | \centering 64 | \begin{tabular}{lll} 65 | \toprule 66 | 操作系统 & 发行版 & 编辑器 \\ 67 | \midrule 68 | Windows & \href{http://www.miktex.org/}{MikTeX} & \href{http://www.toolscenter.org/}{TeXnicCenter}、\href{http://www.winedt.com/}{WinEdt} \\ 69 | Unix/Linux & \href{http://www.tug.org/texlive/}{TeX Live} & \href{http://www.gnu.org/software/emacs/emacs.html}{Emacs}、\href{http://vim.sourceforge.net/}{vim}、\href{http://kile.sourceforge.net/}{Kile} \\ 70 | Mac OS & \href{http://www.tug.org/mactex/}{MacTeX} & \href{http://www.uoregon.edu/~koch/texshop/}{TeXShop} \\ 71 | \bottomrule 72 | \end{tabular} 73 | \end{table} 74 | 75 | \LaTeX~发行版只提供了一个~\LaTeX~后台处理机制,用户还需要一个前台编辑器来编辑它的源文件。常用的~\LaTeX~发行版和编辑器见\fref{tab:latexsoft}。在使用~\LaTeX~的过程中可能还需要其它一些软件,将在后面相关章节中分别介绍。 76 | 77 | \section{学习方法} 78 | \begin{quotation} 79 | 在科学上没有平坦的大道,只有那些不畏劳苦沿着陡峭山路攀登的人,才有希望达到光辉的顶点。 80 | \begin{flushright} 81 | ---~卡尔·马克思 82 | \end{flushright} 83 | \end{quotation} 84 | 85 | \begin{quotation} 86 | 无他,唯手熟尔。 87 | \begin{flushright} 88 | ---~卖油翁 89 | \end{flushright} 90 | \end{quotation} 91 | 92 | \begin{quotation} 93 | 用心。 94 | \begin{flushright} 95 | ---~斯蒂芬·周 96 | \end{flushright} 97 | \end{quotation} 98 | 99 | 限于篇幅和水平,本文只能提供一个概览外加一些八卦。比较严谨的入门资料有~Tobias Oetiker~的《A (Not So) Short Introduction to \LaTeXe》\citep{Oetiker_2008}(简称lshort);若想对~\LaTeX~有更深入全面的了解,可以拜读~Mittelbach~的《The \LaTeX~ Companion》\citep{Mittelbach_2004}。 100 | 101 | 中文资料可参考李果正的《大家来学~\LaTeX》\citep{Lee_2004},lshort~有吴凌云等人翻译的中文版本\footnote{此译本首发于~CTeX~论坛,但是需要注册才能看见链接,所以请读者自行搜索。}。 102 | 103 | \href{http://www.ctan.org/}{Comprehensive TeX Archive Network}(CTAN)和~\href{http://www.tug.org/}{TeX Users Group}~(TUG)提供了权威、丰富的资源。 104 | 105 | \href{http://www.text.ac.uk/}{英国TUG}~和~\href{http://www.ctex.org}{CTeX}~分别提供了常见问题集(FAQ)\citep{UKTUG_FAQ,CTeX_FAQ},一般问题多会在这里找到答案。 106 | 107 | 中文~\TeX~论坛有\href{http://www.smth.org/bbsdoc.php?board=TeX}{水木清华~BBS TeX~版}、\href{http://bbs.ctex.org/}{CTeX~论坛}。 108 | 109 | \bibliographystyle{unsrtnat} 110 | \bibliography{reading} 111 | \newpage 112 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/lnotes.tex: -------------------------------------------------------------------------------- 1 | \documentclass[11pt]{book} 2 | 3 | %\usepackage{lnote} 4 | 5 | \usepackage{CJKutf8,CJKnumb} 6 | %\usepackage{CJKpunct} %a homemade package 7 | 8 | \usepackage{fancyhdr} 9 | \usepackage{titlesec} 10 | 11 | \usepackage{indentfirst} 12 | \usepackage{paralist} 13 | \usepackage{verbatim} 14 | 15 | \usepackage[plain]{fancyref} 16 | \usepackage[bookmarksnumbered,dvipdfmx,unicode, pdfborder=1,breaklinks,colorlinks,linkcolor=RoyalBlue3,urlcolor=blue]{hyperref} 17 | \usepackage{makeidx} 18 | 19 | \usepackage{mflogo,texnames} 20 | \usepackage{textcomp} 21 | 22 | \usepackage{amsmath,amsfonts,amsthm} 23 | 24 | \usepackage[x11names]{xcolor} %must before tikz, x11names defines RoyalBlue3 25 | \usepackage{graphicx} 26 | %\usepackage{ps4pdf} %conflict with tabularx 27 | \usepackage{pstricks,pst-plot,pst-eps} 28 | \usepackage{subfig} 29 | \def\pgfsysdriver{pgfsys-dvipdfmx.def} %put before tikz 30 | \usepackage{tikz} 31 | 32 | \usepackage{booktabs,tabularx,multirow,colortbl,longtable} 33 | 34 | \usepackage{chapterbib} 35 | \usepackage[sectionbib,super,square,sort&compress]{natbib} 36 | 37 | 38 | %中文设置 39 | \newcommand{\song}{\CJKfamily{usong}} 40 | \newcommand{\fang}{\CJKfamily{ufang}} 41 | \newcommand{\kai}{\CJKfamily{ukai}} 42 | \newcommand{\hei}{\CJKfamily{uhei}} 43 | 44 | %\AtBeginDvi{\special{pdf:tounicode GBK-EUC-UCS2}} %not necessary if use UTF8. 45 | 46 | %行距 47 | \renewcommand{\baselinestretch}{1.25} 48 | 49 | %页眉页脚 50 | \pagestyle{fancy} 51 | \fancyhf{} 52 | \fancyhead[LE,RO]{\thepage} 53 | \fancyhead[RE]{\leftmark} 54 | \fancyhead[LO]{\rightmark} 55 | \fancypagestyle{plain}{%设置plain页格式 56 | \fancyhf{} 57 | \renewcommand{\headrulewidth}{0pt} 58 | } 59 | 60 | %章节 61 | \renewcommand{\chaptername}{第\CJKnumber{\thechapter}章} 62 | \newcommand{\sectionname}{节} 63 | \renewcommand{\figurename}{图} 64 | \renewcommand{\tablename}{表} 65 | \renewcommand{\bibname}{参考文献} 66 | \renewcommand{\contentsname}{目~录} 67 | \renewcommand{\listfigurename}{图~目~录} 68 | \renewcommand{\listtablename}{表~目~录} 69 | \renewcommand{\indexname}{索~引} 70 | \titleformat{\chapter}[block]{\center\Huge}{\chaptername}{20pt}{} 71 | 72 | \makeindex 73 | 74 | %空白页 75 | \makeatletter 76 | \def\cleardoublepage{ 77 | \clearpage\if@twoside\ifodd\c@page\else 78 | \hbox{} 79 | \vspace*{\fill} 80 | \begin{center} 81 | 看什么看,没见过空白页? 82 | \end{center} 83 | \vspace{\fill} 84 | \thispagestyle{empty} 85 | \newpage 86 | \if@twocolumn\hbox{}\newpage\fi\fi\fi 87 | } 88 | \makeatother 89 | 90 | %Code demo 91 | \makeatletter 92 | \newenvironment{mycode}{ 93 | \noindent 94 | \newsavebox{\mybox} 95 | \begin{lrbox}{\mybox} 96 | \begin{minipage}[c]{.945\textwidth} 97 | \begin{verbatim} 98 | }{ 99 | \end{verbatim} 100 | \end{minipage} 101 | \end{lrbox}% 102 | \setlength{\fboxsep}{8pt} 103 | \colorbox{demo@bgcolor}{\usebox{\mybox}} 104 | \setlength{\fboxsep}{\oldfboxsep} 105 | } 106 | 107 | \newenvironment{myoutput}{ 108 | \noindent 109 | \begin{lrbox}{\@tempboxa} 110 | \begin{minipage}[c]{.945\textwidth} 111 | }{ 112 | \end{minipage} 113 | \end{lrbox}% 114 | \setlength{\fboxsep}{8pt} 115 | \fbox{\usebox{\@tempboxa}} 116 | \setlength{\fboxsep}{\oldfboxsep} 117 | } 118 | \makeatother 119 | 120 | 121 | \definecolor{demo@bgcolor}{gray}{.8} 122 | \let\oldfboxsep\fboxsep 123 | \newwrite\file 124 | \newsavebox{\mybox} 125 | 126 | \makeatletter 127 | \def\demo@start{ 128 | \begingroup% Lets Keep the Changes Local 129 | \@bsphack 130 | \immediate\openout \file \jobname.exa 131 | \let\do\@makeother\dospecials 132 | \catcode`\^^M\active 133 | \def\verbatim@processline{ 134 | \immediate\write\file{\the\verbatim@line} 135 | } 136 | \verbatim@start 137 | } 138 | 139 | \def\demo@end{\immediate\closeout\file\@esphack\endgroup} 140 | 141 | \def\demo@code#1#2{% 142 | \setlength{\fboxsep}{8pt}% 143 | \colorbox{#1}{% 144 | \begin{minipage}[c]{#2} 145 | \setlength{\fboxsep}{\oldfboxsep} 146 | \small\verbatiminput{\jobname.exa} 147 | \end{minipage}% 148 | }% 149 | } 150 | 151 | \def\demo@out#1{% 152 | \setlength{\fboxsep}{8pt}% 153 | \fbox{% 154 | \begin{minipage}[c]{#1} 155 | \setlength{\fboxsep}{\oldfboxsep} 156 | \small\input{\jobname.exa} 157 | \end{minipage}% 158 | }% 159 | } 160 | 161 | \newenvironment{code}{ 162 | \demo@start 163 | }{ 164 | \demo@end 165 | \list{}{\itemindent-\leftmargin} 166 | \item 167 | \demo@code{demo@bgcolor}{.95\textwidth} 168 | \endlist 169 | } 170 | 171 | \newenvironment{halfcode}{ 172 | \demo@start 173 | }{ 174 | \demo@end 175 | \list{}{\itemindent-\leftmargin} 176 | \item 177 | \demo@code{demo@bgcolor}{.52\textwidth} 178 | \endlist 179 | } 180 | 181 | \newenvironment{out}{ 182 | \demo@start 183 | }{ 184 | \demo@end 185 | \list{}{\itemindent-\leftmargin} 186 | \item 187 | \demo@out{.95\textwidth} 188 | \endlist 189 | } 190 | 191 | \newenvironment{demo}{ 192 | \demo@start 193 | }{ 194 | \demo@end 195 | \list{}{\itemindent-\leftmargin} 196 | \item 197 | \makebox[\textwidth][c]{% 198 | \demo@code{demo@bgcolor}{.52\textwidth}% 199 | \hspace{10pt}% 200 | \demo@out{.36\textwidth}% 201 | } 202 | \endlist 203 | } 204 | 205 | \newenvironment{fdemo}[1]{ 206 | \begin{lrbox}{\mybox}% 207 | \setlength{\fboxsep}{8pt}% 208 | \fbox{% 209 | \begin{minipage}[c]{.36\textwidth} 210 | \setlength{\fboxsep}{\oldfboxsep} 211 | \small{#1} 212 | \end{minipage}% 213 | }% 214 | \end{lrbox} 215 | \demo@start 216 | }{ 217 | \demo@end 218 | \list{}{\itemindent-\leftmargin} 219 | \item 220 | \makebox[\textwidth][c]{% 221 | \demo@code{demo@bgcolor}{0.52\textwidth}% 222 | \hspace{10pt}% 223 | \usebox{\mybox}% 224 | } 225 | \endlist 226 | } 227 | \makeatother 228 | 229 | \def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0 230 | \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}} 231 | \def\XeTeX{\leavevmode 232 | \setbox0=\hbox{X\lower.5ex\hbox{\kern-.15em\reflect{E}}\kern-.1667em \TeX}% 233 | \dp0=0pt\ht0=0pt\box0 } 234 | 235 | %图形设置 236 | \DeclareGraphicsExtensions{.eps,.mps,.pdf,.jpg,.png} 237 | 238 | \usetikzlibrary{arrows,decorations,positioning} 239 | \pgfsetxvec{\pgfpoint{10pt}{0}} 240 | \pgfsetyvec{\pgfpoint{0}{10pt}} 241 | \tikzset{ 242 | box/.style={rectangle,rounded corners=6pt, 243 | minimum width=40pt, minimum height=20pt, inner sep=6pt, 244 | draw=gray,thick,fill=lightgray}, 245 | arrow/.style={->, shorten >=1pt, >=stealth', semithick}, 246 | larrow/.style={->, shorten >=1pt, >=stealth', semithick}, 247 | bloop/.style={semithick, to path={-- ++(0,-35pt) -| (\tikztotarget)}}, 248 | rloop/.style={semithick, to path={-- ++(10pt,0) |- (\tikztotarget)}} 249 | } 250 | 251 | \begin{document} 252 | \begin{CJK*}{UTF8}{usong} 253 | \CJKindent %can only be used in the CJK environment 254 | \CJKtilde 255 | 256 | \frontmatter 257 | 258 | \title{\Huge\LaTeX~ Notes v~1.20} 259 | \author{Alpha Huang\footnote{\url{http://www.dralpha.com/}}} 260 | \date{2008年7月26日} 261 | \maketitle 262 | 263 | 264 | %\setcitestyle{numbers,square} 265 | 266 | %前言页眉 267 | \renewcommand{\chaptermark}[1]{\markboth{#1}{}} 268 | 269 | \include{preface} 270 | \tableofcontents 271 | 272 | \mainmatter 273 | %正文页眉 274 | \renewcommand{\chaptermark}[1]{\markboth{\chaptername\ #1}{}} 275 | \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}} 276 | 277 | \include{introduction} 278 | \include{basics} 279 | \include{math} 280 | \include{graphics} 281 | \include{tables} 282 | \include{misc} 283 | \include{i18n} 284 | \include{fonts} 285 | 286 | \backmatter 287 | \include{postcript} 288 | 289 | %chapter*{索引} 290 | %\printindex 291 | 292 | \newpage 293 | 294 | \end{CJK*} 295 | 296 | \end{document} -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/postcript.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~和~Lua\TeX。 -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/preface.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{此处用法循阿扁古例。}的资料,未免考虑不周挂一漏万,或有误导,敬请海涵。若有高手高手高高手略拨闲暇指点一二,在下感激不尽\footnote{\href{mailto:huang.xingang@gmail.com}{huang.xingang@gmail.com}} 29 | 。 30 | 31 | 借此感谢一下老妻,如果不是伊天天看韩剧,包老师也不会有时间灌水和整理这份笔记。 32 | -------------------------------------------------------------------------------- /latex-notes-zh-cn/src/tables.tex: -------------------------------------------------------------------------------- 1 | \chapter{表格} 2 | \label{sec:tables} 3 | 4 | \section{简单表格} 5 | \verb|tabular|~环境提供了最简单的表格功能。它用~\verb|\hline|~命令代表横线,\verb+|+~代表竖线,用~\verb|&|~来分栏。每个栏位的对齐方式可以用~l、c、r(左中右)来控制。 6 | \begin{code} 7 | \begin{tabular}{|l|c|r|} 8 | \hline 9 | 操作系统 & 发行版 & 编辑器 \\ 10 | \hline 11 | Windows & MikTeX & TeXnicCenter \\ 12 | \hline 13 | Unix/Linux & TeX Live & Emacs \\ 14 | \hline 15 | Mac OS & MacTeX & TeXShop \\ 16 | \hline 17 | \end{tabular} 18 | \end{code} 19 | 20 | \begin{tabular}{|l|c|r|} 21 | \hline 22 | 操作系统 & 发行版 & 编辑器 \\ 23 | \hline 24 | Windows & MikTeX & TeXnicCenter \\ 25 | \hline 26 | Unix/Linux & TeX Live & Emacs \\ 27 | \hline 28 | Mac OS & MacTeX & TeXShop \\ 29 | \hline 30 | \end{tabular} 31 | \ \\ 32 | 33 | 和针对插图的~\verb|figure|~环境类似,\LaTeX~还有另一个针对表格的浮动环境~\verb|table|。我们可以用它给上面的示例穿件马甲,顺便把表格简化为科技文献中常用的三线表。 34 | 35 | \begin{code} 36 | \begin{table}[htbp] 37 | \caption{浮动环境中的三线表} 38 | \label{tab:threesome} 39 | \centering 40 | \begin{tabular}{lll} 41 | \hline 42 | 操作系统 & 发行版 & 编辑器 \\ 43 | \hline 44 | Windows & MikTeX & TeXnicCenter \\ 45 | Unix/Linux & TeX Live & Emacs \\ 46 | Mac OS & MacTeX & TeXShop \\ 47 | \hline 48 | \end{tabular} 49 | \end{table} 50 | \end{code} 51 | 52 | \begin{table}[htbp] 53 | \caption{浮动环境中的三线表} 54 | \label{tab:threesome} 55 | \centering 56 | \begin{tabular}{lll} 57 | \hline 58 | 操作系统 & 发行版 & 编辑器 \\ 59 | \hline 60 | Windows & MikTeX & TeXnicCenter \\ 61 | Unix/Linux & TeX Live & Emacs \\ 62 | Mac OS & MacTeX & TeXShop \\ 63 | \hline 64 | \end{tabular} 65 | \end{table} 66 | 67 | 完美主义者可能觉得上面示例中的三条线一样粗不够美观,这时可以使用~\verb|booktabs|~宏包\citep{Fear_2005}的几个命令。 68 | 69 | \begin{code} 70 | \begin{table}[htbp] 71 | \caption{浮动环境中的三线表} 72 | \centering 73 | \begin{tabular}{lll} 74 | \toprule 75 | 操作系统 & 发行版 & 编辑器 \\ 76 | \midrule 77 | Windows & MikTeX & TeXnicCenter \\ 78 | Unix/Linux & TeX Live & Emacs \\ 79 | \end{code} 80 | 81 | \begin{code} 82 | Mac OS & MacTeX & TeXShop \\ 83 | \bottomrule 84 | \end{tabular} 85 | \end{table} 86 | \end{code} 87 | 88 | \begin{table}[htbp] 89 | \caption{\texttt{booktabs}~宏包的效果} 90 | \centering 91 | \begin{tabular}{lll} 92 | \toprule 93 | 操作系统 & 发行版 & 编辑器 \\ 94 | \midrule 95 | Windows & MikTeX & TeXnicCenter \\ 96 | Unix/Linux & TeX Live & Emacs \\ 97 | Mac OS & MacTeX & TeXShop \\ 98 | \bottomrule 99 | \end{tabular} 100 | \end{table} 101 | 102 | \section{表格宽度} 103 | 有时我们需要控制某栏位宽度,可以将其对齐方式参数从~\verb|l、c、r|~改为~\verb|p{宽度}|~。 104 | \begin{code} 105 | \begin{table}[htbp] 106 | \caption{控制栏位宽度} 107 | \centering 108 | \begin{tabular}{p{100pt}p{100pt}p{100pt}} 109 | \toprule 110 | 操作系统 & 发行版 & 编辑器 \\ 111 | \midrule 112 | Windows & MikTeX & TeXnicCenter \\ 113 | Unix/Linux & TeX Live & Emacs \\ 114 | Mac OS & MacTeX & TeXShop \\ 115 | \bottomrule 116 | \end{tabular} 117 | \end{table} 118 | \end{code} 119 | 120 | \begin{table}[htbp] 121 | \caption{控制栏位宽度} 122 | \centering 123 | \begin{tabular}{p{100pt}p{100pt}p{100pt}} 124 | \toprule 125 | 操作系统 & 发行版 & 编辑器 \\ 126 | \midrule 127 | Windows & MikTeX & TeXnicCenter \\ 128 | Unix/Linux & TeX Live & Emacs \\ 129 | Mac OS & MacTeX & TeXShop \\ 130 | \bottomrule 131 | \end{tabular} 132 | \end{table} 133 | 134 | 若想控制整个表格的宽度可以使用~\verb|tabularx|~宏包,\verb|X|~参数表示某栏可以折行。 135 | 136 | \begin{code} 137 | \begin{table}[htbp] 138 | \caption{控制表格宽度} 139 | \centering 140 | \begin{tabularx}{350pt}{lXlX} 141 | \toprule 142 | 李白 & 平林漠漠烟如织,寒山一带伤心碧。暝色入高楼,有人楼上愁。玉梯空伫立,宿鸟归飞急。何处是归程,长亭更短亭。& 143 | 泰戈尔 & 夏天的飞鸟,飞到我的窗前唱歌,又飞去了。秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。\\ 144 | \bottomrule 145 | \end{tabularx} 146 | \end{table} 147 | \end{code} 148 | 149 | \begin{table}[htbp] 150 | \caption{控制表格宽度} 151 | \centering 152 | \begin{tabularx}{350pt}{lXlX} 153 | \toprule 154 | 李白 & 平林漠漠烟如织,寒山一带伤心碧。暝色入高楼,有人楼上愁。玉阶空伫立,宿鸟归飞急。何处是归程,长亭更短亭。& 155 | 泰戈尔 & 夏天的飞鸟,飞到我的窗前唱歌,又飞去了。秋天的黄叶,它们没有什么可唱,只叹息一声,飞落在那里。\\ 156 | \bottomrule 157 | \end{tabularx} 158 | \end{table} 159 | 160 | \section{跨行、跨列表格} 161 | 有时某栏需要横跨几列,我们可以使用~\verb|\multicolumn|~命令。它的前两个参数指定横跨列数和对齐方式。\verb|booktabs|~宏包的~\verb|\cmidrule|~命令用于横跨几列的横线。 162 | \begin{code} 163 | \begin{table}[htbp] 164 | \caption{跨栏表格} 165 | \centering 166 | \begin{tabular}{lll} 167 | \toprule 168 | & \multicolumn{2}{c}{常用工具} \\ 169 | \cmidrule{2-3} 170 | 操作系统 & 发行版 & 编辑器 \\ 171 | \midrule 172 | Windows & MikTeX & TeXnicCenter \\ 173 | Unix/Linux & TeX Live & Emacs \\ 174 | Mac OS & MacTeX & TeXShop \\ 175 | \bottomrule 176 | \end{tabular} 177 | \end{table} 178 | \end{code} 179 | 180 | \begin{table}[htbp] 181 | \caption{跨栏表格} 182 | \centering 183 | \begin{tabular}{lll} 184 | \toprule 185 | & \multicolumn{2}{c}{常用工具} \\ 186 | \cmidrule{2-3} 187 | 操作系统 & 发行版 & 编辑器 \\ 188 | \midrule 189 | Windows & MikTeX & TeXnicCenter \\ 190 | Unix/Linux & TeX Live & Emacs \\ 191 | Mac OS & MacTeX & TeXShop \\ 192 | \bottomrule 193 | \end{tabular} 194 | \end{table} 195 | 196 | 跨行表格需要使用~\verb|multirow|~宏包,\verb|\multirow|~命令的前两个参数是竖跨的行数和宽度。 197 | \begin{code} 198 | \usepackage{multirow} 199 | ... 200 | \begin{table}[htbp] 201 | \caption{跨行表格} 202 | \centering 203 | \begin{tabular}{lllc} 204 | \end{code} 205 | \begin{code} 206 | \toprule 207 | 操作系统 & 发行版 & 编辑器 & 用户体验\\ 208 | \midrule 209 | Windows & MikTeX & TeXnicCenter & 210 | \multirow{3}{*}{\centering 爽} \\ 211 | Unix/Linux & TeX Live & Emacs \\ 212 | Mac OS & MacTeX & TeXShop \\ 213 | \bottomrule 214 | \end{tabular} 215 | \end{table} 216 | \end{code} 217 | 218 | \begin{table}[htbp] 219 | \caption{跨行表格} 220 | \centering 221 | \begin{tabular}{lllc} 222 | \toprule 223 | 操作系统 & 发行版 & 编辑器 & 用户体验 \\ 224 | \midrule 225 | Windows & MikTeX & TeXnicCenter & 226 | \multirow{3}{*}{\centering 爽} \\ 227 | Unix/Linux & TeX Live & Emacs \\ 228 | Mac OS & MacTeX & TeXShop \\ 229 | \bottomrule 230 | \end{tabular} 231 | \end{table} 232 | 233 | \section{彩色表格} 234 | 彩色表格需要使用~\verb|colortbl|~宏包\citep{Carlisle_2001}提供的一些命令:\verb|\columncolor|、~\verb|\rowcolor|、\verb|\cellcolor|~等。 235 | \begin{code} 236 | \usepackage{colortbl} 237 | ... 238 | \begin{table}[htbp] 239 | \caption{彩色表格} 240 | \centering 241 | \begin{tabular}{lll} 242 | \toprule 243 | 操作系统 & 发行版 & 编辑器 \\ 244 | \midrule 245 | Windows & MikTeX & TeXnicCenter \\ 246 | \end{code} 247 | \begin{code} 248 | \rowcolor[gray]{.8} Unix/Linux & TeX Live & Emacs \\ 249 | Mac OS & MacTeX & TeXShop \\ 250 | \bottomrule 251 | \end{tabular} 252 | \end{table} 253 | \end{code} 254 | 255 | \begin{table}[htbp] 256 | \caption{彩色表格} 257 | \centering 258 | \begin{tabular}{lll} 259 | \toprule 260 | 操作系统 & 发行版 & 编辑器 \\ 261 | \midrule 262 | Windows & MikTeX & TeXnicCenter \\ 263 | \rowcolor[gray]{.8} Unix/Linux & TeX Live & Emacs \\ 264 | Mac OS & MacTeX & TeXShop \\ 265 | \bottomrule 266 | \end{tabular} 267 | \end{table} 268 | 269 | \section{长表格} 270 | 有时表格太长要跨页,可以使用~\verb|longtable|~宏包\citep{Carlisle_2004}。\verb|\endfirsthead|、~\verb|\endhead|~命令用来定义首页表头和通用表头,\verb|\endfoot|、\verb|\endlastfoot|~命令用来定义通用表尾和末页表尾。 271 | \begin{code} 272 | \usepackage{longtable} 273 | ... 274 | \begin{longtable}{ll} 275 | \caption{长表格} \\ 276 | \toprule 277 | 作者 & 作品 \\ 278 | \midrule 279 | \endfirsthead 280 | \midrule 281 | 作者 & 作品 \\ 282 | \midrule 283 | \endhead 284 | \midrule 285 | \multicolumn{2}{r}{接下页\dots} \\ 286 | \end{code} 287 | \begin{code} 288 | \endfoot 289 | \bottomrule 290 | \endlastfoot 291 | 白居易 & 汉皇重色思倾国,\\ 292 | & 御宇多年求不得。\\ 293 | & 杨家有女初长成,\\ 294 | & 养在深闺人未识。\\ 295 | & 天生丽质难自弃,\\ 296 | & 一朝选在君王侧。\\ 297 | & 回眸一笑百媚生,\\ 298 | & 六宫粉黛无颜色。\\ 299 | & 春寒赐浴华清池,\\ 300 | & 温泉水滑洗凝脂。\\ 301 | & 侍儿扶起娇无力,\\ 302 | & 始是新承恩泽时。\\ 303 | & 云鬓花颜金步摇,\\ 304 | & 芙蓉帐暖度春宵。\\ 305 | & 春宵苦短日高起,\\ 306 | & 从此君王不早朝。\\ 307 | \end{longtable} 308 | \end{code} 309 | 310 | \begin{longtable}{ll} 311 | \caption{长表格} \\ 312 | \toprule 313 | 作者 & 作品 \\ 314 | \midrule 315 | \endfirsthead 316 | \midrule 317 | 作者 & 作品 \\ 318 | \midrule 319 | \endhead 320 | \midrule 321 | \multicolumn{2}{r}{接下页\dots} \\ 322 | \endfoot 323 | \bottomrule 324 | \endlastfoot 325 | 白居易 & 汉皇重色思倾国,\\ 326 | & 御宇多年求不得。\\ 327 | & 杨家有女初长成,\\ 328 | & 养在深闺人未识。\\ 329 | & 天生丽质难自弃,\\ 330 | & 一朝选在君王侧。\\ 331 | & 回眸一笑百媚生,\\ 332 | & 六宫粉黛无颜色。\\ 333 | & 春寒赐浴华清池,\\ 334 | & 温泉水滑洗凝脂。\\ 335 | & 侍儿扶起娇无力,\\ 336 | & 始是新承恩泽时。\\ 337 | & 云鬓花颜金步摇,\\ 338 | & 芙蓉帐暖度春宵。\\ 339 | & 春宵苦短日高起,\\ 340 | & 从此君王不早朝。\\ 341 | \end{longtable} 342 | 343 | \bibliographystyle{unsrtnat} 344 | \bibliography{reading} 345 | \newpage 346 | -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib1.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib2.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib3.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib4.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib5.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib6.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib7.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/figures/natbib8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/figures/natbib8.PNG -------------------------------------------------------------------------------- /natbib-zh-cn/natbib-zh/natbib-zh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CTeX-org/ctex-doc/3bb32901566a2c20fe95b59e83b4b5bd802c7064/natbib-zh-cn/natbib-zh/natbib-zh.pdf -------------------------------------------------------------------------------- /ttb-zh-cn/Makefile: -------------------------------------------------------------------------------- 1 | ## Makefile 2 | ## Copyright 2003-2005 Nicolas Markey 3 | # 4 | # This work may be distributed and/or modified under the 5 | # conditions of the LaTeX Project Public License, either version 1.3 6 | # of this license or (at your option) any later version. 7 | # The latest version of this license is in 8 | # http://www.latex-project.org/lppl.txt 9 | # and version 1.3 or later is part of all distributions of LaTeX 10 | # version 2003/12/01 or later. 11 | # 12 | # This work has the LPPL maintenance status "maintained". 13 | # The Current Maintainer of this work is Nicolas Markey 14 | 15 | all: 16 | LATEX=xelatex make tex 17 | 18 | tex: *.tex 19 | ${LATEX} ttb-zh-cn.tex 20 | makeindex -s idxstyle.ist bibtex 21 | makeindex -s idxstyle.ist latex 22 | bibtex ttb-zh-cn 23 | ${LATEX} ttb-zh-cn.tex 24 | ${LATEX} ttb-zh-cn.tex 25 | 26 | clean: 27 | rm -f *.aux ttb-zh-cn.log ttb-zh-cn.blg *.ilg *.ind *.idx \ 28 | ttb-zh-cn.bbl ttb-zh-cn.toc ttb-zh-cn.dvi ttb-zh-cn.out \ 29 | ttb-zh-cn.ptc* ttb-zh-cn.mtc* ttb-zh-cn.bmt * 30 | ~ 31 | -------------------------------------------------------------------------------- /ttb-zh-cn/idxstyle.ist: -------------------------------------------------------------------------------- 1 | %% idxstyle.ist 2 | %% Copyright 2003-2005 Nicolas Markey 3 | % 4 | % This work may be distributed and/or modified under the 5 | % conditions of the LaTeX Project Public License, either version 1.3 6 | % of this license or (at your option) any later version. 7 | % The latest version of this license is in 8 | % http://www.latex-project.org/lppl.txt 9 | % and version 1.3 or later is part of all distributions of LaTeX 10 | % version 2003/12/01 or later. 11 | % 12 | % This work has the LPPL maintenance status "maintained". 13 | % The Current Maintainer of this work is Nicolas Markey 14 | % 15 | % This work consists of the files 16 | % ttb_en.tex 17 | % ttb_en.sec1.tex ttb_en.sec2.tex ttb_en.sec3.tex 18 | % ttb_en.sec4.tex ttb_en.sec5.tex ttb_style.sty 19 | % local.bib idxstyle.ist Makefile 20 | % and the derived ttb_en.dvi, ttb_en.ps and ttb_en.pdf 21 | % 22 | % 23 | % This file is derived from fridx1.ist: 24 | % FICHIER fridx1.ist 25 | % Personnalisation Numero 1 d'un index (faire makeindex -s fridx1.ist) 26 | % -------------------------------------------------------------------- 27 | 28 | headings_flag 1 29 | heading_prefix "{\\large \\bf \\hfil--\\ " 30 | heading_suffix " --\\ \\hfil}\\nopagebreak\n" 31 | symhead_negative "symbols" 32 | symhead_positive "Symbols" 33 | 34 | delim_0 " \\dotfill \ " 35 | delim_1 " \\dotfill \ " 36 | delim_2 " \\dotfill \ " 37 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 | 39 | 40 | -------------------------------------------------------------------------------- /ttb-zh-cn/local.bib: -------------------------------------------------------------------------------- 1 | %% local.bib 2 | %% Copyright 2003-2005 Nicolas Markey 3 | % 4 | % This work may be distributed and/or modified under the 5 | % conditions of the LaTeX Project Public License, either version 1.3 6 | % of this license or (at your option) any later version. 7 | % The latest version of this license is in 8 | % http://www.latex-project.org/lppl.txt 9 | % and version 1.3 or later is part of all distributions of LaTeX 10 | % version 2003/12/01 or later. 11 | % 12 | % This work has the LPPL maintenance status "maintained". 13 | % The Current Maintainer of this work is Nicolas Markey 14 | % 15 | % This work consists of the files 16 | % ttb_en.tex 17 | % ttb_en.sec1.tex ttb_en.sec2.tex ttb_en.sec3.tex 18 | % ttb_en.sec4.tex ttb_en.sec5.tex 19 | % local.bib idxstyle.ist Makefile 20 | % and the derived ttb_en.dvi, ttb_en.ps and ttb_en.pdf 21 | 22 | @book{latex:dps, 23 | author = "Lamport, Leslie", 24 | title = "{{\LaTeX}}: a Document Preparation System", 25 | publisher = "Addison-Wesley", 26 | year = 1997, 27 | month = mar, 28 | } 29 | 30 | @book{latex:lc, 31 | title = "The {{\LaTeX}} Companion", 32 | author = "Goossens, Michel and Mittelbach, Frank and Samarin, 33 | Alexander", 34 | publisher = "Addison-Wesley", 35 | year = 1993, 36 | month = dec, 37 | } 38 | 39 | @book{latex:lc2, 40 | title = "The {{\LaTeX}} Companion~--- Second Edition", 41 | author = "Mittelbach, Frank and Goossens, Michel and 42 | Braams, Johannes and Carlisle, David and Rowley, Chris", 43 | publisher = "Addison-Wesley", 44 | year = 2004, 45 | month = apr, 46 | } 47 | 48 | 49 | @manual{natbib, 50 | author = "Daly, Patrick W.", 51 | title = "Natural Sciences Citations and References", 52 | year = 1999, 53 | month = may, 54 | } 55 | 56 | @manual{bibentry, 57 | author = "Daly, Patrick W.", 58 | title = "A {{\LaTeX}} Package to Place Bibliography Entries in Text", 59 | year = 1999, 60 | month = feb, 61 | } 62 | 63 | @manual{multibib, 64 | author = "Hansen, Thorsten", 65 | title = "The {\textbf{multibib}} package", 66 | year = 2000, 67 | month = jan, 68 | } 69 | 70 | @manual{bibunit, 71 | author = "Hansen, Thorsten", 72 | title = "The {\textbf{bibunits}} package", 73 | year = 2000, 74 | month = oct, 75 | } 76 | 77 | @manual{footbib, 78 | author = "Dommenjoud, {\'E}ric", 79 | title = "The {\textbf{footbib}} package", 80 | year = 1997, 81 | month = mar, 82 | } 83 | 84 | @manual{merlin, 85 | author = "Daly, Patrick W.", 86 | title = "A Master Bibliographic Style File", 87 | year = 1999, 88 | month = may, 89 | } 90 | 91 | @manual{splitbib, 92 | author = "Markey, Nicolas", 93 | title = "The {\textbf{splitbib}} package", 94 | year = 2005, 95 | month = feb, 96 | } 97 | 98 | @manual{jurabib, 99 | author = "Berger, Jens", 100 | title = "The {\textbf{jurabib}} package", 101 | year = 2002, 102 | month = sep, 103 | } 104 | 105 | @manual{jmpl, 106 | author = "Bayart, Benjamin", 107 | title = "Joli Manuel pour {{\LaTeX}}", 108 | year = 1995, 109 | month = dec, 110 | } 111 | 112 | @book{desg, 113 | title = "{{\LaTeX}}~: Apprentissage, Guide et R{\'e}f{\'e}rences", 114 | author = "Desgraupes, Bernard", 115 | publisher = "Vuibert", 116 | year = 2000, 117 | month = nov, 118 | } 119 | 120 | @manual{btxdoc, 121 | author = "Patashnik, Oren", 122 | title = "{\textsc{Bib}}{{\TeX}}ing", 123 | year = 1988, 124 | month = feb, 125 | } 126 | 127 | @manual{btxhak, 128 | author = "Patashnik, Oren", 129 | title = "Designing {\textsc{Bib}}{{\TeX}} styles", 130 | year = 1988, 131 | month = feb, 132 | } 133 | -------------------------------------------------------------------------------- /ttb-zh-cn/ttb_style.sty: -------------------------------------------------------------------------------- 1 | %% ttb_style.sty 2 | %% Copyright 2003-2005 Nicolas Markey 3 | % 4 | % This work may be distributed and/or modified under the 5 | % conditions of the LaTeX Project Public License, either version 1.3 6 | % of this license or (at your option) any later version. 7 | % The latest version of this license is in 8 | % http://www.latex-project.org/lppl.txt 9 | % and version 1.3 or later is part of all distributions of LaTeX 10 | % version 2003/12/01 or later. 11 | % 12 | % This work has the LPPL maintenance status "maintained". 13 | % The Current Maintainer of this work is Nicolas Markey 14 | % 15 | % This work consists of the files 16 | % ttb_en.tex 17 | % ttb_en.sec1.tex ttb_en.sec2.tex ttb_en.sec3.tex 18 | % ttb_en.sec4.tex ttb_en.sec5.tex ttb_style.sty 19 | % local.bib idxstyle.ist Makefile 20 | % and the derived ttb_en.dvi, ttb_en.ps and ttb_en.pdf 21 | 22 | 23 | \RequirePackage{xspace} 24 | \RequirePackage{boxedminipage} 25 | 26 | %\let\nospaceTeX\TeX 27 | %\def\TeX{\nospaceTeX\xspace} 28 | \def\bt{Bib\TeX\xspace} 29 | \let\nospaceLaTeX\LaTeX 30 | \def\LaTeX{\nospaceLaTeX\xspace} 31 | \def\gomo{\emph{grosso modo}\xspace} 32 | \def\ie{ie.\xspace} 33 | \def\cf{cf. } 34 | \catcode`\*=0 35 | *catcode`*\=11 36 | *def*bs{\} 37 | *catcode`*\=0 38 | \catcode`\*=12 39 | \def\at{@} 40 | \catcode`\$=11 41 | \def\dol{$} 42 | \catcode`\$=3 %$ 43 | \def\cmd#1{\index{latex}{#1@\texttt{\protect\bs #1}}{\ttfamily \bs #1}\xspace} 44 | \def\cmdat#1{\index{latex}{#1@\texttt{\protect\bs\protect\at #1}}{\ttfamily \bs\at #1}\xspace} 45 | \def\env#1{\index{latex}{#1@\texttt{#1}}{\ttfamily #1}\xspace} 46 | \def\ext#1{{\ttfamily .#1}\xspace} 47 | 48 | \def\sty{\@ifnextchar[{\@sty}{\@sty[sty]}} 49 | \def\@sty[#1]#2{\index{latex}{#2@\textsf{#2.#1}}{\sffamily #2.#1}\xspace} 50 | 51 | \def\cls#1{\index{latex}{#1@\textsf{#1.cls}}{\sffamily #1.cls}\xspace} 52 | \def\bst#1{\index{bibtex}{#1@\textsf{#1.bst}}{\sffamily #1.bst}\xspace} 53 | \def\chp#1{\index{bibtex}{#1@\texttt{#1}}{\ttfamily #1}\xspace} 54 | \def\ent#1{\index{bibtex}{#1@\protect\at #1}{\bfseries \at #1}\xspace} 55 | \def\fn#1{\index{bibtex}{#1@\texttt{#1\protect\dol}}{\ttfamily #1\dol}\xspace} 56 | 57 | \def\el#1{$\cal #1$} 58 | \def\eli#1#2{$\mathcal{#1}_{#2}$} 59 | 60 | \def\nicmd#1{{\ttfamily \bs #1}\xspace} 61 | \def\nienv#1{{\ttfamily #1}\xspace} 62 | \def\niext#1{{\ttfamily .#1}\xspace} 63 | \def\nisty#1{{\sffamily #1.sty}\xspace} 64 | \def\nicls#1{{\sffamily #1.cls}\xspace} 65 | \def\nibst#1{{\sffamily #1.bst}\xspace} 66 | \def\nichp#1{{\ttfamily #1}\xspace} 67 | \def\nient#1{{\bfseries \at #1}\xspace} 68 | \def\nifn#1{{\ttfamily #1\dol}\xspace} 69 | 70 | \newenvironment{myex}{\bigskip\par 71 | \noindent\begin{boxedminipage}{\textwidth}}{% 72 | \end{boxedminipage}\bigskip\par} 73 | \newenvironment{myexv}{\bigskip\par 74 | \noindent\begin{center}\begin{boxedminipage}{.8\textwidth}}{% 75 | \end{boxedminipage}\end{center} 76 | \bigskip\par} 77 | 78 | %\AtBeginDocument{% 79 | \setcounter{tocdepth}{0}% 80 | \def\thepart{\arabic{part}}% 81 | \def\mypart{\cleardoublepage\part}% 82 | \def\@part[#1]#2{ \ifnum\c@secnumdepth>\m@ne\relax 83 | \refstepcounter{part}% 84 | \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% 85 | \else 86 | \addcontentsline{toc}{part}{#1}% 87 | \fi 88 | {\parindent \z@ \raggedleft 89 | \interlinepenalty \@M 90 | \normalfont 91 | \ifnum \c@secnumdepth >\m@ne\relax 92 | \Large\sffamily\bfseries \partname\nobreakspace\thepart 93 | \par\nobreak 94 | \fi 95 | \huge \sffamily \bfseries #2% 96 | \markboth{}{}\par}% 97 | \nobreak 98 | \vskip 12ex% 99 | \@afterheading}% 100 | \renewcommand*\l@part[2]{% 101 | \ifnum \c@tocdepth >-2\relax 102 | \addpenalty\@secpenalty 103 | \addvspace{2.25em \@plus\p@}% 104 | \setlength\@tempdima{3em}% 105 | \begingroup 106 | \parindent \z@ \rightskip \@pnumwidth 107 | \parfillskip -\@pnumwidth 108 | {\leavevmode 109 | \large \sffamily #1 110 | \leaders\hbox{$\m@th 111 | \mkern 2mu\hbox{\small.}\mkern 2mu$}\hfill 112 | \hb@xt@\@pnumwidth{\hss #2}}\par 113 | \nobreak 114 | \if@compatibility 115 | \global\@nobreaktrue 116 | \everypar{\global\@nobreakfalse\everypar{}}% 117 | \fi 118 | \endgroup 119 | \fi} 120 | \let\mysection\section 121 | \def\mysubsection{\subsection} 122 | \def\mysubsubsection{\subsubsection} 123 | \def\floatpagefraction{.8} 124 | 125 | \def\section{\let\@ssect\save@ssect\@startsection {section}{1}{\z@}% 126 | {-3.5ex \@plus -1ex \@minus -.2ex}% 127 | {2.3ex \@plus.2ex}% 128 | {\normalfont\Large\bfseries}} 129 | %} 130 | 131 | --------------------------------------------------------------------------------