├── .gitignore ├── LICENSE ├── README.md ├── fonts ├── Courier Std │ ├── CourierStd-Bold.otf │ ├── CourierStd-BoldOblique.otf │ ├── CourierStd-Oblique.otf │ └── CourierStd.otf ├── FontAwesome.otf ├── Minion Pro │ ├── MinionPro-Bold.otf │ ├── MinionPro-BoldIt.otf │ ├── MinionPro-It.otf │ └── MinionPro-Regular.otf ├── Myriad Pro │ ├── MyriadPro-Bold.otf │ ├── MyriadPro-BoldIt.otf │ ├── MyriadPro-It.otf │ └── MyriadPro-Regular.otf ├── 方正中等线_GBK.ttf ├── 方正书宋_GBK.ttf ├── 方正仿宋_GBK.ttf ├── 方正小标宋_GBK.ttf ├── 方正楷体_GBK.ttf └── 方正黑体_GBK.ttf ├── progartcn ├── figs │ ├── laravel_logo.png │ └── php-elephant-logo.png ├── progartcn.cls ├── tutorial-sample.pdf └── tutorial-sample.tex ├── progbookcn ├── book-sample.pdf ├── book-sample.tex ├── figs │ └── dependency-injection.png └── progbookcn.cls └── znote ├── booksample-The Great Gatsby.pdf ├── booksample-The Great Gatsby.tex ├── znotearticle.cls └── znotebook.cls /.gitignore: -------------------------------------------------------------------------------- 1 | *.ptc 2 | *.rel 3 | *.listing 4 | 5 | ## Core latex/pdflatex auxiliary files: 6 | *.aux 7 | *.lof 8 | *.log 9 | *.lot 10 | *.fls 11 | *.out 12 | *.toc 13 | *.fmt 14 | *.fot 15 | *.cb 16 | *.cb2 17 | .*.lb 18 | 19 | ## Intermediate documents: 20 | *.dvi 21 | *.xdv 22 | *-converted-to.* 23 | # these rules might exclude image files for figures etc. 24 | # *.ps 25 | # *.eps 26 | # *.pdf 27 | 28 | ## Generated if empty string is given at "Please type another file name for output:" 29 | .pdf 30 | 31 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 32 | *.bbl 33 | *.bcf 34 | *.blg 35 | *-blx.aux 36 | *-blx.bib 37 | *.run.xml 38 | 39 | ## Build tool auxiliary files: 40 | *.fdb_latexmk 41 | *.synctex 42 | *.synctex(busy) 43 | *.synctex.gz 44 | *.synctex.gz(busy) 45 | *.pdfsync 46 | 47 | ## Auxiliary and intermediate files from other packages: 48 | # algorithms 49 | *.alg 50 | *.loa 51 | 52 | # achemso 53 | acs-*.bib 54 | 55 | # amsthm 56 | *.thm 57 | 58 | # beamer 59 | *.nav 60 | *.pre 61 | *.snm 62 | *.vrb 63 | 64 | # changes 65 | *.soc 66 | 67 | # cprotect 68 | *.cpt 69 | 70 | # elsarticle (documentclass of Elsevier journals) 71 | *.spl 72 | 73 | # endnotes 74 | *.ent 75 | 76 | # fixme 77 | *.lox 78 | 79 | # feynmf/feynmp 80 | *.mf 81 | *.mp 82 | *.t[1-9] 83 | *.t[1-9][0-9] 84 | *.tfm 85 | 86 | #(r)(e)ledmac/(r)(e)ledpar 87 | *.end 88 | *.?end 89 | *.[1-9] 90 | *.[1-9][0-9] 91 | *.[1-9][0-9][0-9] 92 | *.[1-9]R 93 | *.[1-9][0-9]R 94 | *.[1-9][0-9][0-9]R 95 | *.eledsec[1-9] 96 | *.eledsec[1-9]R 97 | *.eledsec[1-9][0-9] 98 | *.eledsec[1-9][0-9]R 99 | *.eledsec[1-9][0-9][0-9] 100 | *.eledsec[1-9][0-9][0-9]R 101 | 102 | # glossaries 103 | *.acn 104 | *.acr 105 | *.glg 106 | *.glo 107 | *.gls 108 | *.glsdefs 109 | 110 | # gnuplottex 111 | *-gnuplottex-* 112 | 113 | # gregoriotex 114 | *.gaux 115 | *.gtex 116 | 117 | # htlatex 118 | *.4ct 119 | *.4tc 120 | *.idv 121 | *.lg 122 | *.trc 123 | *.xref 124 | 125 | # hyperref 126 | *.brf 127 | 128 | # knitr 129 | *-concordance.tex 130 | # TODO Comment the next line if you want to keep your tikz graphics files 131 | *.tikz 132 | *-tikzDictionary 133 | 134 | # listings 135 | *.lol 136 | 137 | # makeidx 138 | *.idx 139 | *.ilg 140 | *.ind 141 | *.ist 142 | 143 | # minitoc 144 | *.maf 145 | *.mlf 146 | *.mlt 147 | *.mtc 148 | *.mtc[0-9]* 149 | *.slf[0-9]* 150 | *.slt[0-9]* 151 | *.stc[0-9]* 152 | 153 | # minted 154 | _minted* 155 | *.pyg 156 | 157 | # morewrites 158 | *.mw 159 | 160 | # nomencl 161 | *.nlg 162 | *.nlo 163 | *.nls 164 | 165 | # pax 166 | *.pax 167 | 168 | # pdfpcnotes 169 | *.pdfpc 170 | 171 | # sagetex 172 | *.sagetex.sage 173 | *.sagetex.py 174 | *.sagetex.scmd 175 | 176 | # scrwfile 177 | *.wrt 178 | 179 | # sympy 180 | *.sout 181 | *.sympy 182 | sympy-plots-for-*.tex/ 183 | 184 | # pdfcomment 185 | *.upa 186 | *.upb 187 | 188 | # pythontex 189 | *.pytxcode 190 | pythontex-files-*/ 191 | 192 | # thmtools 193 | *.loe 194 | 195 | # TikZ & PGF 196 | *.dpth 197 | *.md5 198 | *.auxlock 199 | 200 | # todonotes 201 | *.tdo 202 | 203 | # easy-todo 204 | *.lod 205 | 206 | # xmpincl 207 | *.xmpi 208 | 209 | # xindy 210 | *.xdy 211 | 212 | # xypic precompiled matrices 213 | *.xyc 214 | 215 | # endfloat 216 | *.ttt 217 | *.fff 218 | 219 | # Latexian 220 | TSWLatexianTemp* 221 | 222 | ## Editors: 223 | # WinEdt 224 | *.bak 225 | *.sav 226 | 227 | # Texpad 228 | .texpadtmp 229 | 230 | # Kile 231 | *.backup 232 | 233 | # KBibTeX 234 | *~[0-9]* 235 | 236 | # auto folder when using emacs and auctex 237 | ./auto/* 238 | *.el 239 | 240 | # expex forward references with \gathertags 241 | *-tags.tex 242 | 243 | # standalone packages 244 | *.sta 245 | 246 | # generated if using elsarticle.cls 247 | *.spl 248 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Hu Zhifei 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Ready-to-edit LaTeX Templates 2 | My ready-to-edit LaTeX templates, for books, articles, and notes, using XeLaTeX, specified both for Chinese and English documents. 3 | 4 | ## Templates for Books 5 | 6 | ### [progbookcn](./progbookcn) 7 | 8 | Yet Another LaTeX Template for Programming or Technical Books 9 | 10 | **Features** 11 | 12 | - Specified for programming or technical books, could be used to write English or Chinese books. 13 | - Using `Minion Pro`, `Myriad Pro` and `Courier Std` as English font families, and using FZ series for Chinese. 14 | - Customizing the styles of titlepage, partpage, chapter/section/subsection, hdr, etc. 15 | - Defining styles for languages not predefined in `listings`: JavaScript/ES6, TypeScript, golang. 16 | - Creating new framed boxes environments using `tcolorbox`: titledbox, information, keypoint, exclamation, question. 17 | 18 | **Testing platforms** 19 | - OS platform: 20 | Windows 10, macOS 21 | - TeX Systems: 22 | TeXLive 2016/2017, MacTeX 2018 23 | - Softwares: 24 | Emacs + AUCTeX, TeXstudio, WinEdt 25 | 26 | 27 | ## Templates for Note-taking 28 | 29 | ### znotebook 30 | 31 | znotebook 32 | 33 | ### znotearticle 34 | 35 | znotearticle 36 | 37 | ## Templates for Articles or Tutorials 38 | 39 | ### [progartcn](./progartcn) 40 | 41 | Yet Another LaTeX Template for Programming or Technical Articles or Tutorials 42 | 43 | **Features** 44 | 45 | - Specified for programming or technical articles or tutorials. 46 | - Using `Minion Pro`, `Myriad Pro` and `Courier Std` as English font families, and using FZ series for Chinese. 47 | - Customizing the styles of abstract, section/subsection/subsubsection, table, hdr, etc. 48 | - Defining a set of colors: primary, secondary, success, danger, info, warning, light, and dark. 49 | - Defining styles for languages not predefined in `listings`: JavaScript/ES6, TypeScript, golang. 50 | - Defining boxes for shell commands and output result, such as `shellBox` and `invertedShellBox`. 51 | - Creating new boxes environments using `tcolorbox`: noteBox, importantBox, tipBox, and warningBox. 52 | 53 | ## Templates for Presentations (Beamer) 54 | 55 | ### [GoogleBlue](https://github.com/WisdomFusion/latex-beamer-teamplates) 56 | 57 | ## Declarations 58 | 59 | **ALL FONTS INCLUDED IN THIS REPOSITORY ARE FOR TESTING AND STUDY ONLY.** 60 | 61 | ## Contributions 62 | 63 | If you'd like to help to improve these templates, just create a [Pull Request](https://github.com/WisdomFusion/latex-templates/pulls). Feel free to report bugs and issues [here](https://github.com/WisdomFusion/latex-templates/issues/new). -------------------------------------------------------------------------------- /fonts/Courier Std/CourierStd-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Courier Std/CourierStd-Bold.otf -------------------------------------------------------------------------------- /fonts/Courier Std/CourierStd-BoldOblique.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Courier Std/CourierStd-BoldOblique.otf -------------------------------------------------------------------------------- /fonts/Courier Std/CourierStd-Oblique.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Courier Std/CourierStd-Oblique.otf -------------------------------------------------------------------------------- /fonts/Courier Std/CourierStd.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Courier Std/CourierStd.otf -------------------------------------------------------------------------------- /fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /fonts/Minion Pro/MinionPro-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Minion Pro/MinionPro-Bold.otf -------------------------------------------------------------------------------- /fonts/Minion Pro/MinionPro-BoldIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Minion Pro/MinionPro-BoldIt.otf -------------------------------------------------------------------------------- /fonts/Minion Pro/MinionPro-It.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Minion Pro/MinionPro-It.otf -------------------------------------------------------------------------------- /fonts/Minion Pro/MinionPro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Minion Pro/MinionPro-Regular.otf -------------------------------------------------------------------------------- /fonts/Myriad Pro/MyriadPro-Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Myriad Pro/MyriadPro-Bold.otf -------------------------------------------------------------------------------- /fonts/Myriad Pro/MyriadPro-BoldIt.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Myriad Pro/MyriadPro-BoldIt.otf -------------------------------------------------------------------------------- /fonts/Myriad Pro/MyriadPro-It.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Myriad Pro/MyriadPro-It.otf -------------------------------------------------------------------------------- /fonts/Myriad Pro/MyriadPro-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/Myriad Pro/MyriadPro-Regular.otf -------------------------------------------------------------------------------- /fonts/方正中等线_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正中等线_GBK.ttf -------------------------------------------------------------------------------- /fonts/方正书宋_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正书宋_GBK.ttf -------------------------------------------------------------------------------- /fonts/方正仿宋_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正仿宋_GBK.ttf -------------------------------------------------------------------------------- /fonts/方正小标宋_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正小标宋_GBK.ttf -------------------------------------------------------------------------------- /fonts/方正楷体_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正楷体_GBK.ttf -------------------------------------------------------------------------------- /fonts/方正黑体_GBK.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/fonts/方正黑体_GBK.ttf -------------------------------------------------------------------------------- /progartcn/figs/laravel_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/progartcn/figs/laravel_logo.png -------------------------------------------------------------------------------- /progartcn/figs/php-elephant-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/progartcn/figs/php-elephant-logo.png -------------------------------------------------------------------------------- /progartcn/progartcn.cls: -------------------------------------------------------------------------------- 1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 | %% progartcn - Yet Another LaTeX Template for Programming or Technical Articles or Tutorials 3 | %% WisdomFusion@gmail.com 4 | %% July, 2018 5 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | 7 | \NeedsTeXFormat{LaTeX2e} 8 | \ProvidesClass{progartcn}[July, 2018 Yet Another LaTeX Template for Technical Articles or Tutorials] 9 | \LoadClass[a4paper]{ctexart} 10 | 11 | \RequirePackage{xunicode} 12 | 13 | 14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 15 | %% colors 16 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 17 | \RequirePackage[dvipsnames]{xcolor} 18 | 19 | % primary 20 | \definecolor{colorPrimary}{HTML}{007bff} 21 | \definecolor{colorPrimaryBorder}{HTML}{b8daff} 22 | \definecolor{colorPrimaryBackground}{HTML}{cce5ff} 23 | \definecolor{colorPrimaryText}{HTML}{004085} 24 | 25 | % secondary 26 | \definecolor{colorSecondary}{HTML}{6c757d} 27 | \definecolor{colorSecondaryBorder}{HTML}{d6d8db} 28 | \definecolor{colorSecondaryBackground}{HTML}{e2e3e5} 29 | \definecolor{colorSecondaryText}{HTML}{383d41} 30 | 31 | % success 32 | \definecolor{colorSuccess}{HTML}{28a745} 33 | \definecolor{colorSuccessBorder}{HTML}{c3e6cb} 34 | \definecolor{colorSuccessBackground}{HTML}{d4edda} 35 | \definecolor{colorSuccessText}{HTML}{155724} 36 | 37 | % info 38 | \definecolor{colorInfo}{HTML}{17a2b8} 39 | \definecolor{colorInfoBorder}{HTML}{bee5eb} 40 | \definecolor{colorInfoBackground}{HTML}{d1ecf1} 41 | \definecolor{colorInfoText}{HTML}{0c5460} 42 | 43 | % danger 44 | \definecolor{colorDanger}{HTML}{dc3545} 45 | \definecolor{colorDangerBorder}{HTML}{f5c6cb} 46 | \definecolor{colorDangerBackground}{HTML}{f8d7da} 47 | \definecolor{colorDangerText}{HTML}{721c24} 48 | 49 | % warning 50 | \definecolor{colorWarning}{HTML}{ffc107} 51 | \definecolor{colorWarningBorder}{HTML}{ffeeba} 52 | \definecolor{colorWarningBackground}{HTML}{fff3cd} 53 | \definecolor{colorWarningText}{HTML}{856404} 54 | 55 | % light 56 | \definecolor{colorLight}{HTML}{f8f9fa} 57 | \definecolor{colorLightBorder}{HTML}{fdfdfe} 58 | \definecolor{colorLightBackground}{HTML}{fefefe} 59 | \definecolor{colorLightText}{HTML}{818182} 60 | 61 | % dark 62 | \definecolor{colorDark}{HTML}{343a40} 63 | \definecolor{colorDarkBorder}{HTML}{c6c8ca} 64 | \definecolor{colorDarkBackground}{HTML}{d6d8d9} 65 | \definecolor{colorDarkText}{HTML}{1b1e21} 66 | 67 | 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 69 | %% hyperref settings 70 | %% 超链接设定 71 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 72 | \RequirePackage{hyperref} 73 | \hypersetup{ 74 | bookmarksnumbered, 75 | colorlinks, 76 | linkcolor={black}, 77 | citecolor={black}, 78 | urlcolor={black} 79 | } 80 | 81 | \RequirePackage[open,openlevel=0,atend]{bookmark} 82 | 83 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 84 | %% graphicx settings 85 | %% 图片设定 86 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 87 | \RequirePackage{graphicx} 88 | \RequirePackage{graphbox} 89 | \RequirePackage{wrapfig} 90 | \graphicspath{{./figs/}{./figure/}{./figures/}{./image/}{./images/}{./graphics/}{./graphic/}{./pictures/}{./picture/}} 91 | 92 | 93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 94 | %% geometry settings 95 | %% 页面设定 96 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 97 | \RequirePackage{geometry} 98 | \geometry{ 99 | textwidth=138mm, 100 | textheight=215mm, 101 | left=27mm, 102 | %% or 103 | %% inner=23mm, 104 | right=27mm, 105 | %% or 106 | %% outer=18mm, 107 | top=25.4mm, bottom=25.4mm, 108 | headheight=2.17cm, 109 | headsep=4mm, 110 | footskip=12mm, 111 | heightrounded, 112 | } 113 | 114 | 115 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 116 | %% fonts settings 117 | %% 字体设定 118 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 119 | \RequirePackage{fontspec} 120 | %% \usepackage{ebgaramond} 121 | 122 | %% 开明式:句末点号用占一个汉字宽度,标号和句内点号占半个汉字宽度 123 | %\punctstyle{kaiming} 124 | 125 | \setmainfont{Minion Pro} 126 | \setsansfont{Myriad Pro} 127 | \setmonofont{Courier Std} 128 | 129 | \setCJKmainfont[BoldFont={方正小标宋_GBK}, ItalicFont={方正楷体_GBK}, BoldItalicFont={方正仿宋_GBK}]{方正书宋_GBK} 130 | \setCJKsansfont{方正黑体_GBK} 131 | \setCJKmonofont{方正中等线_GBK} 132 | 133 | \XeTeXlinebreaklocale "zh" 134 | \XeTeXlinebreakskip = 0pt plus 1pt 135 | 136 | \setCJKfamilyfont{fzss}{方正书宋_GBK} 137 | \newcommand{\fzss}{\CJKfamily{fzss}} 138 | 139 | \setCJKfamilyfont{fzxbs}{方正小标宋_GBK} 140 | \newcommand{\fzxbs}{\CJKfamily{fzxbs}} 141 | 142 | \setCJKfamilyfont{fzhei}{方正黑体_GBK} 143 | \newcommand{\fzhei}{\CJKfamily{fzhei}} 144 | 145 | \setCJKfamilyfont{fzkai}{方正楷体_GBK} 146 | \newcommand{\fzkai}{\CJKfamily{fzkai}} 147 | 148 | \setCJKfamilyfont{fzfs}{方正仿宋_GBK} 149 | \newcommand{\fzfs}{\CJKfamily{fzfs}} 150 | 151 | \setCJKfamilyfont{fzzdx}{方正中等线_GBK} 152 | \newcommand{\fzzdx}{\CJKfamily{fzzdx}} 153 | 154 | 155 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 156 | %% titlesec 157 | %% 标题设定 158 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 159 | \RequirePackage{titlesec} 160 | \RequirePackage{zhnumber} 161 | 162 | 163 | %% \renewcommand\abstractname{Summary} 164 | \renewenvironment{abstract}{\noindent\rule{\textwidth}{.5pt}\\[2ex] \centering\begin{minipage}{.97\textwidth}{\zihao{-4}\sffamily\bfseries\abstractname}\\} 165 | {\par\noindent\end{minipage}\\[2ex] \rule{\textwidth}{.5pt}} 166 | 167 | %% section 168 | \titleformat{\section} 169 | [hang] 170 | {\sffamily} 171 | {\centering\zihao{-3}\bfseries\thesection\enspace} 172 | {1pt} 173 | {\zihao{-3}\bfseries} 174 | 175 | %% subsection 176 | \titleformat{\subsection} 177 | [hang] 178 | {\sffamily} 179 | {\zihao{4}\bfseries\thesubsection\enspace} 180 | {1pt} 181 | {\zihao{4}\bfseries\filright} 182 | 183 | %% subsubsection 184 | \titleformat{\subsubsection} 185 | [hang] 186 | {\sffamily} 187 | {\zihao{-4}\bfseries\thesubsubsection\enspace} 188 | {1pt} 189 | {\zihao{-4}\bfseries\filright} 190 | 191 | \titlespacing{\section}{0pt}{2.5ex plus 1ex minus .2ex}{1.3ex plus .2ex} 192 | %\titlespacing{\section}{0pt}{\parskip}{-\parskip} 193 | \titlespacing{\subsection}{0pt}{\parskip}{-\parskip} 194 | \titlespacing{\subsubsection}{0pt}{\parskip}{-\parskip} 195 | 196 | 197 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 198 | %% boxes 199 | %% 信息框 200 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 201 | \RequirePackage[many]{tcolorbox} 202 | \RequirePackage{fontawesome} 203 | 204 | %% 带标题的文本框 205 | \newtcolorbox{titledBox}[1]{% 206 | tikznode boxed title, 207 | enhanced, 208 | arc=3pt, 209 | interior style={white}, 210 | attach boxed title to top center = {yshift=-\tcboxedtitleheight/2}, 211 | fonttitle=\normalfont, 212 | colbacktitle=white,coltitle=black, 213 | boxed title style={size=normal,colframe=white,boxrule=0pt}, 214 | boxrule=.5pt, 215 | left=5pt, right=5pt, top=5pt, bottom=0pt, 216 | boxsep=5pt, 217 | title={#1}, 218 | halign=left, 219 | fontupper=\fzkai 220 | } 221 | 222 | 223 | %% Note 224 | \newtcolorbox{noteBox}{% 225 | enhanced, 226 | arc=2pt, 227 | boxrule=.5pt, 228 | left=5pt, right=5pt, top=0pt, bottom=0pt, 229 | boxsep=5pt, 230 | colframe=colorInfoBorder, 231 | colback=colorInfoBackground, 232 | colbacktitle=colorInfoBackground, 233 | coltext=colorInfoText, 234 | title={\textcolor{colorInfoText}{\faStickyNoteO\hspace{.5em}\bfseries{\textsc{Note}}}}, 235 | titlerule=0pt, 236 | halign=left, 237 | fontupper=\fzkai 238 | } 239 | 240 | %% Important 241 | \newtcolorbox{importantBox}{% 242 | enhanced, 243 | arc=2pt, 244 | boxrule=.5pt, 245 | left=5pt, right=5pt, top=0pt, bottom=0pt, 246 | boxsep=5pt, 247 | colframe=colorWarningBorder, 248 | colback=colorWarningBackground, 249 | colbacktitle=colorWarningBackground, 250 | coltext=colorWarningText, 251 | title={\textcolor{colorWarningText}{\faExclamationCircle\hspace{.5em}\bfseries{\textsc{Important}}}}, 252 | titlerule=0pt, 253 | halign=left, 254 | fontupper=\fzkai 255 | } 256 | 257 | %% Tip 258 | \newtcolorbox{tipBox}{% 259 | enhanced, 260 | arc=2pt, 261 | boxrule=.5pt, 262 | left=5pt, right=5pt, top=0pt, bottom=0pt, 263 | boxsep=5pt, 264 | colframe=colorSuccessBorder, 265 | colback=colorSuccessBackground, 266 | colbacktitle=colorSuccessBackground, 267 | coltext=colorSuccessText, 268 | title={\textcolor{colorSuccessText}{\faCheckCircle\hspace{.5em}\bfseries{\textsc{Tip}}}}, 269 | titlerule=0pt, 270 | halign=left, 271 | fontupper=\fzkai 272 | } 273 | 274 | %% Warning 275 | \newtcolorbox{warningBox}{% 276 | enhanced, 277 | arc=2pt, 278 | boxrule=.5pt, 279 | left=5pt, right=5pt, top=0pt, bottom=0pt, 280 | boxsep=5pt, 281 | colframe=colorDangerBorder, 282 | colback=colorDangerBackground, 283 | colbacktitle=colorDangerBackground, 284 | coltext=colorDangerText, 285 | title={\textcolor{colorDangerText}{\faExclamationTriangle\hspace{.5em}\bfseries{\textsc{Warning}}}}, 286 | titlerule=0pt, 287 | halign=left, 288 | fontupper=\fzkai 289 | } 290 | 291 | 292 | %% verbatim 环境无法直接在新环境中使用 293 | %% 换用 \VerbatimEnvironment \begin{Verbatim} 294 | \RequirePackage{fancyvrb} 295 | 296 | %% 命令行 297 | \newenvironment{shellBox} 298 | {% 299 | \VerbatimEnvironment 300 | \begin{tcolorbox}[ 301 | enhanced, 302 | arc=2pt, 303 | boxrule=.5pt, 304 | left=5pt, right=5pt, top=0pt, bottom=0pt, 305 | boxsep=5pt, 306 | colframe=colorSecondaryBorder, 307 | colback=colorSecondaryBackground, 308 | coltext=colorSecondaryText, 309 | title={}, 310 | fontupper=\linespread{1.2} 311 | ]% 312 | \begin{Verbatim} 313 | } 314 | {% 315 | \end{Verbatim} 316 | \end{tcolorbox} 317 | } 318 | 319 | %% 命令行 320 | \newenvironment{invertedShellBox} 321 | {% 322 | \VerbatimEnvironment 323 | \begin{tcolorbox}[ 324 | enhanced, 325 | arc=2pt, 326 | boxrule=.5pt, 327 | left=5pt, right=5pt, top=0pt, bottom=0pt, 328 | boxsep=5pt, 329 | colframe=colorSecondary, 330 | colback=colorSecondary, 331 | coltext=white, 332 | title={}, 333 | fontupper=\linespread{1.2} 334 | ]% 335 | \begin{Verbatim} 336 | } 337 | {% 338 | \end{Verbatim} 339 | \end{tcolorbox} 340 | } 341 | 342 | 343 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 344 | %% head and foot 345 | %% 页眉页脚 346 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 347 | \RequirePackage{fancyhdr} 348 | \RequirePackage{zhnumber} 349 | 350 | \pagestyle{fancy} 351 | \fancyhf{} 352 | \renewcommand\headrulewidth{.5pt} 353 | \renewcommand\footrulewidth{0pt} 354 | %\futurelet\TMPheadrule\def\headrule{{\color{violet}\TMPheadrule}} 355 | 356 | \renewcommand{\sectionmark}[1]{\markright{#1}} 357 | 358 | \fancyhead[L]{\fzkai{\rightmark}} 359 | \fancyhead[R]{\thepage} 360 | 361 | 362 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 363 | %% code listings 364 | %% 代码块设定 365 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 366 | \RequirePackage{listings,verbatim} 367 | 368 | \lstdefinelanguage{JavaScript}{ 369 | keywords={do, if, in, for, let, new, try, var, case, else, enum, eval, null, this, true, void, with, await, break, catch, class, const, false, super, throw, while, yield, delete, export, import, public, return, static, switch, typeof, default, extends, finally, package, private, continue, debugger, function, arguments, interface, protected, implements, instanceof}, 370 | sensitive=true, 371 | comment=[l]{//}, 372 | morecomment=[s]{/*}{*/}, 373 | morestring=[b]', 374 | morestring=[b]" 375 | } 376 | 377 | \lstdefinelanguage{TypeScript}{ 378 | keywords={abstract, break, case, catch, class, const, continue, debugger, default, delete, do, else, enum, export, extends, false, finally, for, function, if, import, in, instanceof, new, null, return, super, switch, this, throw, true, try, typeof, var, void, while, with, as, implements, interface, let, package, private, protected, public, static, yield, any, boolean, constructor, declare, get, module, require, number, set, string, symbol, type, from, of}, 379 | sensitive=true, 380 | comment=[l]{//}, 381 | morecomment=[s]{/*}{*/}, 382 | morestring=[b]', 383 | morestring=[b]" 384 | } 385 | 386 | \lstdefinelanguage{golang}{ 387 | keywords={break, default, func, interface, select, case, defer, go, map, struct, chan, else, goto, package, switch, const, fallthrough, if, range, type, continue, for, import, return, var}, 388 | sensitive=true, 389 | comment=[l]{//}, 390 | morecomment=[s]{/*}{*/}, 391 | morestring=[b]', 392 | morestring=[b]" 393 | } 394 | 395 | \lstdefinestyle{mystyle}{ 396 | % Basic design 397 | basicstyle=\linespread{1.2}\ttfamily, 398 | frame=tb, 399 | framesep=5pt, 400 | framerule=.5pt, 401 | framexleftmargin=10pt, 402 | rulecolor=\color{black}, 403 | abovecaptionskip=0pt, 404 | belowcaptionskip=5pt, 405 | aboveskip=5pt, 406 | backgroundcolor=\color{black!5!white}, 407 | % Code design 408 | keywordstyle=\color{colorPrimary}, 409 | commentstyle=\color{colorSuccess}, 410 | stringstyle=\color{colorSecondary}, 411 | numberstyle=\small\color{gray}, 412 | breakatwhitespace=false, 413 | breaklines=true, 414 | captionpos=t, 415 | keepspaces=true, 416 | % Line numbers 417 | numbers=none, 418 | numbersep=15pt, 419 | xleftmargin=10pt, 420 | stepnumber=1, 421 | firstnumber=1, 422 | numberfirstline=true, 423 | % Code 424 | tabsize=4, 425 | showspaces=false, 426 | showstringspaces=false, 427 | showtabs=false, 428 | breaklines=true, 429 | } 430 | \lstset{style=mystyle} 431 | 432 | %% 命令行 433 | \lstdefinestyle{bashInputStyle}{ 434 | backgroundcolor=\color{colorInfoBackground}, 435 | basicstyle=\linespread{1.2}\ttfamily\color{colorDark}, 436 | keepspaces=true, 437 | numbers=none, 438 | numbersep=10pt, 439 | frame=l, 440 | framerule=2pt, 441 | framesep=5pt, 442 | framexleftmargin=3pt, 443 | framextopmargin=-5pt, 444 | xleftmargin=10pt, 445 | rulecolor=\color{colorInfo}, 446 | % Code 447 | tabsize=4, 448 | showspaces=false, 449 | showstringspaces=false, 450 | showtabs=false, 451 | breaklines=true, 452 | } 453 | 454 | %% 命令行输出 455 | \lstdefinestyle{bashOutputStyle}{ 456 | backgroundcolor=\color{black!5!white}, 457 | basicstyle=\linespread{1.2}\ttfamily\color{colorDark}, 458 | keepspaces=true, 459 | numbers=none, 460 | numbersep=10pt, 461 | frame=l, 462 | framerule=2pt, 463 | framesep=5pt, 464 | framexleftmargin=3pt, 465 | framextopmargin=-5pt, 466 | xleftmargin=10pt, 467 | rulecolor=\color{colorSecondary}, 468 | % Code 469 | tabsize=4, 470 | showspaces=false, 471 | showstringspaces=false, 472 | showtabs=false, 473 | breaklines=true, 474 | } 475 | 476 | %% 代码列表标题 477 | \RequirePackage{caption} 478 | \DeclareCaptionFormat{codecaptionformat}{% 479 | %%\colorbox{black!20}{ 480 | %% \parbox{\textwidth}{#1#2\ttfamily#3} 481 | %%} 482 | \parbox{\textwidth}{\textcolor{violet}\faCode~\textcolor{violet}{#1#2}\hspace{.5em}\fzkai #3} 483 | } 484 | \captionsetup[lstlisting]{format=codecaptionformat} 485 | 486 | 487 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 488 | %% Chinese names 489 | %% 中文名称 490 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 491 | \renewcommand{\figurename}{图} 492 | \renewcommand{\tablename}{表} 493 | \renewcommand{\lstlistingname}{CODE} 494 | \renewcommand{\abstractname}{摘要} 495 | 496 | 497 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 498 | %% global settings 499 | %% 以下是全局格式设定 500 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 501 | 502 | %% 添加首行缩进,两个字符 503 | \RequirePackage{indentfirst} 504 | \setlength{\parindent}{2em} 505 | 506 | %% 行距 507 | \linespread{1.5} 508 | 509 | %% captions 510 | \RequirePackage[singlelinecheck=false]{caption} 511 | \DeclareCaptionFont{kai}{\fzkai} 512 | \captionsetup[table]{belowskip=0pt,aboveskip=5pt,labelfont=kai,textfont=kai} 513 | \captionsetup[figure]{belowskip=0pt,aboveskip=5pt,format=hang,labelfont=kai,textfont=kai} 514 | -------------------------------------------------------------------------------- /progartcn/tutorial-sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wisdomfusion/latex-templates/3a194790b456bc023abc8ec4011e0252c4db505a/progartcn/tutorial-sample.pdf -------------------------------------------------------------------------------- /progartcn/tutorial-sample.tex: -------------------------------------------------------------------------------- 1 | %!TEX program = xelatex 2 | 3 | \documentclass{progartcn} 4 | \usepackage{graphicx} 5 | \usepackage[dvipsnames]{xcolor} 6 | \usepackage{wrapfig} 7 | \usepackage{enumerate} 8 | \usepackage{amsmath,mathrsfs,amsfonts} 9 | \usepackage{booktabs} 10 | \usepackage{tabularx} 11 | \usepackage{colortbl} 12 | \usepackage{multirow,makecell} 13 | \usepackage{multicol} 14 | \usepackage{ulem} % \uline 15 | \usepackage{listings} 16 | \usepackage{tikz} 17 | \usepackage{tcolorbox} 18 | \usepackage{fontawesome} 19 | 20 | 21 | \title{\bfseries\sffamily 22 | Sample: Angular 6 快速入门\\ 23 | \normalfont\zihao{-3} 24 | One framework. Mobile \& desktop. 25 | } 26 | \author{WisdomFusion \\ \faGithubAlt~ https://github.com/WisdomFusion} 27 | \date{} 28 | 29 | 30 | \begin{document} 31 | 32 | \sloppy % 解决中英文混排文字超出边界问题 33 | 34 | 35 | \maketitle 36 | \thispagestyle{empty} 37 | 38 | 39 | \begin{abstract} 40 | \noindent 只是样例填充的文字,内容都不相干的!Laravel 5.6 在 Laravel 5.5 的基础上继续进行优化,包括\textbf{日志系统}、\textit{单机任务调度}、\textbf{\textit{模型序列化优化}}、动态频率限制、广播频道类、API 资源控制器生成、Eloquent 日期格式化优化、Blade 组件别名、Argon2 密码哈希支持、引入 Collision 扩展包等等等等。此外,所有的前端脚手架代码都已升级到 Bootstrap 4,Laravel 底层使用的 Symfony 组件都已升级到 Symfony $\sim$4.0 版本。 41 | 42 | \vspace{2ex} 43 | \noindent \textbf{关键字:}LISP,\hspace{.5em}PHP,\hspace{.5em}学习环境 44 | \end{abstract} 45 | 46 | \section{什么是 Angular?} 47 | \label{newfeatures} 48 | 49 | Angular 是一个开发平台。它能帮你更轻松的构建 Web 应用。Angular 集声明式模板、依赖注入、端到端工具和一些最佳实践于一身,为你解决开发方面的各种挑战。Angular 为开发者提升构建 Web、手机或桌面应用的能力。 50 | 51 | \section{架构概览} 52 | 53 | Angular 是一个用 HTML 和 TypeScript 构建客户端应用的平台与框架。Angular 本身使用 TypeScript 写成的。它将核心功能和可选功能作为一组 TypeScript 库进行实现,你可以把它们导入你的应用中。 54 | 55 | Angular 的基本构造块是 NgModule,它为组件提供了编译的上下文环境。 NgModule 会把相关的代码收集到一些功能集中。Angular 应用就是由一组 \verb|NgModule| 定义出的。 应用至少会有一个用于引导应用的根模块,通常还会有很多特性模块。 56 | 57 | \begin{itemize} 58 | \item 组件定义\textbf{视图}。视图是一组可见的屏幕元素,Angular 可以根据你的程序逻辑和数据来选择和修改它们。 每个应用都至少有一个根组件。 59 | 60 | \item 组件使用\textbf{服务}。服务会提供那些与视图不直接相关的功能。服务提供商可以作为依赖被注入到组件中, 这能让你的代码更加模块化、可复用,而且高效。 61 | \end{itemize} 62 | 63 | \section{\ttfamily @NgModule \sffamily{元数据}} 64 | 65 | \verb|NgModule| 是一个带有 \verb|@NgModule| 装饰器的类。\verb|@NgModule| 装饰器是一个函数,它接受一个元数据对象,该对象的属性用来描述这个模块。其中最重要的属性如下。 66 | 67 | \begin{itemize} 68 | \item \verb|declarations|(可声明对象表) —— 那些属于本 \verb|NgModule| 的组件、指令、管道。 69 | 70 | \item \verb|exports|(导出表) —— 那些能在其它模块的组件模板中使用的可声明对象的子集。 71 | 72 | \item \verb|imports|(导入表) —— 那些导出了本模块中的组件模板所需的类的其它模块。 73 | 74 | \item \verb|providers| —— 本模块向全局服务中贡献的那些服务的创建器。 这些服务能被本应用中的任何部分使用。(你也可以在组件级别指定服务提供商,这通常是首选方式。) 75 | 76 | \item \verb|bootstrap| —— 应用的主视图,称为根组件。它是应用中所有其它视图的宿主。只有根模块才应该设置这个 \verb|bootstrap| 属性。 77 | \end{itemize} 78 | 79 | 80 | 下面是一个简单的根 NgModule 定义: 81 | 82 | \begin{lstlisting}[language=TypeScript,caption={src/app/app.module.ts}] 83 | import { NgModule } from '@angular/core'; 84 | import { BrowserModule } from '@angular/platform-browser'; 85 | @NgModule({ 86 | imports: [ BrowserModule ], 87 | providers: [ Logger ], 88 | declarations: [ AppComponent ], 89 | exports: [ AppComponent ], 90 | bootstrap: [ AppComponent ] 91 | }) 92 | export class AppModule { } 93 | \end{lstlisting} 94 | 95 | \begin{lstlisting}[style=bashInputStyle] 96 | cd my-app 97 | ng serve --open 98 | \end{lstlisting} 99 | 100 | \begin{lstlisting}[style=bashOutputStyle] 101 | blablabla 102 | \end{lstlisting} 103 | 104 | \section{快速上手} 105 | 106 | Angular CLI是一个命令行界面工具,它可以创建项目、添加文件以及执行一大堆开发任务,比如测试、打包和发布。 107 | 108 | 本章的目标是构建并运行一个超级简单的 TypeScript Angular 应用。使用 Angular CLI 来让每个 Angular 应用从风格指南的那些建议中获益。 109 | 110 | 在本章的末尾,你会对用 CLI 进行开发有一个最基本的理解,并将其作为其它文档范例以及真实应用的基础。 111 | 112 | \subsection{步骤 1. 设置开发环境} 113 | 114 | 在开始工作之前,你必须设置好开发环境。 115 | 116 | 如果你的电脑里没有 Node.js®和 npm,请安装它们。 117 | 118 | \begin{invertedShellBox} 119 | npm install -g @angular/cli 120 | \end{invertedShellBox} 121 | 122 | \subsection{步骤 2. 创建新项目} 123 | 124 | 打开终端窗口。 125 | 126 | 运行下列命令来生成一个新项目以及默认的应用代码: 127 | 128 | \begin{invertedShellBox} 129 | ng new my-app 130 | \end{invertedShellBox} 131 | 132 | \subsection{步骤 3. 启动开发服务器} 133 | 134 | 进入项目目录,并启动服务器。 135 | 136 | \begin{invertedShellBox} 137 | cd my-app 138 | ng serve --open 139 | \end{invertedShellBox} 140 | 141 | 你的应用代码位于 \verb|src| 文件夹中。 所有的 Angular 组件、模板、样式、图片以及你的应用所需的任何东西都在那里。 这个文件夹之外的文件都是为构建应用提供支持用的。 142 | 143 | \begin{lstlisting}[style=bashOutputStyle] 144 | src 145 | app 146 | app.component.css 147 | app.component.html 148 | app.component.spec.ts 149 | app.component.ts 150 | app.module.ts 151 | assets 152 | .gitkeep 153 | environments 154 | environment.prod.ts 155 | environment.ts 156 | browserslist 157 | favicon.ico 158 | index.html 159 | ... 160 | \end{lstlisting} 161 | 162 | \noindent 163 | \begin{table}[htp] 164 | \caption{sample table 表 }\label{table:1} 165 | \begin{tabularx}{\textwidth}{>{\hsize=.6\hsize\raggedright\arraybackslash}X>{\raggedright\arraybackslash}X}\toprule 166 | \bfseries{文件} & \bfseries{用途}\\ \midrule 167 | \verb|app/app.component.{ts,html,css,spec.ts}| & 使用 HTML 模板、CSS 样式和单元测试定义 \verb|AppComponent| 组件。 它是根组件,随着应用的成长它会成为一棵组件树的根节点。\\ 168 | \verb|app/app.module.ts| & 定义 \verb|AppModule|,根模块为 Angular 描述如何组装应用。 目前,它只声明了 \verb|AppComponent|。 不久,它将声明更多组件。\\ \bottomrule 169 | \end{tabularx} 170 | \end{table} 171 | blabla 172 | 173 | \clearpage 174 | 175 | \section{boxes} 176 | 177 | \noindent\verb|\begin{titledBox}{