├── CHANGELOG ├── LICENSE ├── LaTeX_tutorial_zh.pdf ├── LaTeX_tutorial_zh ├── NCU_thesis.cls ├── appendix_LODraw_export.tex ├── appendix_commonBug.tex ├── chapter_presentation_beamer.tex ├── chapter_template.tex ├── chapter_titlepage.tex ├── config.tex ├── figures │ ├── LibreOffice_Draw_epsOption.png │ ├── LibreOffice_Draw_epsSave.png │ ├── LibreOffice_Draw_select.png │ ├── Zotero_01.png │ ├── Zotero_02.png │ ├── Zotero_03.png │ ├── Zotero_04.png │ ├── Zotero_05.png │ ├── Zotero_06.png │ ├── Zotero_07.png │ ├── github_branchList.png │ ├── github_pjDownload.png │ ├── github_tagList.png │ ├── logo-Debian.eps │ ├── logo-GNU.png │ ├── logo-Linux.png │ ├── logo-NCU.jpg │ ├── logo-sinica.png │ ├── logo-toad.jpg │ ├── pay_it_forward.jpg │ ├── pdf_metadata.png │ ├── titleFontStyle_rm.png │ ├── titleFontStyle_sf.png │ ├── titleStyle_0.png │ ├── titleStyle_1.png │ ├── titleStyle_1i.png │ ├── titleStyle_c0.png │ ├── titleStyle_c1.png │ ├── titleStyle_c1i.png │ ├── tocStyleAlign_0_en.png │ ├── tocStyleAlign_0_zh.png │ ├── tocStyleAlign_1_en.png │ ├── tocStyleAlign_1_zh.png │ ├── tocStyleChapter_0.png │ ├── tocStyleChapter_2.png │ ├── tutorial_firefox_bookmark.png │ └── tutorial_zotero_bbt_config.png ├── macros_document.tex ├── macros_preamble.tex ├── main.tex ├── preface.tex ├── sppmgTools.cwl ├── sppmgTools.sty ├── thesis_base.cls ├── titlepage.tex ├── tutorial.bib └── tutorial.tex └── README.md /CHANGELOG: -------------------------------------------------------------------------------- 1 | # Change Log | 版本紀錄 2 | 3 | ## v1.6 (2018-01-17) 4 | - 獨立專案後的初始版本。最後編輯日期實為 2016-12-30 。 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution-ShareAlike 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution-ShareAlike 4.0 International Public 58 | License 59 | 60 | By exercising the Licensed Rights (defined below), You accept and agree 61 | to be bound by the terms and conditions of this Creative Commons 62 | Attribution-ShareAlike 4.0 International Public License ("Public 63 | License"). To the extent this Public License may be interpreted as a 64 | contract, You are granted the Licensed Rights in consideration of Your 65 | acceptance of these terms and conditions, and the Licensor grants You 66 | such rights in consideration of benefits the Licensor receives from 67 | making the Licensed Material available under these terms and 68 | conditions. 69 | 70 | 71 | Section 1 -- Definitions. 72 | 73 | a. Adapted Material means material subject to Copyright and Similar 74 | Rights that is derived from or based upon the Licensed Material 75 | and in which the Licensed Material is translated, altered, 76 | arranged, transformed, or otherwise modified in a manner requiring 77 | permission under the Copyright and Similar Rights held by the 78 | Licensor. For purposes of this Public License, where the Licensed 79 | Material is a musical work, performance, or sound recording, 80 | Adapted Material is always produced where the Licensed Material is 81 | synched in timed relation with a moving image. 82 | 83 | b. Adapter's License means the license You apply to Your Copyright 84 | and Similar Rights in Your contributions to Adapted Material in 85 | accordance with the terms and conditions of this Public License. 86 | 87 | c. BY-SA Compatible License means a license listed at 88 | creativecommons.org/compatiblelicenses, approved by Creative 89 | Commons as essentially the equivalent of this Public License. 90 | 91 | d. Copyright and Similar Rights means copyright and/or similar rights 92 | closely related to copyright including, without limitation, 93 | performance, broadcast, sound recording, and Sui Generis Database 94 | Rights, without regard to how the rights are labeled or 95 | categorized. For purposes of this Public License, the rights 96 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 97 | Rights. 98 | 99 | e. Effective Technological Measures means those measures that, in the 100 | absence of proper authority, may not be circumvented under laws 101 | fulfilling obligations under Article 11 of the WIPO Copyright 102 | Treaty adopted on December 20, 1996, and/or similar international 103 | agreements. 104 | 105 | f. Exceptions and Limitations means fair use, fair dealing, and/or 106 | any other exception or limitation to Copyright and Similar Rights 107 | that applies to Your use of the Licensed Material. 108 | 109 | g. License Elements means the license attributes listed in the name 110 | of a Creative Commons Public License. The License Elements of this 111 | Public License are Attribution and ShareAlike. 112 | 113 | h. Licensed Material means the artistic or literary work, database, 114 | or other material to which the Licensor applied this Public 115 | License. 116 | 117 | i. Licensed Rights means the rights granted to You subject to the 118 | terms and conditions of this Public License, which are limited to 119 | all Copyright and Similar Rights that apply to Your use of the 120 | Licensed Material and that the Licensor has authority to license. 121 | 122 | j. Licensor means the individual(s) or entity(ies) granting rights 123 | under this Public License. 124 | 125 | k. Share means to provide material to the public by any means or 126 | process that requires permission under the Licensed Rights, such 127 | as reproduction, public display, public performance, distribution, 128 | dissemination, communication, or importation, and to make material 129 | available to the public including in ways that members of the 130 | public may access the material from a place and at a time 131 | individually chosen by them. 132 | 133 | l. Sui Generis Database Rights means rights other than copyright 134 | resulting from Directive 96/9/EC of the European Parliament and of 135 | the Council of 11 March 1996 on the legal protection of databases, 136 | as amended and/or succeeded, as well as other essentially 137 | equivalent rights anywhere in the world. 138 | 139 | m. You means the individual or entity exercising the Licensed Rights 140 | under this Public License. Your has a corresponding meaning. 141 | 142 | 143 | Section 2 -- Scope. 144 | 145 | a. License grant. 146 | 147 | 1. Subject to the terms and conditions of this Public License, 148 | the Licensor hereby grants You a worldwide, royalty-free, 149 | non-sublicensable, non-exclusive, irrevocable license to 150 | exercise the Licensed Rights in the Licensed Material to: 151 | 152 | a. reproduce and Share the Licensed Material, in whole or 153 | in part; and 154 | 155 | b. produce, reproduce, and Share Adapted Material. 156 | 157 | 2. Exceptions and Limitations. For the avoidance of doubt, where 158 | Exceptions and Limitations apply to Your use, this Public 159 | License does not apply, and You do not need to comply with 160 | its terms and conditions. 161 | 162 | 3. Term. The term of this Public License is specified in Section 163 | 6(a). 164 | 165 | 4. Media and formats; technical modifications allowed. The 166 | Licensor authorizes You to exercise the Licensed Rights in 167 | all media and formats whether now known or hereafter created, 168 | and to make technical modifications necessary to do so. The 169 | Licensor waives and/or agrees not to assert any right or 170 | authority to forbid You from making technical modifications 171 | necessary to exercise the Licensed Rights, including 172 | technical modifications necessary to circumvent Effective 173 | Technological Measures. For purposes of this Public License, 174 | simply making modifications authorized by this Section 2(a) 175 | (4) never produces Adapted Material. 176 | 177 | 5. Downstream recipients. 178 | 179 | a. Offer from the Licensor -- Licensed Material. Every 180 | recipient of the Licensed Material automatically 181 | receives an offer from the Licensor to exercise the 182 | Licensed Rights under the terms and conditions of this 183 | Public License. 184 | 185 | b. Additional offer from the Licensor -- Adapted Material. 186 | Every recipient of Adapted Material from You 187 | automatically receives an offer from the Licensor to 188 | exercise the Licensed Rights in the Adapted Material 189 | under the conditions of the Adapter's License You apply. 190 | 191 | c. No downstream restrictions. You may not offer or impose 192 | any additional or different terms or conditions on, or 193 | apply any Effective Technological Measures to, the 194 | Licensed Material if doing so restricts exercise of the 195 | Licensed Rights by any recipient of the Licensed 196 | Material. 197 | 198 | 6. No endorsement. Nothing in this Public License constitutes or 199 | may be construed as permission to assert or imply that You 200 | are, or that Your use of the Licensed Material is, connected 201 | with, or sponsored, endorsed, or granted official status by, 202 | the Licensor or others designated to receive attribution as 203 | provided in Section 3(a)(1)(A)(i). 204 | 205 | b. Other rights. 206 | 207 | 1. Moral rights, such as the right of integrity, are not 208 | licensed under this Public License, nor are publicity, 209 | privacy, and/or other similar personality rights; however, to 210 | the extent possible, the Licensor waives and/or agrees not to 211 | assert any such rights held by the Licensor to the limited 212 | extent necessary to allow You to exercise the Licensed 213 | Rights, but not otherwise. 214 | 215 | 2. Patent and trademark rights are not licensed under this 216 | Public License. 217 | 218 | 3. To the extent possible, the Licensor waives any right to 219 | collect royalties from You for the exercise of the Licensed 220 | Rights, whether directly or through a collecting society 221 | under any voluntary or waivable statutory or compulsory 222 | licensing scheme. In all other cases the Licensor expressly 223 | reserves any right to collect such royalties. 224 | 225 | 226 | Section 3 -- License Conditions. 227 | 228 | Your exercise of the Licensed Rights is expressly made subject to the 229 | following conditions. 230 | 231 | a. Attribution. 232 | 233 | 1. If You Share the Licensed Material (including in modified 234 | form), You must: 235 | 236 | a. retain the following if it is supplied by the Licensor 237 | with the Licensed Material: 238 | 239 | i. identification of the creator(s) of the Licensed 240 | Material and any others designated to receive 241 | attribution, in any reasonable manner requested by 242 | the Licensor (including by pseudonym if 243 | designated); 244 | 245 | ii. a copyright notice; 246 | 247 | iii. a notice that refers to this Public License; 248 | 249 | iv. a notice that refers to the disclaimer of 250 | warranties; 251 | 252 | v. a URI or hyperlink to the Licensed Material to the 253 | extent reasonably practicable; 254 | 255 | b. indicate if You modified the Licensed Material and 256 | retain an indication of any previous modifications; and 257 | 258 | c. indicate the Licensed Material is licensed under this 259 | Public License, and include the text of, or the URI or 260 | hyperlink to, this Public License. 261 | 262 | 2. You may satisfy the conditions in Section 3(a)(1) in any 263 | reasonable manner based on the medium, means, and context in 264 | which You Share the Licensed Material. For example, it may be 265 | reasonable to satisfy the conditions by providing a URI or 266 | hyperlink to a resource that includes the required 267 | information. 268 | 269 | 3. If requested by the Licensor, You must remove any of the 270 | information required by Section 3(a)(1)(A) to the extent 271 | reasonably practicable. 272 | 273 | b. ShareAlike. 274 | 275 | In addition to the conditions in Section 3(a), if You Share 276 | Adapted Material You produce, the following conditions also apply. 277 | 278 | 1. The Adapter's License You apply must be a Creative Commons 279 | license with the same License Elements, this version or 280 | later, or a BY-SA Compatible License. 281 | 282 | 2. You must include the text of, or the URI or hyperlink to, the 283 | Adapter's License You apply. You may satisfy this condition 284 | in any reasonable manner based on the medium, means, and 285 | context in which You Share Adapted Material. 286 | 287 | 3. You may not offer or impose any additional or different terms 288 | or conditions on, or apply any Effective Technological 289 | Measures to, Adapted Material that restrict exercise of the 290 | rights granted under the Adapter's License You apply. 291 | 292 | 293 | Section 4 -- Sui Generis Database Rights. 294 | 295 | Where the Licensed Rights include Sui Generis Database Rights that 296 | apply to Your use of the Licensed Material: 297 | 298 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 299 | to extract, reuse, reproduce, and Share all or a substantial 300 | portion of the contents of the database; 301 | 302 | b. if You include all or a substantial portion of the database 303 | contents in a database in which You have Sui Generis Database 304 | Rights, then the database in which You have Sui Generis Database 305 | Rights (but not its individual contents) is Adapted Material, 306 | 307 | including for purposes of Section 3(b); and 308 | c. You must comply with the conditions in Section 3(a) if You Share 309 | all or a substantial portion of the contents of the database. 310 | 311 | For the avoidance of doubt, this Section 4 supplements and does not 312 | replace Your obligations under this Public License where the Licensed 313 | Rights include other Copyright and Similar Rights. 314 | 315 | 316 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 317 | 318 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 319 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 320 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 321 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 322 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 323 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 324 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 325 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 326 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 327 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 328 | 329 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 330 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 331 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 332 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 333 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 334 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 335 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 336 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 337 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 338 | 339 | c. The disclaimer of warranties and limitation of liability provided 340 | above shall be interpreted in a manner that, to the extent 341 | possible, most closely approximates an absolute disclaimer and 342 | waiver of all liability. 343 | 344 | 345 | Section 6 -- Term and Termination. 346 | 347 | a. This Public License applies for the term of the Copyright and 348 | Similar Rights licensed here. However, if You fail to comply with 349 | this Public License, then Your rights under this Public License 350 | terminate automatically. 351 | 352 | b. Where Your right to use the Licensed Material has terminated under 353 | Section 6(a), it reinstates: 354 | 355 | 1. automatically as of the date the violation is cured, provided 356 | it is cured within 30 days of Your discovery of the 357 | violation; or 358 | 359 | 2. upon express reinstatement by the Licensor. 360 | 361 | For the avoidance of doubt, this Section 6(b) does not affect any 362 | right the Licensor may have to seek remedies for Your violations 363 | of this Public License. 364 | 365 | c. For the avoidance of doubt, the Licensor may also offer the 366 | Licensed Material under separate terms or conditions or stop 367 | distributing the Licensed Material at any time; however, doing so 368 | will not terminate this Public License. 369 | 370 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 371 | License. 372 | 373 | 374 | Section 7 -- Other Terms and Conditions. 375 | 376 | a. The Licensor shall not be bound by any additional or different 377 | terms or conditions communicated by You unless expressly agreed. 378 | 379 | b. Any arrangements, understandings, or agreements regarding the 380 | Licensed Material not stated herein are separate from and 381 | independent of the terms and conditions of this Public License. 382 | 383 | 384 | Section 8 -- Interpretation. 385 | 386 | a. For the avoidance of doubt, this Public License does not, and 387 | shall not be interpreted to, reduce, limit, restrict, or impose 388 | conditions on any use of the Licensed Material that could lawfully 389 | be made without permission under this Public License. 390 | 391 | b. To the extent possible, if any provision of this Public License is 392 | deemed unenforceable, it shall be automatically reformed to the 393 | minimum extent necessary to make it enforceable. If the provision 394 | cannot be reformed, it shall be severed from this Public License 395 | without affecting the enforceability of the remaining terms and 396 | conditions. 397 | 398 | c. No term or condition of this Public License will be waived and no 399 | failure to comply consented to unless expressly agreed to by the 400 | Licensor. 401 | 402 | d. Nothing in this Public License constitutes or may be interpreted 403 | as a limitation upon, or waiver of, any privileges and immunities 404 | that apply to the Licensor or You, including from the legal 405 | processes of any jurisdiction or authority. 406 | 407 | 408 | ======================================================================= 409 | 410 | Creative Commons is not a party to its public 411 | licenses. Notwithstanding, Creative Commons may elect to apply one of 412 | its public licenses to material it publishes and in those instances 413 | will be considered the “Licensor.” The text of the Creative Commons 414 | public licenses is dedicated to the public domain under the CC0 Public 415 | Domain Dedication. Except for the limited purpose of indicating that 416 | material is shared under a Creative Commons public license or as 417 | otherwise permitted by the Creative Commons policies published at 418 | creativecommons.org/policies, Creative Commons does not authorize the 419 | use of the trademark "Creative Commons" or any other trademark or logo 420 | of Creative Commons without its prior written consent including, 421 | without limitation, in connection with any unauthorized modifications 422 | to any of its public licenses or any other arrangements, 423 | understandings, or agreements concerning use of licensed material. For 424 | the avoidance of doubt, this paragraph does not form part of the 425 | public licenses. 426 | 427 | Creative Commons may be contacted at creativecommons.org. 428 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh.pdf -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/NCU_thesis.cls: -------------------------------------------------------------------------------- 1 | % This class is a link to real class. 2 | \NeedsTeXFormat{LaTeX2e} 3 | \ProvidesClass{NCU_thesis}[2016/11/18 by sppmg] 4 | % pass no defined option to book class. 5 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{thesis_base}} 6 | % terminates the option processing. 7 | \ProcessOptions\relax 8 | % Load base class 9 | \LoadClass{thesis_base} 10 | %%%%% Load additional packages and commands. 11 | 12 | \endinput % this must be the last command. -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/appendix_LODraw_export.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | \begin{document} 3 | \chapter{LibreOffice Draw} 4 | \label{sec:a_loDraw} 5 | 因為朋友的M\$ Office 無法匯出eps 6 | \footnote{M\$ 好像很不重視eps(還是說像NTFS,不想給死老百姓用?),預設軟體都無法讀取。} 7 | ,於是附上我製作eps圖的方法。當然你如果有其它更好用、更順手的軟體,你就直接用那個吧! 8 | 首先你要有LibreOffice,沒有的請去下載。\url{https://zh-tw.libreoffice.org/} 9 | 10 | LibreOffice 如同M\$ Office有各種不同的子軟體 11 | \footnote{不過和M\$O不同的是 LO 各軟體共用同一核心,所以很多功能是通用的。} 12 | ,其中Draw 就是專門繪圖、製造海報的工具。 13 | 當你畫完圖後,點滑鼠左鍵選擇欲匯出物件(按住Shift連選,或是Ctrl+A全選)並於工具列選擇「匯出」(\cref{fig:loDraw_select})。 14 | 存檔視窗中,副檔名使用「.eps」或是選擇類型處點選「eps」來指定匯出為eps格式。記得勾選左下角「選取」框限制僅匯出選取的物件,否則會將整張紙面一起匯出。(\cref{fig:loDraw_save}) 15 | 按下確定存檔後會出現eps格式的設定細節。基本上不須要改,頂多注意要使用彩色還是灰階與是否壓縮。(\cref{fig:loDraw_epsOpt}) 16 | \insfig[0.7][fig:loDraw_select]{LibreOffice_Draw_select.png} 17 | \insfig[0.8][fig:loDraw_save]{LibreOffice_Draw_epsSave.png} 18 | \insfig[0.5][fig:loDraw_epsOpt]{LibreOffice_Draw_epsOption.png} 19 | 20 | \end{document} 21 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/appendix_commonBug.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | \begin{document} 3 | \chapter{常見錯誤列表} 4 | 這些是我打樣板時常見的手誤,時常導致難以理解的問題,像是超出\textbackslash{}endgroup 之類的。 5 | 6 | \begin{table}[h] 7 | \centering 8 | \begin{tabularx}{\textwidth}{| l | X |} 9 | \hline 10 | 網址中的 ``\#'' & wikibook網址中常有\#,即使位於\textbackslash{}url中仍會被視為關鍵字,須用跳脫字元處理。同樣的問題也會發生在其他關鍵子。 \\ \hline 11 | 文章中的底線\_ & 我的檔名大量使用底線命名,也是不小心就漏掉。會出現錯誤訊息說少\$ (被當數學模式) \\ \hline 12 | \end{tabularx} 13 | \end{table} 14 | 15 | \end{document} 16 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/chapter_presentation_beamer.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | % \let\orilabel\label % enable \ref in LTXexample 3 | 4 | \begin{document} 5 | 6 | % \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 7 | % \end{LTXexample} 8 | % \begin{lstlisting} 9 | % \end{lstlisting} 10 | \let\tnote\tptabletnote 11 | \chapter{用 Beamer 做簡報} 12 | \LaTeX 除了排版書籍,製作簡報也是沒問題的。如果你厭倦了 GUI 介面的簡報軟體如 M\$ Office 的 PPT 或是 Libreoffice 的 impress 須要精密的滑鼠操控技術以及多圖下 Lag 到不行的體驗,那\LaTeX 簡報或許是你的救贖。不過對於常常須要建立箭頭指標等等的簡報類型,可能會讓你花費更多的時間,請依個人情況決定是否採用。 13 | 14 | 其實政大數學系的蔡炎龍老師做過一份淺顯易懂的\href{http://yenlung.km.nccu.edu.tw/xms/read_attach.php?id=85}{簡報}。 15 | \footnote{由\url{http://yenlung.km.nccu.edu.tw/xms/read_attach.php?id=85}下載。} 16 | 下面的內容算是自己的心得整理。 17 | 18 | \section{快速上手} 19 | 20 | \LaTeX 做簡報有很多種方法,其中最流行的就是 Beamer 。 21 | \footnote{Beamer 無論是\LaTeX 、 PDFLaTeX 或是 \XeLaTeX 都支援。其他製作方法有些限定了可用的編譯器,選用上須注意。} 22 | 一份最簡單的(英文) Beamer 簡報如下: 23 | \begin{lstlisting} 24 | \documentclass[xetex,mathserif,serif]{beamer} 25 | % \usetheme{Warsaw} 26 | 27 | \title{Title of Presentation} 28 | \subtitle{Subtitle of Presentation} 29 | \author{sppmg} 30 | % \institute{} 31 | % \date{} 32 | 33 | \begin{document} 34 | \frame{\titlepage} 35 | 36 | \begin{frame}{Title of slide} 37 | Content goes here 38 | \end{frame} 39 | 40 | \begin{frame} %[plain], [shrink], [allowframebreaks], [fragile] 41 | \frametitle{Title of slide} 42 | \framesubtitle{Subtitle of slide} 43 | Content goes here 44 | \end{frame} 45 | 46 | \end{document} 47 | \end{lstlisting} 48 | 這個例子將會生成3頁的簡報。各項解釋如下: 49 | \renewcommand*{\thead}[1]{\multicolumn{1}{|c|}{\bfseries #1}} 50 | \begin{table}[h] 51 | \begin{threeparttable} 52 | \caption{} 53 | % -------------------------- 54 | \begin{tabularx}{\textwidth}{|l|X|} \hline 55 | \thead{行號或項目} & \thead{解說} \\ \hline 56 | 1 & 使用 beamer class 。選項使用 xetex 是因為我使用 \XeLaTeX ,非 \XeLaTeX 使用者請依手冊修正。 \\ \hline 57 | 2 & 選擇簡報主題。 \tnote{1} \\ \hline 58 | 4 $\sim$ 8 & 設定簡報題目、作者資訊 \\ \hline 59 | 11 & 產生封面 \\ \hline 60 | \textbackslash{}begin\{frame\} $\sim$ \textbackslash{}end\{frame\} & 一頁簡報。 \\ \hline 61 | \textbackslash{}frametitle\{\} & 各頁標題,亦可直接以\{\}加在\textbackslash{}begin\{frame\}後(第1參數)。 \\ \hline 62 | \textbackslash{}framesubtitle\{\} & 各頁子標題,亦可直接以\{\}加在\textbackslash{}begin\{frame\}後(第2參數)。 \\ \hline 63 | frame選項 & 擇一使用或不用亦可 \\ \hline 64 | plain & (經測試,有些頁面下方的附加資訊會消失,可略增頁面空間。) \\ \hline 65 | shrink & 將一頁內容縮小至符合頁面大小。可用[shrink=5]來設定允許縮小比例。若內容小於頁面將向上對齊而非至中。 \\ \hline 66 | allowframebreaks & 若超過頁面的話可以自動分成另一頁(頁標題自動附加數目)。 \\ \hline 67 | fragile & 若需verb 、 verbatim 、 lstlisting 等原樣輸出指令,須用此選項。 \\ \hline 68 | % http://nochair.net/posts/2011/05-05-fragile-latex-beamer.html 69 | \end{tabularx} 70 | % -------------------------- 71 | \begin{tablenotes} 72 | \item [1] 完整主題截圖列表請見:\url{https://www.hartwork.org/beamer-theme-matrix/} 。 縱軸為主題,橫軸為色彩(\textbackslash{}usecolortheme\{\})。 73 | \end{tablenotes} 74 | \end{threeparttable} 75 | \end{table} 76 | 77 | \section{文字強調及色彩} 78 | 一般 \LaTeX 文件中常用 \verb|\emph{}| 做\emph{強調文字},但這指令在 Beamer 中會太斜,也不夠醒目。因此 Beamer 中另提供\verb|\structure{}|與\verb|alert{}| ,\verb|\structure{}|通常為粗體,顏色則視主題而定。 79 | \verb|alert{}|一般使用{\color{red}紅色}文字。 80 | 81 | 若要使用其他顏色可以用 \verb|\color{color}| ,記得加上\{\}限制範圍(這方法與一般文件是一樣的)。 82 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 83 | This is {\color{green} green color} word. 84 | \end{LTXexample} 85 | 86 | \section{文字方塊} 87 | Beamer 提供文字方塊,如 。但須注意預設的主題中並未定義各方塊樣式,請用\verb|\usetheme{}|更改主題。 88 | 89 | 90 | 91 | \section{分段顯示} 92 | 這裡的「分段顯示」指的是在逐步切換過程中,一頁的文字會逐漸顯示出來。譬如說一個列表每按一次顯示一個項目。這個功能在 Beamer 中稱為 ``overlay'' 。 93 | 94 | \section{縮短編譯時間} 95 | % Improving Compilation Speed 96 | % \documentclass[draft]{beamer} 97 | % \includeonlyframes{⟨frame label list⟩} 98 | 縮短編譯時間有兩種方法。一是使用 draft 選項,如同一般文件,draft 將不處理圖片及目錄。 99 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 100 | \documentclass[draft]{beamer} 101 | \end{LTXexample} 102 | 103 | 另一種方法類似一般文件的\verb|\includeonly{}|,僅編譯所標記下來的頁面。(但似乎無法配合 allowframebreaks ) 104 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 105 | \includeonlyframes{current} 106 | \begin{frame}[label=current]{title} 107 | ... 108 | \end{frame} 109 | \end{LTXexample} 110 | 111 | 112 | \end{document} -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/chapter_template.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | % \let\orilabel\label % enable \ref in LTXexample 3 | 4 | \begin{document} 5 | 6 | % \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 7 | % \end{LTXexample} 8 | % \begin{lstlisting} 9 | % \end{lstlisting} 10 | 11 | \chapter{} 12 | \section{} 13 | 14 | \end{document} -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/chapter_titlepage.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | % \let\orilabel\label % enable \ref in LTXexample 3 | \begin{document} 4 | 5 | % \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 6 | % \end{LTXexample} 7 | % \begin{lstlisting} 8 | % \end{lstlisting} 9 | % \textbackslash{} 10 | 11 | \section{封面製作方法} 12 | 13 | 製作封面的方法在常見的 \LaTeX 教學中,僅提到利用 \textbackslash{}maketitle 指令可以產生封面頁。但使用後會發現其產生的封面極其簡陋,往往不合我們的需求。這裡要介紹的就是產生自訂封面的基礎方法。 14 | 15 | 16 | 在開始之前,讓我們靜下心想想,封面與內文的差異處: 17 | \begin{enumerate} 18 | \item 不顯示、計算頁碼。 19 | \item 字體大小、位置、對齊方式等等都是自由可變化的。 20 | \end{enumerate} 21 | 22 | 第一個要求可以透過 titlepage 環境達成,其作用是表明這是封面(未必是首頁),同時去除頁面的多欄(columns)設定、停用頁碼計數、修改頁面風格、另起新頁等等。 23 | \footnote{\textbackslash{}maketitle 指令其實就是利用 titlepage 定義一個非常簡單的格式,請參考 book.cls } 24 | 25 | 第二個字體部份,與內文區大同小異。字的大小可用 \textbackslash{}Large 這類指令進行修改(或是\textbackslash{}fontsize\{size\}\{skip\})。對齊方式常用的如 center 環境來置中文字。文字行的間距除了可以用 Word 常用方法~直接換行外,\LaTeX 中更好的做法是利用\textbackslash{}vspace*\{\} 指令強制插入一個固定的垂直空白(須指定單位如 \vspace*{3mm} )。 26 | \footnote{若使用不加星號的 \textbackslash{}vspace\{\} ,在頁首處將會失效,各位可斟酌使用。(\url{http://tex.stackexchange.com/q/76101})} 27 | 另外 \TeX 也提供了一個可變長度的填充指令 \textbackslash{}vfill ,\TeX 會將頁面文字剩餘空間平均分配給生成頁面上所有的 \textbackslash{}vfill 。舉例來說,以下範例會讓文字出現在1/3的位置。 28 | \footnote{其實還有另一個指令 \textbackslash{}vfil 。\textbackslash{}vfil 與 \textbackslash{}vfill 作用相同但階層不同。\textbackslash{}vfill 較「高級」,能夠搶走\textbackslash{}vfil 的空間。詳見\url{http://tex.stackexchange.com/q/64756/111676}} 29 | \begin{lstlisting} 30 | \begin{titlepage} 31 | \vfill 32 | Here is 1/3 position. 33 | \vfill 34 | \vfill 35 | \end{titlepage} 36 | \end{lstlisting} 37 | 38 | 除了上面的基本格式方法外,還有幾個小地方要注意,這裡我直接用我的樣板設定來講。 39 | \begin{lstlisting} 40 | \begin{document} 41 | 42 | \titlepageFontFamily 43 | \newgeometry{top=2.0cm, bottom=2.0cm, inner=2cm, outer=2cm} 44 | \begin{spacing}{1.0} 45 | \begin{titlepage} 46 | \null\vfill 47 | \begin{center} 48 | Text. 49 | \end{center} 50 | \end{titlepage} 51 | \end{spacing} 52 | \restoregeometry 53 | \normalfont % use main font 54 | \cleardoublepage 55 | \end{lstlisting} 56 | 其中要注意的指令及作用如下表: 57 | \begin{table}[!h] 58 | \begin{tabularx}{\textwidth}{lX} 59 | \textbackslash{}titlepageFontFamily & 自訂指令,為了設定封面頁的字型風格,如 \textbackslash{}sffamily \\ 60 | \textbackslash{}newgeometry\{\} & 使用一個新的頁面規劃(頁邊寬度之類),並暫存之前的設定。這指令常用在封面規劃與內文不同的情況,尤其是左右邊距不同的情況。 \\ 61 | \textbackslash{}begin\{spacing\}\{1.0\} & 固定行距。因內文行距設定不應影響封面,所以這裡設定一個固定值。當然,若之前未更動行距設定,這裡也不用加。(spacing 環境需載入 setspace 套件) \\ 62 | \textbackslash{}restoregeometry & 復原至上一個頁面規劃。\\ 63 | \textbackslash{}normalfont & 復原至預設字型\\ 64 | \textbackslash{}cleardoublepage & 強制換至右頁(用於雙面模式下,單面模式就單純換面)。\\ 65 | \end{tabularx} 66 | \end{table} 67 | 68 | 69 | 上面這些就是使用純文字製作封面的方法了。若要仿造某個封面(如:某校提供的範例)或是做較為精細的版面設計,建議在\textbackslash{}documentclass 的選項加上 colorgrid ,可以顯示以 mm 為單位的網格用於對齊(由 eso-pic 套件提供)。如果想放入圖片、表格請直接用 \textbackslash{}includegraphics\{\} 與 tabular (毋須浮動環境figure、table)。若是要放入繪製圖、線段等等可以參考 tikz 繪圖。 70 | 71 | 72 | % 要製作一個封面,須要使用到 titlepage 環境(用\begin{...} \end{...}包起來)與 \vfill 指令。 73 | % titlepage 環境的作用是表明這是封面(未必是首頁),同時去除頁面的多欄(columns)設定、停用頁碼計數、修改頁面風格、另起新頁等等。( \maketitle 指令其實就是利用 titlepage 定義一個非常簡單的格式) 74 | % 75 | % \vfill 指令則是在指令位置插入一個可變大小的垂直距離(空白)。 LaTeX 會將頁面文字剩餘空間平均分配給生成頁面上所有的 \vfill 。舉例來說,以下範例會讓文字出現在1/3的位置。 76 | % \begin{lstlisting} 77 | % \begin{titlepage} 78 | % \vfill 79 | % Here is 1/3 position. 80 | % \vfill 81 | % \vfill 82 | % \end{titlepage} 83 | % \end{lstlisting} 84 | % 85 | % 接著還有 center 環境與 \vspace*{…} 指令可以控制文字位置。center 環境就是將文字置中,而 \vspace*{…} 則是強制插入一個固定的垂直空白(須指定單位如 \vspace*{3mm} )。 86 | % 稍微提一下, 若使用不加星號的 \vspace{…} ,在頁首處將會失效,各位可斟酌使用。( 87 | % http://tex.stackexchange.com/q/76101 ) 88 | % 89 | % 進一步了解 90 | % 除了上面的基本格式方法外,還有幾個小地方要注意,這裡我直接用我的樣板設定來講。 91 | % 92 | 93 | 94 | 95 | \end{document} 96 | % 97 | % \begin{titlepage}% 98 | % \let\footnotesize\small 99 | % \let\footnoterule\relax 100 | % \let \footnote \thanks 101 | % \null\vfil 102 | % \vskip 60\p@ 103 | % \begin{center}% 104 | % {\LARGE \@title \par}% 105 | % \vskip 3em% 106 | % {\large 107 | % \lineskip .75em% 108 | % \begin{tabular}[t]{c}% 109 | % \@author 110 | % \end{tabular}\par}% 111 | % \vskip 1.5em% 112 | % {\large \@date \par}% % Set date in \large size. 113 | % \end{center}\par 114 | % \@thanks 115 | % \vfil\null 116 | % \end{titlepage}% 117 | % \setcounter{footnote}{0}% 118 | % \global\let\thanks\relax 119 | % \global\let\maketitle\relax 120 | % \global\let\@thanks\@empty 121 | % \global\let\@author\@empty 122 | % \global\let\@date\@empty 123 | % \global\let\@title\@empty 124 | % \global\let\title\relax 125 | % \global\let\author\relax 126 | % \global\let\date\relax 127 | % \global\let\and\relax 128 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/config.tex: -------------------------------------------------------------------------------- 1 | %%%%% build setting | 編譯設定 %%%%% 2 | \setboolean{publish}{false} % {true}/{false} Set true before publish. 發佈前設true 3 | % draft option will not load figure, so reduce compile time. 4 | % add to class option in main.tex ( \documentclass[draft] ) 5 | \def\lang{zh} % zh/en Set main language. 6 | \setboolean{disableChinese}{false} % {true}/{false} Disable chinese, for English user. 7 | \def\titlepageLang{zh} % zh/en/{} Choose language for titlepage (zh -> Chinese / en -> English / {} -> hide titlepage and disable chinese font) 8 | \synctex=1 % Enable SyncTeX 9 | 10 | %%%%% Information of your document. | 定義文件資訊 %%%%% 11 | \def\deptshort {} 12 | \def\dept {}%XX學系XXX碩士班(請參考「中央大學學位論文撰寫體例參考」附錄) 13 | \def\degree {} 14 | \def\title {\LaTeX\ 論文樣板與簡易教學} 15 | \def\subtitle {\LaTeX\ Thesis Template and Tutorial} 16 | \def\logo {logo-toad.jpg} % 填入校徽檔名。中央無校徽在封面,維持空白可除去校徽 17 | \def\author {sppmg} 18 | \def\mprof {} 19 | \def\sprofi {} % 共同指導 1 20 | \def\sprofii {} % 共同指導 2 21 | \def\degreedate{} 22 | \def\copyyear {2012-2013} 23 | \setboolean{printcopyright}{false} % {true}/{false} print copyright text on titlepage or cover. 24 | 25 | \def\keywordsZh{latex, 中文, 論文, sppmg} % don't use \def\keywords 26 | \def\keywordsEn{latex, chinese, thesis, sppmg} 27 | 28 | %%%%%% set OS | 設定作業系統 %%%%% 29 | % Will overwrite \OS if your latex compile parameter has ``-shell-escape''(Texstudio default enable). 30 | \def\OS{linux} % {linux}/{win}, only effect auto select CJK font.(CJK means Chinese, Japanese, and Korean) 31 | 32 | %%%%%% set font | 設定中英文字型 %%%%% 33 | % keep empty for default font. CJK font must set OS for auto select. 34 | % Setting by name of font(English will be better) or font filename. 35 | % Linux 利用指令 fc-list :lang=zh 來查詢可以用的字體名稱。 36 | % Windows 使用內建字型管理查詢。 37 | \def\mainfont {} % default use Latin Modern Roman (lmodern pkg.) 38 | \def\sansfont {} 39 | \def\monofont {} 40 | \def\CJKmainfont{} 41 | \def\CJKsansfont{} 42 | \def\CJKmonofont{} 43 | 44 | %%%%% depth | 文獻列表風格 %%%%% 45 | \setboolean{bibStyleNameYear}{false} % {true}/{false} true for use name,year to sort and cite.(If you want use custom option in .cls, set false here. ) 46 | 47 | %%%%% depth | 章節深度 %%%%% 48 | % LaTeX 預設2,chapter == 0。 49 | \def\secNumDepth{4} % 設定章節標題給予數字標號的深度, \paragraph == 4。 50 | \def\tocDepth{2} % 目錄顯示層級,\subsection == 2。 51 | 52 | %%%%% style of toc and titles | 目錄及章節風格 %%%%% 53 | % see tutorial. (0 -> original) 54 | \def\tocStyleAlign{0} % 0/1 55 | \def\tocStyleChapter{1} % 0/1/2 56 | \def\titleStyle{0} % 0/1 57 | \def\indentBlockSSS{0mm} % indent \subsubsection{} 58 | \def\indentBlockPar{0mm} % indent \paragraph{} 59 | \def\indentBlockSPar{0mm} % indent \subparagraph{} 60 | 61 | %%%%% style of fonts and line stretch | 字體大小風格及行距 %%%%% 62 | % Base font 63 | \def\baseFontSize{14pt} % valid: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt 64 | \def\baseLineStretch{1.5} 65 | % Bibliography 66 | \def\bibFontStyle{\small} 67 | \def\bibLineStretch{1.2} 68 | % Table 69 | \def\floatFontStyle{\small} % content of table 70 | \def\tableLineStretch{1.2} 71 | % Caption 72 | \def\captionFontStyle{\small} 73 | \def\subcaptionFontStyle{\footnotesize} 74 | \def\captionLineStretch{1.2} 75 | % Page 76 | \def\pageHeaderStyle{\sffamily\itshape\footnotesize} 77 | \def\pageFooterStyle{\sffamily\footnotesize} 78 | % listing font style set by basicstyle in \lstdefinestyle, see macro_preamble.tex 79 | % todonotes font style set by textsize option when package loading, see cls. default footnotesize 80 | 81 | %%%%% Style of titles | 標題風格 %%%%% 82 | \def\titlepageFontFamily{\sffamily} 83 | % set "\rmfamily\CJKfamily{sf}" to mix rm for English and sf(default Kai) for CJK, see wiki on TW_Thesis_Template. 84 | \def\abstractHeaderStyle{\sffamily\Large} % Information on abstract, cls default use \centering 85 | 86 | \def\chapterTitleNumStyle{\sffamily\LARGE\bfseries} % Number of chapter, only for en 87 | \def\chapterTitleStyle{\sffamily\huge\bfseries} % cls default use \centering for zh 88 | \def\sectionTitleStyle{\sffamily\Large\bfseries} 89 | \def\subsectionTitleStyle{\sffamily\large\bfseries} 90 | \def\subsubsectionTitleStyle{\sffamily\normalsize\bfseries} 91 | \def\paragraphTitleStyle{\sffamily\normalsize\bfseries} 92 | \def\subparagraphTitleStyle{\sffamily\normalsize\bfseries} 93 | 94 | %%%%% Misc | 雜項 %%%%% 95 | \setboolean{pdfLinkBoxDisplay}{true} % {true}/{false} ,Draw a box on the link. It only display in pdf viewer, not on paper. 96 | \def\fakeBoldFactor{2} % 假粗體粗度。(Only affect CJK font.) -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/LibreOffice_Draw_epsOption.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/LibreOffice_Draw_epsOption.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/LibreOffice_Draw_epsSave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/LibreOffice_Draw_epsSave.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/LibreOffice_Draw_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/LibreOffice_Draw_select.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_01.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_02.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_03.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_04.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_05.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_06.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/Zotero_07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/Zotero_07.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/github_branchList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/github_branchList.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/github_pjDownload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/github_pjDownload.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/github_tagList.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/github_tagList.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-Debian.eps: -------------------------------------------------------------------------------- 1 | %!PS-Adobe-3.0 EPSF-3.0 2 | %%BoundingBox: 262 316 372 461 3 | %................................ 4 | %%Creator: GNU Ghostscript 510 (epswrite) 5 | %%CreationDate: 1999/12/10 21:20:34 6 | %%DocumentData: Clean7Bit 7 | %%LanguageLevel: 2 8 | %%EndComments 9 | %%BeginProlog 10 | % This copyright applies to everything between here and the %%EndProlog: 11 | % Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. 12 | %%BeginResource: procset GS_pswrite_ProcSet 13 | /GS_pswrite_ProcSet 40 dict dup begin 14 | /!{bind def}bind def/X{load def}! 15 | /rg/setrgbcolor X/g/setgray X/w/setlinewidth X/J/setlinecap X 16 | /j/setlinejoin X/M/setmiterlimit X/d/setdash X/i/setflat X 17 | /m/moveto X/l/lineto X/c/curveto X/h/closepath X 18 | /lx{0 rlineto}!/ly{0 exch rlineto}!/v{currentpoint 6 2 roll c}!/y{2 copy c}! 19 | /re{4 -2 roll m exch dup lx exch ly neg lx h}! 20 | /q/gsave X/Q/grestore X/f/fill X/f*/eofill X/S/stroke X/rf{re f}! 21 | /Y{initclip clip newpath}!/Y*{initclip eoclip newpath}!/rY{re Y}! 22 | /@/currentfile X/|{string readstring pop}! 23 | /Ix{[1 0 0 1 9 -1 roll neg 9 -1 roll neg]exch}! 24 | /It{true exch Ix imagemask}!/If{false exch Ix imagemask}!/I{exch Ix image}! 25 | /Ic{Ix false 1 colorimage}! 26 | /@85{@/ASCII85Decode filter}! 27 | end def 28 | %%EndResource 29 | %%EndProlog 30 | %%Page: 1 1 31 | %%BeginPageSetup 32 | save GS_pswrite_ProcSet begin 0.1 0.1 scale 33 | %%EndPageSetup 34 | 0.843137 0.027451 0.317647 rg 35 | 0 0 m 36 | 6120 0 l 37 | 6120 7920 l 38 | 0 7920 l 39 | Y 40 | 3233.33 4125.86 m 41 | 3218.39 4125.66 3236.15 4118.18 3255.66 4115.17 c 42 | 3261.06 4119.39 3265.94 4123.63 3270.29 4127.77 c 43 | 3258.15 4124.8 3245.79 4124.73 3233.33 4125.86 c 44 | f 45 | 3313.52 4145.85 m 46 | 3322.43 4158.14 3328.92 4171.58 3331.2 4185.48 c 47 | 3329.19 4175.58 3323.84 4167.03 3318.76 4157.99 c 48 | 3290.83 4140.4 3316.12 4168.43 3318.74 4179.1 c 49 | 3288.72 4141.27 3314.61 4156.42 3313.52 4145.85 c 50 | f 51 | 3343.14 4222.89 m 52 | 3344.95 4249.8 3337.84 4241.28 3335.46 4231.03 c 53 | 3338.23 4229.57 3340.44 4212.05 3343.14 4222.89 c 54 | f 55 | 3176.66 4590.68 m 56 | 3184.64 4589.26 3193.91 4588.16 3192.58 4586.25 c 57 | 3201.32 4588.18 3203.3 4589.92 3176.66 4590.68 c 58 | f 59 | 3192.58 4586.25 m 60 | 3186.96 4585.08 l 61 | 3192.21 4585.56 l 62 | 3192.58 4586.25 l 63 | f 64 | 3441.26 4212.69 m 65 | 3442.16 4188.53 3434.21 4176.79 3427.02 4156.03 c 66 | 3414.1 4149.6 l 67 | 3403.54 4129.06 3415.15 4136.56 3407.57 4120.23 c 68 | 3391.05 4105.56 3357.51 4074.34 3346.77 4071.48 c 69 | 3338.92 4071.65 3352.08 4080.74 3353.8 4084.29 c 70 | 3331.71 4069.13 3336.06 4061.53 3302.29 4052.3 c 71 | 3301.3 4054.51 l 72 | 3218 4015.31 3102.28 4092.98 3103.8 4198.94 c 73 | 3102.92 4192.22 3101.27 4193.9 3099.43 4191.2 c 74 | 3095.13 4245.71 3124.61 4300.46 3174.33 4322.85 c 75 | 3222.96 4346.91 3279.97 4337.05 3314.79 4304.56 c 76 | 3295.66 4329.62 3257.58 4356.19 3212.45 4353.73 c 77 | 3168.24 4353.01 3126.88 4324.92 3113.07 4294.41 c 78 | 3090.43 4280.16 3087.79 4239.45 3077.93 4231.99 c 79 | 3064.64 4134.39 3102.9 4092.24 3167.63 4042.63 c 80 | 3177.79 4035.77 3170.49 4034.72 3171.85 4029.5 c 81 | 3150.35 4039.56 3130.67 4054.76 3114.47 4073.37 c 82 | 3123.07 4060.8 3132.34 4048.58 3144.33 4038.98 c 83 | 3124.04 4045.83 3096.95 4088.11 3089.06 4089.83 c 84 | 3124.01 4027.25 3230.84 3980.08 3286.81 4003.49 c 85 | 3260.92 4002.53 3228.03 4002.96 3198.94 4013.71 c 86 | 3186.7 4020 3170.1 4033.01 3173.07 4035.44 c 87 | 3249.42 4006.93 3328.29 4013.86 3394.36 4066.81 c 88 | 3411.16 4079.91 3429.52 4102.18 3434.83 4102.48 c 89 | 3426.85 4090.46 3436.2 4096.7 3430.07 4086.09 c 90 | 3446.8 4113.1 3422.78 4097.09 3447.37 4132.73 c 91 | 3456.46 4120.23 l 92 | 3453.07 4142.67 3484.31 4169.89 3481.12 4205.35 c 93 | 3488.29 4216.19 3489.11 4193.67 3481.51 4168.73 c 94 | 3492.06 4196.4 3484.31 4200.85 3487 4223.69 c 95 | 3489.92 4216.01 3493.78 4207.86 3495.75 4199.75 c 96 | 3488.88 4226.5 3502.78 4244.78 3506.24 4260.33 c 97 | 3502.82 4261.83 3495.64 4248.51 3493.98 4280.09 c 98 | 3494.23 4293.81 3497.8 4287.28 3499.17 4290.66 c 99 | 3496.49 4292.21 3489.42 4302.73 3485.13 4322.9 c 100 | 3488.22 4327.65 3493.45 4310.61 3497.69 4309.92 c 101 | 3494.96 4325.95 3490.26 4338.18 3490.07 4350.49 c 102 | 3477.67 4376.39 3485.67 4347.03 3475.64 4361.61 c 103 | 3462.44 4402.75 3486.57 4371.16 3488.21 4389.84 c 104 | 3508.19 4360.89 3519.59 4315.99 3524.83 4297.4 c 105 | 3520.83 4320.07 3514.39 4342.04 3506.49 4363.29 c 106 | 3512.59 4360.72 3496.72 4409.92 3514.4 4377.34 c 107 | 3495.52 4446.79 3433.62 4511.69 3376.67 4542.13 c 108 | 3383.62 4535.76 3392.42 4527.76 3389.27 4526.5 c 109 | 3360.94 4543.35 3365.92 4544.68 3361.85 4551.8 c 110 | 3338.8 4561.19 3337.27 4551.03 3322 4551.78 c 111 | 3278.52 4574.86 3270.13 4572.4 3230.1 4586.85 c 112 | 3231.91 4578.33 l 113 | 3203.1 4587.93 3198.34 4574.71 3167.21 4578.31 c 114 | 3165.32 4579.78 3177.19 4583.67 3186.96 4585.08 c 115 | 3159.11 4581.4 3160.41 4590.58 3133.15 4584.07 c 116 | 3139.86 4588.78 3146.98 4591.91 3154.14 4595.91 c 117 | 3131.43 4594.53 3099.9 4582.69 3109.63 4593.47 c 118 | 3072.58 4576.93 3006.77 4553.72 2969.84 4519.09 c 119 | 2968.68 4526.85 l 120 | 2951.76 4506.54 2894.89 4466.19 2890.36 4439.86 c 121 | 2885.83 4438.81 l 122 | 2877.04 4423.9 2871.33 4407.01 2864.35 4391.68 c 123 | 2852.84 4372.05 2847.47 4384.12 2849.11 4381.04 c 124 | 2826.46 4335.12 2815.19 4296.54 2805.48 4264.88 c 125 | 2812.4 4254.53 2805.65 4202.56 2808.26 4160.97 c 126 | 2796.9 3955.53 2952.44 3756.07 3122.46 3710.04 c 127 | 3147.38 3701.11 3184.43 3701.44 3215.96 3700.55 c 128 | 3178.77 3711.19 3173.97 3706.17 3137.73 3718.81 c 129 | 3111.6 3731.13 3105.88 3745.18 3087.36 3761.25 c 130 | 3094.69 3748.3 l 131 | 3058.39 3761.15 3073.58 3764.2 3044.04 3773.55 c 132 | 3051.87 3783.77 l 133 | 3040.1 3784.67 3020.7 3803.59 3015.4 3814.1 c 134 | 3002.52 3813.59 l 135 | 2987.06 3832.66 2978.81 3846.43 2979.42 3857.09 c 136 | 2975.26 3849.67 l 137 | 2970.55 3857.75 2918.35 3921.25 2945.43 3906.47 c 138 | 2940.4 3911.05 2933.71 3913.94 2926.46 3927.13 c 139 | 2931.97 3933.42 l 140 | 2918.96 3950.19 2907.99 3971.68 2908.83 3978.84 c 141 | 2915.78 3969.46 2920.6 3967.7 2925.38 3966.09 c 142 | 2892.47 4047.73 2890.62 3970.58 2865.71 4049.19 c 143 | 2870.97 4049.61 l 144 | 2866.94 4055.72 2864.47 4062.31 2861.23 4068.8 c 145 | 2863.53 4091.65 l 146 | 2839.85 4119.01 2856.91 4208.1 2860.34 4256.95 c 147 | 2862.69 4276.81 2880.11 4297.96 2893.34 4331.13 c 148 | 2885.28 4332.51 l 149 | 2900.7 4359.39 2973.3 4440.5 3006.94 4436.34 c 150 | 3023.23 4456.8 3003.7 4436.42 3000.51 4441.56 c 151 | 3036.3 4478.59 3047.55 4467.72 3071.7 4474.39 c 152 | 3097.73 4489.84 3049.35 4468.35 3061.69 4480.28 c 153 | 3106.72 4491.77 3093.59 4506.42 3152.32 4512.25 c 154 | 3158.52 4508.73 3137.95 4506.81 3132.79 4502.24 c 155 | 3170.29 4520.6 3251.48 4516.41 3304.23 4492.06 c 156 | 3365.41 4463.45 3434.17 4378.92 3436.89 4299.39 c 157 | 3439.97 4298.56 l 158 | 3438.41 4266.94 3444.81 4230.37 3433.71 4196.79 c 159 | 3441.26 4212.69 l 160 | f 161 | 3070.23 4105.36 m 162 | 3068.12 4094.89 l 163 | 3077.95 4081.54 3085.75 4067.08 3098.28 4056.68 c 164 | 3089.26 4074.27 3082.57 4081.54 3070.23 4105.36 c 165 | f 166 | 3093.44 4106.26 m 167 | 3088.24 4112.02 3085.18 4118.94 3081.72 4125.82 c 168 | 3085.02 4113.71 3091.78 4103.3 3098.05 4092.7 c 169 | 3093.44 4106.26 l 170 | f 171 | 3504.27 4195.56 m 172 | 3502.08 4190.04 l 173 | 3498.06 4161.46 3489.36 4133.18 3476.03 4106.95 c 174 | 3490.75 4134.62 3500.25 4164.89 3504.27 4195.56 c 175 | f 176 | 3179.63 4597.85 m 177 | 3189.73 4601.54 3204.45 4599.88 3215.19 4602.31 c 178 | 3201.21 4601.14 3187.3 4600.44 3173.57 4598.69 c 179 | 3179.63 4597.85 l 180 | f 181 | 2824.92 4409.23 m 182 | 2827.25 4387.69 2808.72 4379.32 2829.02 4393.54 c 183 | 2839.92 4418.08 2824.78 4400.31 2824.92 4409.23 c 184 | f 185 | 2801.04 4309.49 m 186 | 2805.73 4323.86 2806.57 4332.48 2808.36 4340.81 c 187 | 2795.43 4324.27 2802.4 4320.74 2801.04 4309.49 c 188 | f 189 | 0 g 190 | 2758.02 3347.25 m 191 | 2757.57 3346.78 2757.57 3272.19 2756.64 3252.72 c 192 | 2755.72 3236.97 2754.32 3203.15 2720.96 3203.15 c 193 | 2686.67 3203.15 2678.33 3242.54 2675.55 3259.67 c 194 | 2672.31 3278.67 2672.31 3294.43 2672.31 3301.37 c 195 | 2672.31 3323.61 2673.7 3385.72 2726.06 3385.72 c 196 | 2741.82 3385.72 2750.62 3381.07 2757.57 3377.38 c 197 | 2758.02 3347.25 l 198 | h 199 | 2623.65 3292.56 m 200 | 2623.65 3161.9 2693.16 3161.9 2703.35 3161.9 c 201 | 2732.08 3161.9 2750.62 3177.66 2758.49 3204.98 c 202 | 2759.42 3163.75 l 203 | 2768.23 3164.22 2777.03 3165.14 2791.39 3165.14 c 204 | 2796.49 3165.14 2800.65 3165.14 2804.37 3164.67 c 205 | 2808.08 3164.67 2811.78 3164.22 2815.95 3163.75 c 206 | 2808.54 3178.57 2802.98 3211.93 2802.98 3284.24 c 207 | 2802.98 3354.67 2802.98 3473.75 2809 3509.9 c 208 | 2792.33 3502.01 2777.95 3496.91 2746.44 3494.14 c 209 | 2758.95 3480.7 2758.95 3473.75 2758.95 3412.6 c 210 | 2750.16 3415.37 2739.03 3418.61 2720.03 3418.61 c 211 | 2637.09 3418.61 2623.65 3346.33 2623.65 3292.56 c 212 | f 213 | 2874.95 3316.21 m 214 | 2875.42 3354.67 2883.3 3388.97 2916.19 3388.97 c 215 | 2952.34 3388.97 2955.1 3349.12 2954.18 3316.21 c 216 | 2874.95 3316.21 l 217 | h 218 | 3000.05 3311.56 m 219 | 3000.05 3365.78 2989.4 3419.08 2920.82 3419.08 c 220 | 2826.3 3419.08 2826.3 3314.35 2826.3 3292.11 c 221 | 2826.3 3198.05 2868.46 3160.98 2939.36 3160.98 c 222 | 2970.85 3160.98 2986.16 3165.6 2994.5 3167.93 c 223 | 2994.04 3184.61 2996.35 3195.27 2999.15 3209.63 c 224 | 2989.4 3203.59 2976.89 3195.72 2949.09 3195.72 c 225 | 2876.8 3195.72 2875.87 3261.54 2875.87 3284.24 c 226 | 2999.15 3284.24 l 227 | 3000.05 3311.56 l 228 | f 229 | 3150.8 3291.64 m 230 | 3150.8 3248.55 3142.93 3190.62 3089.18 3190.62 c 231 | 3081.76 3190.62 3072.5 3192.03 3066.48 3193.42 c 232 | 3065.55 3210.1 3065.55 3238.83 3065.55 3272.19 c 233 | 3065.55 3312.05 3069.71 3332.87 3072.97 3343.09 c 234 | 3082.69 3375.98 3104.47 3376.44 3108.63 3376.44 c 235 | 3143.85 3376.44 3150.8 3327.77 3150.8 3291.64 c 236 | h 237 | 3017.82 3241.13 m 238 | 3017.82 3206.84 3017.82 3187.38 3012.26 3172.56 c 239 | 3031.26 3165.14 3054.88 3160.98 3083.16 3160.98 c 240 | 3101.23 3160.98 3153.59 3160.98 3181.85 3218.89 c 241 | 3195.29 3245.76 3199.92 3281.91 3199.92 3309.26 c 242 | 3199.92 3325.94 3198.07 3362.54 3184.63 3385.72 c 243 | 3171.66 3407.48 3150.8 3418.61 3128.57 3418.61 c 244 | 3084.08 3418.61 3071.11 3381.54 3064.17 3362.54 c 245 | 3064.17 3386.17 3064.62 3468.65 3068.32 3510.82 c 246 | 3038.21 3496.91 3019.66 3494.61 2999.75 3492.75 c 247 | 3017.82 3485.35 3017.82 3454.75 3017.82 3355.12 c 248 | 3017.82 3241.13 l 249 | f 250 | 3288.99 3163.75 m 251 | 3279.73 3165.14 3273.22 3166.07 3259.78 3166.07 c 252 | 3244.98 3166.07 3234.77 3165.14 3224.12 3163.75 c 253 | 3228.75 3172.56 3230.6 3176.74 3231.99 3206.84 c 254 | 3233.85 3248.09 3234.32 3358.38 3231.07 3381.54 c 255 | 3228.75 3399.16 3224.59 3401.93 3218.1 3406.56 c 256 | 3256.09 3410.27 3266.76 3413.05 3284.35 3421.39 c 257 | 3280.65 3401.02 3280.18 3390.8 3280.18 3359.77 c 258 | 3279.26 3199.88 3278.79 3182.75 3288.99 3163.75 c 259 | f 260 | 3437.37 3294.9 m 261 | 3436.46 3265.7 3435.99 3245.31 3428.1 3229.1 c 262 | 3418.37 3208.24 3402.16 3202.23 3390.11 3202.23 c 263 | 3362.29 3202.23 3356.28 3225.39 3356.28 3248.09 c 264 | 3356.28 3291.64 3395.21 3294.9 3412.8 3294.9 c 265 | 3437.37 3294.9 l 266 | h 267 | 3309.93 3237.89 m 268 | 3309.93 3208.69 3318.74 3179.51 3344.7 3166.99 c 269 | 3356.28 3161.9 3367.86 3161.9 3371.57 3161.9 c 270 | 3414.21 3161.9 3428.56 3193.42 3437.37 3212.87 c 271 | 3436.9 3192.48 3437.37 3179.98 3438.76 3163.75 c 272 | 3447.1 3164.22 3455.44 3165.14 3469.35 3165.14 c 273 | 3477.22 3165.14 3484.64 3164.22 3492.51 3163.75 c 274 | 3487.41 3171.62 3484.64 3176.27 3483.23 3194.34 c 275 | 3482.31 3211.93 3482.31 3229.55 3482.31 3254.1 c 276 | 3482.78 3348.63 l 277 | 3482.78 3383.87 3473.51 3418.61 3403.99 3418.61 c 278 | 3358.14 3418.61 3331.26 3404.71 3317.82 3397.75 c 279 | 3323.39 3387.56 3328.02 3378.77 3332.18 3358.83 c 280 | 3350.26 3374.59 3373.9 3382.93 3397.98 3382.93 c 281 | 3436.46 3382.93 3436.46 3357.44 3436.46 3321.31 c 282 | 3427.65 3321.76 3420.22 3322.68 3407.71 3322.68 c 283 | 3348.86 3322.68 3309.93 3300 3309.93 3237.89 c 284 | f 285 | 3704.27 3209.63 m 286 | 3704.74 3193.87 3704.74 3177.19 3711.22 3163.75 c 287 | 3701.02 3164.67 3694.99 3166.07 3676.01 3166.07 c 288 | 3664.87 3166.07 3658.86 3165.14 3650.05 3163.75 c 289 | 3651.89 3169.77 3652.84 3172.09 3653.76 3179.98 c 290 | 3655.15 3190.62 3656.08 3226.31 3656.08 3238.83 c 291 | 3656.08 3288.87 l 292 | 3656.08 3310.65 3656.08 3342.17 3654.68 3353.28 c 293 | 3653.76 3361.15 3651.46 3382.46 3624.56 3382.46 c 294 | 3598.15 3382.46 3589.36 3363.01 3586.1 3347.25 c 295 | 3582.41 3331.03 3582.41 3313.42 3582.41 3244.84 c 296 | 3582.86 3185.53 3582.86 3179.98 3587.49 3163.75 c 297 | 3579.62 3164.67 3569.89 3165.6 3555.99 3165.6 c 298 | 3544.85 3165.6 3537.45 3165.14 3528.19 3163.75 c 299 | 3531.44 3171.17 3533.29 3174.88 3534.21 3200.82 c 300 | 3535.15 3226.31 3537 3351.43 3532.8 3381.07 c 301 | 3530.5 3399.16 3525.85 3403.32 3520.77 3407.95 c 302 | 3558.31 3409.8 3570.34 3415.84 3581.94 3421.85 c 303 | 3581.94 3372.73 l 304 | 3587.49 3387.11 3599.07 3419.08 3645.42 3419.08 c 305 | 3703.35 3419.08 3703.8 3376.91 3704.27 3349.12 c 306 | 3704.27 3209.63 l 307 | f 308 | 0.843137 0.027451 0.317647 rg 309 | 3292.9 3486.97 m 310 | 3254.53 3448.61 l 311 | 3216.17 3486.97 l 312 | 3254.53 3525.33 l 313 | 3292.9 3486.97 l 314 | f 315 | end showpage restore 316 | %%PageTrailer 317 | %%Trailer 318 | %%Pages: 1 319 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-GNU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/logo-GNU.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-Linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/logo-Linux.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-NCU.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/logo-NCU.jpg -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-sinica.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/logo-sinica.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/logo-toad.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/logo-toad.jpg -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/pay_it_forward.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/pay_it_forward.jpg -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/pdf_metadata.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/pdf_metadata.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleFontStyle_rm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleFontStyle_rm.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleFontStyle_sf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleFontStyle_sf.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_0.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_1.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_1i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_1i.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_c0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_c0.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_c1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_c1.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/titleStyle_c1i.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/titleStyle_c1i.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleAlign_0_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleAlign_0_en.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleAlign_0_zh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleAlign_0_zh.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleAlign_1_en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleAlign_1_en.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleAlign_1_zh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleAlign_1_zh.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleChapter_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleChapter_0.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tocStyleChapter_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tocStyleChapter_2.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tutorial_firefox_bookmark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tutorial_firefox_bookmark.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/figures/tutorial_zotero_bbt_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sppmg/LaTeX_tutorial_for_thesis/9df4f85a8ceba829f3280c4730cbac85297ba026/LaTeX_tutorial_zh/figures/tutorial_zotero_bbt_config.png -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/macros_document.tex: -------------------------------------------------------------------------------- 1 | % This file is common document region, 2 | % it will loading when LaTeX see ``\begin{document}'' 3 | % It's for some command which need use in document region. 4 | % DON'T put preamble only command in here, eg. \usepackage 5 | % -------------------------------------------------- 6 | 7 | % standalone setting for sub-tex. (not every class option can use \standaloneconfig) 8 | \IfStandalone{\standaloneconfig{float=true}}{} 9 | % ``float=false'' disable floating environment when build sub-tex. 10 | 11 | % Old method for change font size, but no limit for size so keep here. 12 | % \fontsize{size}{baselineskip} 無級調大小、行高, 行高倍數 = baselineskip/size/1.2 ,詳見教學。 13 | % \fontsize{14}{25}\selectfont 14 | 15 | \ifzh{ 16 | \setlength{\parindent}{2em} % 中文段首縮排2中文字寬 17 | }{} % 英文照 LaTeX 預設 18 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/macros_preamble.tex: -------------------------------------------------------------------------------- 1 | % This file is common preamble region, 2 | % it will load in .cls, before hyperref and cleveref package. 3 | % If your package need load aftre hyperref (to get link function), 4 | % please load in main.tex by \usepackage{package} 5 | % Use \RequirePackage{package} in this file to load package. 6 | % -------------------------------------------------- 7 | \addbibresource{tutorial.bib} % add your bib file here 8 | 9 | \usepackage{textcomp} % 貝利 10 | \usepackage{xltxtra} % for \XeLaTeX logo only 11 | % display latex code with result.(will use listings path,must change to root tex) 12 | \usepackage{showexpl} 13 | 14 | % This is for \parindent in LTXexample env. \parindentsave in macros_preamble.tex, 15 | % so creat \parindentsave here even did not use showexpl package. 16 | % see. http://tex.stackexchange.com/questions/98302/how-to-prevent-ltxexample-from-ignoring-the-paragraph-indentation 17 | \newlength{\parindentsave} 18 | \AtBeginDocument{\setlength{\parindentsave}{\parindent}} 19 | 20 | \usepackage{booktabs} % beautiful line in table. 21 | \usepackage{ctable} 22 | \let\ctabletnote\tnote % \tnote collision with threeparttable, save to another . 23 | \let\tnote\relax 24 | \usepackage{threeparttable} 25 | \let\tptabletnote\tnote % \tnote collision with ctable, save to another . 26 | \let\tnote\relax 27 | \newcommand*{\thead}[1]{\multicolumn{1}{c}{\bfseries #1}} 28 | 29 | 30 | % for todo colors(ref: http://tex.stackexchange.com/questions/9796/how-to-add-todo-notes?noredirect=1) 31 | \NewDocumentCommand{\todoUnsure}{O{} +m}{\todo[linecolor=red,backgroundcolor=red!25,bordercolor=red,#1]{#2}} 32 | \NewDocumentCommand{\todoChange}{O{} +m}{\todo[linecolor=blue,backgroundcolor=blue!25,bordercolor=blue,#1]{#2}} 33 | \NewDocumentCommand{\todoInfo}{O{} +m}{\todo[linecolor=OliveGreen,backgroundcolor=OliveGreen!25,bordercolor=OliveGreen,#1]{#2}} 34 | \NewDocumentCommand{\todoImprovement}{O{} +m}{\todo[linecolor=Plum,backgroundcolor=Plum!25,bordercolor=Plum,#1]{#2}} 35 | \NewDocumentCommand{\todoThiswillnotshowUnsure}{O{} +m}{\todo[disable,#1]{#2}} 36 | 37 | % A example for define unit command. 38 | \providecommand{\temp}[1]{$\SI{#1}{\degreeCelsius}$} 39 | \providecommand{\symumm}[1]{$\SI{#1}{\milli\metre}$} 40 | \providecommand{\symums}[1]{$\SI{#1}{\milli\second}$} 41 | \providecommand{\symumM}[1]{$\SI{#1}{\milli\Molar}$} 42 | \providecommand{\symumv}[1]{$\SI{#1}{\milli\volt}$} 43 | \providecommand{\symuma}[1]{$\SI{#1}{\milli\ampere}$} 44 | 45 | \providecommand{\abs}[1]{\lvert #1 \rvert } % Required package: amsmath 46 | 47 | %%%%%%%% for codes %%%%%%%%% 48 | \definecolor{codegreen}{rgb}{0,0.6,0} 49 | \definecolor{codegray}{rgb}{0.5,0.5,0.5} 50 | \definecolor{codepurple}{rgb}{0.58,0,0.82} 51 | \definecolor{codebgcolor}{rgb}{0.95,0.95,0.92} 52 | 53 | \lstdefinestyle{consoleStyle}{ 54 | frame=single, 55 | %backgroundcolor=\color{codebgcolor}, 56 | commentstyle=\color{codegreen}, 57 | keywordstyle=\color{blue}, 58 | numberstyle=\footnotesize\color{codegray}, 59 | stringstyle=\color{codepurple}, 60 | basicstyle=\ttfamily\small\setstretch{1.0}, 61 | breakatwhitespace=false, 62 | breaklines=true, 63 | captionpos=t, 64 | %caption={\protect\filename@parse{\lstname}\protect\filename@base\text{.}\protect‌​\filename@ext}, 65 | % http://tex.stackexchange.com/questions/174541/only-get-filename-and-extension-of-listing-not-whole-path 66 | keepspaces=true, 67 | xleftmargin=0cm, 68 | numbers=none, 69 | showspaces=false, 70 | showstringspaces=false, 71 | showtabs=false, 72 | tabsize=4 73 | } 74 | 75 | \lstdefinestyle{LatexStyle}{ 76 | language={[LaTeX]TeX}, 77 | inputpath={./}, % must same as root tex 78 | frame=single, 79 | %backgroundcolor=\color{backcolour}, 80 | commentstyle=\color{codegreen}, 81 | keywordstyle=\color{blue}, 82 | numberstyle=\scriptsize\color{codegray}, 83 | stringstyle=\color{codepurple}, 84 | basicstyle=\ttfamily\footnotesize\setstretch{1.0}, 85 | breakatwhitespace=false, 86 | breaklines=true, 87 | captionpos=t, 88 | %caption={\protect\filename@parse{\lstname}\protect\filename@base\text{.}\protect‌​\filename@ext}, 89 | % http://tex.stackexchange.com/questions/174541/only-get-filename-and-extension-of-listing-not-whole-path 90 | keepspaces=true, 91 | xleftmargin=1cm, 92 | %xrightmargin=1cm, 93 | numbers=left, 94 | numbersep=5pt, 95 | showspaces=false, 96 | showstringspaces=false, 97 | showtabs=false, 98 | tabsize=4, 99 | preset=\setlength{\parindent}{\parindentsave} % \parindent in LTXexample 100 | % http://tex.stackexchange.com/questions/98302/how-to-prevent-ltxexample-from-ignoring-the-paragraph-indentation 101 | } 102 | 103 | \lstset{style=LatexStyle} % default style 104 | \renewcommand{\lstlistingname}{Code} % change title of caption to ``Code'' from ``Listing'' 105 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/main.tex: -------------------------------------------------------------------------------- 1 | % !TEX TS-program = xelatex 2 | % !BIB program = biber 3 | % !TEX encoding = UTF-8 Unicode 4 | 5 | % 使用手冊請見 TW_Thesis_Template wiki: 6 | % https://github.com/sppmg/TW_Thesis_Template/wiki 7 | 8 | % User guide in wiki of TW_Thesis_Template : 9 | % https://github.com/sppmg/TW_Thesis_Template/wiki 10 | 11 | \documentclass[]{NCU_thesis} % [draft] = don't load fig' 12 | \usepackage[subpreambles=true]{standalone} % standalone class setting in config.tex ,``subpreambles=false'' disable sub-tex's preambles(pkg default) 13 | \begin{document} 14 | \frontmatter 15 | \input{titlepage} % 封面/書名頁 16 | \cleardoublepage % 由下個右頁開始 17 | \input{preface} 18 | %\input{acknowledgements} % 誌謝(可略) 19 | \cleardoublepage 20 | \phantomsection 21 | \addcontentsline{toc}{chapter}{\contentsname} %手動將「目錄」字樣加入目錄 22 | \tableofcontents % 目錄 23 | \listoffigures % 圖目錄 24 | \listoftables % 表目錄 25 | \mainmatter 26 | \input{tutorial} 27 | \backmatter % book class 預設\backmatter 在\appendix 後面。因此.cls修改過\appendix 定義 28 | \printbibliography[heading = bibnumbered, title = {參考文獻}] 29 | \appendix 30 | \input{appendix_LODraw_export} 31 | \input{appendix_commonBug} 32 | \end{document} -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/preface.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | \begin{document} 3 | 4 | \chapter{前言} 5 | 這是一個簡易的\LaTeX\ 教學。概略的介紹\LaTeX\ 的用法,並且使用Cookbook的形式寫作。也就是說使用者可以直接複製/貼上\LaTeX\ code ,省去慢慢打、慢慢學的時間。除了\LaTeX\ 語法外,本文也會介紹一些幫助撰寫\LaTeX\ 的工具。所有知識都不會說的太詳細,各位要深入了解的話就請各位自行發揮舉一反三的能力上Google搜尋囉! 6 | 這份文件(以及論文樣板)歡迎各位自由使用、修改、發佈。發現內容有誤也歡迎指正。 7 | 如果研究生認為我幫你節省很多時間,想感謝一下的話,請推薦更多人閱讀、採用,這樣就可以稀釋我的時間成本了QQ 。 8 | 9 | \tikz[remember picture,overlay] \node[opacity=0.1,inner sep=0pt] at (current page.center){\includegraphics[width=\paperwidth,height=\paperheight]{pay_it_forward}}; 10 | % http://tex.stackexchange.com/questions/167719/how-to-use-background-image-in-latex , figure from wiki:pay_it_forward 11 | \end{document} 12 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/sppmgTools.cwl: -------------------------------------------------------------------------------- 1 | % CWL File for sppmg's command 2 | % ref: https://websvn.kde.org/*checkout*/tags/kile/2.0/src/README.cwl 3 | 4 | \fig{path} 5 | \fig[scalefactor]{path}[caption] 6 | \fig[scalefactor][fig:label][!htb]{path}[caption][short caption] 7 | 8 | \insfig{path} 9 | \insfig[scalefactor]{path}[caption] 10 | \insfig[scalefactor][fig:label][!htb]{path}[caption][short caption] 11 | 12 | \circhar{text} 13 | 14 | \placetextbox{x(mm)}{y(mm)}{text} 15 | 16 | \fs{fontsize} 17 | \fs{fontsize}[baselineskip] 18 | \fs{fontsize}[baselinestretch] 19 | \showfont -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/sppmgTools.sty: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesPackage{sppmgTools}[2016/11/29 by sppmg] 3 | 4 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 5 | % Packages 6 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 7 | 8 | \RequirePackage{xparse} 9 | \RequirePackage{tikz} 10 | \RequirePackage{eso-pic} 11 | % \RequirePackage{expl3} 12 | 13 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 | % My tools 15 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 | 17 | \newcommand{\placetextbox}[3]{% \placetextbox{}{}{} 18 | \setbox0=\hbox{#3}% Put in a box 19 | \AddToShipoutPictureFG*{% Add to current page foreground 20 | \put(\LenToUnit{#1mm},\LenToUnit{#2mm}){\vtop{{\null}\makebox[0pt][c]{#3}}}% 21 | }% 22 | }% mm 可取代為\paperwidth 使用比例0-1 23 | % 選項colorgrid標示座標 24 | 25 | 26 | % easy insert single figure 27 | % \fig[scalefactor][label][!htb]{path}[caption][short caption] 28 | \NewDocumentCommand\fig{O{0.5} O{} O{} m O{} o}{ % need xparse package 29 | \begin{figure}[#3]%[!htb] 30 | \centering 31 | \includegraphics[width=#1\textwidth]{#4} 32 | \IfNoValueTF{#6}{\caption{#5}}{\caption[#6]{#5}} 33 | \def\temp@fig{#2} 34 | \ifx\temp@fig\empty 35 | \label{fig:#4} 36 | \else 37 | \label{#2} 38 | \fi 39 | \end{figure} 40 | } 41 | % \insfig is old name of \fig, for compatibility 42 | \newcommand\insfig{\fig} 43 | 44 | 45 | % make circle around letters (use tikz, copy from other guy) 46 | \newcommand*\circhar[1]{% 47 | \begin{tikzpicture} 48 | \node[draw,circle,inner sep=1pt] {#1}; 49 | \end{tikzpicture}} 50 | 51 | 52 | 53 | % short command for fontsize. for easy read. 54 | % usage: \fs{fontsize}[baselineskip] , unit = pt 55 | % if baselineskip < fontsize => multiple 56 | 57 | % need pgf / tikz 58 | \NewDocumentCommand\fs{m o}{ 59 | \IfNoValueTF{#2}{ 60 | \fontsize{#1}{#1}\selectfont 61 | }{ 62 | \pgfmathparse{ 63 | ifthenelse(#2 < #1 , #1*1.2*#2 , #2)} 64 | \fontsize{#1}{\pgfmathresult}\selectfont 65 | } 66 | } 67 | 68 | % LaTeX3 , work fine but need expl3 after 2012-05-08 69 | % \ExplSyntaxOn 70 | % \NewDocumentCommand\fs{m o}{ 71 | % \IfNoValueTF{#2}{ 72 | % \fontsize{#1}{#1}\selectfont 73 | % }{ 74 | % \fp_compare:nNnTF {#2} < {#1}{ 75 | % \fontsize{#1}{\fp_eval:n {#1*1.2*#2} }\selectfont 76 | % }{ 77 | % \fontsize{#1}{#2}\selectfont 78 | % } 79 | % } 80 | % } 81 | % \ExplSyntaxOff 82 | 83 | 84 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 85 | % Debug 86 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 87 | 88 | % display used package list in .log file, information for develop. 89 | \listfiles 90 | 91 | % display current font information. 92 | \newcommand{\showfont}{ \par 93 | \begin{tabular}{rcc} \hline 94 | current font info. & En & CJK \\ \hline 95 | encoding: & \f@encoding & - \\ 96 | family: & \f@family & 97 | \ifx\undefined\CJK@family 98 | - 99 | \else 100 | \CJK@family 101 | \fi \\ 102 | series: & \f@series & - \\ 103 | shape: & \f@shape & - \\ 104 | size: & \f@size & - \\ \hline 105 | \end{tabular}\par 106 | } % old xeCJK no \CJK@family 107 | 108 | \endinput % this must be the last command. -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/thesis_base.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesClass{thesis_base}[2017/02/13 by sppmg] 3 | % pass no defined option to book class. 4 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extbook}} 5 | % terminates the option processing. 6 | \ProcessOptions\relax 7 | 8 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 9 | % LaTeX tools 10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 11 | 12 | \RequirePackage{ifthen} 13 | \RequirePackage{etoolbox} 14 | \RequirePackage{ifplatform} % only for auto select CJK font. 15 | \RequirePackage{xparse} % advanced macro package, similar with xargs 16 | % \RequirePackage{xargs} % Use more than one optional parameter in a new commands , for orig todonotes macro, not require now. 17 | % \RequirePackage{mmap} % testing 18 | 19 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 20 | % Load config.tex 21 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 22 | \ifx\undefined\configured 23 | % --------- Define option for config.tex ---------- 24 | \provideboolean{publish} % publish ? Set true before publish. 發佈前設true 25 | \provideboolean{disableChinese} % Disable chinese, for English user. 26 | \provideboolean{printcopyright} % print copyright text on titlepage or cover. 27 | \provideboolean{pdfLinkBoxDisplay} % Draw box on link in the pdf viewer. 28 | \provideboolean{bibStyleNameYear} % bibliography use name,year to sort and cite. 29 | 30 | % --------- Load config.tex ---------- 31 | \IfFileExists{./config.tex}{\input{./config.tex}\gdef\configured{}}{} % search only in the current directory use ./file 32 | 33 | % Easy check Chinese sitting. It will not disable Chinese font. 34 | % Usage: \ifzh{zh}{non-zh} or \ifzh{zh} 35 | \ProvideDocumentCommand{\ifzh}{+m +G{}}{ 36 | \ifthenelse{\NOT \boolean{disableChinese} \AND \equal{\lang}{zh}}{#1}{#2} 37 | } 38 | \fi 39 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40 | % Load base class 41 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 42 | 43 | \LoadClass[a4paper,\baseFontSize]{extbook} 44 | 45 | %%%%%%%%%%%%%%% Load additional packages and commands. %%%%%%%%%%%%%%% 46 | 47 | \setcounter{secnumdepth}{\secNumDepth} % 設定章節標題給予數字標號的深度, \paragraph == 4。 48 | \setcounter{tocdepth}{\tocDepth} % 目錄顯示層級,\subsection == 2。 49 | 50 | 51 | \PassOptionsToPackage{hyphens, allowmove}{url} % testing for break url 52 | 53 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 54 | % Chinese, XeLaTeX with Chinese 55 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 56 | 57 | % (xeCJK will load fontspec and set \XeTeXlinebreaklocale , but I still keep it.) 58 | \XeTeXlinebreakskip = 0pt plus 1pt % 設定中文字距與英文字距 59 | \RequirePackage{fontspec} % no need these package now : inputenc,xltxtra,xunicode 60 | \ifthenelse{\boolean{disableChinese}}{}{ 61 | \XeTeXlinebreaklocale "zh" % 設定斷行演算法為中文 62 | \RequirePackage[CJKmath=true, 63 | slantfont, 64 | boldfont, 65 | EmboldenFactor=\fakeBoldFactor]{xeCJK} % [啟用斜體,粗體] 66 | \xeCJKDeclareSubCJKBlock{GreekCoptic}{ "0370 -> "03FF }% Unicode block of Greek and Coptic 67 | } 68 | 69 | % \setlength{\parindent}{2em} % 縮排2字寬(TL2012放導言有bug,會無效,須放內文區。TL2016可放導言) 70 | % Linux 利用指令 fc-list :lang=zh 來查詢可以用的字體名稱。 71 | %\setmainfont{DejaVu Sans} % ==\setromanfont 72 | %\setmonofont[Ligatures=Historical]{DejaVu Sans Mono} 73 | % \setCJKmainfont{AR PL UMing TW MBE} % 襯線字體(\rmfamily),中文設為明體 74 | % \setCJKsansfont{AR PL UKai TW MBE} % 原意為無襯線字體(\sffamily),中文設為楷體 75 | % \setCJKmonofont[Scale=0.9]{AR PL UMing TW MBE} % (\ttfamily) 76 | 77 | %%%%%%%%%%% Auto select font %%%%%%%%%%%%%% 78 | % Use ifplatform package to determine OS and overwrite \OS. 79 | % It's need option ``-shell-escape'' to XeLaTeX. 80 | % If no this option , It's only determine windows. 81 | % (Texstudio may default use -shell-escape) 82 | \iflinux 83 | \def\OS{linux} 84 | \else\ifwindows 85 | \def\OS{win} 86 | \fi\fi 87 | % --------- English ---------- 88 | \ifx\mainfont\empty\else 89 | \setmainfont{\mainfont} 90 | \fi 91 | \ifx\sansfont\empty\else 92 | \setsansfont{\sansfont} 93 | \fi 94 | \ifx\monofont\empty\else 95 | \setmonofont{\monofont} 96 | \fi 97 | % --------- Chinese ---------- 98 | \ifthenelse{\boolean{disableChinese}}{}{ 99 | \ifx\CJKmainfont\empty 100 | \ifthenelse{\equal{\OS}{linux}}{ 101 | % linux os 102 | \def\CJKmainfont{AR PL UMing TW} % 明體 103 | }{ 104 | \ifthenelse{\equal{\OS}{win}}{ 105 | % win os 106 | \def\CJKmainfont{MingLiU} % MingLiU == 細明體 107 | }{ 108 | % set macos later 109 | }} 110 | \fi 111 | \setCJKmainfont{\CJKmainfont} 112 | %%% 113 | \ifx\CJKsansfont\empty 114 | \ifthenelse{\equal{\OS}{linux}}{ 115 | % linux os 116 | \def\CJKsansfont{AR PL UKai TW} % 楷體 117 | }{ 118 | \ifthenelse{\equal{\OS}{win}}{ 119 | % win os 120 | \def\CJKsansfont{DFKai-SB} % DFKai-SB == 標楷體 121 | }{ 122 | % set macos later 123 | }} 124 | \fi 125 | \setCJKsansfont{\CJKsansfont} 126 | %%% 127 | \ifx\CJKmonofont\empty 128 | \ifthenelse{\equal{\OS}{linux}}{ 129 | % linux os 130 | \edef\CJKmonofont{\CJKmainfont} % 明體 131 | }{ 132 | \ifthenelse{\equal{\OS}{win}}{ 133 | % win os 134 | \edef\CJKmonofont{\CJKmainfont} % MingLiU == 細明體 135 | }{ 136 | % set macos later 137 | }} 138 | \fi 139 | \setCJKmonofont{\CJKmonofont} 140 | } 141 | %%%%%%%%%%%% Auto select font end %%%%%%%%%%%%% 142 | 143 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 144 | % Chinese, for document 145 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 146 | 147 | \ifzh{ 148 | \RequirePackage{zhnumber} % Translate number to Chinese number. 149 | 150 | % 中文化變數 151 | \renewcommand{\chaptername}{章} 152 | \renewcommand{\figurename}{圖} 153 | \renewcommand{\tablename}{表} 154 | %\renewcommand{\refname}{參考資料} % book class no \refname 155 | \renewcommand{\bibname}{參考文獻} % biblatex need setting by \defbibheading 156 | \renewcommand{\appendixname}{附錄} 157 | \renewcommand\contentsname{目錄} 158 | \renewcommand\listfigurename{圖目錄} 159 | \renewcommand\listtablename{表目錄} 160 | % \cref setting in the last . 161 | } 162 | 163 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 164 | % Style 165 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 166 | 167 | %設定頁面配置 168 | \RequirePackage[a4paper, top=2.5cm, bottom=2.5cm, inner=3cm, outer=2cm, marginparwidth=2.0cm]{geometry}% use showframe in class option for check. marginparwidth for todonotes 169 | %http://tex.stackexchange.com/questions/5180/how-can-i-get-todonotes-in-the-left-marginparwidth 170 | \RequirePackage{xcolor} % Coloured text etc. 171 | \RequirePackage{indentfirst} % 章節首行縮排 172 | % \setcounter{secnumdepth}{3} % 顯示至\subsubsection 的標號,LaTeX 預設2 , move to config.tex 173 | 174 | % ---------------------- Packages for title and TOC --------------------------- 175 | \RequirePackage{titlesec} 176 | \RequirePackage{titletoc} 177 | 178 | % ---------------------- Chapter title style --------------------------- 179 | % 1. Change title to zhnumber when lang=zh (in config.tex). 180 | % 2. Add header to abstract. (depend on chapter title) 181 | % ref: LaTeX 章節名稱及目錄改為中文 http://lzsh00262.blogspot.tw/2013/02/xelatex.html 182 | % \titleformat{\chapter}{\centering\Huge\bfseries}{\zhnumber{\thechapter}、}{1em} {} 183 | % Little hack here because need add header to abstract. You should use \titleformat(above) to do that, if you don't need header.(\titleformat is not compatible for this hack.) 184 | 185 | % abstract use special header(copy and modify from book.cls) 186 | \def\abstractHeaderZh{\centering\abstractHeaderStyle\titleZh} 187 | \def\abstractHeaderEn{\centering\abstractHeaderStyle\titleEn} 188 | % modify \chapter, add hearer if abstract. use zhnumber if mainmatter, all centering. 189 | \def\@makechapterhead#1{% 190 | \vspace*{10\p@} % modify by sppmg 191 | \ifthenelse{\equal{#1}{摘要}}{{\abstractHeaderZh\par}} 192 | {\ifthenelse{\equal{#1}{Abstract}}{{\abstractHeaderEn\par}}{\vspace*{20\p@}}} % modify by sppmg 193 | % \abstractHeader don't forget {} for \centering 194 | \vspace*{20\p@}% orig = 50pt 195 | \ifzh{ 196 | % Chinese 197 | {\parindent \z@ \centering \normalfont % modify by sppmg 198 | \ifnum \c@secnumdepth >\m@ne 199 | \if@mainmatter 200 | \chapterTitleStyle \zhnumber{\thechapter}、\makebox[0.5em]{} % modify by sppmg 201 | \fi 202 | \fi 203 | \chapterTitleStyle #1\par\nobreak % modify by sppmg 204 | \vskip 40\p@ 205 | } 206 | }{ 207 | % English 208 | {\parindent \z@ \raggedright \normalfont 209 | \ifnum \c@secnumdepth >\m@ne 210 | \if@mainmatter 211 | \chapterTitleNumStyle \@chapapp\space \thechapter % modify by sppmg 212 | \par\nobreak 213 | \vskip 20\p@ 214 | \fi 215 | \fi 216 | \interlinepenalty\@M 217 | \chapterTitleStyle #1\par\nobreak % modify by sppmg 218 | \vskip 40\p@ 219 | } 220 | }} 221 | % modify \chapter*, all centering. (TOC/LOF/LOT use \chapter*) 222 | \def\@makeschapterhead#1{% 223 | \vspace*{50\p@}% 224 | { 225 | \ifzh{ 226 | % Chinese 227 | \parindent \z@ \centering % modify by sppmg 228 | }{ 229 | % English 230 | \parindent \z@ \raggedright 231 | } 232 | \normalfont 233 | \interlinepenalty\@M 234 | \chapterTitleStyle #1\par\nobreak 235 | \vskip 40\p@ 236 | }} 237 | % 修改每章首頁的標題格式 238 | %\titleformat{\chapter}{\centering\Huge\bfseries}{\zhnumber{\thechapter}、}{1em} {} 239 | %\titlespacing{\chapter}{0cm}{-1.3cm}{1em} % 修改章節上方空白的大小 240 | 241 | 242 | % --------------------- title's style and font style ---------------------------- 243 | % http://tex.stackexchange.com/questions/59726/change-size-of-section-subsection-subsubsection-paragraph-and-subparagraph-ti 244 | \titleformat*{\section}{\sectionTitleStyle} 245 | \titleformat*{\subsection}{\subsectionTitleStyle} 246 | \ifcase \titleStyle 247 | \titleformat*{\subsubsection}{\subsubsectionTitleStyle} 248 | \titleformat*{\paragraph}{\paragraphTitleStyle} 249 | \or 250 | \titleformat{\subsubsection}{\subsubsectionTitleStyle}{\arabic{subsubsection}.}{0.5em}{} 251 | \titlespacing*{\subsubsection}{\indentBlockSSS}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex} 252 | \titleformat{\paragraph}[hang]{\paragraphTitleStyle}{(\arabic{paragraph})}{0.5em}{} 253 | \titlespacing*{\paragraph}{\indentBlockPar}{3.25ex plus 1ex minus .2ex}{1em} 254 | \fi 255 | \titleformat*{\subparagraph}{\subparagraphTitleStyle} 256 | 257 | % --------------------- TOC style ---------------------------- 258 | % 修改目錄的風格(縮排) 259 | \ifx\undefined\thecontentslabel@chapter 260 | \ifzh{ % TOC 章級標號形式設定 261 | \gdef\thecontentslabel@chapter{\zhnumber{\thecontentslabel}、} 262 | \gdef\thecontentslabel@chapter@app{\appendixname\thecontentslabel} 263 | }{ 264 | \gdef\thecontentslabel@chapter{\thecontentslabel} 265 | \gdef\thecontentslabel@chapter@app{\thecontentslabel} 266 | } 267 | \fi 268 | 269 | % TOC 章級風格 270 | \ifcase \tocStyleChapter 271 | % \tocStyleChapter == 0 近原始 LaTeX, 向上間距、粗體、無點線 272 | \def\tocStyleChapterFiller{\bfseries\hfill\contentspage} 273 | \def\tocStyleChapterAbove{\addvspace{1em}} 274 | \def\tocStyleChapterAboveApp{\tocStyleChapterAbove} % appendix same 275 | \def\tocStyleChapterFont{\bfseries} 276 | \or 277 | % \tocStyleChapter == 1 向上間距(至 \mainmatter 才增加)、粗體、無點線 278 | \def\tocStyleChapterFiller{\bfseries\hfill\contentspage} 279 | \def\tocStyleChapterAbove{} 280 | \def\tocStyleChapterAboveApp{\addvspace{1em}} % appendix same 281 | \def\tocStyleChapterFont{\bfseries} 282 | \appto{\mainmatter}{ % 至 \mainmatter 才增加 chapter 向上間距 283 | \titlecontents{chapter}[\tocNumSpaceC@Before] 284 | {\addvspace{1em}} 285 | {\tocStyleChapterFont\makebox[\tocNumSpaceC@Total][l]{\thecontentslabel@chapter}} 286 | {\tocStyleChapterFont} 287 | {\tocStyleChapterFiller} 288 | }{}{} 289 | \or 290 | % \tocStyleChapter == 2 正常間距、正常字體、點線 291 | \def\tocStyleChapterFiller{\titlerule*[0.4pc]{.}\contentspage} 292 | \def\tocStyleChapterAbove{} 293 | \def\tocStyleChapterAboveApp{\tocStyleChapterAbove} % appendix same 294 | \def\tocStyleChapterFont{} 295 | \fi 296 | 297 | % \tocNumSpaceC@Before = 數字到文字框邊 , \tocNumSpaceC@Total = 數字到章名間距 298 | % \appendix will change \titlecontents{chapter}, see below. 299 | \ifcase \tocStyleAlign 300 | % \tocStyleAlign == 0 , (en == LaTeX default) 301 | \def\tocNumSpaceC@Before {0em} % chapter 302 | \ifzh{ 303 | \def\tocNumSpaceC@Total {3.8em} % en = 1.5 zh = 3.8 304 | }{ 305 | \def\tocNumSpaceC@Total {1.5em} 306 | } 307 | \def\tocNumSpaceS@Before {1.5em} % section 308 | \def\tocNumSpaceS@Total {2.3em} 309 | \def\tocNumSpaceSS@Before {3.8em} % subsection 310 | \def\tocNumSpaceSS@Total {3.0em} 311 | \or 312 | % \tocStyleAlign == 1 313 | \def\tocNumSpaceC@Before {0em} 314 | \def\tocNumSpaceC@Total {6em} 315 | \def\tocNumSpaceS@Before {2em} 316 | \def\tocNumSpaceS@Total {4em} 317 | \def\tocNumSpaceSS@Before {3em} 318 | \def\tocNumSpaceSS@Total {3em} 319 | \fi 320 | 321 | % \titlecontents{section}[left (to margin)] 322 | % {above} % 數字到文字框(頁)邊 323 | % {before with label (\chapter{})} 324 | % {before without label (\chapter*{})} 325 | % {filler}[after] 326 | % 僅接受定義當下值,後面要改須重使用 \titlecontents 327 | % 這裡使用 \makebox 拉開標號至標題文字間距。 328 | \titlecontents{chapter}[\tocNumSpaceC@Before] 329 | {\tocStyleChapterAbove} 330 | {\tocStyleChapterFont\makebox[\tocNumSpaceC@Total][l]{\thecontentslabel@chapter}} 331 | {\tocStyleChapterFont} 332 | {\tocStyleChapterFiller} 333 | % ---------------------------- 334 | \titlecontents{section}[\tocNumSpaceS@Before] 335 | {}{\makebox[\tocNumSpaceS@Total][l] 336 | {\thecontentslabel}}{} 337 | {\titlerule*[0.4pc]{.}\contentspage}%0.4 = 點距 338 | % ---------------------------- 339 | \titlecontents{subsection}[\tocNumSpaceSS@Before] 340 | {}{\makebox[\tocNumSpaceSS@Total][l] 341 | {\thecontentslabel}}{} 342 | {\titlerule*[0.4pc]{.}\contentspage} 343 | 344 | % 各目錄增加「頁次」文字 345 | \ifzh{\def\@textPage{頁次}}{\def\@textPage{page}} 346 | \addtocontents{toc}{~\hfill\textbf{\@textPage}\par} 347 | \addtocontents{lof}{~\hfill\textbf{\@textPage}\par} 348 | \addtocontents{lot}{~\hfill\textbf{\@textPage}\par} 349 | 350 | % --------------------- Header of each page ---------------------------- 351 | % http://latexfly.com/docs/packages/fancyhdr.html 352 | % http://tex.stackexchange.com/questions/228362/get-sectionmark-in-fancyhdr-without-chapter-number 353 | \RequirePackage{fancyhdr} 354 | \pagestyle{fancy} % 使用自訂的頁面風格 355 | 356 | % http://tex.stackexchange.com/questions/290400/remove-chapter-0-from-header-in-frontmatter-chapters-with-fancyhdr 357 | \ifzh{ 358 | % Chinese, translate \thechapter and remove \MakeUppercase . 359 | \renewcommand{\chaptermark}[1]{\markboth{% 360 | \ifnum \c@secnumdepth >\m@ne 361 | \if@mainmatter % mainmatter 才進行中文化 362 | \expandafter\ifx\@chapapp\appendixname % in \appendix 363 | \thechapter、\ % 364 | \else 365 | \zhnumber{\thechapter}、\ % 366 | \fi 367 | \fi 368 | \fi 369 | #1}{}} 370 | \renewcommand{\sectionmark}[1]{\markright {% 371 | \ifnum \c@secnumdepth >\z@ 372 | \thesection \ % 373 | \fi 374 | #1}} 375 | }{ 376 | % English, copy from book.cls, because fancyhdr remove \if@mainmatter . 377 | \renewcommand{\chaptermark}[1]{\markboth {\MakeUppercase{% 378 | \ifnum \c@secnumdepth >\m@ne 379 | \if@mainmatter 380 | \@chapapp\ \thechapter. \ % 381 | \fi 382 | \fi 383 | #1}}{}} 384 | \renewcommand{\sectionmark}[1]{\markright {\MakeUppercase{% 385 | \ifnum \c@secnumdepth >\z@ 386 | \thesection. \ % 387 | \fi 388 | #1}}} 389 | } 390 | 391 | % \renewcommand{\chaptermark}[1]{\markboth{第\arabic{chapter}章\quad #1 }{}} 392 | \fancyhead{} % 清除頁眉 393 | \fancyhead[LE]{\pageHeaderStyle\leftmark} 394 | \fancyhead[RO]{\pageHeaderStyle\rightmark} 395 | \fancyfoot{} % 清除頁尾 396 | \fancyfoot[C]{\pageFooterStyle\thepage} 397 | \renewcommand{\headrulewidth}{0pt} % remove line 398 | \renewcommand{\footrulewidth}{0pt} 399 | 400 | % Redefine the plain page style (\chapter page will use plain style) 401 | \fancypagestyle{plain}{% 402 | \fancyhf{}% 403 | \fancyfoot[C]{\pageFooterStyle\thepage}% 404 | \renewcommand{\headrulewidth}{0pt} % remove line 405 | \renewcommand{\footrulewidth}{0pt} 406 | } 407 | 408 | % ---------------------- appendix title, header & TOC --------------------------- 409 | % 修改附錄的章格式,因為附錄使用字母A,B,C所以要另外定義。這裡使用etoolbox 附加指令到\appendix。 410 | \apptocmd{\appendix}{ 411 | \ifzh{ 412 | \titleformat{\chapter}{\centering\chapterTitleStyle}{\appendixname\thechapter}{1em}{} % 改章首 413 | }{} 414 | \titlecontents{chapter} % 改目錄 415 | [\tocNumSpaceC@Before] 416 | {\tocStyleChapterAboveApp} 417 | {\tocStyleChapterFont\makebox[\tocNumSpaceC@Total][l]{\thecontentslabel@chapter@app}} 418 | {\tocStyleChapterFont} 419 | {\tocStyleChapterFiller} 420 | \@mainmattertrue % \appendix 置於 \backmatter 之後 421 | }{}{} 422 | 423 | % --------------------- Some color definition ---------------------------- 424 | % Require xcolor . color values Red, Green, Blue 425 | \definecolor{mygreen}{RGB}{28,172,0} 426 | \definecolor{mylilas}{RGB}{170,55,241} 427 | \definecolor{OliveGreen}{rgb}{0,0.6,0} % for todonotes 428 | 429 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 430 | % Text & bibliography 431 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 432 | 433 | \RequirePackage{setspace} % for setstretch 434 | \setstretch{\baseLineStretch} % 行距 435 | 436 | % bibliography use biber(external program) and biblatex(package) 437 | % \RequirePackage[nottoc,numbib]{tocbibind} % add bibliography to TOC, not require for biblatex 438 | %\renewcommand{\tocbibname}{參考文獻} % no effect 439 | \ifthenelse{\boolean{bibStyleNameYear}}{ 440 | \RequirePackage[backend=biber,style=ieee, citestyle=authoryear-comp, sorting=nyt]{biblatex} 441 | }{ 442 | \RequirePackage[backend=biber,style=ieee]{biblatex} 443 | % use biblatex and sort by citation order 444 | } 445 | % http://tex.stackexchange.com/questions/51434/biblatex-citation-order 446 | % use \addbibresource{bib.bib} in preamble 447 | % \defbibheading{\bibname} % biblatex use \defbibheading 448 | \def\bibfont{\bibFontStyle\setstretch{\bibLineStretch}} 449 | 450 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 451 | % figure & float env. 452 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 453 | 454 | \RequirePackage{graphicx} % include graphics 455 | \graphicspath{ {./figures/} {../figures/} } % add path 456 | \RequirePackage{pdfpages} % Insert PDF file by \includepdf[pages={1,3,5}]{myfile.pdf} 457 | \RequirePackage[format=hang]{caption} 458 | \RequirePackage{subcaption} % subfigure 459 | \captionsetup{subrefformat=parens} % \subref style is (a) 460 | \DeclareCaptionFont{myCaptionStyle}{\captionFontStyle} 461 | \captionsetup{font={myCaptionStyle,stretch=\captionLineStretch}} 462 | \DeclareCaptionFont{myCaptionSubStyle}{\subcaptionFontStyle} 463 | \captionsetup[sub]{font=myCaptionSubStyle} 464 | 465 | % FloatBarrier http://tex.stackexchange.com/questions/279/how-do-i-ensure-that-figures-appear-in-the-section-theyre-associated-with/235312#235312 466 | % Make sure figure in the subsection. 467 | \RequirePackage{placeins} 468 | \let\Oldsection\section 469 | \renewcommand{\section}{\FloatBarrier\Oldsection} 470 | \let\Oldsubsection\subsection 471 | \renewcommand{\subsection}{\FloatBarrier\Oldsubsection} 472 | \let\Oldsubsubsection\subsubsection 473 | \renewcommand{\subsubsection}{\FloatBarrier\Oldsubsubsection} 474 | 475 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 476 | % Table 477 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 478 | 479 | \RequirePackage{tabularx} % for table which specified width. tabulary also can do it. 480 | \RequirePackage{multirow} % for table 481 | \RequirePackage{colortbl} % color table 482 | \renewcommand{\arraystretch}{\tableLineStretch} 483 | \RequirePackage{floatrow} % set caption position of table 484 | \floatsetup[table]{capposition=top} 485 | \DeclareFloatFont{myFloatStyle}{\floatFontStyle} % see, floatrow pkg. 3.6.3 float font option 486 | \floatsetup{font=myFloatStyle} 487 | 488 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 489 | % Math/Science 490 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 491 | 492 | \RequirePackage{amsmath} 493 | \RequirePackage{siunitx} 494 | \sisetup{per-mode=symbol, range-phrase=$\:\sim\:$} % \per default use / not ^-1 , change ``to'' to ``~'' 495 | % set a new ``molar'' unit 496 | \DeclareSIUnit\molar{\mole\per\cubic\deci\metre} 497 | \DeclareSIUnit\Molar{\textsc{m}} 498 | 499 | \RequirePackage[version=3]{mhchem} % usage \ce{KH2PO4} 500 | 501 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 502 | % Misc 503 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 504 | 505 | % --------------------- todonotes ---------------------------- 506 | \ifthenelse{\boolean{publish}}{ 507 | \RequirePackage[disable]{todonotes} % hide notes 508 | }{ 509 | \RequirePackage[colorinlistoftodos,prependcaption,textsize=footnotesize]{todonotes} 510 | } 511 | \reversemarginpar % add this after loading the geometry and todonotes packages 512 | %http://tex.stackexchange.com/questions/5180/how-can-i-get-todonotes-in-the-left-margin 513 | % textsize=footnotesize 514 | 515 | % --------------------- Program code ---------------------------- 516 | % 程式碼 517 | \RequirePackage{listingsutf8} % for program source. 518 | \newcommand*\lstinputpath[1]{\lstset{inputpath=#1}} 519 | \lstinputpath{./codes/} 520 | 521 | % --------------------- graphics ---------------------------- 522 | % creating graphics programmatically 523 | \RequirePackage{tikz} 524 | 525 | % 浮水印及自動填單 526 | \RequirePackage{eso-pic}% The zero point of the coordinate systemis the lower left corner of the page (the default). 527 | 528 | % --------------------- Break long url ---------------------------- 529 | % Break long url. Only for break, \url{} from hyperref package. bibliography url can break without this package. 530 | % \RequirePackage[hyphens, allowmove]{url} 531 | % \makeatletter 532 | % \g@addto@macro{\UrlBreaks}{\UrlOrds} 533 | % \makeatother 534 | 535 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 536 | % Load/set user's macro 537 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 538 | % input users preamble 539 | \IfFileExists{./macros_preamble.tex}{\input{./macros_preamble.tex}}{} % search only in the current directory use ./file 540 | % A hook for run cmd ever begin{document} 541 | \IfFileExists{./macros_document.tex}{\AtBeginDocument{\input{./macros_document.tex}}}{} 542 | 543 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 544 | % Last pkg 545 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 546 | % this 2 pkg should in the last. 547 | \RequirePackage{hyperref} % url and PDF bookmarks 548 | \providecommand\phantomsection{} % with hyperref 549 | % http://tex.stackexchange.com/questions/44088/when-do-i-need-to-invoke-phantomsection 550 | % PDF Metadata with hyperref in LaTeX https://www.karlrupp.net/2016/01/pdf-metadata-in-latex-documents/ 551 | \hypersetup{ 552 | pdftitle={\title}, 553 | pdfsubject={\ifx\subtitle\empty\title\else\subtitle\fi}, 554 | pdfauthor={\author}, 555 | pdfkeywords={\keywordsZh,\ \keywordsEn} 556 | } 557 | \ifthenelse{\boolean{pdfLinkBoxDisplay}}{}{ 558 | \hypersetup{pdfborder = {0 0 0 0}} } % 0 -> Don't draw box on link in the pdf 559 | 560 | \RequirePackage{cleveref} 561 | % each of the following has two versions 562 | % \crefname{environmentname}{singular}{plural}, to be used mid-sentence 563 | % \Crefname{environmentname}{singular}{plural}, to be used at the beginning of a sentence 564 | \ifzh{ 565 | \crefname{figure}{\figurename}{\figurename} 566 | \Crefname{figure}{\figurename}{\figurename} 567 | \crefname{table}{\tablename}{\tablename} 568 | \Crefname{table}{\tablename}{\tablename} 569 | \crefname{equation}{式}{式} 570 | \Crefname{equation}{式}{式} 571 | \crefname{section}{章節}{章節} 572 | \Crefname{section}{章節}{章節} 573 | \crefname{appendix}{\appendixname}{\appendixname} 574 | \Crefname{appendix}{\appendixname}{\appendixname} 575 | } 576 | 577 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 578 | % My tools 579 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 580 | 581 | \RequirePackage{sppmgTools} 582 | 583 | \endinput % this must be the last command. -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/titlepage.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false]{standalone} 2 | % datetime2 replaced datetime but TL2012 don't has it. 3 | \IfFileExists{datetime2.sty}{ 4 | \usepackage{datetime2} 5 | }{ 6 | \usepackage[yyyymmdd]{datetime} 7 | \renewcommand{\dateseparator}{-} 8 | } 9 | \usetikzlibrary{calc,shapes.callouts,shapes.arrows} 10 | \newcommand{\bubblethis}[2]{ 11 | \tikz[remember picture,baseline]{\node[anchor=base,inner sep=0,outer sep=0]% 12 | (#1) {#1};\node[overlay,cloud callout,callout relative pointer={(-1.2cm,-0.7cm)},% 13 | aspect=3.5,fill=green!50] at ($(2.8cm,6.2cm)$) {#2};}% 14 | } 15 | % http://tex.stackexchange.com/questions/38805/simple-speech-bubbles-arrows-or-balloon-like-shapes-in-beamer 16 | 17 | \begin{document} 18 | \def\fsTitle{\fontsize{22}{26.4}\selectfont } 19 | \def\fsNames{\fontsize{16}{20}\selectfont } 20 | % --------define title page layout for thesis 21 | \titlepageFontFamily % set in config.tex 22 | \newgeometry{top=2.5cm, bottom=2.5cm, inner=2cm, outer=2cm} % only for titlepage 23 | \begin{spacing}{1.0} 24 | \begin{titlepage} 25 | %\vfill 26 | \vspace*{30mm} 27 | \begin{center} 28 | {\fsTitle {\title} \par} 29 | \vspace*{5mm} 30 | {\fsTitle {\subtitle} \par} 31 | \vspace*{40mm} 32 | {\ifx \logo\empty\vspace*{40mm} \else 33 | \includegraphics[height=80mm]{\logo} 34 | \bubblethis{}{\parbox{8em}{ 35 | \centering\fontsize{12}{15}\selectfont 36 | 哈哈哈~欸!胖胖。\\ 有人不會\LaTeX\ 耶!}} 37 | \vspace*{10mm} \par 38 | \fi} 39 | {\fsNames 40 | \begin{tabular}{l@{:}l@{\quad}r} 41 | 主要作者 & \author & \\ 42 | \end{tabular}\par} 43 | {\fsNames \url{https://github.com/sppmg/TW\_Thesis\_Template} \par} 44 | \vspace*{5ex} 45 | {\fsTitle {\today} \par} 46 | \vspace*{2ex} 47 | \ifthenelse{\boolean{printcopyright}} 48 | {{{版權所有\copyright\ \author\ \copyyear} \par}} 49 | {\hspace{5cm}} 50 | \end{center} 51 | \vfill 52 | \end{titlepage} 53 | \end{spacing} 54 | \restoregeometry 55 | \normalfont % use main font 56 | %--------end of title page for thesis 57 | \cleardoublepage 58 | \end{document} 59 | -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/tutorial.bib: -------------------------------------------------------------------------------- 1 | 2 | @online{__????, 3 | title = {大家來學 {LaTeX}, latex123}, 4 | url = {http://www.cs.pu.edu.tw/~wckuo/doc/latex123/latex123.html}, 5 | urldate = {2016-10-10}, 6 | file = {大家來學 LaTeX, latex123:/home/sppmg/.mozilla/firefox/onxyd4fz.zoteroDemo/zotero/storage/8JMIVZ4A/latex123.html:text/html} 7 | } 8 | 9 | @online{_sppmg/tw_thesis_template_????, 10 | title = {sppmg/{TW}\_Thesis\_Template}, 11 | url = {https://github.com/sppmg/TW_Thesis_Template}, 12 | abstract = {{TW}\_Thesis\_Template - The {LaTeX} Template for Thesis}, 13 | titleaddon = {{GitHub}}, 14 | urldate = {2016-10-23}, 15 | file = {Snapshot:/home/sppmg/.mozilla/firefox/onxyd4fz.zoteroDemo/zotero/storage/73ZETBNK/TW_Thesis_Template.html:text/html} 16 | } 17 | 18 | @book{mittelbach_latex_2004, 19 | location = {Boston}, 20 | edition = {2nd edition}, 21 | title = {The {LaTeX} Companion}, 22 | isbn = {978-0-201-36299-2}, 23 | abstract = {This is the digial version of the printed book (Copyright © 2004). The {LaTeX} Companion has long been the essential resource for anyone using {LaTeX} to create high-quality printed documents. This completely updated edition brings you all the latest information about {LaTeX} and the vast range of add-on packages now available--over 200 are covered! Full of new tips and tricks for using {LaTeX} in both traditional and modern typesetting, this book will also show you how to customize layout features to your own needs--from phrases and paragraphs to headings, lists, and pages. Inside, you will find: Expert advice on using {LaTeX}'s basic formatting tools to create all types of publications--from memos to encyclopedias In-depth coverage of important extension packages for tabular and technical typesetting, floats and captions, multicolumn layouts--including reference guides and discussions of the underlying typographic and {TeXnical} concepts Detailed techniques for generating and typesetting contents lists, bibliographies, indexes, etc. Tips and tricks for {LaTeX} programmers and systems support New to this edition: Nearly 1,000 fully tested examples that illustrate the text and solve typographical and technical problems--all ready to run! An additional chapter on citations and bibliographies Expanded material on the setup and use of fonts to access a huge collection of glyphs, and to typeset text from a wide range of languages and cultures Major new packages for graphics, "verbatim" listings, floats, and page layout Full coverage of the latest packages for all types ofdocuments--mathematical, multilingual, and many more Detailed help on all error messages, including those troublesome low-level {TeX} errors Like its predecessor, The {LaTeX} Companion, Second Edition, is an indispensable reference for anyone wishing to use {LaTeX} productively. The accompanying {CD}-{ROM} contains a complete plug-and-play {LaTeX} installation, including all the packages and examples featured in the book.}, 24 | pagetotal = {1120}, 25 | publisher = {Addison-Wesley Professional}, 26 | author = {Mittelbach, Frank and Goossens, Michel and Braams, Johannes and Carlisle, David and Rowley, Chris}, 27 | date = {2004-05-02} 28 | } 29 | 30 | @article{session_genome_2016, 31 | title = {Genome evolution in the allotetraploid frog Xenopus laevis}, 32 | volume = {538}, 33 | rights = {© 2016 Macmillan Publishers Limited, part of Springer Nature. All rights reserved.}, 34 | issn = {0028-0836}, 35 | url = {http://www.nature.com/nature/journal/v538/n7625/full/nature19840.html}, 36 | doi = {10.1038/nature19840}, 37 | abstract = {To explore the origins and consequences of tetraploidy in the African clawed frog, we sequenced the Xenopus laevis genome and compared it to the related diploid X. tropicalis genome. We characterize the allotetraploid origin of X. laevis by partitioning its genome into two homoeologous subgenomes, marked by distinct families of ‘fossil’ transposable elements. On the basis of the activity of these elements and the age of hundreds of unitary pseudogenes, we estimate that the two diploid progenitor species diverged around 34 million years ago (Ma) and combined to form an allotetraploid around 17–18 Ma. More than 56\% of all genes were retained in two homoeologous copies. Protein function, gene expression, and the amount of conserved flanking sequence all correlate with retention rates. The subgenomes have evolved asymmetrically, with one chromosome set more often preserving the ancestral state and the other experiencing more gene loss, deletion, rearrangement, and reduced gene expression.}, 38 | pages = {336--343}, 39 | number = {7625}, 40 | journaltitle = {Nature}, 41 | shortjournal = {Nature}, 42 | author = {Session, Adam M. and Uno, Yoshinobu and Kwon, Taejoon and Chapman, Jarrod A. and Toyoda, Atsushi and Takahashi, Shuji and Fukui, Akimasa and Hikosaka, Akira and Suzuki, Atsushi and Kondo, Mariko and van Heeringen, Simon J. and Quigley, Ian and Heinz, Sven and Ogino, Hajime and Ochi, Haruki and Hellsten, Uffe and Lyons, Jessica B. and Simakov, Oleg and Putnam, Nicholas and Stites, Jonathan and Kuroki, Yoko and Tanaka, Toshiaki and Michiue, Tatsuo and Watanabe, Minoru and Bogdanovic, Ozren and Lister, Ryan and Georgiou, Georgios and Paranjpe, Sarita S. and van Kruijsbergen, Ila and Shu, Shengquiang and Carlson, Joseph and Kinoshita, Tsutomu and Ohta, Yuko and Mawaribuchi, Shuuji and Jenkins, Jerry and Grimwood, Jane and Schmutz, Jeremy and Mitros, Therese and Mozaffari, Sahar V. and Suzuki, Yutaka and Haramoto, Yoshikazu and Yamamoto, Takamasa S. and Takagi, Chiyo and Heald, Rebecca and Miller, Kelly and Haudenschild, Christian and Kitzman, Jacob and Nakayama, Takuya and Izutsu, Yumi and Robert, Jacques and Fortriede, Joshua and Burns, Kevin and Lotay, Vaneet and Karimi, Kamran and Yasuoka, Yuuri and Dichmann, Darwin S. and Flajnik, Martin F. and Houston, Douglas W. and Shendure, Jay and {DuPasquier}, Louis and Vize, Peter D. and Zorn, Aaron M. and Ito, Michihiko and Marcotte, Edward M. and Wallingford, John B. and Ito, Yuzuru and Asashima, Makoto and Ueno, Naoto and Matsuda, Yoichi and Veenstra, Gert Jan C. and Fujiyama, Asao and Harland, Richard M. and Taira, Masanori and Rokhsar, Daniel S.}, 43 | urldate = {2016-10-24}, 44 | date = {2016-10-20}, 45 | langid = {english}, 46 | keywords = {Genome evolution, Molecular evolution}, 47 | file = {Full Text PDF:/home/sppmg/.mozilla/firefox/onxyd4fz.zoteroDemo/zotero/storage/D42SNAPG/Session 等。 - 2016 - Genome evolution in the allotetraploid frog Xenopu.pdf:application/pdf;Snapshot:/home/sppmg/.mozilla/firefox/onxyd4fz.zoteroDemo/zotero/storage/XUBNDCPA/nature19840.html:text/html} 48 | } -------------------------------------------------------------------------------- /LaTeX_tutorial_zh/tutorial.tex: -------------------------------------------------------------------------------- 1 | \documentclass[class=NCU_thesis, crop=false, float=true]{standalone} 2 | 3 | \begin{document} 4 | \let\orilabel\label % enable \ref in LTXexample 5 | 6 | \chapter{FAQ} 7 | \label{sec:c_faq} 8 | \section{什麼是\LaTeX ?} 9 | \LaTeX\ 是一個非常古老、強大、專業的排版軟體。它將許多專業排版的細節隱藏起來 10 | \footnote{專業排版連\SI{0.2}{\milli\metre}都在苛求。} 11 | ,讓你專注在內容上而不用擔心最終文件是否好看。這一個特性又以數學公式最為顯著(用Word的應該可以深切體會微軟對於防止客戶腦袋老化的用心良苦 :D )。 12 | 13 | 使用上來說,\LaTeX\ 使用過程如同寫程式般,須要用一些指令告訴\LaTeX\ 這段文字是什麼(標題、章節......)。最後還要經過編譯才能看到排版結果 14 | \footnote{雖然部份編輯器提供即時編譯功能,只要停止輸入幾秒立刻進行編譯。但實務上這不是必要的,並且會加重電腦的負擔。另外有些如Lyx這類「所見即所得」(WYSIWYG)的軟體是基於\LaTeX\ ,各位可以玩玩看。} 15 | 。這種非「所見即所得」(WYSIWYG)的軟體可能會讓許多新手敬而遠之。不過不用擔心,你已經拿到這份教學了,一定可以在1hr內學會寫\LaTeX\ 文件的 :D ! 16 | 17 | \section{\LaTeX 比起 Word 有什麼優點?} 18 | \begin{itemize} 19 | \item 文字間距以及字本身大小不是固定的,它會做微幅調整讓整體最為美觀。這點在英文上更為明顯(Microtype套件能做到更漂亮)。 20 | \item 圖表位置可以浮動,能夠限制圖表只能在頁頂或頁底,不用再擔心插入文字會跑掉。 21 | \item 程式化特性,讓許多重複文字、動作都可以簡化。 22 | \item 數學公式美觀,輸入更為方便、穩定,不會像Word無法理解的跑來跑去。 23 | \item 站在巨人的肩膀上。\LaTeX\ 為出版界所用,排版規則即為專業規範。 24 | \item 隨時隨地寫論文,因為只要簡單的文字編輯器即可,任何智慧型手機、平板均可寫作。 25 | \item 免費正版,不會好心的告訴你「你是盜版的受害者」。讓你專心寫論文。 26 | \end{itemize} 27 | 28 | \section{新手如何學\LaTeX\ ?} 29 | \begin{enumerate} 30 | \item 砍掉Windows... 喔不,是忘了 Word。\LaTeX\ 不是Word,也不是單純的記事本。請不要用Word 的方式去使用\LaTeX\ 。(其實很多人把Word當記事本用....) 31 | \item 快速瀏覽過本教學。不懂沒關係,至少知道\LaTeX\ 有哪些功能、要到哪裡找。瀏覽一遍只要15分鐘,不知道好用功能可以浪費你好幾天。(\emph{學弟妹們!不要再手打圖表編號了啊!!})本教學不會是最好的\LaTeX\ 教學,不過我相信對中文使用者來說,這是非常好入門的教學。至少足夠你寫論文了! 32 | \item 實踐中學習。快寫論文吧! 33 | \end{enumerate} 34 | 35 | \section{這樣板和中央大學(羅吉昌先生)提供的有何不同?} 36 | 嗯.... 這對我來說是能否編譯的差別 XD 。 原因我也不知道為何,不過不少同學即使能夠產生PDF檔,也還是須要修改一些小地方。所以我乾脆就把我從頭打造的設定做成樣板啦! 37 | \footnote{其中還是有很小一部份是修改自羅吉昌的樣板,譬如封面頁的格式幾乎就是羅吉昌的。} 38 | 我寫論文時選定的編譯器是\XeLaTeX\ ,理由是他可以直接使用系統內的字型,也對非拉丁文字支援較好的樣子。所以這個樣板完全只測試\XeLaTeX\ 下的使用情況。 39 | 40 | 除了專注在\XeLaTeX\ 之外,我的版本也儘量使用套件處理格式而不直接動底層的設定。 41 | \footnote{2016/10/26: 為了符合學校要求,還是重定義了一些\LaTeX\ 指令......} 42 | 譬如版面設定直接使用geometry 套件設定邊距。這麼做除了我本身不熟\LaTeX\ 外,也相當於將底層的轉換交給套件開發人員,會比我自己維護來的好得多。我也替換掉將數字轉成中文(1 $\rightarrow$ 一、2 $\rightarrow$ 二)的xCJKnumb而改用zhnumber。這是因為xCJKnumb為CJKnumb的改造版,而這個套件不存在於ctan網站上,要取得只能google,然後在不知名blog上下載。雖然目前使用上沒有問題,但未來維護則未知。 43 | 44 | \section{這樣板符合學校要求嗎?} 45 | 先說結論,我的論文是照此格式提交的,既然審過了,應該沒有問題。 46 | \footnote{其實中央很松啦~~我看過比我更慘的格式。\textbf{重點在內容啊!}} 47 | 48 | 這樣板並非完全照學校要求製作。理由是有些規定我認為過於於愚蠢或是使編排變得混亂。差異處如下: 49 | \begin{itemize} 50 | \item 附錄編號採用英文字母A,B,C。理由:附錄編號與正文不該相同。(羅先生樣板雖然表面符合學校格式,但實在不應該讓章條目是中文,節條目出現英文A.1。) 51 | \item 節編號的連接符「-」換成「.」。理由:1. \LaTeX\ 預設。 2. 表達較為清晰、美觀。 3. 沒看過用「-」的。 52 | \item 圖、表、公式全部以章分別編號。理由:1. \LaTeX\ 預設。 2. 這樣做更能了解內容類別。 53 | \item 參考文獻格式使用 Nature 風格。理由:國際通用、製作方便。 54 | \end{itemize} 55 | 另外還有章節風格的問題,請見\cref{sec:s_specialTemplate_ncu_secStyle}。 56 | 57 | \section{這樣板有很厲害嗎?} 58 | 我最初大概花了1個月左右來調樣板吧!(然後教學又是1個多月......)有很多小細節都已經解決了,也儘量做到自動化設定(連pdf屬性都貼心的幫你完成了呢!\cref{fig:pdf_metadata.png})。當然啦!花費時間跟天資也是有關的,你要說「這東西也要花一個月?」我也認了orz...... 59 | \fig[0.7][][t]{pdf_metadata.png} 60 | \footnote{持續更新中==持續花時間......} 61 | 62 | \section{要怎麼使用樣板?} 63 | {\color{red} 64 | 樣板詳細設定方法使用GitHub 專案的wiki頁面做說明。 65 | } 66 | 67 | 整個流程如下: 68 | \begin{enumerate} 69 | \item 照教學檔安裝、設定軟體環境。修改編輯器的預設LaTeX編譯器,\textbf{改成使用\XeLaTeX\ }。與文獻資料庫處理程式\textbf{(改成使用biber)}。 70 | \item 先編譯一次樣板或是教學檔中的\textbf{根文件(main.tex)},確認正常編譯。\textbf{編譯前先修改config.tex中的中文字型或作業系統,詳情見\cref{sec:s_template_structure}。}\footnote{這部份其實可以透過ifplatform套件自動解決,但須要加入``-shell-escape''參數至編譯指令,我怕新手對這比較怕,所以改用設定值處理。}如果編譯出錯的話建議自行找人解決,沒人解決可以找我。不過畢竟不在現場,處理上會較為麻煩。自行解決後請回報問題及解法。 71 | \item 依樣畫葫蘆。 72 | \begin{enumerate} 73 | \item 設定(各學校目錄中的)config.tex中的個人資訊以及相關設定。 74 | \item 照教學檔試著插入文字、圖檔、表格......至以存在的chapter\_開頭的檔案。(圖片檔、程式碼檔案請置入figures、codes目錄中。) 75 | \item 須要新增章節子檔的話直接複製chapter\_template(\_demo).tex,修改內容、重命名後插入main.tex對應的章節位置。 76 | \item 要新增使用套件或其他導言區指令請填入 macros\_preamble.tex檔案,樣板會自動讀取。文獻資料庫bib檔一樣於此檔中設定。 77 | \item 同樣的,文件內的共用指令(填在\textbackslash{}begin\{document\}之後的)填入macros\_document.tex。 78 | \item 若有風格不符合的部份(如:文獻引用要用作者名、列表要照字母排序等等),請於cls檔中搜尋關鍵字(編輯器通常會提供搜尋功能,或按快速鍵Ctrl+f),找到設定行之後自行修改。 79 | \end{enumerate} 80 | \item 全部完成後編譯main.tex,產生pdf。 81 | \item 口試後將審定書、推薦書等文書簽名後掃描後存成pdf置換原先插入的單頁pdf。(附件區域已嘗試自動生成客製化文件,省去另開Word編輯文件的功夫。) 82 | \end{enumerate} 83 | 論文各文件、章節次序已經按照學校要求排好,各位只要直接修改或替換即可。 84 | 85 | \section{樣板不符合我的要求怎辦?} 86 | 要新增使用套件或其他導言區指令請填入 macros\_preamble.tex檔案,樣板會自動讀取。文件內的共用指令(填在\textbackslash{}begin\{document\}之後的)填入macros\_document.tex。一些設定要改的話可於cls檔中搜尋關鍵字(編輯器通常會提供搜尋功能,或按快速鍵Ctrl+f),找到設定行之後自行修改。 87 | 88 | 如果遇到(其他)學校要求一些奇奇怪怪的格式,真的不會改的話,只好用其他軟體(LiberOffice Writer,甚至是LiberOffice Draw)先生成pdf檔再插入囉! 89 | 90 | \section{有其他教學嗎?} 91 | \LaTeX\ 教學很多,但大多是英文的。免費資源中,wikibook的\LaTeX\ 92 | \footnote{\url{https://en.wikibooks.org/wiki/LaTeX}} 93 | 是我非常推薦的,同時也是本文主要參考的文件。 94 | 中文的完整文件有\LaTeX\ 123 95 | \footnote{\url{http://www.cs.pu.edu.tw/~wckuo/doc/latex123/node1.html}}。 96 | 不過文中使用的是\LaTeX\ + CJK套件,而本文用的是\XeLaTeX\ ,少數內容與本樣板不同。 97 | 另外還有cwTeX的文件也可以參考。 98 | 99 | 如果你碰到問題,研究半天無解,想問人沒人問又不想上英文論壇問,可以上ptt的 LaTeX 板試試。(那裡臥虎藏龍啊!) 100 | 101 | \section{MATLAB 圖要如何插入?} 102 | 不管你是用MATLAB還是Origin還是其他軟體生成的圖,都要匯出成一般圖檔才能插入。建議格式依序為為eps、png、jpg。 103 | \footnote{eps是向量圖,縮放不失真,同時也是\LaTeX\ 原本就支援的格式。png, jpg則是\XeLaTeX\ 才支援。} 104 | 如果是流程圖或一些手繪線條圖,雖然\LaTeX\ 有套件可以畫出,但我建議初學者還是用Dia/LibreOffice Draw之類的,先畫完再匯出成eps插入比較快。 105 | 106 | \section{編譯出錯怎辦?} 107 | 看錯誤訊息囉!首先回憶你剛剛做了什麼。接著儘量減少錯誤的可能,把新增行一一註解掉。有必要的話新增一個空的子檔,把新增內容複製過去檢查(會比編譯整份文件快得多)。 108 | 如果自己找不出解決辦法,試著把錯誤訊息拿去google看看。 109 | 110 | \section{為什麼你的樣板沒有附書脊(側邊)?} 111 | 目前還沒做,實際上也不須要。校園四周影印店的人比你我還專業!(我不清楚書皮製作流程,影印店也有可能為了方便製作根本不用你的書脊。) 112 | 113 | \section{台大有規定要加密、保全,為什麼你沒有?} 114 | {\color{red}因為我認為加密完全沒有用,最後害到的只有你的讀者。}如果你的論文真有極高價值,就是花錢請人重打一份都可以。或是直接OCR也可以獲取文章資訊,所以最好的保全方式就是根本不要拿出來。最終,你的加密只會讓不去破解的使用者感到麻煩而已。看看影音公司為了防止盜版做了多少加密措施,結果要盜的人直接轉錄去除加密。而乖乖牌使用者則要忍受一堆限制,還有未來可能無法使用的問題。 115 | \footnote{DRM, \url{https://zh.wikipedia.org/wiki/\%E6\%95\%B0\%E5\%AD\%97\%E7\%89\%88\%E6\%9D\%83\%E7\%AE\%A1\%E7\%90\%86}} 116 | 同樣的,Windows使用者因為沒連網就要被抹黑使用盜版,而破解版爽爽用~~(還好我用Linux,沒這問題:D) 117 | 118 | \section{為什麼你的\LaTeX 歪歪的啊!} 119 | 這是\LaTeX 的logo,本來就是\textit{歪歪}的。你可以用\textbackslash{}LaTeX 指令做出。注意大小寫以及後面要有空格區別指令與後方文字。英文環境下要再後面加一個反斜線像這樣:\verb*|\LaTeX\ |,不然因為空格被當分隔字元,\LaTeX\ 會和後面文字黏在一起。 120 | 121 | \section{為什麼你一直Linux Linux的啊!} 122 | 正啊! lol \\ 123 | 只有和她好好相處一個月才會發現她的好,也才會發現她是無可取代的。 \\ 124 | 125 | \noindent 要試嗎? :D 126 | 127 | 128 | 129 | \chapter{軟體安裝} 130 | \label{sec:c_install} 131 | 目前主要針對Linux、Windows下的軟體做說明。(Mac也有相對應軟體,但僅稍微提及) 132 | \section{TeX 編輯器} 133 | 雖然TeX 檔均為純文字檔,用任何一個文字編輯器均能編輯(即使是windows的記事本)。但選用一個好的Tex 編輯器可以省下不少功夫,像是快速鍵編譯、語法高亮度、原始碼片段插入,也會比爛爛的Windows記事本還安全,像是自動儲存等等。以下列表前兩者為我推薦的編輯器: 134 | \begin{enumerate} 135 | \item TexStudio , 跨平台的編輯器,具有許多好用功能,並且仍在活躍開發中,非常推薦\footnote{Linux/Windows/Mac均有。也是眾多Macer的選擇}。(此為Texmaker 的分支版) 136 | \item Kile , KDE下的編輯器,我用的是這個。 137 | \item Gummi , 一個可以即時編譯的編輯器。 138 | \item TeXShop, Mac上的另一個選擇。(沒用過,自己試) 139 | \end{enumerate} 140 | 關於編譯時的行為,TexStudio與Kile兩者都能夠自動找到根文件(將整份文件分割成不同tex檔撰寫時,最上層的主文件)進行編譯。TexStudio毋須任何設定,Kile則須要將檔案加入專案中。此功能好處是編輯任何子文件後,直接按下編譯快速鍵即可完整編譯整份文件,不過缺點是浪費時間。如果你有用到subfile/standalone等輔助套件可以考慮禁用此功能,也不須修改根文件的內容。(我在Kile 的作法是除了main.tex外,全部加入專案做管理,按編譯後由於kile找不到引用的上層文件,所以就會只編譯當前檔案。) 141 | 142 | TexStudio 由於持續開發的緣故,支援了很多有趣的東西。像是``magic comments'',可以在Tex檔開頭利用註解指定一些編譯參數,當使用支援的環境編譯時,就不須手動選擇使用\XeLaTeX\ 或是手動插入編譯所須參數。 143 | 144 | \section{TeX 發行版} 145 | 所謂「發行版」指的是特定組織將編譯TeX所須的環境,包含編譯器、常用套件等等包裝在一起發佈的軟體集合。最流行的三個分別是TeX Live、MiKTeX、MacTeX 。 TeX Live 設計上是朝多人使用設計(應該是指安裝在伺服器上共用),而MiKTeX 則是單人使用,所以在安全性方面TeX Live 會較好,詳情請自行google。以下是其官方網站: 146 | \begin{itemize} 147 | \item TeX Live \url{https://www.tug.org/texlive/} Linux/Unix, Windows 148 | \item MiKTeX \url{http://miktex.org/} Windows 149 | \item MacTeX \url{http://www.tug.org/mactex/} Mac 150 | \end{itemize} 151 | \LaTeX\ 網站上對此亦有詳細列表,甚至包含了幾個線上版的TeX(\url{https://www.latex-project.org/get/})。下面介紹不同作業系統下的安裝方法。 152 | 153 | \subsection{GNU/Linux} 154 | 一般來說Linux儘量由(Linux)發行版自己的套件庫安裝會比較好,這裡以 Debian 的指令模式舉例,視窗介面或是其他發行版請自行舉一反三。 155 | 156 | 以下是我在Debian 中須要手動安裝的套件,其他須要安裝的會透過相依性自己安裝。(如果想全裝就裝texlive-full套件) 157 | \begin{table}[h] 158 | \centering 159 | \begin{tabular}{|l|l|} 160 | \hline 161 | 套件名稱(in debian) & 說明及需求TeX套件 \\ \hline 162 | texlive & 主要套件,會連帶安裝基本系統 \\ \hline 163 | texlive-bibtex-extra & BibLaTeX \\ \hline 164 | texlive-lang-chinese & xeCJK,連帶安裝CJK相關套件 \\ \hline 165 | texlive-science & siunitx(單位) \\ \hline 166 | texlive-xetex & \XeLaTeX\ \\ \hline 167 | biber & 搭配BibLaTeX \\ \hline 168 | \end{tabular} 169 | \end{table} 170 | 171 | 對應的一行安裝指令為 172 | \begin{lstlisting}[style=consoleStyle,language=bash] 173 | apt-get install texlive texlive-bibtex-extra texlive-lang-chinese 174 | \end{lstlisting} 175 | 176 | 稍微注意一下 lmodern 套件是否自動安裝,我在debian 7上面碰過沒自動裝,導致找不到字型的問題。(這套件包含一些英文PS字型(Latin Modern family),自樣板1.6版後預設使用它) 177 | 178 | 稍微說明一下,我的樣板使用\XeLaTeX\ + Biblatex + biber 。如果要用傳統的Bibtex 做文獻索引的話免裝texlive-bibtex-extra biber。 179 | 180 | 缺套件時除了google後安裝含所須tex套件的Linux套件這個方法外,也可以使用Tex Live自己的套件管理程式tlmgr來安裝單一套件。 181 | 182 | \subsection{Windows} 183 | 請上各\LaTeX\ 發行版官方網站下載。安裝內容若不知如何選請按完整安裝或是日後透過Tex Live自己的套件管理程式tlmgr進行安裝(目前的TeX Live全裝約4.5GB。)。MiKTeX 具有即時安裝的功能,編譯時若有缺會自動下載。 184 | 185 | \section{文獻資料庫(.bib)管理軟體} 186 | 如果你的文獻列表使用到文獻資料庫(.bib)的話,建議你安裝一個管理軟體比較方便。這節的說明若看不懂可以先跳到基礎教學的文獻(\cref{sec:s_bib})看一下。 187 | 先列出常用的文獻管理軟體: 188 | \begin{description} 189 | \item[Zotero] 極度推薦!同時也是我使用的文獻管理軟體。免費、自由(AGPL授權)、開源、跨平台、Unicode(可引入中文條目)。加上BBT擴充後可以方便的插入\textbackslash{}cite\{cite\_key\}。(下面專門介紹) 190 | \item[JabRef] 使用Java開發,免費、自由(MIT授權)、開源、跨平台、似乎支援Unicode,但須手動設定。可以方便的插入\textbackslash{}cite\{cite\_key\}。 191 | \item[Bibus] 很早期的Linux軟體介紹會出現,但個人感覺頗難用,且已停止開發。 192 | \item[KBibTeX] KDE (Linux的桌面環境之一)提供的漂亮軟體。沒用過XD,用KDE有興趣玩玩。 193 | \item[EndNote] \$ \$ \$ 。非常昂貴的軟體(我知道各位的學校、研究單位都已經很好心的幫我們繳錢了,這點可能不是問題...)。不支援中文、不支援Linux。個人不推。 194 | \end{description} 195 | 我自己用的是Zotero,所以在這裡詳述心得。 196 | Zotero 有Firefox addon 版以及Standalone版 197 | \footnote{亦有Chrome 和Safari版,見\url{https://www.zotero.org/download/}} 198 | 。我是兩個都裝,因為Firefox addon 版可以在瀏覽網頁的當下點addon 提供的按鈕,直接匯入網頁、期刊的文獻資料,省去慢慢手打的時間。這方面其他文獻管理軟體就沒這麼方便。 199 | \footnote{期刊可以使用google scholar各條目下的「引用」複製所須資訊(如BibTeX、EndNote)再匯入管理軟體,。 EndNote 本身則是提供搜索引擎,可以直接取得相關資訊。} 200 | 。 201 | 而Standalone版的好處則是操作快速,當然這可能跟我的Firefox有1000+個分頁有關,各位可自行決定是否加安裝Standalone版。 202 | 203 | \LaTeX\ 引用文獻時須要使用\textbackslash{}cite\{cite\_key\}這樣的指令,但對於大量文獻,我們很難記得每一個的cite\_key(有些編輯器支援自動補完,但仍須記得前幾個字母),所以文獻管理軟體要是能支援插入\textbackslash{}cite\{cite\_key\}是一件非常美好的事,這也是我朋友極力推薦 JabRef 的原因之一。 Zotero 雖然本身不提供這個功能,但透過\textbf{B}etter \textbf{B}ib(La)\textbf{T}eX 擴充後能夠以拖曳方式插入\textbackslash{}cite\{cite\_key\} 。 204 | 205 | \subsection{安裝Zotero以及BBT套件} 206 | Zotero 可由官網\url{https://www.zotero.org/}下載。而BBT擴充的專案位於\url{https://github.com/retorquere/zotero-better-bibtex}。安裝說明頁 \url{https://github.com/retorquere/zotero-better-bibtex/wiki/Installation} 其中的xpi檔連結即為BBT套件,下載並安裝至Zotero/Firefox。 207 | 208 | 安裝完畢後開啟Zotero 設定視窗,在「匯出」分頁的「預設輸出格式」選「Better BibTeX Quick Copy」即可使用拖曳插入\textbackslash{}cite\{cite\_key\} 的功能。 209 | \fig[0.7][][h]{tutorial_zotero_bbt_config.png}[BBT拖曳插入cite\_key的設定方法。] 210 | \subsection{Zotero使用方法} 211 | Zotero 的一個最方便的地方就是直接由瀏覽器匯入所須資訊。\cref{fig:zotero_save}為儲存一篇\emph{Nature}期刊的例子。只要在Firefox上點一點,不但儲存作者、期刊標題等資訊,連pdf檔都一起存進來了呢!(當然你要有權限才可以啦!還有像APS系列期刊還要先朝\emph{愛因斯坦}三鞠躬才準載喔!) 212 | \begin{figure} 213 | %\captionsetup[subfigure]{labelformat=empty} % 完全隱藏圖號 214 | \centering 215 | \subcaptionbox 216 | {點紅框處儲存 217 | \label{fig:Zotero_01}} 218 | {\includegraphics[width=0.95\linewidth]{Zotero_01.png}} 219 | 220 | \vspace{\baselineskip} 221 | \subcaptionbox 222 | {儲存中(螢幕右下角) 223 | \label{fig:Zotero_02}} 224 | {\includegraphics[width=0.4\linewidth]{Zotero_02.png}} 225 | 226 | \vspace{\baselineskip} % 分隔上下列 227 | \subcaptionbox 228 | {完成 229 | \label{fig:Zotero_03}} 230 | {\includegraphics[width=0.95\linewidth]{Zotero_03.png}} 231 | 232 | \vspace{\baselineskip} % 分隔上下列 233 | \subcaptionbox 234 | {資料庫項目 235 | \label{fig:Zotero_04}} 236 | {\includegraphics[width=0.4\linewidth]{Zotero_04.png}} 237 | \hspace{0.8cm} 238 | \subcaptionbox 239 | {條目資訊 240 | \label{fig:Zotero_05}} 241 | {\includegraphics[width=0.4\linewidth]{Zotero_05.png}} 242 | \caption{Zotero 儲存期刊資訊} 243 | \label{fig:zotero_save} 244 | \end{figure} 245 | 246 | 最後要編譯前記得對Zotero中的文獻庫(左方窗格的資料夾圖示)按滑鼠右鍵,選「匯出文獻庫」並選擇「BibLaTeX」格式(如果你打算採用BibTeX格式請記得自行修改樣板)匯出.bib文獻庫。如\cref{fig:zotero_exportBib} 247 | \footnote{JabRef這類直接對.bib進行管理的軟體應該就不須要再匯出了。} 248 | \begin{figure} 249 | %\captionsetup[subfigure]{labelformat=empty} % 完全隱藏圖號 250 | \centering 251 | \subcaptionbox 252 | {匯出文獻庫(選定的目錄) 253 | \label{fig:Zotero_06}} 254 | {\includegraphics[width=0.4\linewidth]{Zotero_06.png}} 255 | \hspace{2em} 256 | \subcaptionbox 257 | {匯出BibLaTeX格式(本樣板採用BibLaTeX) 258 | \label{fig:Zotero_07}} 259 | {\includegraphics[width=0.4\linewidth]{Zotero_07.png}} 260 | \caption{Zotero 匯出文獻資料庫bib檔} 261 | \label{fig:zotero_exportBib} 262 | \end{figure} 263 | 264 | \section{本\LaTeX\ 專案結構及使用說明} 265 | 這節的說明若涉及到\LaTeX\ 專有名詞請先閱讀後面教學。 266 | \subsection{取得專案} 267 | 本專案公開於GitHub,你可以在``TW\_Thesis\_Template''專案首頁\cite{_sppmg/tw_thesis_template_????}(不是我的帳號首頁喔!)右邊找到Download鈕(\cref{fig:github_pjDownload.png})下載整個專案(github不提供下載單一目錄。單檔可以進入頁面後另存)。下載前確認你要載的版本,左側``Branch''鈕可以選擇不同的分支(\cref{fig:github_branchList}),master分支通常是穩定版,而有時為了測試會新增develop分支。``tag''則是在重要版本發布時(Ver 1.0)才會特別標記(\cref{fig:github_tagList})。 268 | \fig[0.5]{github_pjDownload.png} 269 | \begin{figure} 270 | \centering 271 | \subcaptionbox 272 | {GitHub 分支列表(使用我的另一個有develop分支的專案當範例)。 273 | \label{fig:github_branchList}} 274 | {\includegraphics[width=0.3\linewidth]{github_branchList.png}} 275 | \hspace{3em} 276 | \subcaptionbox 277 | {GitHub 標籤列表。 278 | \label{fig:github_tagList}} 279 | {\includegraphics[width=0.3\linewidth]{github_tagList.png}} 280 | \caption{GitHub的分支及標籤列表。} 281 | \label{fig:github_branch_tagList} 282 | \end{figure} 283 | 284 | \subsection{專案結構} 285 | \label{sec:s_template_structure} 286 | 專案根目錄包含教學(LaTeX tutorial)、各校規定(info)、各校樣板與語系(NCU\_zh)三類型目錄。另附上教學與樣板的編譯結果(*.pdf)作為閱讀以及對照使用者編譯之用。 287 | 各\LaTeX\ 目錄中的共用檔案及目錄(結尾含``/''者)如\cref{tab:template_structure} ,請盡量不要修改檔名或刪除檔案,除非你確定知道你在做什麼。 288 | \let\tnote\tptabletnote 289 | \begin{table} 290 | \centering 291 | \begin{threeparttable} 292 | \begin{tabularx}{\textwidth}{| l | X |} 293 | \hline 294 | codes/ & 用來存放程式碼。 \\ \hline 295 | figures/ & 用來存放論文中的圖片。亦可直接存在根目錄,但可能顯得凌亂。 \\ \hline 296 | NCU\_thesis.cls & 樣板連結,基本上不處理設定,提供各.tex子檔使用。 \\ \hline 297 | NCU\_thesis\_*.cls & 樣板主要設定,基於 extbook class,須要修改格式可以由此檔修改。 \\ \hline 298 | sppmgTools.sty & sppmg 提供的工具,可於各樣板間共用,因此另外獨立於cls。(請置於主檔同目錄或 \TeX\ 之套件搜尋路徑中) \\ \hline 299 | sppmgTools.cwl & sppmg 提供工具的指令形式,用於編輯器「自動完成」之功能(見\cref{sec:s_autocomplete}),請自行確認編輯器如何載入。 \\ \hline 300 | main.tex & 主檔案。\textbf{欲生成整份文件請編譯此檔}。檔案用於定義各子檔(章節)順序。 \\ \hline 301 | config.tex & 個人資訊設定檔。設定如論文題目等設定。\textbf{請設定使用之中文字型再編譯}。修改的方法是直接將花括號\{\}內改成你要的設定值\tnote{a},不然可能因找不中文字型而出錯。\textbf{本樣板可以利用設定作業系統來使用各系統預設字型}。 \\ \hline 302 | macros\_preamble.tex & 共用導言檔。將你要放在各個檔案導言區\tnote{b}的指令置於此檔。此檔將由NCU\_thesis.cls讀入,子文件中不須再引入。 \\ \hline 303 | macros\_document.tex & 共用文內設定。有些指令必須置於文內(\textbackslash{}begin\{document\}內),如設定字體大小的fontsize指令。這類型指令可置於此檔保持各子檔整潔以及避免漏放指令。(這個檔案會自動載入於\textbackslash{}begin\{document\}之後) \\ \hline 304 | titlepage*.tex & 書名頁/封面,中央格式一樣,因此電子檔僅使用一張。(英文版有兩種封面,但如非必要建議僅用中文封面) \\ \hline 305 | acknowledgements.tex & 誌謝(可不加,自行於main.tex註解掉。) \\ \hline 306 | abbreviation.tex & 符號表。這裡簡單的以表格列出。\tnote{c} \\ \hline 307 | abstract\_*.tex & 各語系摘要。 \\ \hline 308 | chapter\_*.tex & 各章節。(通常一章就一個檔。當然你可以再細分成更小的section子檔。\tnote{d}有些人會將chapter放在獨立目錄中,但以我的經驗,在搭配standalone等套件做子檔單獨編譯的情況下容易搞混相對路徑,所以我都放一起。) \\ \hline 309 | appendix\_*.tex & 各附錄。 \\ \hline 310 | letter\_*.pdf & 各校須附文件。(不附加直接刪除即可,可不註解) \\ \hline 311 | \end{tabularx} 312 | 313 | \caption{樣板目錄結構。} 314 | \label{tab:template_structure} 315 | 316 | \begin{tablenotes} 317 | \footnotesize 318 | \item[a]{儘量設定字型的英文名稱以避免出錯。Linux中可以使用指令``fc-list :lang=zh''來查詢可用的中文字型名稱。} 319 | \item[b] 何謂導言區,請見\cref{sec:s_latexDoc_structure}。 320 | \item[c] \LaTeX\ 亦有專用套件幫助處理術語,好處是可以自動進行排序,google關鍵字:Nomenclature(套件:nomencl)、Glossary(套件:glossary)以及綜合功能的套件:glossaries 321 | \item[d] 似乎在巢狀引入子擋上import套件比較好,請自行查閱說明手冊。 322 | \end{tablenotes} 323 | \end{threeparttable} 324 | \end{table} 325 | 共用檔名開頭(如chapter\_*.tex)只是我個人為了文件目錄的整潔而自訂的規則,各位自行決定是否跟隨。 326 | 327 | \chapter{\LaTeX\ 基礎教學} 328 | \label{sec:c_basicLatex} 329 | 這裡的教學目的只是希望\LaTeX\ 新手可以無痛寫論文。所以只說明搭配此樣版後須要具備的基礎知識。如何調整樣板不是主要目標,有興趣或是有此需求的可以直接看\LaTeX\ code,內有一些註解或網頁連結可能可以幫到你。下面的說明我儘量以範例呈現,各位可以直接複製所須的\LaTeX\ 片段貼上論文再改。不過由pdf複製文字的部份怪怪的,可能要由\LaTeX\ 原始碼複製。這部份可能是pdf cmap 等等的問題。 330 | 331 | \section{背景知識} 332 | 333 | \subsection{\TeX\ 、\LaTeX\ 歷史} 334 | \LaTeX\ 是一個非常強大、專業的排版軟體。事實上\LaTeX\ 其實是\TeX\ 的巨集。它使得原本較為困難的TeX語法變得簡單許多。 335 | \TeX\ 是 Donald Knuth 1977年為其巨著「The Art of Computer Programming」 336 | \footnote{這本「神書」目前還沒寫完全套,希望Knuth有生之年可以順利完成。} 337 | 進行校稿時,發現當時的數學公式排版過於差勁,於是決定自己弄一個排版系統出來(這才是真正的Hacker !!)。由於直接寫\TeX\ (或稱Plain \TeX\ )文件較困難,因此後來發展出\LaTeX\ 來簡化上手難度。而後來又因為非英語、直接產生PDF 等等需求又衍生出各式各樣的\TeX\ /\LaTeX\ 版本。 338 | \footnote{\TeX\ 追求穩定,所以只除錯,不添加新功能。} 339 | 340 | \subsection{編譯/生成PDF檔} 341 | \LaTeX\ 不同於LibreOffice Writer/ MS Office Word 之類的程式,它須要寫好tex檔之後以LaTeX程式(再透過Tex程式)編譯成最終檔案 342 | \footnote{原始的\LaTeX\ 編譯器(就稱為latex)是將tex轉為dvi檔(可用evince等軟體開啟)。若要再轉pdf 須要再經由其他軟體轉換。}。% 編輯過程中無法看到排版結果, 343 | 其中tex檔為純文字檔,和常見的.txt 文字檔相同,亦即你可以由任何文字編輯器開啟,如Linux上的VIM或是Windows 上的記事本。相對的像是Word 的doc檔一定要用支援doc的程式才能開啟,否則會顯示成亂碼。 344 | 345 | \LaTeX\ 編譯器除了本身稱為\LaTeX\ 的程式外,尚有\XeLaTeX\ 、PdfLaTeX、LuaLaTex 等編譯器 346 | \footnote{他們相對應的\TeX\ 編譯器分別是\XeTeX\ 、PdfTeX、LuaTex。事實上它們的特色是由*\TeX\ 所提供而非*\LaTeX\ 。} 347 | 。其特色如下: 348 | \begin{description} 349 | \item[XeLaTex] 支援Unicode 萬國字碼(原生UTF-8)。支援現代系統中的常見字型格式,如TrueType/OpenType,也就是說不須要另外載\LaTeX\ 用的 PostScript 字型。輸出檔為PDF(但不支援DVI/PS)。 350 | \item[PdfLaTeX] 非Unicode,輸出檔為PDF。中文字碼處理須透過CJK套件,似乎以奇怪方式支援\footnote{\url{https://www.csie.ntu.edu.tw/~tzhuan/www/resources/ntu/}}。(其他優點我就不知啦!) 351 | \item[LuaLaTex] 人如其名;LuaLaTeX 即是基於 PdfLaTeX 再加上Lua 腳本引擎。由於 \TeX\ 並不是真正的程式語言,要實現某些程式化動作可能須要拐彎抹角甚至是無法達成。而加上Lua則能夠以真正的程式語言優美的完成所須動作。支援Unicode 萬國字碼。 352 | \end{description} 353 | 目前看起來\XeLaTeX\ 是較為先進與穩定的編譯器,因此本文僅針對 \XeLaTeX\ 說明以及測試。(教學部份一般適用於所有\LaTeX\ 編譯器,若你使用其他編譯器應該也只有少數區域要修改。) 354 | 355 | \LaTeX\ 編譯時不會一次完成所有的工作,因此須要多次編譯。下面是含.bib文獻的標準編譯順序 356 | \footnote{若須生成目錄(樣板main.tex會生成目錄),\textbackslash{}tableofcontents指令,須編譯到第二次才會生成。} 357 | 。(main表示main.tex,為某一專案的主檔案) 358 | \begin{enumerate} 359 | \item xelatex main $\longleftarrow$ 先編譯一次,部份內容如文獻以代號紀錄下來。 360 | \item biber main $\longleftarrow$ 處理.bib文獻資料庫。biber 是BibLaTeX用的程式,若你用BibTeX則為 bibtex main 361 | \item xelatex main $\longleftarrow$ 將上次編譯產生的代號替換為最終格式。 362 | \item (xelatex main) $\longleftarrow$ 可能視情況還須要更多次編譯(如makeindex)。 363 | \end{enumerate} 364 | 通常\LaTeX\ 專用編輯器已經幫你處理好了,你只須要按下快速鍵(或圖示)一次就可以編譯完成。 365 | 366 | 指令介面的使用者對於單次編譯可以使用下面指令 367 | \begin{lstlisting}[style=consoleStyle,language=bash] 368 | xelatex -interaction=nonstopmode main 369 | \end{lstlisting} 370 | 371 | 而多次編譯的話可以安裝latexmk 這個軟體,它可以自動完成所須的編譯動作。 372 | 373 | \XeLaTeX\ 使用者推薦使用以下指令:\\ 374 | \begin{lstlisting}[style=consoleStyle,language=bash] 375 | latexmk -xelatex -interaction=errorstopmode main 376 | \end{lstlisting} 377 | 其中``-xelatex'' 指定用xelatex處理,須要latexmk 4.31版(2012年發佈)以上才可用。``errorstopmode''設定僅當編譯出錯才暫停,對於一些警告直接略過(時常因字體大小等等問題出現一堆警告,不理不會有任何問題)。亦可用nonstopmode取代之,但不甚推薦。 378 | 下面是某次我在 TeX Live 2016 上使用latexmk編譯後,輸出訊息結尾(首行\$表示Linux下輸入指令): 379 | \begin{lstlisting}[style=consoleStyle,language=bash] 380 | $ latexmk -time -xelatex -interaction=errorstopmode main 381 | .... 382 | .... 383 | .... 384 | Output written on main.pdf (89 pages). 385 | SyncTeX written on main.synctex.gz. 386 | Transcript written on main.log. 387 | Latexmk: Found input bbl file 'main.bbl' 388 | Latexmk: Log file says output to 'main.pdf' 389 | Latexmk: Found biber source file(s) [main.bcf tutorial.bib] 390 | Latexmk: All targets (main.pdf) are up-to-date 391 | 'xelatex -interaction=errorstopmode -recorder "main.tex"': time = 5.92 392 | 'biber "main"': time = 0.66 393 | 'xelatex -interaction=errorstopmode -recorder "main.tex"': time = 18.36 394 | 'biber "main"': time = 0.920000000000002 395 | 'xelatex -interaction=errorstopmode -recorder "main.tex"': time = 18.01 396 | 'xelatex -interaction=errorstopmode -recorder "main.tex"': time = 18.2 397 | 'xelatex -interaction=errorstopmode -recorder "main.tex"': time = 18.09 398 | Accumulated processing time = 82.53 399 | \end{lstlisting} 400 | 會發現xelatex 總共執行5次。實際上次數不固定,所以若使用手動指定編譯次數方法,最好在編譯後檢視訊息,你可能會看到要求再次執行 biber 的訊息: 401 | \begin{lstlisting}[style=consoleStyle,language=bash] 402 | Package biblatex Warning: Please (re)run Biber on the file: 403 | (biblatex) main 404 | (biblatex) and rerun LaTeX afterwards. 405 | 406 | ) 407 | \end{lstlisting} 408 | 或是編譯完發現pdf檔缺東缺西(目錄不正常啦、todonotes 的線沒對到之類的)就可能要再執行一次 xelatex。 409 | 410 | 編譯過程中若是遇到錯誤會暫停,並顯示在終端上(假設你用文字式終端編譯以及使用了errorstopmode)。按 鍵可以略過這個錯誤(文件也不會是完整的)。若是要直接終止編譯過程,可以輸入``x''。 411 | 412 | 編譯完成後,若你的系統上有Ghostscript (Linux上應該很常見)可以以下面指令壓縮pdf檔: 413 | \begin{lstlisting}[style=consoleStyle,language=bash] 414 | gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="Compressed.pdf" "Original.pdf" 415 | \end{lstlisting} 416 | 壓縮後體積可以縮小不少,以我的論文來說縮了約40\%。不過缺點是pdf檔的附加資訊會連帶被消除。解決辦法是搭配pdftk取出附加資訊,gs處理完再匯入。 417 | \footnote{\url{http://unix.stackexchange.com/questions/50475/how-to-make-ghostscript-not-wipe-pdf-metadata} 提到這是gs的bug,要利用pdftk處理。} 418 | 419 | 你可能會發現在編譯之後,工作目錄下出現許多奇怪附檔名的檔案。這是由於\LaTeX\ 編譯時無法往回處理之前的標記,所以須要將標記資料紀錄下,待下次編譯時再處理。你可以不理會它們,對你而只有.tex(文件檔)、.bib(你置入的文獻資料庫)以及編譯生成的.pdf須要保留。不過有時會因為殘留的紀錄檔導致編譯出錯,所以有時遇到奇怪問題時記得試試先清除它們再編譯,或是直接將「清除紀錄檔」這個動作加到編譯序列的最前面。 420 | \footnote{各檔案說明見\url{https://en.wikibooks.org/wiki/LaTeX/Basics\#Ancillary_files} } 421 | 422 | \section{文件結構} 423 | \label{sec:s_latexDoc_structure} 424 | 最簡單的\LaTeX\ 文件如下: 425 | \begin{lstlisting}[linewidth=0.9\textwidth] 426 | \documentclass{article} 427 | % This is comment, here is preamble. 428 | \begin{document} 429 | Hello world! 430 | \end{document} 431 | \end{lstlisting} 432 | 以\textbackslash{} 開頭的均為指令,而\{\}為其選項。 433 | \textbackslash{}doocumentclass 選擇文件的類型(class),article 適合一篇簡單的文件(如實驗報告)。而其他如book/report則適合較大型的書、期刊等等。 434 | 不同的類型會產生不同風格的文件,如單雙面、單雙欄、頁眉頁尾、目錄等等。甚至連可使用的指令都有差異。選擇合適的類型可以省下很多調整的功夫。由於論文比較近似書的風格,因此本樣板即是使用(類)book class。 435 | \footnote{說(類)是因為原始的book class 有字大小的限制,因此後來改用其他套件提供的book class。} 436 | \textbackslash{}begin~\textbackslash{}end 則是某個環境的範圍。(這裡是document環境)\textbackslash{}begin\{document\} 表示其中為文件內容。而\textbackslash{}begin\{document\}前面的區域為導言區(preamble),用來設定所用的套件。 437 | 438 | 各個不同的文件的類型(class)提供不同的風格設定。以本樣板用到的book為例,其原始結構如下: 439 | \begin{lstlisting} 440 | \begin{document} 441 | \frontmatter 442 | 443 | \maketitle % print titlepage or cover 444 | \tableofcontents % table of contents (目錄) 445 | \listoffigures % list of figures (圖片列表) 446 | \listoftables 447 | 448 | % Introductory chapters 449 | \chapter{Preface} 450 | % ... 451 | 452 | \mainmatter 453 | \chapter{First chapter} 454 | % ... 455 | 456 | \appendix 457 | \chapter{First Appendix} 458 | 459 | \backmatter 460 | \chapter{Last note} 461 | \printbibliography % print bibliography in here.(文獻) 462 | \end{document} 463 | \end{lstlisting} 464 | 各區段(frontmatter/mainmatter/backmatter/...)有不同設定,如頁碼的差異、章節的編號等等。\textbackslash{}chapter 表示新的一章。類似的像是\textbackslash{}section、\textbackslash{}subsection 表示節、小節。 465 | \footnote{樣板預設目錄顯示至第三級(\textbackslash{}subsection\{\}),章節編號標至第五級(\textbackslash{}paragraph\{\})。} 466 | 467 | 468 | 依照中央大學的要求,\textbackslash{}appendix 必須在\textbackslash{}backmatter後面 469 | \footnote{據說APA格式亦要求\textbackslash{}appendix放至最後。} 470 | ,因此NCU樣板有對\textbackslash{}appendix做一點小小修改,使其置於\textbackslash{}backmatter 之後亦正常顯示。 471 | 472 | 473 | \section{套件與指令} 474 | \label{sec:s_basicCmd} 475 | \LaTeX\ 文件中,提供各種特別功能的就稱為指令,而指令有些須要另載入「套件」才會有。譬如要打出水的化學式\ce{H_2O},你須要載入mhchem套件 476 | \footnote{我知道有些人是直接用數學模式啦!} 477 | ,然後利用它提供的指令:\textbackslash{}ce\{H\_2O\}。 478 | 479 | 要載入套件可於導言區(preamble)使用: 480 | \begin{lstlisting} 481 | \usepackage[option]{package} 482 | \end{lstlisting} 483 | 484 | 而各指令的形式如下 485 | \begin{lstlisting} 486 | \commandname[option1,option2, ...]{argument1}{argument2} ... 487 | \end{lstlisting} 488 | 指令起始於\textbackslash{}。有些指令不帶參數,如\textbackslash{}LaTeX 489 | % ,記得在結尾加上空格或是\{\}做結尾 490 | \footnote{\textbackslash{}LaTeX用在文字行時,結尾要加上反斜線、空格:``\textbackslash{}LaTeX\textbackslash{}\ ''不然會和後面黏在一起。} 491 | 。 492 | 有些指令則是須要一個以上的參數,其中\{argument\}為必要參數。[option]為可略選項。譬如圖片說明文字的指令為: \\ 493 | \begin{lstlisting} 494 | \caption[short]{full} 495 | \end{lstlisting} 496 | 當填入[short]時,圖列表處的說明會換成短版的說明(顯示於圖目錄)。 497 | 498 | \textbackslash{}起始的指令名稱直到空格或保留字才結束,因此對於內文中的無參數指令一定要加空格或是以\{\}結束。下面示範於內文中(以text夾住)使用指令 499 | \begin{table}[h] 500 | \centering 501 | \caption{指令範例} 502 | \begin{tabular}{| l | l |} 503 | \hline 504 | \verb*|text\cmd text| & o Valid \\ \hline 505 | \verb*|text\cmd{}text| & o Valid \\ \hline 506 | \verb*|text\cmdtext| & x Invalid \\ \hline 507 | \verb*|text\cmd文字| & x Invalid \\ \hline 508 | \end{tabular} 509 | \end{table} 510 | 511 | 512 | 有些指令提供帶星號形式。如\textbackslash{}chapter 與\textbackslash{}chapter$\ast$ ,後者將產生一個無編號的章節,同時也不顯示於目錄。 513 | 514 | 指令的參數([]或是\{\})內不能有多餘的空格。譬如插入圖片時的路徑若在結尾多打一個空格: 515 | \begin{lstlisting}[showspaces=true] 516 | \includegraphics{logo-Linux.png } 517 | \end{lstlisting} 518 | 編譯時會出現錯誤,因為編譯器會將空格視為檔名,所以找不到檔案。 519 | 520 | \section{文字} 521 | \label{sec:s_text} 522 | \LaTeX\ 中的文字編排有以下特性: 523 | \begin{itemize} 524 | \item 除了保留字外,一般文字直接打就可以顯示在文件上。 525 | \item 區分大小寫。\textbackslash{}chapter 與 \textbackslash{}Chapter 是不一樣的。 526 | \item 縮減空格。文字間多個空格與單一空格等效,僅會顯示出同樣的間隔,而此一間隔由\LaTeX\ 編譯器判斷。 527 | \item 忽略單一斷行。單一斷行與連接在一起是等效的。二個以上的斷行視為新的段落。若要強制斷行但不分段可以使用雙反斜線:\textbackslash{}\textbackslash{}。 528 | \item 英文``引號'',左邊要用兩個「\verb|`|」(曲線號「$\sim$」那顆鍵,1左邊),右邊要用兩個「\verb|'|」(Enter左邊的鍵) 529 | \end{itemize} 530 | 531 | 532 | \subsection{保留字} 533 | 以下字元為保留字,直接使用不會出現在文件上(大部分會導致編譯失敗)。 534 | \begin{table}[h] 535 | \centering 536 | \begin{tabular}{|l|l|l|} 537 | \hline 538 | 保留字 & 顯示文字指令 & 保留字功能 \\ \hline 539 | \# & \textbackslash{}\# & 定義指令的選項 \\ \hline 540 | \$ & \textbackslash{}\$ & 數學模式標記 \\ \hline 541 | \% & \textbackslash{}\% & 註解 \\ \hline 542 | \^{} & \textbackslash{}\^{}\{\} & 上標,用於數學模式\\ \hline 543 | \& & \textbackslash{}\& & 矩陣、表格分隔符 \\ \hline 544 | \_ & \textbackslash{}\_ & 下標,用於數學模式\\ \hline 545 | \{ & \textbackslash{}\{ & 指令參數標記\\ \hline 546 | \} & \textbackslash{}\} & 指令參數標記\\ \hline 547 | \~{} & \textbackslash{}\~{}\{\} &\\ \hline 548 | \textbackslash{} & \textbackslash{}textbackslash\{\}& 指令起始字元\\ \hline 549 | \end{tabular} 550 | \end{table} 551 | 552 | 553 | \subsection{字體大小與行高} 554 | {\color{red} 555 | 本樣板已提供豐富、簡便的「字體大小與行高」設定,請於config.tex中「字體大小風格及行距」、「標題風格」等選項設定。直接使用\LaTeX\ 指令即可。風格均可疊加,如``\textbackslash{}sffamily\textbackslash{}Large''。 556 | } 557 | 558 | \subsubsection{字體大小} 559 | \LaTeX\ 中的字體大小基本上使用相對大小的方式設置。在一開始載入class 檔時就先決定基礎字體大小。之後文內(以及標題等等)使用相對大小進行修改,如\textbackslash{}large、\textbackslash{}small。 560 | \footnote{其對應的真實大小可以由wikibook查到,也可以自己寫指令測量。} 561 | 此外,我們也可以經由anyfontsize套件提供的\textbackslash{}fontsize指令來調整字的絕對大小。 562 | 563 | 設定基礎大小的方法如下: 564 | \begin{lstlisting} 565 | \documentclass[a4paper,10pt]{book} 566 | \end{lstlisting} 567 | 10pt(1pt=1/72.27 inch 568 | \footnote{\TeX\ 中pt 定義和 Adobe 的 PostScript pt不同,Adobe 的pt在 \TeX\ 中稱為bp,1bp=1/72 inch。Word似乎也是以bp做單位。} 569 | )即為這個例子所設定的大小(事實上10pt也是book class預設值,不指定就是10pt)。不過10pt對於中文來說太小,而\LaTeX\ 預設文件類別又只提供有限的選項(10pt,11pt,12pt)。 570 | 若要用更大的字體,解決方法有兩種。一是改用其他套件提供的class,另一是在內文區段(\textbackslash{}begin\{document\}內)使用\textbackslash{}fontsize調整。 571 | 572 | 改用其他套件提供的class方面。如extsize套件對應的extbook class提供了 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt這些選項。而 KOMA-script的scrbook class則是使用無級縮放[fontsize=14pt]。 573 | 由於本樣板目前(v1.6)採用extsize,所以請從extbook class的大小選項中選一個使用並填入main.tex的\textbackslash{}documentclass選項(樣板預設中文樣板使用14pt,英文使用12pt)。 574 | 設定範例如下:(documentclass使用extbook舉例,樣板使用者請維持原本的documentclass。) 575 | \begin{lstlisting} 576 | \documentclass[a4paper,10pt]{extbook} 577 | \end{lstlisting} 578 | 579 | 若是採用\textbackslash{}fontsize調整文字,雖然它可以方便的無級縮放文字,但要注意 580 | \textbackslash{}fontsize只能放在\textbackslash{}begin\{document\}內(樣板提供macro\_document.tex,置於此即可),並且只能暫時影響其後的文字。當遇到\textbackslash{}large之類的指令時將調回基礎大小的「large大小」(以及行高),有可能發生\textbackslash{}large比原文還小的情況。 581 | \textbackslash{}fontsize範例如下: 582 | \begin{lstlisting} 583 | % \fontsize{size}{baselineskip}\selectfont 584 | \fontsize{10}{12}\selectfont 585 | \end{lstlisting} 586 | size指定大小(單位pt),baselineskip為行高(\LaTeX\ 預設值10pt,12pt。(一倍行高=1.2x))。 587 | 588 | 相對的修改字體大小指令示範如\cref{tab:fontsize} 589 | \footnote{完整列表見wikibook:\url{https://en.wikibooks.org/wiki/LaTeX/Fonts\#Sizing_text}} 590 | : 591 | \begin{table}[h] 592 | \centering 593 | \caption{字體大小範例(指令前後的\{\}作用為限制影響範圍)} 594 | \begin{tabular}{| l | l |} 595 | \hline 596 | 指令 & 效果 \\ \hline 597 | \{\textbackslash{}tiny ...\} & {\tiny 字體大小}\\ \hline 598 | \{\textbackslash{}footnotesize ...\} & {\footnotesize 字體大小} \\ \hline 599 | \{\textbackslash{}small ...\} & {\small 字體大小} \\ \hline 600 | \{\textbackslash{}normalsize ...\} & {\normalsize 字體大小} \\ \hline 601 | \{\textbackslash{}large ...\} & {\large 字體大小} \\ \hline 602 | \{\textbackslash{}LARGE ...\} & {\LARGE 字體大小} \\ \hline 603 | \{\textbackslash{}Huge ...\} & {\Huge 字體大小} \\ \hline 604 | \end{tabular} 605 | \label{tab:fontsize} 606 | \end{table} 607 | 再次提醒!所有的大小都是相對於\textbackslash{}normalsize而訂,而這個\textbackslash{}normalsize就是一開始傳給class的數值。 608 | 609 | 本樣板於1.5版以前採用\textbackslash{}fontsize,1.6版後已經遷移至extbook,所以預設不用\textbackslash{}fontsize做調整。不過仍舊於 macro\_document.tex保留註解掉的\textbackslash{}fontsize。 610 | 更豐富的字體大小設定請見\url{http://texblog.org/2012/08/29/changing-the-font-size-in-latex/} 611 | 612 | \subsubsection{行高} 613 | 行高方面有多種設定方式。(\textbackslash{}fontsize可以直接設定,這裡就不再提了) 614 | 本樣板採用的方式是利用setspace套件設定。 615 | \begin{lstlisting} 616 | \setstretch{1.5} 617 | \end{lstlisting} 618 | 上面的設定將使得行高變更為1.5倍,這也是公認最舒適的行距並且是本樣板預設值。不過表格內容以及caption也會因此而改成1.5倍,不太好看。沒關係!本樣板已經幫你調好,只要在config.tex中分別設定即可。(細節我就不講啦!自己去研究cls檔。) 619 | 620 | 其他不用套件調行高的方法如下: 621 | \begin{lstlisting} 622 | \renewcommand{\baselinestretch}{1.5} 623 | \end{lstlisting} 624 | 免套件,但統一調整所有行距。彈性不如setspace套件。 625 | \begin{lstlisting} 626 | \linespread{1.3} 627 | \end{lstlisting} 628 | 倍數不直觀,例如1.6為2倍行高。 629 | 630 | \subsection{字型樣式} 631 | \LaTeX\ 中的字形樣式以指令設定,包含文字風格(粗、斜體)以及字型。下面這張表格示範了常用的樣式指令以及效果。其中第一欄(\LaTeX\ )指令會影響後面的所有文字 632 | \footnote{可使用\{\}來限制範圍,如\{\textbackslash{}em ... \}} 633 | 。第二欄(小範圍)則是只影響\{...\}中的內容。最後面分別測試中英文的效果。 634 | \footnote{改自\LaTeX\ wikibook:\url{https://en.wikibooks.org/wiki/LaTeX/Fonts\#Shapes}} 635 | \footnote{底線須要另外使用ulem套件,理由是應以emphasis取代,見wikibook。中文的xeCJK亦支援ulem套件,請參考其手冊。} 636 | \begin{table}[h] 637 | \centering 638 | \caption{樣式範例} 639 | \begin{tabular}{| l | l | l |} 640 | \hline 641 | \LaTeX\ & 小範圍 & 效果 \\ \hline 642 | \textbackslash{}normalfont & \textbackslash{}textnormal\{...\} & \textnormal{正常normal} \\ \hline 643 | \textbackslash{}em & \textbackslash{}emph\{...\} & \emph{強調emphasis} \\ \hline 644 | \textbackslash{}rmfamily & \textbackslash{}textrm\{...\} & \textrm{羅馬(襯線)roman}\\ \hline 645 | \textbackslash{}sffamily & \textbackslash{}textsf\{...\} & \textsf{無襯線sans serif}\\ \hline 646 | \textbackslash{}ttfamily & \textbackslash{}texttt\{...\} & \texttt{打字機(等寬)teletypefont(monospace)}\\ \hline 647 | \textbackslash{}bfseries & \textbackslash{}textbf\{...\} & \textbf{粗體bold}\\ \hline 648 | \textbackslash{}itshape & \textbackslash{}textit\{...\} & \textit{斜體italic}\\ \hline 649 | \end{tabular} 650 | \end{table} 651 | 本樣板中,\textbackslash{}rmfamily, \textbackslash{}sffamily, \textbackslash{}ttfamily 可以由config.tex的 \textbackslash{}def\textbackslash{}mainfont等指令設定使用的字型,中文則是\textbackslash{}def\textbackslash{}CJKmainfont等指令。 652 | \footnote{事實上是透過 fontspec套件提供的 \textbackslash{}setmainfont, \textbackslash{}setsansfont, \textbackslash{}setmonofont進行設定。而對應的中文則是由xeCJK套件提供的\textbackslash{}setCJKmainfont,\textbackslash{}setCJKsansfont,\textbackslash{}setCJKmonofont } 653 | 654 | 普通文件常用的字體有\textsf{楷體}以及明體(或用宋體)兩種。通常內文較適合細字的明體,這樣讀起來較不容易疲勞。而楷體適合放在字體、空間較大的標題,因此本樣板中設定中文的主要字體為明體,而無襯線字體則是設定楷體 655 | \footnote{若要在一段文字中暫時的使用襯線英文與楷體,可以簡單的用\textbackslash{}rmfamily\textbackslash{}CJKfamily{sf}達成,見\cref{sec:s_fonts}。} 656 | 。若要新增其他字型,可以使用\textbackslash{}newfontfamily來設定。下面是一個簡單的範例,這裡假設你的系統中有「cwTeX 楷書」字型。 657 | \begin{lstlisting}[style=LatexStyle,xleftmargin=0.5cm] 658 | \begin{document} 659 | \newfontfamily\cwbm{cwTeX 楷書} 660 | 正常文字 661 | {\cwbm 使用cwTeX楷書} 662 | 正常文字 663 | \end{document} 664 | \end{lstlisting} 665 | 666 | 有些文件會以一種較短的指令來設定樣式,如粗體使用\textbackslash{}bf、斜體使用 \textbackslash{}it。這是舊的指令,存在某些問題。現在(2016年)請用\textbackslash{}bfseries、 \textbackslash{}itshape。 667 | 668 | \section{圖片} 669 | \label{sec:s_figure} 670 | \XeLaTeX\ 支援的圖片格式有eps, pdf, png, jpg。數據圖推薦使用eps格式,因為eps是向量圖檔,縮放不會失真。流程圖或一些手繪線條圖,雖然\LaTeX\ 有套件可以畫出,但我建議初學者還是用Dia/LibreOffice Draw之類的,先畫完再匯出成eps插入比較快。 671 | \footnote{推薦的自由軟體:影像、照片修圖:GIMP。向量圖、手繪線條:Inkscape、LibreOffice Draw。流程圖/關係圖:Dia、Graphviz} 672 | LibreOffice Draw的匯出方法見\cref{sec:a_loDraw}。 673 | \footnote{M\$ Office 「力點」據說無法匯出成eps格式。} 674 | 675 | 這裡用的圖片全部都不採用「文繞圖」模式,一般正式文件應該也很少使用文繞圖。欲使用的話可使用wrapfigure套件。 676 | \footnote{\url{https://nl.sharelatex.com/learn/Inserting\_Images}} 677 | 678 | \subsection{插入單一圖片} 679 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 680 | \begin{figure}[!htb] 681 | \centering 682 | \includegraphics[width=0.2\textwidth]{logo-Linux.png} 683 | \caption[Linux logo]{This is a Linux logo. It is a penguin.} 684 | \label{fig:first_linux_logo} 685 | \end{figure} 686 | \end{LTXexample} 687 | 注意幾件事: 688 | \begin{itemize} 689 | \item \{figure\}環境為一個浮動性環境,也就是說在沒有使用[h]選項的情況下,\LaTeX\ 會自動為我們選擇適當位置。細節請參考\cref{sec:s_float} 690 | \footnote{本樣板已於cls中設定FloatBarrier,浮動環境不會超出\textbackslash{}subsubsection範圍。} 691 | \item \textbackslash{}includegraphics中,width=0.2\textbackslash{}textwidth 指得是縮放圖形至0.2倍行寬。 692 | \item \textbackslash{}label須要放在\textbackslash{}caption之後,因為\textbackslash{}caption存在\textbackslash{}label才會生成標記。 693 | \end{itemize} 694 | 若只是插入一張圖片,上面的指令稍嫌麻煩,於是我提供一個簡化指令,其語法如下: 695 | \begin{lstlisting} 696 | \fig[scalefactor][fig:label][!htb]{path}[caption][short caption] 697 | \end{lstlisting} 698 | 除path外,其餘均可忽略,但須注意[]在\{\}前後分別為前三後二,若提供數目不足會當作左方的設定值。例如\{\}前只提供兩個[],則第一個為[scalefactor],第二個為[fig:label] 699 | \footnote{雖然這裡寫得是[fig:label],但其實``fig:'' 就是 label 的內容,見\cref{sec:s_labelRef}。} 700 | 。若須要忽略中間的[fig:label]必須補上空括號,以下照優先順序排列說明。 701 | \footnote{[scalefactor]基於\textbackslash{}textwidth,也就是文字行寬。數值範圍[0~1]} 702 | \begin{enumerate} 703 | \item path,圖片路徑含副檔名。 704 | \item scalefactor縮放因子,0.0~1.0倍行寬,預設0.5 705 | \item label標籤,省略則預設「fig:」+ 檔名(path) 706 | \item !htb浮動選項,預設為空,即交由\LaTeX\ 排版。 707 | \item caption,圖片說明,顯示在\textbackslash{}includegraphics的相對位置。 708 | \item short caption短圖說,用來取代圖目錄裡的文字,預設為空,即同caption。 709 | \end{enumerate} 710 | 須要注意的是括號僅path為大/花括號,這是因為路徑為必要參數。以下示範各種使用方法: 711 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 712 | \fig{logo-Linux.png} 713 | \fig{logo-Linux.png}[line 2, caption] 714 | \fig[0.15]{logo-Linux.png} 715 | \fig[0.15][][h]{logo-Linux.png}[line 4, caption] 716 | \fig[0.15][fig:label_test_1][h]{logo-Linux.png}[line 5, caption] 717 | \fig[0.15][fig:label_test_2]{logo-Linux.png}[line 6, caption] 718 | \fig[0.15][fig:label_test_3][!hbt]{logo-Linux.png}[line 7, caption][short caption] 719 | \end{LTXexample} 720 | 省略label的圖會自動設定label為``fig:logo-Linux.png'' 721 | 722 | \subsection{插入多張圖片} 723 | 這裡使用subcaption套件並且使用\textbackslash{}subcaptionbox ,它可以對齊各子圖的底部,多行caption時比較整齊。下面範例同時示範文內引用的方法。 724 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm,preset=\let\label\orilabel] 725 | \begin{figure}[!hbt] 726 | %\captionsetup[subfigure]{labelformat=empty} % 完全隱藏圖號 727 | \centering 728 | \subcaptionbox 729 | {Linux (A kernel of OS) 730 | \label{fig:subfig_linux}} 731 | {\includegraphics[width=0.3\linewidth]{logo-Linux.png}} 732 | ~ 733 | \subcaptionbox 734 | {Debain (A popular distribution). Demo long caption, bla bla bla bla bla. 735 | \label{fig:subfig_debian}} 736 | {\includegraphics[width=0.3\linewidth]{logo-Debian.eps}} 737 | \vspace{\baselineskip} % 分隔上下列 738 | \subcaptionbox 739 | {GNU (A project of OS) 740 | \label{fig:subfig_gnu}} 741 | {\includegraphics[width=0.6\linewidth]{logo-GNU.png}} 742 | % use ``\subref{fig:subfig_debian}'' get ID of subfigure(this ID is Debian) 743 | \caption{caption, 這裡可使用 \subref{fig:subfig_debian}取得子圖(Debian)編號 } 744 | \label{fig:multifig_label} 745 | \end{figure} 746 | % 以下內文示範引用 747 | \cref{fig:multifig_label}為三張圖的編號,Debian是\cref{fig:subfig_debian}。 748 | \end{LTXexample} 749 | ``\~{}'' 表示在圖片間插入間隔,當圖片較密時比較美觀(亦可用\textbackslash{}hspace\{\}來指定)。圖片一行的寬度總和建議不要超過「0.98\textbackslash{}linewidth」,不然會自動折行跑到下一行去。 750 | 若要控制圖片如「品」字排列(強制換行),可以將上面的``\~{}'' 取代為空行,若要再加大上下間距可以用\textbackslash{}vspace\{\} 751 | \footnote{\textbackslash{}hspace\{\}、\textbackslash{}vspace\{\}可指定長度單位,如\textbackslash{}hspace\{5mm\}} 752 | 。 753 | 當子圖太小時, caption 可能會因為圖片不夠寬導致折行並加大文字間距,非常難看。可以加上subcaptionbox的寬度選項,如: \textbackslash{}subcaptionbox\{caption\}[5cm]\{\textbackslash{}includegraphics .... \} 手動設定圖框的寬度。 754 | 如果要做其他更細緻的子圖位置設定,請自行參考minipage用法。 755 | \footnote{\url{http://tex.stackexchange.com/questions/55337/how-to-use-figure-inside-a-minipage}} 756 | 757 | 引用子圖時直接使用子圖(\textbackslash{}subcaptionbox)的\textbackslash{}label的標記即可,子圖會自動加上編號。 758 | 759 | 760 | \section{表格} 761 | \label{sec:s_table} 762 | 表格如果太複雜不會製作或是嫌不好輸入,可以找圖形界面的軟體或是線上網站。同樣的,有些編輯器也已經內建表格產生器了,不過功能可能很陽春就是了。 763 | 表格的說明文字(caption)位置改設定在表格上方。(雖然說caption位置可以透過\textbackslash{}caption和tabular環境的相對位置來設定,但產生出的caption與表格距離會過近 764 | \footnote{事實上這個距離由\textbackslash{}abovecaptionskip 和\textbackslash{}belowcaptionskip 設定,預設為10pt、0pt。} 765 | ,所以本樣板透過floatrow套件設定表格的caption位置,\LaTeX\ code 中\textbackslash{}caption也不必特別寫在tabular上方。) 766 | 767 | 表格的\{table\}環境和\{figure\}環境一樣屬於浮動性環境,詳情見\cref{sec:s_float}中的說明。 768 | \subsection{一般表格} 769 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 770 | \begin{table}[h] 771 | \centering 772 | \caption{Solution} 773 | \begin{tabular}{| l | l |} 774 | \hline 775 | Component & Concentration(mM) \\ \hline 776 | \ce{NaCl} & 118.0 \\ \hline 777 | \ce{CaCl_2} & 2.11 \\ \hline 778 | \ce{KCl} & 4.69 \\ \hline 779 | \end{tabular} 780 | \label{key} 781 | \end{table} 782 | \end{LTXexample} 783 | \textbackslash{}begin\{tabular\}\{| l | l |\}旁的「|」表示畫垂直線,英文字母「l」表示左對齊,\textbackslash{}hline表示水平線。對齊控制除了「l」外,亦可用「c」(center)、「r」(right)。表格分隔若想用其他字元亦可用「@\{\}」處理,樣板的符號列表就是利用冒號分隔「@\{:\}」 784 | 785 | \subsection{自動折行表格} 786 | tabularx 套件的 tabularx 環境可以設定表格寬度,過長的內容將自動折行(其實這才是我的目的)。下面以原始tabular進行對照。當文字寬度超出表格時,原始tabular會超出頁面(下面超出的表格是正常的喔!),而tabularx會自動折行以及調整表格至行寬。 787 | \footnote{更多資訊請參考wikibook https://en.wikibooks.org/wiki/LaTeX/Tables\#The\_tabularx\_package } 788 | 789 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 790 | \begin{table}[h] 791 | \centering 792 | \begin{tabular}{| l | l |} 793 | \hline 794 | short & ssssssss \\ \hline 795 | long & llllllllll lllllll llllllll lllllllllll llllllll \\ \hline 796 | \end{tabular} 797 | \label{key} 798 | \end{table} 799 | 800 | \begin{table}[h] 801 | \centering 802 | \begin{tabularx}{\textwidth}{| l | X |} 803 | \hline 804 | short & ssssssss \\ \hline 805 | long & llllllllll lllllll llllllll lllllllllll llllllll \\ \hline 806 | \end{tabularx} 807 | \label{key} 808 | \end{table} 809 | \end{LTXexample} 810 | 811 | \subsection{合併欄位表格} 812 | 示範合併欄位。 813 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 814 | \begin{table}[h] 815 | \centering 816 | \begin{tabular}{| l | l | l | l |} 817 | \hline 818 | 1 & 2 & 3 & d \\ \hline 819 | 4 & 5 & \multirow{2}{*}{66} & e \\ 820 | \cline{1-2}\cline{4-4} 821 | 7 & 8 & & f \\ \hline 822 | 9 & \multicolumn{2}{c|}{ a }& g \\ \hline 823 | b & c & h & i \\ \hline 824 | \end{tabular} 825 | \label{key} 826 | \end{table} 827 | \end{LTXexample} 828 | 829 | \subsection{其他表格} 830 | \LaTeX\ 預設的tabular表格無法使用腳註(footnote),此外還有無法處理太長、太寬的表格等問題。須要用到的話可見\cref{sec:s_advTable}的說明。 831 | 832 | \section{列表/條列} 833 | \label{sec:s_list} 834 | 常用的列表形式有項目(itemize)、數字(enumerate)、描述(description)三種,以下示範項目(itemize)列表: 835 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 836 | \begin{itemize} 837 | \item item 1 838 | \item item 2 839 | \begin{itemize} 840 | \item item 2.1 $\quad \leftarrow$ nesting 841 | \item item 2.2 842 | \end{itemize} 843 | \item item 3 844 | \end{itemize} 845 | \end{LTXexample} 846 | 列表允許巢狀使用,也就是在列表環境中再包一個列表。下面的示範就只列出兩個項目。\\ 847 | 數字(enumerate)列表: 848 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 849 | \begin{enumerate} 850 | \item item 1 851 | \item item 2 852 | \end{enumerate} 853 | \end{LTXexample} 854 | 描述(description)列表: 855 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 856 | \begin{description} 857 | \item[description 1] item 1 858 | \item[description 2] item 2 859 | \end{description} 860 | \end{LTXexample} 861 | 862 | 863 | \section{數學符號、方程} 864 | \label{sec:s_math} 865 | 數學式的編輯實在太廣,這裡只講解一些基本概念。 866 | 更多資訊請參考wikibook: \url{https://en.wikibooks.org/wiki/LaTeX/Mathematics} 867 | 868 | \subsection{顯示模式} 869 | \LaTeX\ 中的常用數學顯示模式有下面三種: 870 | \begin{itemize} 871 | \item Equation 環境,由\textbackslash{}begin\{equation\}...\textbackslash{}end\{equation\}包起來。數學式會獨立成行,並且擁有一個編號。 872 | \item Displaymath 環境 ,通常直接使用\textbackslash{}[...\textbackslash{}]包住數學式即可。數學式獨立成行但無編號。 873 | \item Inline math 環境。使用\$...\$包住數學式。數學式與普通文字同一行,並且字體一樣大。 874 | \end{itemize} 875 | 下面分別示範這三種顯示模式。 876 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 877 | \textbf{Equation, new line and numbered}\\ 878 | start equation 879 | \begin{equation} 880 | \oint_C {E \cdot d\ell} = 0 881 | \end{equation} 882 | end equation \\ 883 | ------------------------\\ 884 | \textbf{Displaymath, new line} \\ 885 | start equation 886 | \[ 887 | \oint_C {E \cdot d\ell} = 0 888 | \] 889 | end equation \\ 890 | ------------------------\\ 891 | \textbf{Inline}\\ 892 | start equation 893 | $\oint_C E \cdot d\ell = 0 $ 894 | end equation 895 | \end{LTXexample} 896 | 以我的習慣來說,一律使用 Equation 環境,即使不一定用到編號。 897 | 898 | \subsection{常用數學符號} 899 | 下面示範常用數學符號。(如果你用的是\LaTeX\ 專用編輯器,通常都有按紐可以輔助插入指令,不用拿個手冊在旁邊對照。) 900 | 901 | \begin{table}[h] 902 | \centering 903 | \caption{常用數學符號} 904 | \begin{tabularx}{\textwidth}{| l | l | >{\raggedright\arraybackslash}X |} 905 | \hline 906 | \LaTeX\ & Result & 說明 \\ \hline 907 | \verb|A_i=\mathrm{e}^{-x}| & $A_i=\mathrm{e}^{-x}$ & \^{}\ \_{} 為上、下標。\textbackslash{}mathrm標示數學文字 \\ \hline 908 | \verb|(a+b-c)\cdot d \times e| & $(a+b-c)\cdot d \times e$ & 加、減、乘 \\ \hline 909 | \verb|\frac{\frac{1}{x}+^1/_{y}}{y-z}|&$\frac{\frac{1}{x}+^1/_{y}}{y-z}$ & 兩種除法 \\ \hline 910 | \verb|\cos^2 \theta - \sin^2 \theta| & $\cos^2 \theta - \sin^2 \theta$ & 三角函數\\ \hline 911 | \verb|\alpha\beta\gamma\Omega| & $\alpha\beta\gamma\Omega$ & 希臘字母 \\ \hline 912 | \verb|50\textbaht| & $50\textbaht$ & 一隻喬巴 (須要textcomp套件)\\ \hline 913 | \verb|\infty| & $\infty$ & 富間 \\ \hline 914 | \end{tabularx} 915 | \end{table} 916 | 數學模式中,非指令文字均視為變數,而變數一律以斜體表達。為了避免一些非變數文字變成斜體就必須特別處理。(載入amsmath套件後)\textbackslash{}text與\textbackslash{}mathrm就是處理這個問題。\textbackslash{}text通常用在純文字上,而\textbackslash{}mathrm則是符號類文字。 917 | \footnote{\url{http://tex.stackexchange.com/questions/19502/is-there-a-preference-of-when-to-use-text-and-mathrm}} 918 | 919 | \section{科學符號} 920 | \label{sec:s_science} 921 | 這兩者雖然有時可用其他方法達成,譬如像溫度\temp{} , 有人會用圓圈加上C,有人用字碼。但基於排版以及可讀性我會建議各位用專用套件(\LaTeX\ style :D )。 922 | \subsection{SI單位} 923 | 使用siunitx套件。一些常用的如溫度,我會另外寫指令加速完成。如何寫見後面章節說明。 924 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 925 | $\SI{30}{\centi\metre}$ \\ 926 | $\SI{5}{\milli\litre}$ \\ 927 | $\SI{25}{\degreeCelsius}$ \\ 928 | \temp{37} <-- my command 929 | \end{LTXexample} 930 | 931 | \subsection{化學式} 932 | 前面表格已經示範了。使用到mhchem套件 933 | \footnote{TeX Live 2016 的 mhchem為第四版,但我的TeX Live 2012的mhchem套件為第三版,所以我在cls檔中設定mhchem選項[version=3] ,如果各位沒有相容性問題又想用最新版可以取消掉。我保留這個設定也是怕說mhchem未來更動語法可能會出現論文移到新的TeX發行版後就不能用的情況。} 934 | 。表達離子帶電用\^{},原子數用\_ 。離子帶電可以不加上標,因為用在後面預設視為上標模式。 935 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 936 | \begin{table}[h] 937 | \centering 938 | \begin{tabular}{| l | l |} 939 | \hline 940 | \ce{Ca2+} & x \\ \hline 941 | \ce{Ca^2+} & o \\ \hline 942 | \ce{Ca^{2+}} & o \\ \hline 943 | \end{tabular} 944 | \end{table} 945 | \end{LTXexample} 946 | 947 | \section{標記與參考Cross-referencing} 948 | \label{sec:s_labelRef} 949 | 「標記與參考」是\LaTeX\ 很好用的一個功能。各位千萬不要手打「見圖 1.1」啊!!標記可以設定一個標籤給它,而內文可以藉由參考指令取得標記位置的數值。這功能可以用在圖、表格、章節、文獻之上。 950 | 951 | \subsection{標記(label)} 952 | 標記方法前面已經提到,用\textbackslash{}label\{type:mylabel\}標記。type方面如\cref{tab:label_type}所示。 953 | \begin{table}[t] 954 | \centering 955 | \caption{常用標記類型} 956 | \begin{tabular}{| l | l |} 957 | \hline 958 | fig & figure \\ \hline 959 | tab & table \\ \hline 960 | eq & equation \\ \hline 961 | sec & section \\ \hline 962 | \end{tabular} 963 | \label{tab:label_type} 964 | \end{table} 965 | 有些套件會用到這個縮寫,所以最好符合通用習慣。(其餘見 \url{https://en.wikibooks.org/wiki/LaTeX/Labels_and_Cross-referencing\#Introduction}) 966 | 稍微注意的是\textbackslash{}label\{\}要放在\textbackslash{}caption\{\}之後才會有作用。(caption也不能為空喔!) 967 | 968 | \subsection{參考(ref/cref)} 969 | 假設你已經在figure中使用\textbackslash{}label\{fig:image001\},那文章中若要產生此圖的標號可以用\textbackslash{}ref\{fig:image001\},但有時我們懶得每個圖都要打``\emph{fig}. \textbackslash{}ref\{fig:image001\}這樣,所以我這使用了cleveref 套件。它提供\textbackslash{}cref指令自動產生相對應的文字。 970 | \footnote{文字可以由\textbackslash{}crefname修改,見cls檔。cleveref亦提供大寫版\textbackslash{}Crefname用於行首風格(大寫)。不過中文無此須求。} 971 | % \fig[0.3][fig:reftest0]{logo-Linux.png}[this is ref test figure.] 972 | % (insfig will add ``fig:'')\\ 973 | % Use \textbackslash{}ref :\ref{fig:reftest}\\ 974 | % Use \textbackslash{}cref :\cref{fig:reftest} 975 | \begin{LTXexample}[style=LatexStyle,preset=\let\label\orilabel] 976 | \begin{figure} 977 | \centering 978 | \includegraphics[width=0.2\textwidth]{logo-Linux.png} 979 | \caption[Linux logo]{This is a Linux logo. It is a penguin.} 980 | \label{fig:reftest} 981 | \end{figure} 982 | 983 | Use \textbackslash{}ref :\ref{fig:reftest}\\ 984 | Use \textbackslash{}cref :\cref{fig:reftest} 985 | \end{LTXexample} 986 | \textbackslash{}cref 支援多個標籤,如:\textbackslash{}cref\{ref1,ref2,ref4\} 。 987 | \textbf{(注意!中間不可插入空格。)} 988 | 亦提供連續引用指令\textbackslash{}crefrange。 989 | \footnote{範例見\url{http://texblog.org/2013/05/06/cleveref-a-clever-way-to-reference-in-latex/},連接文字、符號欲修改請參考手冊。} 990 | 991 | \section{文獻} 992 | \label{sec:s_bib} 993 | 如同之前的\textbackslash{}label、\textbackslash{}ref 。插入引用文獻須要建立文獻條目,再利用\textbackslash{}cite\{cite\_key\}來插入條目編號。 994 | \footnote{下面提到的bibtex, biber, biblatex, natbib 詳細資訊可參考 \url{http://tex.stackexchange.com/questions/25701/bibtex-vs-biber-and-biblatex-vs-natbib}} 995 | 996 | \subsection{嵌入式文獻資料庫} 997 | 少量條目時可以直接使用嵌入的方式,於thebibliography環境以 \textbackslash{}bibitem\{cite\_key\} 嵌入至tex檔中,然後以\textbackslash{}cite\{cite\_key\}插入文章。 998 | \footnote{這裡因為示範生成檔會導致章節錯亂,所以只列出\LaTeX\ 碼。} 999 | \begin{lstlisting} 1000 | \begin{thebibliography}{9} 1001 | 1002 | \bibitem{lamport94} 1003 | Leslie Lamport, 1004 | \emph{\LaTeX\ : a document preparation system}, 1005 | Addison Wesley, Massachusetts, 1006 | 2nd edition, 1007 | 1994. 1008 | 1009 | \end{thebibliography} 1010 | see bibliography \cite{lamport94}. 1011 | \end{lstlisting} 1012 | ``lamport94'' 即為cite\_key 。而\textbackslash{}begin\{thebibliography\}\{9\} 的9指得是生成的條目上限為9條。據wikibook指出嵌入式的上限為99。 1013 | 1014 | \subsection{BibTeX} 1015 | \begin{center} 1016 | \noindent{\color{red}\textbf{本樣板採用的是BibLaTeX,請見\cref{sec:s_bib_biblatex}。}} 1017 | \end{center} 1018 | 1019 | 針對大量文獻,通常使用文獻管理軟體先產生一個包含各條目的.bib檔(亦為純文字檔),再於tex中引入。 1020 | 傳統上使用BibTeX這軟體,只要在要生成文獻地方插入\textbackslash{}bibliography\{Path\_of\_BibTeX\_database\}即可。 1021 | \begin{lstlisting} 1022 | \bibliographystyle{plain} 1023 | \bibliography{sample1,sample2,...,samplen} 1024 | % Note the lack of whitespace between the commas and the next bib file. 1025 | \end{lstlisting} 1026 | 這裡示範引入多個bib資料庫,也就是sampleN,注意中間不能有空格。若要使用與編譯文件不同目錄的資料庫,可以使用相對路徑表達,如``../sample1''。 1027 | \footnote{tex檔中的路徑一律使用正斜線``/'',即使是在windows中編譯。} 1028 | 一開頭的\textbackslash{}bibliographystyle用途則是指定生成的風格。 1029 | 1030 | 用了BibTex之後,記得要再多執行一次編譯動作。也就是說要經過 xelatex tex $\rightarrow$ bibtex tex $\rightarrow$ xelatex tex 三個動作。tex附檔名(.tex)不用加。 1031 | 1032 | BibTeX生成的文獻編號一律是數字,如果你須要更有變化譬如作者和年份(eg. Roberts, 2003),那你可以使用Natbib套件,不過\textbackslash{}cite指令須要修改。這部份請自行查詢wikibook 1033 | \footnote{\url{https://en.wikibooks.org/wiki/LaTeX/Bibliography_Management\#Natbib}} 1034 | \footnote{ShareLaTeX 有一個 BibTeX風格列表預覽 https://www.sharelatex.com/learn/Bibtex\_bibliography\_styles } 1035 | 。 1036 | 1037 | \subsection{BibLaTeX} 1038 | \label{sec:s_bib_biblatex} 1039 | 另一個管理大量文獻的方法則是使用 BibLaTeX。雖然這裡說是「使用 BibLaTeX」,但實際上處理文獻資料庫的是biber這個程式。 1040 | \footnote{亦可使用BibTeX作為BibLaTeX的後端。} 1041 | BibLaTeX只是一個套件,作為\LaTeX\ 與 biber的中間介面,作用如同上面提到的Natbib套件。 1042 | BibLaTeX+biber的好處是支援UTF-8 ,能夠處理非英語系的文獻條目。並且資料庫格式新增如online類別用來紀錄網頁內容。另外對於文獻的排序方式也有多種選擇。因此本樣板使用 BibLaTeX+biber作為預設的文獻管理方式。(不過 BibLaTeX 畢竟是較新的方法,如果你要發期刊可能不被接受,只能使用BibTeX。) 1043 | 1044 | BibLaTeX與 BibTeX 非常類似。首先你要有一個 BibLaTeX 的資料庫,副檔名一樣是.bib,內容格式大同小異。接著使用如下指令: 1045 | \begin{lstlisting} 1046 | \addbibresource{sample1.bib} % must including the extension 1047 | \addbibresource{sample2.bib} 1048 | \printbibliography[heading = bibnumbered, title = {Bibliography title}] 1049 | \end{lstlisting} 1050 | \textbackslash{}addbibresource 作用為加入文獻資料庫。與 BibTeX的\textbackslash{}bibliography 有以下差異: 1051 | \begin{itemize} 1052 | \item 僅能置於導言區。(\emph{本樣板請置於macros\_preamble.tex}) 1053 | \item 僅加入文獻資料庫而非印在當前位置。 1054 | \item \{\} 內僅允許加入單一資料庫,但可多次使用\textbackslash{}addbibresource 來加入多個文獻資料庫。 1055 | \item 文獻資料庫路徑(檔名)須要加上副檔名(.bib) 1056 | \end{itemize} 1057 | 加入的資料庫最終會在\textbackslash{}printbibliography的位置生成文獻列表,資料庫有但未用到的文獻不會顯示出。 1058 | \footnote{可以用\textbackslash{}nocite顯示,請查閱手冊。} 1059 | 選項中``title''直接指定文獻頁的章標題(中文就是「參考文獻」了) 1060 | \footnote{BibLaTeX 不會使用到\textbackslash{}bibname 這個變數,所以改了也沒用。} 1061 | 1062 | 文獻列表的風格是在引入套件時設定的,下面是樣板($\ast$thesis.cls)內的指令(一般tex內用\textbackslash{}usepackage引入套件,cls內要用\textbackslash{}RequirePackage) 1063 | \begin{lstlisting} 1064 | \RequirePackage[backend=biber, style=nature]{biblatex} 1065 | \end{lstlisting} 1066 | 依此設定風格將會是nature, 1067 | \footnote{這是一個非標準的選項,使用後將由biblatex-nature套件進行設定。見\url{https://www.sharelatex.com/learn/Biblatex_citation_styles}} 1068 | 其引用標記使用數字``[1]'',且列表順序照文內出現順序,也就是隱含了\verb| citestyle=numeric-comp, sorting=none|這兩個選項。理工論文通常使用這樣的設定即可,但文組論文據說較習慣使用作者名來標記和排序,可以在選項處加上\verb|citestyle=authoryear-comp, sorting=nyt|。\textbf{(樣板使用者可以在config.tex中設定bibStyleNameYear為true。)} 1069 | 其他風格或是排序方法請自行參考套件手冊並自行於cls檔中修改。 1070 | \footnote{排序方法還有依作者字母排序,也有相應的CJK排序。} 1071 | \footnote{ShareLaTeX 有一個 BibLaTeX 風格列表預覽 \url{https://www.sharelatex.com/learn/Biblatex\_bibliography\_styles}} 1072 | 1073 | 編譯方面與BibTeX類似,一樣須要多執行一次編譯動作,只不過中間換成biber。也就是說至少要經過 xelatex tex $\rightarrow$ biber tex $\rightarrow$ xelatex tex 三個動作。tex附檔名(.tex)不用加。 1074 | 1075 | 最後這裡示範引用。(\textbackslash{}cite只要能唯一對應資料庫檔的條目即可,``????''是資料庫檔內的設定。) 1076 | \begin{lstlisting} 1077 | 這是一篇Nature的文章\cite{session_genome_2016}。再來個\LaTeX\ 的書\cite{mittelbach_latex_2004}。然後是\LaTeX\ 中文教學網頁\cite{__????}。最後這整份教學以及樣板都是源自於sppmg的GitHub\cite{_sppmg/tw_thesis_template_????}。 1078 | \end{lstlisting} 1079 | 這是一篇Nature的文章\cite{session_genome_2016}。再來個\LaTeX\ 的書\cite{mittelbach_latex_2004}。然後是\LaTeX\ 中文教學網頁\cite{__????}。最後這整份教學以及樣板都是源自於sppmg的GitHub\cite{_sppmg/tw_thesis_template_????}。 1080 | 1081 | \section{程式碼} 1082 | \label{sec:s_code} 1083 | 程式碼區域有幾項不同於內文的特性: 1084 | \begin{itemize} 1085 | \item 使用等寬字型 1086 | \item 忽略\LaTeX\ 關鍵字、不分段、保持縮排與換行 1087 | \item 最好有行號、語法高亮度 1088 | \end{itemize} 1089 | 建議使用listings/listingsutf8套件來達成上述目標。樣板已載入此套件,使用前請先於 macro\_preamble.tex 中設定語言風格與預設使用風格,之後以``lstlisting'' 環境將程式碼包起來或是用 \textbackslash{}lstinputlisting\{\}引入程式檔。範例請見 macro\_preamble.tex 與 appendix\_code.tex 1090 | 1091 | \section{註解} 1092 | \label{sec:s_comment} 1093 | 有時候文章須要做一個小說明,或是寫一些只有編輯者才看得到的註解(無論是寫內心os還是暫時隱藏文字)。這時候你就須要了解\LaTeX\ 註解方法了。 1094 | \subsection{\LaTeX\ 原生註解} 1095 | 有三種: 1096 | \begin{itemize} 1097 | \item \% 直接隱藏後面直到行尾。 1098 | \item 腳註:\textbackslash{}footnote\{\},註解在頁尾,指令位置插入標號。 1099 | \item 邊註:\textbackslash{}marginpar\{\},註解在頁邊,指令位置不插標號。 1100 | \end{itemize} 1101 | 使用如下:(\LaTeX\ code 展示套件似乎無法顯示頁邊,所以這裡就不示範結果了。) 1102 | \begin{lstlisting} 1103 | \footnote{This is footnote.} 1104 | \marginpar{This is marginpar.} 1105 | \end{lstlisting} 1106 | 1107 | \subsection{TodoNotes 套件} 1108 | 顧名思義,TodoNotes就是給你做便條用的。它可以簡單的做出內文、頁邊註解,並且顯示在生成檔(pdf)上。要隱藏註解時只要套件選項改成disable即可,如下: 1109 | \begin{lstlisting} 1110 | \usepackage[disable]{todonotes} 1111 | \end{lstlisting} 1112 | cls檔中也有定義了幾個顏色可供使用。如:\\ 1113 | \todoUnsure{這裡示範「不確定」} 1114 | \textbackslash{}todoUnsure\{note\} 1115 | \\ 1116 | \todoChange{這裡示範「要修改」} 1117 | \textbackslash{}todoChange\{note\} 1118 | \\ 1119 | \todoInfo{這裡示範「資訊說明」} 1120 | \textbackslash{}todoInfo\{note\} 1121 | \\ 1122 | 下面這兩個也很好用: 1123 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 1124 | \todo[inline]{A note box} 1125 | \missingfigure{Data, where are you....} 1126 | \end{LTXexample} 1127 | TodoNotes搭配上\cref{sec:s_tools_ext_synctex}提到的SyncTeX簡直就是神物啊!!!不過注意用了之後\LaTeX\ 要編譯到第二次以後頁邊註解才會指向正確位置。 1128 | 1129 | 為了讓各位覺得使用本樣板更值回票價,我在config.tex中放置了publish選項。 1130 | \begin{lstlisting} 1131 | \setboolean{publish}{false} % {true}/{false} 1132 | \end{lstlisting} 1133 | 只要你設定true之後將自動隱藏TodoNotes。 1134 | 1135 | 1136 | \chapter{進一步了解} 1137 | 這裡放一些進階知識。 1138 | 1139 | \section{分割文件} 1140 | \label{sec:s_split} 1141 | 如同寫程式般,大型文件(論文就算是啦!)通常不會一個檔案完成,而是依章節分割成多個子檔撰寫後再以一個主檔合併。這樣不僅可以專注於單一章節,還可以僅編譯單一章節(子檔),加速處理、測試效果。 1142 | 1143 | 以本樣板及教學為例,主檔都是main.tex。 1144 | \footnote{檔名隨你訂,不限於main.tex。} 1145 | main.tex中再以\textbackslash{}input\{filename\}引入其他tex檔。除了\textbackslash{}input\{\}外,亦可用\textbackslash{}include\{\}。兩者差異在於\textbackslash{}input\{\}一定會另起一頁,且雙面配置時一定由右頁開始 1146 | \footnote{預設起始頁為右頁,可自訂為左頁。}。這兩個引入的指令不須另加套件即可使用 1147 | \footnote{ShareLaTeX網站提到用到巢狀引用時用import套件較好}。 1148 | 1149 | 不過若僅使用\textbackslash{}input\{\}或\textbackslash{}include\{\} 1150 | 子檔案不能包含\textbackslash{}documentclass\{\}以及\textbackslash{}begin\{document\}這幾句,因為這樣會造成主文件有巢狀的documentclass。也因此無法單獨編譯子檔,必須由主檔編譯,然後在主檔註解掉其他子檔或是利用\textbackslash{}includeonly\{\}設定僅引入某一子檔。這樣在編譯/編輯各子檔時須要頻繁修改主檔,非常麻煩。 1151 | 解決辦法是利用subfile或是standalone之類的套件來處理子檔中的相關語句。 1152 | 介紹可見wikibook \url{https://en.wikibooks.org/wiki/LaTeX/Modular_Documents\#Separate_compilation_of_child_documents} 1153 | (本樣板預設採用standalone套件。所須的子檔標頭已經寫在chapter\_template.tex中,直接複製進行修改即可。) 1154 | 1155 | \subsection{subfile} 1156 | \begin{center} 1157 | \noindent{\color{red}\textbf{本樣板採用的是standalone,請見\cref{sec:s_split_standalone}。}} 1158 | \end{center} 1159 | 1160 | subfile的概念較簡單,就是改以\textbackslash{}subfile插入子檔,並且在編譯時子檔一律會去讀主檔的導言區,所以要添加任何套件統統都填到主檔導言區。這種方法的缺點是在後期會越來越肥,即使一個空的tex都要讀其他子檔須要的套件因而浪費些許時間。 1161 | 1162 | \subsection{standalone} 1163 | \label{sec:s_split_standalone} 1164 | Standalone的一個主要目的就是讓一些由\TeX\ 指令生成的圖片可以單獨編譯。 1165 | 本樣板採用standalone的理由就是他可以做到單獨設定子檔所須套件。以本樣板為例,主檔結構如下: 1166 | \begin{lstlisting} 1167 | \documentclass{NCU_thesis_zh} 1168 | \usepackage[subpreambles=true]{standalone} 1169 | %% Main-preamble 1170 | \begin{document} 1171 | %% my document content 1172 | \input{chapter1} 1173 | \end{document} 1174 | \end{lstlisting} 1175 | 首行指定使用NCU\_thesis這個自訂樣式(也可以是book這種基礎樣式) 1176 | 第二行引入standalone套件,並給予``subpreambles=true''的選項,這部份稍後說明。中間插入子檔直接照舊有的習慣以\textbackslash{}input\{\}或\textbackslash{}include\{\}即可。 1177 | 1178 | 子檔的部份如下: 1179 | \begin{lstlisting} 1180 | \documentclass[class=NCU_thesis_zh, crop=false]{standalone} 1181 | \begin{document} 1182 | %% Sub-preamble 1183 | \chapter{chapter name} 1184 | %% my chapter content 1185 | \end{document} 1186 | \end{lstlisting} 1187 | 除了首行之外,和一般tex檔完全一樣。首行class改用standalone,而選項中的class指定使用自訂樣式NCU\_thesis,crop=false設定不裁切,維持原紙面大小。 1188 | 1189 | 只要照上面的格式即可任意選擇編譯子檔還是主檔而不須另外處理。不過用\LaTeX\ 專用編輯器(如Texstudio)按快速鍵編譯者可能要注意編輯器可能會自動判斷主檔,導致即使你在子檔按下編譯鈕也還是選擇主檔進行編譯。 1190 | 1191 | standalone 的選項分成兩類:package option以及class option。前者即主檔使用的選項,後者為子檔的選項。兩類選項的細目請見standalone的手冊。 1192 | 上面範例中,package option 使用了``subpreambles=true'',這是因為預設情況下standalone 在編譯主檔時會忽略各子檔導言區的設定而僅僅讀取主檔的導言區。設定``subpreambles=true''之後子檔的導言區就可以被讀取了。這樣在各子檔用到不同套件時會非常方便。 1193 | \footnote{不過我自己的經驗是使用子導言區有時會出現一些奇怪問題。曾有指令同一行後面的註解改換到下一行後就可以編譯通過的問題。如果懷疑是 standalone 產生問題可以改將指令插入到主導言區(main.tex)或是 macro\_preamble.tex中。} 1194 | 1195 | class option 除了設定在子檔\textbackslash{}documentclass之外,有「部份」的設定可以用\textbackslash{}standaloneconfig\{\}設定在\textbackslash{}begin\{document\}之後,因此本樣板將此指令放在macro\_document.tex中: 1196 | \begin{lstlisting} 1197 | \IfStandalone{\standaloneconfig{float=true}}{} 1198 | \end{lstlisting} 1199 | macro\_document.tex 會在碰到\textbackslash{}begin\{document\}時載入,所以子檔將共享\textbackslash{}standaloneconfig\{\}中的 1200 | 設定。不過這指令只能放在standalone class (子檔)中,所以另外加上\textbackslash{}IfStandalone來判斷是否為子檔。這裡放的``float=true''指得是單獨編譯子檔時是否啟用浮動環境(圖、表等等),預設是不啟用的。 1201 | 1202 | 對於各檔共用套件,一般就是加入主檔。不過為了保持主檔的整潔,本樣板提供macro\_preamble.tex 作為共用導言區 1203 | \footnote{由.cls末端載入。}。 1204 | 1205 | 1206 | \section{字型} 1207 | \label{sec:s_fonts} 1208 | 電腦上常用的中文字型有四大基本類型,分別為楷、明、宋、黑(這是不包含行書之類的非正式文書字體)。楷體較粗,明、宋較細。而黑體則是各筆劃粗細相同(常用於廣告?)。一般來說文件的內文應該要是較細的文字(如明、宋體),避免閱讀疲勞。因此此樣板設定封面、標題為楷體(應文則是預設無襯線字),其餘皆為明體。 1209 | \footnote{對應到微軟預設字型就是標楷體以及細明體。新細明體與細明體差別為英文字元是否等距。} 1210 | 1211 | 除了字的美觀外,各位可能要注意一下字本身的正確性。因為有些字體使用舊的寫法或是大陸寫法,如「骨」字上面應該是向右而非向左。 1212 | 1213 | 關於中文的開源字型可見Cheng-Chia Tseng 的詳細講解。(\url{http://breezymove.blogspot.tw/2013/11/cantarell.html})。而\LaTeX\ 的搭配可以再參考「阿盤」的設定(\url{http://www.slideshare.net/chenpanliao/apan-beamertemplate})。各字型由Google搜尋字型名稱就可以找到下載點了。除了上面網頁提到的字型外,政府網站也提供「全字庫」字型。 1214 | \footnote{抱怨一下,這東西用納稅人的錢做的,結果只是能免費使用,並不是開放字型....}。 1215 | 在意字體美觀的人推薦使用cwTeX的字型(Debain 套件庫已經有了,不過是舊版本。新版請google)。 1216 | \footnote{曾見過有人認為Linux中常用的「AR PL UMing TW」以及對應的楷體很醜,所以替換成全字庫字型。} 1217 | 英文字型的分類就簡單的多。一般就分兩大類:襯線(serif)與無襯線(sans-serif)。Windows上最常見的Times New Roman就是襯線字型。一般來說內文的英文用襯線會比較美觀。 1218 | 1219 | 另外英文還有一種等寬字型。這是因為英文字母若均為相同寬度,一般文件會顯得太零散導致不易閱讀,因此一般使用非等寬的字型(如lllll與wwwww的寬度是不同的)。但在如程式碼這種須要對齊字元的用途上,等寬字元則是比較適合的字型。 1220 | 1221 | 此樣版可以在config.tex中分別設定中文以及英文字型。預設封面為楷體中文與無襯線英文,章節標題亦為楷體中文與無襯線英文,其餘內文均為明體中文與襯線英文。\cref{fig:titleFontStyle}為預設風格與自訂的一個示範。 1222 | \begin{figure} 1223 | \centering 1224 | \subcaptionbox 1225 | {預設值,楷體中文+無襯線英文 1226 | \label{fig:titleFontStyle_sf}} 1227 | {\includegraphics[width=0.6\linewidth]{titleFontStyle_sf.png}} 1228 | 1229 | \vspace{5mm} 1230 | \subcaptionbox 1231 | {楷體中文+襯線英文 1232 | \label{fig:titleFontStyle_rm}} 1233 | {\includegraphics[width=0.6\linewidth]{titleFontStyle_rm.png}} 1234 | \caption{透過config.tex設定章節標題風格} 1235 | \label{fig:titleFontStyle} 1236 | \end{figure} 1237 | 1238 | 以\textbackslash{}section為例(\textbackslash{}def\textbackslash{}sectionTitleStyle\{\}),預設的風格是\textbackslash{}sffamily\textbackslash{}Large\textbackslash{}bfseries。因為樣板指定中文的\textbackslash{}sffamily(CJKsansfont)就是楷體,所以直接使用\textbackslash{}sffamily就可以了。如果要改成\cref{fig:titleFontStyle_rm}這樣分別設定的形式,可以簡單的以\textbackslash{}rmfamily\textbackslash{}CJKfamily\{sf\} 1239 | \footnote{這是由xeCJK套件提供的指令,\textbackslash{}CJKfamily\{sf\}表示僅中文使用\textbackslash{}sffamily,而前面已指定\textbackslash{}rmfamily,因此其餘(英文)將會是\textbackslash{}rmfamily。另外也可用\textbackslash{}CJKfamily-\{rm\}反過來操作,細節請見xeCJK手冊。} 1240 | 來取代原有的\textbackslash{}sffamily。 1241 | 1242 | \section{浮動環境} 1243 | \label{sec:s_float} 1244 | % 1245 | 1246 | 在基礎教學中,我們已經看到圖片環境\{figure\}與表格環境\{table\}都屬於浮動環境。(其實前面沒講的是,即使你不加這兩個環境一樣可以貼圖或是創造表格,只是說就不能浮動了。) 1247 | 而其置放位置\LaTeX\ 已經幫我們深思過了,一般來說不須要修改。 1248 | \footnote{據我個人觀察,它會儘量不切斷文字,並放置於頁的上、下方,再來是直接放置於同一頁。雖然說一般文章會建議不要使用h(here)選項強制置於指令位置,但有時\LaTeX\ 自動排列會出現一些非常愚蠢的結果,可能還是須要自行決定是否使用h。} 1249 | \footnote{約有20個因素會影響\LaTeX\ 判斷放置位置。} 1250 | 不過\LaTeX\ 仍舊提供幾個參數讓我們手動選擇(\cref{tab:floatOpt})。參數可以同時使用,如[ht]或[!hbt]。這表示允許的位置集,其順序不影響結果。 1251 | \begin{table} 1252 | \centering 1253 | \caption{浮動環境選項} 1254 | \begin{tabular}{|c|l|} 1255 | \hline 1256 | \multicolumn{1}{|c|}{\textbf{參數}} & \multicolumn{1}{c|}{\textbf{說明}} \\ \hline 1257 | ! & 覆蓋原有設定。 \\ \hline 1258 | h & here, 插入於\LaTeX\ 原始碼插入處。\\ \hline 1259 | t & top, 頁頂。 \\ \hline 1260 | b & bottom, 頁底。 \\ \hline 1261 | p & page, 置於專頁 。\\ \hline 1262 | \end{tabular} 1263 | \label{tab:floatOpt} 1264 | \end{table} 1265 | 1266 | 一般來說不建議使用h指定位置,儘量由\LaTeX\ 進行排版(畢竟幫它設計規則的人,排版絕對比我們來得專業)。而文章寫作未完稿前也不要去調整特定圖片位置(除非你都用h),因為可能在你添加文字後,圖表就跑到別的位置了。有任何須要手動調整位置的請在內容完成後再行調整。 1267 | 1268 | 有時\LaTeX\ 浮動會將圖表移到下一節去顯示。為了避免這問題,本樣板已於cls中設定FloatBarrier(浮動障壁),浮動環境不會超出設置節級的位置。樣板設定最小到 \textbackslash{}subsubsection範圍,若不須這麼小可以自行於cls中註解掉。 1269 | 1270 | 關於浮動環境,這裡有非常詳細的解說 1271 | \url{http://tex.stackexchange.com/questions/39017/how-to-influence-the-position-of-float-environments-like-figure-and-table-in-lat}。 1272 | 本節也是參考此文略做解說。 1273 | 1274 | \section{表格細說} 1275 | \label{sec:s_advTable} 1276 | 在講表格前先來個名詞定義 1277 | \begin{table}[h] 1278 | \setstretch{1} 1279 | \renewcommand{\arraystretch}{1} 1280 | \centering 1281 | \begin{tabular}{lccc} 1282 | \thead{英文} & \thead{方向} & \thead{台灣} & \thead{大陸} \\ 1283 | \midrule 1284 | row & 橫 & 列 & 行 \\ 1285 | column & 直 & 行 & 列 \\ 1286 | \end{tabular} 1287 | \end{table} 1288 | 這裡將以台灣的用法為準。另外,下面的示範中為了呈現 booktabs 格線的效果,特別將表格與文字行高均設為一倍。 1289 | (\textbackslash{}arraystretch、\textbackslash{}setstretch) 1290 | 實際使用不須特別設定。 1291 | 1292 | \par\noindent\rule{\textwidth}{1pt} 1293 | 1294 | 前面提過\LaTeX\ 原生表格指令是tabular環境: 1295 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm, pos=b] 1296 | \setstretch{1} 1297 | \renewcommand{\arraystretch}{1} 1298 | 1299 | \begin{tabular}{lcr} 1300 | Head a & Head b & Head c \\ 1301 | cell 1 & cell 02 & cell 003 \\ 1302 | cell 0004 & cell 00005 & cell 000006 \\ 1303 | \end{tabular} 1304 | \end{LTXexample} 1305 | (tabular 是一個不可浮動環境,所以通常再將它置於table環境中浮動,這裡因為已經包於示範\LaTeX\ 的環境了,就不多此一舉。) 1306 | 1307 | 欄位屬性中,對齊方式除了基本的 l, c, r 之外,還可以用>\{\textbackslash{}cmd\} 或 <\{\textbackslash{}cmd\}。 1308 | \footnote{見\url{https://en.wikibooks.org/wiki/LaTeX/Tables\#Column\_specification\_using\_.3E.7B.5Ccmd.7D\_and\_.3C.7B.5Ccmd.7D}} 1309 | ``>'' 指得是在欄位之前執行,``<'' 指得是在欄位之後執行。以直接讓欄位進入數學模式為例,欄位屬性應該寫成:\verb|{>{$}c<{$}}| 也就是各行(column)置中,並且前後均以\$包起來。 1310 | 1311 | 接著我們來談談格線。 1312 | 1313 | \subsection{格線} 1314 | 上面的示範是無格線,基礎\LaTeX\ 說明則是用\textbackslash{}hline。但\textbackslash{}hline 會佔用一定的空間,使得表格看起來較窄。若一定要畫格線的話,一個更好的方法是使用booktabs 套件中的三種\textbackslash{}*rule。 1315 | (下面的示範為了更明顯,特別將文字行高與表格行高均改成1倍。) 1316 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm, pos=b] 1317 | \setstretch{1} 1318 | \renewcommand{\arraystretch}{1} 1319 | 1320 | Original \LaTeX\ \textbackslash{}hline : 1321 | \begin{tabular}{lcr} 1322 | \hline 1323 | Head a & Head b & Head c \\ 1324 | \hline 1325 | cell 1 & cell 02 & cell 003 \\ 1326 | cell 0004 & cell 00005 & cell 000006 \\ 1327 | \hline 1328 | \end{tabular} 1329 | 1330 | \vspace{2ex} % ---------------------- 1331 | 1332 | Use booktab\textquoteright s \textbackslash{}*rule: 1333 | \begin{tabular}{lcr} 1334 | \toprule 1335 | Head a & Head b & Head c \\ 1336 | \midrule 1337 | cell 1 & cell 02 & cell 003 \\ 1338 | cell 0004 & cell 00005 & cell 000006 \\ 1339 | \bottomrule 1340 | \end{tabular} 1341 | \end{LTXexample} 1342 | 很明顯的,改用booktab 的表格會較為美觀,這是因為 booktab 的線會分別調整其粗細以及與欄位的間隙。 1343 | 若要畫上中間的格線只要使用\textbackslash{}midrule置於行後,如\textbackslash{}hline一般。 1344 | 至於垂直格線,若和之前一樣在 tabular 的對齊設定使用``|''符號的話,會出現垂直格線無法接上橫線的情況。這似乎無解,所以不建議在使用 booktab 的 *rule 情況下使用垂直格線。 1345 | 1346 | \subsection{表頭} 1347 | \LaTeX\ 的表格首欄沒有定義任何行為。如果欲達到表頭粗體,須要自行定義。舉例來說,若之前的表格的表頭須要加粗+置中,每欄都得要寫成下面這樣(利用multicolumn調整欄位屬性成置中,不能用\textbackslash{}centering): 1348 | \begin{lstlisting} 1349 | \multicolumn{1}{c}{\bfseries Head a} 1350 | \end{lstlisting} 1351 | 不過每次都打很麻煩,所以可以定義一個指令來簡化: 1352 | \begin{lstlisting} 1353 | \newcommand*{\thead}[1]{\multicolumn{1}{c}{\bfseries #1}} 1354 | \end{lstlisting} 1355 | 這裡給個示範: 1356 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm, pos=b] 1357 | \setstretch{1} 1358 | \renewcommand{\arraystretch}{1} 1359 | 1360 | \begin{tabular}{lcr} 1361 | \toprule 1362 | \thead{Head a} & \thead{Head b} & \thead{Head c} \\ 1363 | \midrule 1364 | cell 1 & cell 02 & cell 003 \\ 1365 | cell 0004 & cell 00005 & cell 000006 \\ 1366 | \bottomrule 1367 | \end{tabular} 1368 | \end{LTXexample} 1369 | 1370 | 另一個方法是使用tabu套件的\textbackslash{}rowfont指令指定屬性。有興趣的自行查閱。 1371 | 1372 | \subsection{腳註(footnote)} 1373 | 原始的 tabular 是不處理腳註(footnote)的,直接使用腳註的情況下會出現只有腳註標記而無腳註文字的情況。解決辦法一是使用 tabularx(\LaTeX\ 示例套件無法處理footnote,所以這裡直接放入內文,腳註位於頁底。) 1374 | 1375 | { 1376 | \setstretch{1} 1377 | \renewcommand{\arraystretch}{1} 1378 | \centering 1379 | 1380 | \begin{tabularx}{13em}{cr} 1381 | \toprule 1382 | \thead{Head b} & \thead{Head c} \\ 1383 | \midrule 1384 | cell 02 \footnote{note 1} & cell 003 \\ 1385 | cell 00005 & cell 000006 \footnote{note 2} \\ 1386 | \bottomrule 1387 | \end{tabularx} 1388 | } \\ 1389 | 但有兩個問題:一是太醜了!跟表格距離過遠。再來是放入table浮動環境後就失效了。 1390 | 所以這裡介紹兩個套件: threeparttable 與 ctable 1391 | 1392 | \subsubsection{threeparttable} 1393 | \let\tnote\tptabletnote 1394 | threeparttable環境為非浮動環境,要浮動的話須放在table環境中。 1395 | 其結構如下: 1396 | \begin{lstlisting} 1397 | \begin{table} 1398 | \begin{threeparttable}[b] 1399 | \caption{...} 1400 | % -------------------------- 1401 | \begin{tabular}...% or {tabular*} 1402 | ...42\tnote{1}&.... ... 1403 | \end{tabular} 1404 | % -------------------------- 1405 | \begin{tablenotes} 1406 | \item [1] the first note ... 1407 | \end{tablenotes} 1408 | \end{threeparttable} 1409 | \end{table} 1410 | \end{lstlisting} 1411 | threeparttable 等於是在原有的表格基礎上增加 tablenotes 環境放置註解,並加上標記註解的\textbackslash{}tnote\{\} 與\textbackslash{}item[](標記須要手動指定)。因為語法幾乎和原有表格一樣,所以這裡直接示範較複雜的表格,其中使用到booktabs的\textbackslash{}toprule等指令。([b]選項處可用t,b,c,預設t。但結合table環境下似乎沒差。) 1412 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm, pos=b] 1413 | \setstretch{1} 1414 | \renewcommand{\arraystretch}{1} 1415 | 1416 | \begin{table}[h] 1417 | \centering 1418 | \begin{threeparttable} 1419 | \caption{caption of threeparttable} 1420 | \begin{tabular}{llr} 1421 | \toprule 1422 | \multicolumn{2}{c}{Name} \\ 1423 | \cmidrule(r){1-2} 1424 | First name & Last Name & Grade \\ 1425 | \midrule 1426 | John\tnote{1} & Doe & $7.5$ \\ 1427 | Richard & Miles & $2$ \\ 1428 | \bottomrule 1429 | \end{tabular} 1430 | 1431 | \begin{tablenotes} 1432 | \footnotesize 1433 | \item [1] the first note (long notes long notes long notes long notes long notes) ... 1434 | \end{tablenotes} 1435 | \end{threeparttable} 1436 | \end{table} 1437 | \end{LTXexample} 1438 | 由於 threeparttable 使用了table 浮動環境,所以字體方面會受到\textbackslash{}floatsetup設定的影響(也就是樣板config.tex中的\textbackslash{}floatFontStyle設定值) 1439 | \footnote{這裡的文字大小因為包在示例環境中,所以是\textbackslash{}normalsize} 1440 | 。不過連帶的也會影響 tablenotes 的風格,只能透過在tablenotes使用字體大小指令做修改。 1441 | 1442 | \subsubsection{ctable} 1443 | \let\tnote\ctabletnote 1444 | {\color{red} 1445 | 注意!ctable與threeparttable的\textbackslash{}tnote會發生衝突,同時使用須要做一點處理。 1446 | } 1447 | \footnote{若文內只用到ctable,可於載入套件「\textbackslash{}usepackage\{ctable\}」前使用\let\tnote\relax 去除原threeparttable定義的\textbackslash{}tnote(常見情況如apa6 documentclass 預先載入threeparttable)。若要同時使用兩套件,可以\textbackslash{}let暫存至另一個巨集,用前再指定回來,請參考本文原始碼。} 1448 | 1449 | ctable 整合了原有\LaTeX\ 表格相關的指令,並且本身是浮動環境。 1450 | 所以單獨使用\textbackslash{}ctable即可處理相關設定。其結構如下: 1451 | \begin{lstlisting} 1452 | \ctable[options] % key=value,... 1453 | {coldefs} % for \begin{tabular} 1454 | {foottable} % zero or more \tnote commands (see below) 1455 | {table rows} % rows for the table 1456 | \end{lstlisting} 1457 | \begin{description} 1458 | \item[options] 選項,如caption, 浮動位置等等。 1459 | \item[coldefs] tabular中的行(column)對齊定義,如{rlc} 1460 | \item[foottable] 定義註解文字 1461 | \item[table rows] 定義欄位 1462 | \end{description} 1463 | 直接來看範例。首先來個基本版: 1464 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm, pos=b] 1465 | \setstretch{1} 1466 | \renewcommand{\arraystretch}{1} 1467 | 1468 | \ctable[ 1469 | caption = Simple example for ctable, 1470 | label = ctable_simple, 1471 | pos = ht 1472 | ]{lll}{ 1473 | \tnote{tablenotes 1} 1474 | \tnote[b]{tablenotes 2} 1475 | }{ \FL 1476 | cell 1 \tmark & cell 02 \ML 1477 | cell 003 & cell 0004 \tmark[b] \NN 1478 | cell 5 & cell 6 \LL 1479 | } 1480 | \end{LTXexample} 1481 | 其中\textbackslash{}tmark就是定義註解標記位置與符號。省略的話會設為``a''(不過這是固定的,所以多次使用會全部都是``a'')。\textbackslash{}tnote就是對應的文字了。\textbackslash{}FL等等的定義如下: 1482 | \begin{description} 1483 | \item[\textbackslash{}FL] First Line, 相當於booktab 的 \textbackslash{}toprule 1484 | \item[\textbackslash{}ML] Middle Line, 相當於booktab 的 \textbackslash{}midrule 1485 | \item[\textbackslash{}NN] Normal Newline, 單純換行,相當於``\textbackslash{}\textbackslash{}'' 1486 | \item[\textbackslash{}LL] Last Line, 相當於booktab 的 \textbackslash{}bottomrule 1487 | \end{description} 1488 | 1489 | 再來複雜點 1490 | \footnote{此範例修改自ctable說明文件}: 1491 | \begin{LTXexample}[style=LatexStyle, xleftmargin=0.5cm, pos=b] 1492 | \setstretch{1} 1493 | \renewcommand{\arraystretch}{1} 1494 | 1495 | \ctable[ 1496 | caption = Complex example for ctable with a specified width of 100mm, 1497 | cap = Complex example for ctable 1498 | label = ctable_complex, 1499 | width = 100mm, 1500 | pos = ht 1501 | ]{c>{\raggedright}XcX}{ 1502 | \tnote[1]{Tablenotes are placed under the table. (long notes long notes long notes long notes long notes.)} 1503 | \tnote[b]{Sec. tablenotes} 1504 | }{ \FL 1505 | \multicolumn{4}{c}{Example using tabularx} \ML 1506 | \multicolumn{2}{c}{Multicolumn entry!} & THREE & FOUR \NN 1507 | \cmidrule(r){1-2}\cmidrule(rl){3-3}\cmidrule(l){4-4} 1508 | one& 1509 | The width of this column depends on the width of the table.\tmark[1] & 1510 | three \tmark[b] & 1511 | Column four will act in the same way as column two, with the same width.\LL 1512 | } 1513 | \end{LTXexample} 1514 | 這個例子示範合併欄位以及自動折行(tabularx)的功能。並且在折行欄位使用不同的對齊方式。選項處也示範使用short caption以及固定表格寬度的方法。這裡的標記故意用數字英文參雜,也就是說你可以自訂想要的標記。 1515 | 1516 | 字體大小方面,預設表格內文為\textbackslash{}normalsize,註解文字則是\textbackslash{}footnotesize。不會受到\textbackslash{}floatsetup設定的影響(也就是樣板config.tex中的\textbackslash{}floatFontStyle設定值)。要修改的話,表格內文字大小可用doinside=\textbackslash{}small選項設定(或是在\textbackslash{}ctable外面使用\textbackslash{}setupctable\{doinside=\textbackslash{}small\}來設定其後所有的ctable)。註解文字大小似乎沒有選項可以設定,只能在每個tnote文字前設定。 1517 | 1518 | \subsection{其他表格} 1519 | \begin{itemize} 1520 | \item 超長、跨頁表格:使用longtable套件(wikibook推薦改用 tabu,理由是含腳註功能),若須用到 threeparttable 功能,改用 threeparttablex 。如果使用ctable,只能手動截斷另建表格並加上``continued''參數。 1521 | \item 超寬表格:旋轉90度,用 rotfloat 套件(keyword: Sideways tables)。ctable 則是內建此功能。 1522 | \end{itemize} 1523 | 1524 | 1525 | \section{自製指令與巨集} 1526 | \label{sec:s_defMacro} 1527 | 有的時候可能會覺得在寫文件的時候,一些東西很常用,但每次打都很麻煩,譬如之前的溫度符號``\temp{}''。或是非英語、超長文字......。這時候可以善用\LaTeX\ 的程式化特性。定義新的指令可以用: 1528 | \begin{lstlisting} 1529 | \newcommand{name}[num]{definition} 1530 | \end{lstlisting} 1531 | ``name''就是指令名稱。``[num]''是參數數目。\{\}內就是定義啦!直接打就可以顯示出來了。我們直接看範例: 1532 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 1533 | \providecommand{\catman}{Schr\"{o}dinger} 1534 | \providecommand{\tbpman}{Poincar\`{e}} 1535 | \providecommand{\pne}{pneumonoultramicroscopicsilicovolcanoconiosis} 1536 | \providecommand{\temp}[1]{$\SI{#1}{\degreeCelsius}$} 1537 | % ---------------------------- 1538 | Someone: \tbpman{} , Does \catman \textquoteright{}s cat get \pne ? \\ 1539 | \tbpman : I just care my three-body problem. \\ 1540 | Cat : Here is soooo cold , \temp{-195} , let me out ! 1541 | \end{LTXexample} 1542 | 這個範例使用的是\textbackslash{}providecommand,因為\textbackslash{}newcommand遇到已經定義過的名稱會出錯(這其實是為了檢查問題),而\textbackslash{}temp已經定義過了,所以這裡使用\textbackslash{}providecommand來跳過避免重複定義。類似的還有\textbackslash{}renewcommand,剛好是介於前面兩者之間,遇到沒定義過的會出錯。 1543 | 1544 | 定義指令也可以使用Plain \TeX\ 的\textbackslash{}def,它同樣也可以接受輸入參數,config.tex內的設定大多由\textbackslash{}def完成,一方面是它不檢查重複定義(不同於\textbackslash{}providecommand忽略第二次定義,而是重新定義,覆蓋原有設定。),另一方面是字母少,美觀 :D 。 1545 | 1546 | 對於變動數量的指令可以使用xparse或xargs來處理。這裡推薦使用xparse,他是\LaTeX\ 3計畫中用來替換\LaTeX\ $2_\varepsilon$的\textbackslash{}newcommand等指令。據說它對於參數省略的狀況處理得比xargs好。 1547 | \footnote{本樣板早期兩個都有用,因為todonotes的顏色設定是複製別人的。而他用的就是xargs,目前已經改成以 xparse 實現。} 1548 | xparse的指令集和原始的定義指令很像,分別是(這裡只列3個): 1549 | \begin{itemize} 1550 | \item \textbackslash{}NewDocumentCommand 1551 | \item \textbackslash{}RenewDocumentCommand 1552 | \item \textbackslash{}ProvideDocumentCommand 1553 | \end{itemize} 1554 | 而在指令名稱後不是以``[num]''單純定義個數,取而代之的是設定各參數的屬性。 1555 | 直接看我的cls內定義快速插圖的\LaTeX\ Code: 1556 | \begin{lstlisting} 1557 | % easy insert single figure 1558 | % \fig[scalefactor][label][!htb]{path}[caption][short caption] 1559 | \NewDocumentCommand\fig{O{0.5} o O{} m O{} o}{ % need xparse package 1560 | \begin{figure}[#3]%[!htb] 1561 | \centering 1562 | \includegraphics[width=#1\textwidth]{#4} 1563 | \IfNoValueTF{#6}{\caption{#5}}{\caption[#6]{#5}} 1564 | \label{\IfNoValueTF{#2}{fig:#4}{#2}} 1565 | \end{figure} 1566 | } 1567 | \end{lstlisting} 1568 | 其中``\verb*|{O{0.5} o O{} m O{} o}|''就是定義最多6個參數,大寫O表示那個參數可省略,預設值為\{\}內容。小寫o同樣可略,但會傳回``-NoValue-''標記,這裡就是用 \textbackslash{}IfNoValueTF 來判斷是否省略。m表示必要參數。使用時只要是可略參數都要用``[]'',必要參數則是``\{\}''。除了o,m之外,xparse還提供其他不同的參數與指令,請自行查閱說明手冊。 1569 | 1570 | \section{文件類型(documentclass)選項} 1571 | \LaTeX\ 文件的第一行指定了使用何種類型的文件。如同一般指令,它可以接受輸入選項。以book class來說,最常用到的選項如下: 1572 | \begin{lstlisting} 1573 | \documentclass[a4paper,10pt]{book} 1574 | \end{lstlisting} 1575 | a4paper指定使用A4紙,10pt指定文件基準字體大小為10pt 1576 | \footnote{book class僅接受10pt,11pt,12pt}。 1577 | 其他還有很多選項,一般依照預設值就可以了。不過有一個選項``draft''很有用。它會略去圖形、連結的處理。所以編譯速度會較快(以這份教學為例,draft約減少20\%時間)。要啟用的話只要將它加入方括號中即可。本樣版採用 standalone 處理子文件,這裡分別示範主文件、子文件添加選項方法。\\ 1578 | 主文件: 1579 | \begin{lstlisting} 1580 | \documentclass[draft]{NCU_thesis_zh} 1581 | \end{lstlisting} 1582 | 子文件: 1583 | \begin{lstlisting} 1584 | \documentclass[class=NCU_thesis_zh, crop=false, draft]{standalone} 1585 | \end{lstlisting} 1586 | 子文件僅影響編譯子文件時的效果,而主文件影響整體。 1587 | 1588 | 另外還有showframe選項,可以顯示文件各區塊邊界,在調整版面時也是蠻好用。 1589 | 1590 | \section{tex檔編碼} 1591 | 建立tex檔時請注意使用的文字編碼是否為UTF-8,通常流行的\LaTeX\ 編輯器均預設UTF-8。為了避免編譯時產生問題,建議非純英文文件均使用UTF-8編碼。 1592 | \footnote{微軟內建的編輯器(如記事本)會在UTF-8檔案前面插入BOM字元,可能導致程式出錯。因此請不要使用微軟生產的軟體編輯UTF-8檔案。} 1593 | 1594 | \section{樣板提供工具} 1595 | \label{sec:s_tools_sppmg} 1596 | 這裡列一些我論文裡面用到的小工具。 1597 | 1598 | \subsection{圓圈文字} 1599 | 有時後會用到一些記號,像是提到公司、產品時常會用: 1600 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 1601 | \textcopyright,\textregistered,\texttrademark 1602 | \end{LTXexample} 1603 | 但假如要更多樣的符號怎辦?沒問題。本樣板提供 1604 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 1605 | \circhar{a}、\circhar{b}、\circhar{c}\\ 1606 | \circhar{1}、\circhar{2}、\circhar{3}\\ 1607 | \circhar{正}、\circhar{中}、\circhar{央}\\ 1608 | \circhar{Linux}、\circhar{Mac}、\colorbox{blue}{\color{white}Windows} 1609 | \end{LTXexample} 1610 | (咦!Windows為何沒有成功?啊!BSOD了....) 1611 | 1612 | \subsection{快速插入單一圖片} 1613 | 之前提過,見圖片的章節(\cref{sec:s_figure})。 1614 | 1615 | \subsection{單位} 1616 | 提供一些單位,指令名稱不喜歡可以自改,位於macros\_preamble.tex中。要更多的單位請參考siunitx套件的手冊。 1617 | \begin{LTXexample}[style=LatexStyle,xleftmargin=0.5cm] 1618 | \temp{37}\\ 1619 | \symumm{300}=\SI{30}{\centi\metre}\\ 1620 | \symumv{10}\\ 1621 | \end{LTXexample} 1622 | 1623 | 1624 | \chapter{寫作輔助工具} 1625 | \label{sec:s_tools_ext} 1626 | \section{SyncTeX} 1627 | \label{sec:s_tools_ext_synctex} 1628 | 由於\LaTeX\ 非所見即所得的排版軟體,如果我們編譯後發現須修改生成檔(dvi/pdf)的特定位置,往往要辛苦找尋原始碼中的對應位置。SyncTeX 即是一個解決這個麻煩的方法。他可以讓你點閱讀器後,自動將編輯器移到對應位置。使用的方法是在編譯時加入``\verb|--synctex=1|''的選項(或是\verb|-synctex=1|),或是在tex檔中插入``\textbackslash{}synctex=1''。(除非編譯器太舊,不然都支援。)本樣板已於config.tex中設定了\textbackslash{}synctex=1。 1629 | 1630 | \subsection{Kile + Okuar} 1631 | 我用的寫作環境是Kile編輯器+Okuar檢視器。 1632 | 只要將Kile檢視pdf的動作改用``ForwardPDF'',然後在Okuar中設定Editor為Kile這樣就可以了。只要在Okuar瀏覽pdf時按下\emph{shift+滑鼠左鍵},Kile就會自動跳過去了。 1633 | 這個網頁有詳細圖文教學:\url{https://localframeofreference.wordpress.com/2010/08/31/kile-synctex/} 1634 | 1635 | \section{自動完成(Autocomplete)與cwl檔} 1636 | \label{sec:s_autocomplete} 1637 | \LaTeX\ 編輯器通常會提供指令自動完成功能,只要打指令開頭就會有選單跑出來顯示可選指令。一方面大大節省時間與腦力,另方面也可以減少打錯指令的機會。 1638 | (Kile還提供非指令文字的自動完成以及程式碼片段(Snippets),TexStudio似乎就沒這些了。) 1639 | 1640 | 但有時打套件提供的指令(如\textbackslash{}cref)不會跑出來選單,這是因為自動完成功能須要.cwl檔指示指令的格式,而.cwl尚未載入。以 TexStudio來說,當它看到\textbackslash{}usepackage{package}時,將自動載入相應的.cwl(不過我不確定樣板檔.cls中的\textbackslash{}RequirePackage是否也會觸發自動載入。)。假如 TexStudio 沒有自動載入,可以從功能表的「Options -> Completion」去手動載入。以\textbackslash{}cref 來說,就是要勾選 cleveref.cwl (如果真不知道要選哪個的話就全勾吧!XD)。 1641 | 其他的編輯器同理,請自行找尋如何載入.cwl。對於自訂指令也可以自寫.cwl來解決。本樣板也提供appmgTools.cwl給我自製的指令使用。 1642 | 1643 | 1644 | \section{Git版本管理與tex檔比較} 1645 | 其實這是兩個不同主題的東西,不過我不打算在這裡細講,只概略提一下。 1646 | 1647 | Git是一個版本管理系統,最初用來管理程式碼(Linux kernel)。不過由於他的特性,使得他可以被用來管理任何形式的檔案。應用於論文上除了能管理各個版本之外,更棒的是備份容易。搭配latexdiff這個比較tex檔版本的工具後,你還可以清楚知道各版本的變動狀況。我之前有做一個投影片有較詳細的說明,請見: 1648 | \url{http://www.slideshare.net/sppmg/latex-with-git} 1649 | 而遠端git倉庫可以使用``GitLab''這個免費的服務,他可以讓你選擇是否隱藏專案(也就是你的論文啦!)。 1650 | 1651 | 論文這種東西隨時隨地多備份比較妥當(當然還有相關資料)。當年中央被偷筆電+隨身碟的博士生不知最後如何了......之前還有清大研究鍺烯的博士生被撞,焚毀筆電事件。 1652 | \subsection{gitignore} 1653 | 稍微說明一下 gitignore 這個檔案。Git 可以將某目錄下所有檔案加入追蹤。但有些檔案是我們不要的暫存檔或備份檔,如\LaTeX\ 編譯產生的*.aux、*.log或是編輯器自動備份的*.backup等等。所以我們可以在git根目錄加上``.gitignore''這個檔案 1654 | \footnote{這是Linux的檔名,加.表示隱藏檔。其他系統請自行查詢。},這樣在大範圍加入檔案時就會略去符合條件的檔案了(仍然可以用``-f''強制加入,如最終生成的pdf)。 1655 | \LaTeX\ 用的.gitignore內容為: 1656 | \begin{lstlisting}[style=consoleStyle,language=bash] 1657 | *.aux 1658 | *.glo 1659 | *.idx 1660 | *.log 1661 | *.toc 1662 | *.ist 1663 | *.acn 1664 | *.acr 1665 | *.alg 1666 | *.bbl 1667 | *.blg 1668 | *.dvi 1669 | *.glg 1670 | *.gls 1671 | *.ilg 1672 | *.ind 1673 | *.lof 1674 | *.lot 1675 | *.maf 1676 | *.mtc 1677 | *.mtc1 1678 | *.out 1679 | *.synctex.gz 1680 | 1681 | # sppmg. for editor 1682 | *.bcf 1683 | *.backup 1684 | *~ 1685 | *.kilepr 1686 | 1687 | # sppmg. this only 1688 | *.xml 1689 | *-blx.bib 1690 | *.pdf 1691 | *.sta 1692 | *.directory 1693 | *_latexmk 1694 | *.tdo 1695 | .* 1696 | \end{lstlisting} 1697 | 1698 | 1699 | \chapter{文獻搜尋} 1700 | \label{sec:s_research} 1701 | 文獻除了直接由google搜尋關鍵字外,亦可由專門的文獻資料庫搜尋。(付費型)文獻資料庫可以詢問各校圖書館(網頁上通常會寫明),下面幾個是我推薦的搜尋網站。 1702 | \begin{description} 1703 | \item[ScienceDirect] \url{http://www.sciencedirect.com} 免費使用,但全文下載仍須權限。 1704 | \item[PubMed.gov] \url{https://www.ncbi.nlm.nih.gov/pubmed} 免費使用,但全文下載仍須權限。 1705 | \item[Web of Science] \url{http://www.webofknowledge.com} 須權限才能使用。文獻資訊包含引用次數等等的進階資訊。 1706 | \end{description} 1707 | 「權限」指的就是須要付費才能取得。通常學校或研究單位付費購買後,同一個網域的使用者都能用。而網域之外的使用者就要看單位是否提供校外連線方法。以NCU來說,校外使用者可以使用EZproxy。 1708 | 我的用法是直接改網址,https://ezproxy.lib.ncu.edu.tw/login?url= 表示完整(含http://)的網址。所以\url{http://www.sciencedirect.com} 要載付費全文的話就是由\url{https://ezproxy.lib.ncu.edu.tw/login?url=http://www.sciencedirect.com/}登入後下載。 1709 | 至於快速改書籤的方式在Firefox中可以由建立關鍵字書籤方式處理。如下圖: 1710 | \fig[1][][h]{tutorial_firefox_bookmark.png} 1711 | 於網址填入\url{http://ezproxy.lib.ncu.edu.tw/login?url=http://\%S} 並加上關鍵字ezp,當瀏覽到須要登入的頁面時直接在網址開頭加上``ezp ''即可轉換成所須網址。 1712 | \footnote{同理,NCU圖書館查書可以用\url{http://opac.lib.ncu.edu.tw/search*cht/a?a?searchtype=Y&searcharg=\%S} 1713 | 以及關鍵字``lib''來處理。} 1714 | 1715 | 除了上面列的網站外,這裡特別推薦 arXiv.org(\url{https://arxiv.org/}),台大圖書館有詳細介紹(\url{http://tul.blog.ntu.edu.tw/archives/17366})。 1716 | 1717 | \chapter{特定樣板細說} 1718 | \label{sec:c_specialTemplate} 1719 | \section{中央大學(NCU)} 1720 | \label{sec:s_specialTemplate_ncu} 1721 | \subsection{章節層級} 1722 | \label{sec:s_specialTemplate_ncu_secStyle} 1723 | book類別的章節層級有: 1724 | \begin{enumerate} 1725 | \item \textbackslash{}chapter\{章\} 1726 | \item \textbackslash{}section\{節\} 1727 | \item \textbackslash{}subsection\{小節\} 1728 | \item \textbackslash{}subsubsection\{小小節\} 1729 | \item \textbackslash{}paragraph\{段\} 1730 | \item \textbackslash{}subparagraph\{小段\} 1731 | \end{enumerate} 1732 | 不過學校體例參考文件中少去「\textbackslash{}subsubsection\{小小節\}」。在樣板中將以\textbackslash{}subsubsection\{小小節\}來代替段的地位。 1733 | 對於\textbackslash{}subsubsection以下層級,學校要求修改標題的標號,並且整區進行縮排。我自己大多使用到第2級(1.1.1),第3級(1.1.1.1)只有用到一次,所以第3級以後的樣式我直接照\LaTeX\ 預設值。不過本樣板還是提供了較為符合格式的風格選項給各位。 1734 | \subsubsection{目錄風格} 1735 | 樣本預設目錄僅顯示到第2級(\textbackslash{}subsection\{小小節\}),要調整的話可以在config.tex中修改tocDepth的數值。目錄風格方面,本樣板可分別設定對齊策略與章級風格各兩種。 1736 | 1737 | \paragraph{目錄對齊策略} 1738 | 可以簡單的經由config.tex中的tocStyleAlign切換,0為推薦值,英文樣板近似 \LaTeX\ 預設值,中文樣板由於加上頓號,所以將章與節對齊。設為1則是將章、節、小節都對齊。雖然完全符合學校規定,但章數值會距離過遠,加上個人認為辨識度不高,太醜。設定結果如\cref{fig:tocStyleAlign}。 1739 | \begin{figure} 1740 | \centering 1741 | \subcaptionbox 1742 | {中文樣板 \textbackslash{}def\textbackslash{}tocStyleAlign\{0\} } 1743 | {\includegraphics[width=0.35\linewidth]{tocStyleAlign_0_zh.png}} 1744 | \hspace{10mm} 1745 | \subcaptionbox 1746 | {英文樣板 \textbackslash{}def\textbackslash{}tocStyleAlign\{0\} } 1747 | {\includegraphics[width=0.5\linewidth]{tocStyleAlign_0_en.png}} 1748 | 1749 | \vspace{10mm} 1750 | \subcaptionbox 1751 | {中文樣板 \textbackslash{}def\textbackslash{}tocStyleAlign\{1\} } 1752 | {\includegraphics[width=0.35\linewidth]{tocStyleAlign_1_zh.png}} 1753 | \hspace{10mm} 1754 | \subcaptionbox 1755 | {英文樣板 \textbackslash{}def\textbackslash{}tocStyleAlign\{1\} } 1756 | {\includegraphics[width=0.5\linewidth]{tocStyleAlign_1_en.png}} 1757 | \caption{樣板提供的目錄對齊風格} 1758 | \label{fig:tocStyleAlign} 1759 | \end{figure} 1760 | 1761 | \paragraph{目錄章級風格} 1762 | config.tex中的 tocStyleChapter 可以切換目錄章級的風格,如\cref{fig:tocStyleChapter}(中英文效果一樣,只貼中文),章級條目與上方拉開並使用粗體、不用點線。不過在僅有章級的區域(如摘要附近)若亦拉開則會顯得過疏。所以另提供介於中間的風格``1'',其效果如本教學,就不另外截圖了。 1763 | \begin{figure} 1764 | \centering 1765 | \subcaptionbox 1766 | {\textbackslash{}def\textbackslash{}tocStyleChapter\{0\} } 1767 | {\includegraphics[width=0.6\linewidth]{tocStyleChapter_0.png}} 1768 | 1769 | \vspace{10mm} 1770 | \subcaptionbox 1771 | {\textbackslash{}def\textbackslash{}tocStyleChapter\{2\} } 1772 | {\includegraphics[width=0.6\linewidth]{tocStyleChapter_2.png}} 1773 | \caption{樣板提供的目錄章級風格} 1774 | \label{fig:tocStyleChapter} 1775 | \end{figure} 1776 | 1777 | \subsubsection{標題風格} 1778 | 標題風格提供三種形式讓各位自行選擇要採用哪一種。(下面的示範為避免影響到主文件章節數值,使用圖片展示編譯結果。) 1779 | 1780 | 首先示範使用\LaTeX\ 預設值(\textbackslash{}styletitles\{0\})的情況,如\cref{fig:titleStyle_0}: 1781 | \begin{figure}[!h] 1782 | \centering 1783 | \subcaptionbox 1784 | {config.tex 中的設定} 1785 | {\includegraphics[width=0.3\linewidth]{titleStyle_c0.png}} 1786 | 1787 | \subcaptionbox 1788 | {} 1789 | {\includegraphics[width=0.8\linewidth]{titleStyle_0.png}} 1790 | \caption{標題風格 \textbackslash{}def\textbackslash{}titleStyle\{0\}} 1791 | \label{fig:titleStyle_0} 1792 | \end{figure} 1793 | 1794 | 接著是修改標題形式成學校樣式,但不進行縮排。如\cref{fig:titleStyle_1} 1795 | \begin{figure}[!h] 1796 | \centering 1797 | \subcaptionbox 1798 | {config.tex 中的設定} 1799 | {\includegraphics[width=0.3\linewidth]{titleStyle_c1.png}} 1800 | 1801 | \subcaptionbox 1802 | {} 1803 | {\includegraphics[width=0.8\linewidth]{titleStyle_1.png}} 1804 | \caption{標題風格 \textbackslash{}def\textbackslash{}titleStyle\{1\}} 1805 | \label{fig:titleStyle_1} 1806 | \end{figure} 1807 | 1808 | 最後是連縮排也符合學校規定(長度自訂)(\cref{fig:titleStyle_1i})。不過內文同時縮排須要調整\textbackslash{}leftskip的數值,目前樣板須要手動於縮排前後修改。並且記得以空行分隔上一個段落,否則無法產生效果。\textbackslash{}leftskip只有在碰到\textbackslash{}subsubsection層級之後才須要加,碰到的機會應該不多。 1809 | \begin{figure}[!h] 1810 | \centering 1811 | \subcaptionbox 1812 | {config.tex 中的設定} 1813 | {\includegraphics[width=0.3\linewidth]{titleStyle_c1i.png}} 1814 | 1815 | \subcaptionbox 1816 | {} 1817 | {\includegraphics[width=0.8\linewidth]{titleStyle_1i.png}} 1818 | \caption{標題風格 \textbackslash{}def\textbackslash{}titleStyle\{1\}與\textbackslash{}leftskip} 1819 | \label{fig:titleStyle_1i} 1820 | \end{figure} 1821 | 1822 | \chapter{樣板測試結果及已知問題} 1823 | 照目前測試結果來看,TeX Live以及MiKTeX最新版(2016年)都能完美支援。 1824 | \label{sec:c_issue} 1825 | \section{測試結果} 1826 | \begin{table}[h] 1827 | \centering 1828 | \begin{tabularx}{\textwidth}{| X | X | l | X |} 1829 | \hline 1830 | Tex發行版 & 作業系統 & XeTeX 版本 & 測試結果 \\ \hline 1831 | TeX Live 2012 \newline (2012.20120611-5) & Debian GNU/Linux \newline wheezy(7.9) & 3.1415926-2.4-0.9998 & 章節標題後立即接圖片會導致整段粗體,插入任一行文字可解決。\textbackslash{}url跨頁會導致頁眉及中間浮動環境均含連結。listings 套件的行號距離會比設定值短。 \\ \hline 1832 | TeX Live 2016 \newline(2016.20160819-2) & Debian GNU/Linux \newline stretch/sid(9) & 3.14159265-2.6-0.99996 & 無問題 \\ \hline 1833 | MiKTeX \newline(???) & Window 7/8/10(en) & ??? & 無問題 \\ \hline 1834 | TeX Live 2016 & Window 7 & ??? & 無問題 \\ \hline 1835 | \end{tabularx} 1836 | \end{table} 1837 | 1838 | \section{待解決問題} 1839 | %\todo[inline]{url package will load by biblatex. didn't work now.} 1840 | \begin{itemize} 1841 | \item 過長的連結會超出頁邊。本樣板使用url 套件處理這個問題,但仍無法處理超長單字。目前breakurl套件(1.40+)提供了anythingbreaks選項,可以任意截斷連結,請參考\url{http://tex.stackexchange.com/questions/107507/biblatex-url-breaking-not-working-in-dvi-mode} 的說明。不過breakurl 僅支援原始的\LaTeX\ ,PDFLaTeX/XeLaTeX不支援。 1842 | \end{itemize} 1843 | 1844 | 1845 | \end{document} 1846 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaTeX tutorial for thesis | LaTeX 教學暨論文樣板使用手冊 2 | 3 | ![XeLaTeX](https://img.shields.io/badge/TeX-XeLaTeX-orange.svg) 4 | [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://saythanks.io/to/sppmg) 5 | 6 | A tutorial and example for LaTeX use `TW_Thesis_Template` made by sppmg. 7 | 8 | 這是從我的 LaTeX 論文樣板分離出來的 LaTeX 教學手冊 9 | 10 | LaTeX 樣板請見:https://github.com/sppmg/TW_Thesis_Template 11 | 12 | 分離出來是為了更容易更新內容。未來此專案版號前兩位將隨使用的 LaTeX 樣板而變。 13 | 14 | 即: `v1.7.1` , `v.1.7.2` 等等都是針對於樣板 v1.7.X 撰寫,未必適用於 v1.8.X 。 15 | 16 | 不過在不涉及樣板方面的 LaTeX 教學是通用的。 17 | 18 | 各版本差異請見 [CHANGELOG](https://github.com/sppmg/LaTeX_tutorial_for_thesis/blob/master/CHANGELOG) 19 | 20 | ## 授權 21 | 22 | 使用 CC-BY-SA-4.0 。 23 | --------------------------------------------------------------------------------