├── slides ├── figs │ ├── overleaf.png │ └── vscode-compile-project.png ├── minted │ ├── hello.tex │ ├── install_mactex.sh │ ├── article.bib │ ├── inproceedings.bib │ └── latexmkrc ├── .latexmkrc ├── preamble.tex └── main.tex ├── example ├── tikz-example.tex ├── ref.bib ├── .latexmkrc ├── preamble.tex └── main.tex ├── .editorconfig ├── README.md ├── .github └── workflows │ └── main.yml ├── .gitignore └── LICENSE /slides/figs/overleaf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu-cheng/latex-tutorial/HEAD/slides/figs/overleaf.png -------------------------------------------------------------------------------- /slides/figs/vscode-compile-project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xu-cheng/latex-tutorial/HEAD/slides/figs/vscode-compile-project.png -------------------------------------------------------------------------------- /slides/minted/hello.tex: -------------------------------------------------------------------------------- 1 | % this is hello.tex 2 | \documentclass{article} 3 | \begin{document} 4 | Hello, \LaTeX! 5 | \end{document} 6 | -------------------------------------------------------------------------------- /slides/minted/install_mactex.sh: -------------------------------------------------------------------------------- 1 | # Install Homebrew 2 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 3 | # Install MacTeX 4 | brew cask install mactex 5 | -------------------------------------------------------------------------------- /slides/minted/article.bib: -------------------------------------------------------------------------------- 1 | @article{nameofentry, 2 | author = {John Doe and Jane Doe}, 3 | title = {The title of the work}, 4 | journal = {The name of the journal}, 5 | year = 1993, 6 | pages = {201--213}, 7 | month = 7, 8 | volume = 4 9 | } 10 | -------------------------------------------------------------------------------- /example/tikz-example.tex: -------------------------------------------------------------------------------- 1 | \documentclass[tikz]{standalone} 2 | \usetikzlibrary{positioning} 3 | 4 | \begin{document} 5 | \begin{tikzpicture} 6 | \node[draw] (start) { Start }; 7 | \node[draw, right=2cm of start] (end) { End }; 8 | \draw[-latex] (start) -- (end); 9 | \end{tikzpicture} 10 | \end{document} 11 | -------------------------------------------------------------------------------- /slides/minted/inproceedings.bib: -------------------------------------------------------------------------------- 1 | @inproceedings{nameofentry, 2 | author = {Doe, John and Doe, Jane}, 3 | title = {The title of the work}, 4 | booktitle = {The name of the proceedings}, 5 | year = 2019, 6 | pages = {100--110}, 7 | month = 1, 8 | address = {Conference location}, 9 | } 10 | -------------------------------------------------------------------------------- /slides/minted/latexmkrc: -------------------------------------------------------------------------------- 1 | # use pdflatex by default, so you don't need to pass `-pdf` argument 2 | $pdf_mode = 1; 3 | # -synctex=1 allow easy jumps between latex source and pdf file 4 | # -file-line-error make latex report file and line number when there is an error 5 | $pdflatex = 'pdflatex -synctex=1 -file-line-error %O %S'; 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # vim: set ft=dosini nospell: 2 | # document: http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | indent_style = space 10 | insert_final_newline = true 11 | trim_trailing_whitespace = true 12 | indent_size = 2 13 | 14 | [COMMIT_EDITMSG] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LaTeX Tutorial 2 | 3 | An Introduction to the LaTeX 4 | 5 | * [Slides](https://gh.xuc.me/latex-tutorial/slides.pdf) 6 | * [Example](https://gh.xuc.me/latex-tutorial/example.pdf) 7 | 8 | ## License 9 | 10 | [![CC-BY 4.0](https://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg)](http://creativecommons.org/licenses/by/4.0/) 11 | -------------------------------------------------------------------------------- /slides/.latexmkrc: -------------------------------------------------------------------------------- 1 | # vim: set filetype=perl: 2 | 3 | $pdf_mode = 1; 4 | $pdflatex = 'lualatex --shell-escape --synctex=1 --file-line-error %O %S'; 5 | $max_repeat = 5; 6 | my @clean_ext = qw( 7 | %R-blx.aux 8 | %R-blx.bib 9 | _minted-%R 10 | acn 11 | acr 12 | alg 13 | aux 14 | bbl 15 | bcf 16 | blg 17 | brf 18 | cb 19 | cb2 20 | cpt 21 | cut 22 | dvi 23 | fdb_latexmk 24 | fls 25 | fmt 26 | fot 27 | glg 28 | glo 29 | gls 30 | glsdefs 31 | idx 32 | ilg 33 | ind 34 | ist 35 | lb 36 | listing 37 | loa 38 | loe 39 | lof 40 | log 41 | lol 42 | lot 43 | lox 44 | nav 45 | out 46 | pdfsync 47 | pre 48 | run.xml 49 | snm 50 | soc 51 | synctex 52 | synctex(busy) 53 | synctex.gz 54 | synctex.gz(busy) 55 | tdo 56 | thm 57 | toc 58 | upa 59 | upb 60 | vrb 61 | xcp 62 | xdv 63 | xmpi 64 | xyc 65 | ); 66 | $clean_ext = join ' ', @clean_ext; 67 | -------------------------------------------------------------------------------- /example/ref.bib: -------------------------------------------------------------------------------- 1 | @article{shannon1948, 2 | title = {A mathematical theory of communication}, 3 | author = {Shannon, Claude Elwood}, 4 | journal = {Bell system technical journal}, 5 | volume = {27}, 6 | number = {3}, 7 | pages = {379--423}, 8 | year = {1948}, 9 | } 10 | 11 | @inproceedings{merkle1989, 12 | title = {A Certified Digital Signature}, 13 | booktitle = {Advances in Cryptology {\textemdash} {CRYPTO}' 89 Proceedings}, 14 | author = {Merkle, Ralph C.}, 15 | year = {1989}, 16 | pages = {218--238}, 17 | } 18 | 19 | @inproceedings{roussopoulos1995, 20 | title = {Nearest neighbor queries}, 21 | author = {Roussopoulos, Nick and Kelley, Stephen and Vincent, Fr{\'e}d{\'e}ric}, 22 | booktitle = {Proceedings of the 1995 ACM SIGMOD International Conference on Management of Data}, 23 | volume = {24}, 24 | number = {2}, 25 | pages = {71--79}, 26 | year = {1995}, 27 | } 28 | 29 | @misc{latextutoiral, 30 | author = {Xu, Cheng}, 31 | title = {Introduction to \LaTeX}, 32 | subtitle = {Writing papers the right way}, 33 | year = 2019, 34 | url = {https://github.com/xu-cheng/latex-tutorial}, 35 | } 36 | -------------------------------------------------------------------------------- /example/.latexmkrc: -------------------------------------------------------------------------------- 1 | # vim: set filetype=perl: 2 | 3 | $pdf_mode = 1; 4 | set_tex_cmds('-shell-escape -synctex=1 -file-line-error %O %S'); 5 | $max_repeat = 5; 6 | 7 | # File extensions to remove when cleaning 8 | # Ref: https://www.gitignore.io/api/latex 9 | my @clean_ext = qw( 10 | %R-blx.aux 11 | %R-blx.bib 12 | acn 13 | acr 14 | alg 15 | aux 16 | bbl 17 | bcf 18 | blg 19 | brf 20 | cb 21 | cb2 22 | cpt 23 | cut 24 | dvi 25 | fdb_latexmk 26 | fls 27 | fmt 28 | fot 29 | glg 30 | glo 31 | gls 32 | glsdefs 33 | idx 34 | ilg 35 | ind 36 | ist 37 | lb 38 | listing 39 | loa 40 | loe 41 | lof 42 | log 43 | lol 44 | lot 45 | lox 46 | nav 47 | out 48 | pdfsync 49 | pre 50 | run.xml 51 | snm 52 | soc 53 | synctex 54 | synctex(busy) 55 | synctex.gz 56 | synctex.gz(busy) 57 | tdo 58 | thm 59 | toc 60 | upa 61 | upb 62 | vrb 63 | xcp 64 | xdv 65 | xmpi 66 | xyc 67 | *-converted-to.* 68 | */*-converted-to.* 69 | */*/*-converted-to.* 70 | */*/*/*-converted-to.* 71 | ); 72 | $clean_ext = join ' ', @clean_ext; 73 | 74 | no warnings 'redefine'; 75 | 76 | # Overwrite `cleanup1` functions to support more general pattern in $clean_ext. 77 | # Ref: https://github.com/e-dschungel/latexmk-config/blob/master/latexmkrc 78 | sub cleanup1 { 79 | my $dir = fix_pattern( shift ); 80 | my $root_fixed = fix_pattern( $root_filename ); 81 | foreach (@_) { 82 | (my $name = (/%R/ || /[\*\?]/) ? $_ : "%R.$_") =~ s/%R/$dir$root_fixed/; 83 | unlink_or_move( glob( "$name" ) ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Github Actions CI 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | build: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Set up Git repository 11 | uses: actions/checkout@v1 12 | - name: Compile Slides 13 | uses: xu-cheng/latex-action@master 14 | with: 15 | root_file: main.tex 16 | working_directory: slides 17 | - name: Compile Example 18 | uses: xu-cheng/latex-action@master 19 | with: 20 | root_file: main.tex 21 | working_directory: example 22 | - name: Check pdf files 23 | run: | 24 | file slides/main.pdf | grep -q ' PDF ' 25 | file example/main.pdf | grep -q ' PDF ' 26 | - name: Upload 27 | run: | 28 | # configure git 29 | git config --global user.name "Cheng XU" 30 | git config --global user.email "git@xuc.me" 31 | 32 | # setup ssh 33 | mkdir ~/.ssh 34 | chmod 700 ~/.ssh 35 | echo "$DEPLOY_KEY" > ~/.ssh/id_ed25519 36 | chmod 600 ~/.ssh/id_ed25519 37 | git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" 38 | 39 | git clone --depth=1 --branch gh-pages git@github.com:xu-cheng/latex-tutorial.git "$GITHUB_WORKSPACE/deploy" 40 | cp -f slides/main.pdf "$GITHUB_WORKSPACE/deploy/slides.pdf" 41 | cp -f example/main.pdf "$GITHUB_WORKSPACE/deploy/example.pdf" 42 | cd "$GITHUB_WORKSPACE/deploy" 43 | git add slides.pdf example.pdf 44 | git commit -m "[github actions] deploy" 45 | git push 46 | env: 47 | DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} 48 | -------------------------------------------------------------------------------- /example/preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{color} 2 | \usepackage[table,dvipsnames]{xcolor} 3 | 4 | \usepackage{microtype} 5 | \usepackage{etoolbox} 6 | \usepackage{float} 7 | \usepackage{placeins} 8 | \usepackage{balance} 9 | \usepackage{footmisc} 10 | 11 | \usepackage{amsmath} 12 | \usepackage{amssymb} 13 | \let\emptyset\varnothing% 14 | \usepackage{amsfonts} 15 | \usepackage{mathrsfs} 16 | \usepackage{latexsym} 17 | \usepackage[ruled,vlined]{algorithm2e} 18 | \usepackage{amsthm} 19 | \usepackage{thmtools,thm-restate} 20 | \declaretheorem[style=plain]{axiom} 21 | \declaretheorem[style=definition]{definition} 22 | \declaretheorem[style=remark]{example} 23 | \declaretheorem[style=plain]{lemma} 24 | \declaretheorem[style=plain]{theorem} 25 | \declaretheorem[style=remark]{remark} 26 | 27 | \usepackage{caption} 28 | \usepackage{subcaption} 29 | \usepackage{graphicx} 30 | \usepackage[mode=buildnew]{standalone} 31 | 32 | \usepackage{array} 33 | \usepackage{booktabs} 34 | \usepackage{multirow} 35 | 36 | \usepackage{listings} 37 | 38 | \usepackage{hyperref} 39 | \usepackage[capitalise]{cleveref} 40 | \hypersetup{% 41 | unicode, 42 | psdextra, 43 | hidelinks, 44 | bookmarksnumbered=true, 45 | bookmarksopen=true, 46 | bookmarksopenlevel=3, 47 | plainpages=false, 48 | pdfstartview={XYZ null null 1}, 49 | pdfpagemode={UseOutlines}, 50 | pdfpagelayout={OneColumn} 51 | } 52 | 53 | \usepackage[inline]{enumitem} 54 | \setlist{noitemsep,partopsep=0pt,topsep=0pt} 55 | \newlist{inlineenum}{enumerate*}{1} 56 | \setlist[inlineenum]{label=(\roman*),ref=(\roman*)} % chktex 36 57 | 58 | \usepackage[% 59 | style=ieee, 60 | dashed=false, 61 | doi=false, 62 | isbn=false, 63 | giveninits=true, 64 | maxnames=10, 65 | ]{biblatex} 66 | \addbibresource{ref.bib} 67 | 68 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Core latex/pdflatex auxiliary files: 2 | *.aux 3 | *.lof 4 | *.log 5 | *.lot 6 | *.fls 7 | *.out 8 | *.toc 9 | *.fmt 10 | *.fot 11 | *.cb 12 | *.cb2 13 | .*.lb 14 | 15 | ## Intermediate documents: 16 | *.dvi 17 | *.xdv 18 | *-converted-to.* 19 | # these rules might exclude image files for figures etc. 20 | # *.ps 21 | # *.eps 22 | # *.pdf 23 | 24 | ## Generated if empty string is given at "Please type another file name for output:" 25 | .pdf 26 | 27 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 28 | *.bbl 29 | *.bcf 30 | *.blg 31 | *-blx.aux 32 | *-blx.bib 33 | *.run.xml 34 | 35 | ## Build tool auxiliary files: 36 | *.fdb_latexmk 37 | *.synctex 38 | *.synctex(busy) 39 | *.synctex.gz 40 | *.synctex.gz(busy) 41 | *.pdfsync 42 | 43 | ## Auxiliary and intermediate files from other packages: 44 | # algorithms 45 | *.alg 46 | *.loa 47 | 48 | # achemso 49 | acs-*.bib 50 | 51 | # amsthm 52 | *.thm 53 | 54 | # beamer 55 | *.nav 56 | *.pre 57 | *.snm 58 | *.vrb 59 | 60 | # changes 61 | *.soc 62 | 63 | # cprotect 64 | *.cpt 65 | 66 | # elsarticle (documentclass of Elsevier journals) 67 | *.spl 68 | 69 | # endnotes 70 | *.ent 71 | 72 | # fixme 73 | *.lox 74 | 75 | # feynmf/feynmp 76 | *.mf 77 | *.mp 78 | *.t[1-9] 79 | *.t[1-9][0-9] 80 | *.tfm 81 | 82 | #(r)(e)ledmac/(r)(e)ledpar 83 | *.end 84 | *.?end 85 | *.[1-9] 86 | *.[1-9][0-9] 87 | *.[1-9][0-9][0-9] 88 | *.[1-9]R 89 | *.[1-9][0-9]R 90 | *.[1-9][0-9][0-9]R 91 | *.eledsec[1-9] 92 | *.eledsec[1-9]R 93 | *.eledsec[1-9][0-9] 94 | *.eledsec[1-9][0-9]R 95 | *.eledsec[1-9][0-9][0-9] 96 | *.eledsec[1-9][0-9][0-9]R 97 | 98 | # glossaries 99 | *.acn 100 | *.acr 101 | *.glg 102 | *.glo 103 | *.gls 104 | *.glsdefs 105 | 106 | # gnuplottex 107 | *-gnuplottex-* 108 | 109 | # gregoriotex 110 | *.gaux 111 | *.gtex 112 | 113 | # htlatex 114 | *.4ct 115 | *.4tc 116 | *.idv 117 | *.lg 118 | *.trc 119 | *.xref 120 | 121 | # hyperref 122 | *.brf 123 | 124 | # knitr 125 | *-concordance.tex 126 | # TODO Comment the next line if you want to keep your tikz graphics files 127 | *.tikz 128 | *-tikzDictionary 129 | 130 | # listings 131 | *.lol 132 | 133 | # makeidx 134 | *.idx 135 | *.ilg 136 | *.ind 137 | *.ist 138 | 139 | # minitoc 140 | *.maf 141 | *.mlf 142 | *.mlt 143 | *.mtc[0-9]* 144 | *.slf[0-9]* 145 | *.slt[0-9]* 146 | *.stc[0-9]* 147 | 148 | # minted 149 | _minted* 150 | *.pyg 151 | 152 | # morewrites 153 | *.mw 154 | 155 | # nomencl 156 | *.nlg 157 | *.nlo 158 | *.nls 159 | 160 | # pax 161 | *.pax 162 | 163 | # pdfpcnotes 164 | *.pdfpc 165 | 166 | # sagetex 167 | *.sagetex.sage 168 | *.sagetex.py 169 | *.sagetex.scmd 170 | 171 | # scrwfile 172 | *.wrt 173 | 174 | # sympy 175 | *.sout 176 | *.sympy 177 | sympy-plots-for-*.tex/ 178 | 179 | # pdfcomment 180 | *.upa 181 | *.upb 182 | 183 | # pythontex 184 | *.pytxcode 185 | pythontex-files-*/ 186 | 187 | # thmtools 188 | *.loe 189 | 190 | # TikZ & PGF 191 | *.dpth 192 | *.md5 193 | *.auxlock 194 | 195 | # todonotes 196 | *.tdo 197 | 198 | # easy-todo 199 | *.lod 200 | 201 | # xmpincl 202 | *.xmpi 203 | 204 | # xindy 205 | *.xdy 206 | 207 | # xypic precompiled matrices 208 | *.xyc 209 | 210 | # endfloat 211 | *.ttt 212 | *.fff 213 | 214 | # Latexian 215 | TSWLatexianTemp* 216 | 217 | ## Editors: 218 | # WinEdt 219 | *.bak 220 | *.sav 221 | 222 | # Texpad 223 | .texpadtmp 224 | 225 | # Kile 226 | *.backup 227 | 228 | # KBibTeX 229 | *~[0-9]* 230 | 231 | # auto folder when using emacs and auctex 232 | ./auto/* 233 | *.el 234 | 235 | # expex forward references with \gathertags 236 | *-tags.tex 237 | 238 | # standalone packages 239 | *.sta 240 | 241 | # generated if using elsarticle.cls 242 | *.spl 243 | 244 | # build result 245 | /slides/main.pdf 246 | /example/main.pdf 247 | /example/tikz-example.pdf 248 | -------------------------------------------------------------------------------- /slides/preamble.tex: -------------------------------------------------------------------------------- 1 | % utility packages 2 | \usepackage{etoolbox} 3 | \usepackage{multicol} 4 | \usepackage{relsize} 5 | 6 | % better text justifying 7 | \usepackage{microtype} 8 | % justify text inside list environment 9 | % Ref: http://liam0205.me/2017/04/11/justifying-in-beamer-s-lists/ 10 | \usepackage{ragged2e} 11 | \makeatletter 12 | \patchcmd{\itemize}{\raggedright}{\justifying}{}{} 13 | \patchcmd{\beamer@enum@}{\raggedright}{\justifying}{}{} 14 | \patchcmd{\@@description}{\raggedright}{\justifying}{}{} 15 | \makeatother 16 | 17 | % math related packages 18 | \usepackage{amsmath} 19 | \usepackage[ruled,vlined]{algorithm2e} 20 | \SetAlCapNameFnt{\scriptsize} 21 | \SetAlCapFnt{\scriptsize} 22 | \SetAlFnt{\scriptsize} 23 | 24 | % figure related packages 25 | \usepackage{graphicx} 26 | \usepackage[scale=2]{ccicons} 27 | \usepackage{qrcode} 28 | \usepackage{tikz} 29 | \usepackage{tikzpagenodes} 30 | \usetikzlibrary{positioning} 31 | 32 | % table related packages 33 | \usepackage{array} 34 | \usepackage{booktabs} 35 | \usepackage{multirow} 36 | \usepackage{colortbl} 37 | \newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}} 38 | 39 | % code highlight 40 | \usepackage{listings} 41 | \usepackage{minted} 42 | \definecolor{mintedbg}{HTML}{E5E9F0} 43 | \setminted{autogobble,bgcolor=mintedbg,fontsize=\small} 44 | \setmintedinline{bgcolor=mintedbg,fontsize=\smaller} 45 | \newminted{bash}{} 46 | \newminted{latex}{} 47 | \newmintinline{bash}{} 48 | \newmintinline{latex}{} 49 | \newcommand{\texdoc}[2]{\href{#2}{\bashinline|texdoc #1|}} 50 | 51 | % hyperref setting 52 | \hypersetup{ 53 | unicode, 54 | psdextra, 55 | bookmarksnumbered=true, 56 | bookmarksopen=true, 57 | bookmarksopenlevel=3, 58 | bookmarksdepth=4, 59 | pdfcenterwindow=true, 60 | pdfstartview={Fit}, 61 | pdfpagemode={FullScreen}, 62 | pdfpagelayout={SinglePage}, 63 | } 64 | \usepackage{bookmark} 65 | 66 | % beamer theme 67 | \usetheme{metropolis} 68 | \metroset{block=fill,numbering=fraction} 69 | 70 | % caption style 71 | \usepackage{subcaption} 72 | \setlength\abovecaptionskip{3pt} 73 | \setbeamerfont{caption}{size=\scriptsize} 74 | \renewcommand{\figurename}{Fig.} 75 | \captionsetup{labelformat=empty,labelsep=none,textfont={bf,it}} 76 | 77 | % Ref: https://github.com/gpoore/minted/blob/master/source/minted.dtx 78 | \newenvironment{latexexample} 79 | {\VerbatimEnvironment\begin{VerbatimOut}[gobble=3]{example.out}}{\end{VerbatimOut}% 80 | \begin{center} 81 | \begin{minipage}{0.47\linewidth}% 82 | \inputminted[resetmargins,fontsize=\scriptsize]{latex}{example.out}% 83 | \end{minipage}% 84 | \hspace{0.05\linewidth}% 85 | \begin{minipage}{0.47\linewidth}% 86 | \begin{framed} 87 | \setlength{\parindent}{2em}% 88 | \input{example.out}% 89 | \end{framed} 90 | \end{minipage}% 91 | \end{center} 92 | } 93 | 94 | \newenvironment{mathexample} 95 | {\VerbatimEnvironment\begin{VerbatimOut}[gobble=3]{example.out}}{\end{VerbatimOut}% 96 | \begin{center} 97 | \begin{minipage}{0.47\linewidth}% 98 | \inputminted[resetmargins,fontsize=\scriptsize]{latex}{example.out}% 99 | \end{minipage}% 100 | \hspace{0.05\linewidth}% 101 | \begin{minipage}{0.47\linewidth}% 102 | \begin{framed} 103 | \[ \input{example.out} \] 104 | \end{framed} 105 | \end{minipage}% 106 | \end{center} 107 | } 108 | 109 | \newenvironment{mathexamples} 110 | {\VerbatimEnvironment\begin{VerbatimOut}[gobble=3]{example.out}}{\end{VerbatimOut}% 111 | \begin{center} 112 | \begin{minipage}{0.47\linewidth}% 113 | \inputminted[resetmargins,fontsize=\scriptsize]{latex}{example.out}% 114 | \end{minipage}% 115 | \hspace{0.05\linewidth}% 116 | \begin{minipage}{0.47\linewidth}% 117 | \begin{framed} 118 | \directlua{ 119 | local first = true 120 | for line in io.lines('example.out') do 121 | if first then 122 | first = false 123 | else 124 | tex.print('\\newline ') 125 | end 126 | tex.print('$' .. line .. '$') 127 | end 128 | } 129 | \end{framed} 130 | \end{minipage}% 131 | \end{center} 132 | } 133 | -------------------------------------------------------------------------------- /example/main.tex: -------------------------------------------------------------------------------- 1 | % This is a comment 2 | 3 | % Here, we load IEEEtran class with option conference 4 | \documentclass[conference]{IEEEtran} 5 | 6 | % The region after \documentclass and before \begin{document} is called preamble. 7 | % You can load packages and define format of the document here. 8 | 9 | % The \input{...} command read another tex file. 10 | % This is particularly useful when dealing with large document. 11 | % For example, you may want put each section of the paper in a separated tex file. 12 | % Here, we put most of preamble definitions in preamble.tex file. 13 | \input{preamble.tex} 14 | 15 | \title{An Example of \LaTeX~Usage} 16 | \author{John Doe} 17 | 18 | \begin{document} 19 | 20 | % typeset the title 21 | \maketitle 22 | 23 | \begin{abstract} 24 | This document shows how to use \LaTeX~to typeset an academic paper. 25 | \end{abstract} 26 | 27 | \section{Basic Syntax} 28 | 29 | It does not matter whether 30 | you enter one or several 31 | spaces after a word. 32 | 33 | An empty line starts a new 34 | paragraph. 35 | 36 | You can force a line break without starting a new paragraph. Like this: \\ 37 | There will be a line break before this sentence. 38 | 39 | You could also specify the vertical space after the line break. \\ [2ex] 40 | It creates a line break with vertical space equaling to 2 times of the height of character `x'. 41 | 42 | \section{Special Characters and Symbols} 43 | 44 | The following commands are used to typeset special characters: 45 | \# \$ \% \^{} \& \_ \{ \} \~{} \textbackslash 46 | 47 | Quotation marks should be typeset as following: `single quoted text' and ``double quoted text''. 48 | 49 | There are four kinds of dashes in \LaTeX{}. 50 | \begin{itemize} 51 | \item hyphen: part-time. 52 | \item en-dash: pages 1--10. 53 | \item em-dash: yes---or no? 54 | \item minus sign: $0$, $1$, and $-1$. 55 | \end{itemize} 56 | 57 | Ellipsis can be typeset as following: New York, Tokyo, Budapest, \ldots 58 | 59 | \section{Font Face \& Size} 60 | 61 | \subsection{Font Face Commands} 62 | 63 | \textrm{roman} 64 | \textsf{sans serif} 65 | \texttt{typewriter} 66 | \textmd{medium} 67 | \textbf{bold face} 68 | \textup{upright} 69 | \textit{italic} 70 | \textsl{slanted} 71 | \textsc{small caps} 72 | \emph{emphasized} 73 | \textnormal{document font} 74 | 75 | \subsection{Font Size Commands} 76 | 77 | {\tiny tiny font} \\ 78 | {\scriptsize very small font} \\ 79 | {\footnotesize quite small font} \\ 80 | {\small small font} \\ 81 | {\normalsize normal font} \\ 82 | {\large large font} \\ 83 | {\Large large font} \\ 84 | {\LARGE very large font} \\ 85 | {\huge huge} \\ 86 | {\Huge largest} 87 | 88 | \section{Space and Alignment} 89 | 90 | Force an unbreakable space using tilde symbol. e.g.~these~spaces~are~unbreakable. They cannot be broken by line break or page break. 91 | 92 | In addition to the normal space, a breakable space can be inserted using backslash following by a space. For example, there are three spaces\ \ \ inside this sentence. 93 | 94 | You can also specify the space like\hspace{5em}this. 95 | 96 | \vspace{5ex} 97 | 98 | The above command create a vertical space. 99 | 100 | To align the text. 101 | 102 | \begin{center} 103 | text to be centered 104 | \end{center} 105 | 106 | \begin{flushleft} 107 | text to be flushed left 108 | \end{flushleft} 109 | 110 | \begin{flushright} 111 | text to be flushed right 112 | \end{flushright} 113 | 114 | \section{List Structures} 115 | 116 | \begin{enumerate} 117 | \item You can nest the list 118 | environments to your taste: 119 | \begin{itemize} 120 | \item But it might start to 121 | look silly. 122 | \item[-] With a dash. 123 | \end{itemize} 124 | \item Therefore remember: 125 | \begin{description} 126 | \item[Stupid] things will not 127 | become smart because they are 128 | in a list. 129 | \item[Smart] things, though, 130 | can be presented beautifully 131 | in a list. 132 | \end{description} 133 | \end{enumerate} 134 | 135 | You can custom the list using \texttt{enumitem} package. 136 | 137 | \begin{itemize}[label=-] 138 | \item A 139 | \item B 140 | \end{itemize} 141 | 142 | List environments can be inlined. The following \texttt{inlineenum} environment is defined in the \texttt{preamble.tex} file. 143 | \begin{inlineenum} 144 | \item A 145 | \item B 146 | \end{inlineenum} 147 | 148 | \section{Math} 149 | 150 | Inline math: \(\sum_i^k i\) 151 | 152 | Display math: \[\sum_i^k\] 153 | 154 | Math using the \texttt{equation} environment shown in \cref{eqn:1}. 155 | \begin{equation} 156 | E = mc^2 \label{eqn:1} 157 | \end{equation} 158 | 159 | \Cref{eqn:2,eqn:3} use the \texttt{align} environment. 160 | \begin{align} 161 | B' & =-\nabla \times E, \label{eqn:2} \\ 162 | E' & =\nabla \times B - 4\pi j, \label{eqn:3} 163 | \end{align} 164 | 165 | Disable numbering for some equation. 166 | \begin{align} 167 | a & = b + c \nonumber \\ 168 | & = d + e 169 | \end{align} 170 | 171 | Keep equations aligned across text. 172 | \begin{align*} 173 | F & = f_1+f_2+f_3+...+f_n 174 | \intertext{can be written as} % use \intertext{} to insert text while keep equations aligned. 175 | F & = \sum_1^n{f_i} 176 | \end{align*} 177 | 178 | A list of equations without the alignment. 179 | \begin{gather*} 180 | \cos(2\theta) = \cos^2\theta-\sin^2\theta \\ 181 | \lim\limits_{x \to \infty} \exp(-x) = 0 \\ 182 | a \bmod b \\ 183 | x \equiv a \pmod{b} \\ 184 | \log{(N)} \\ 185 | \operatorname{arg\,max}_a f(a) = \operatorname*{arg\,max}_b f(b) \\ 186 | n^{22} \\ 187 | f(n) = n^5 + 4n^2 + 2 |_{n=17} \\ 188 | \sum_{i=1}^{n} i \\ 189 | \lim_{x \to \infty} \frac{1}{x} \\ 190 | \frac{n!}{k!(n-k)!} = \binom{n}{k} \\ 191 | \sqrt{2} \\ 192 | \sqrt[n]{1+x+x^2+x^3+\dots+x^n} \\ 193 | \left(\frac{x^2}{y^3}\right) \\ 194 | P\left(A=2\middle|\frac{A^2}{B}>4\right) \\ 195 | \left\{\frac{x^2}{y^3}\right\} 196 | \end{gather*} 197 | 198 | Typeset matrices. 199 | 200 | \begin{gather*} 201 | \begin{pmatrix} 202 | a & b & c \\ 203 | d & e & f \\ 204 | g & h & i 205 | \end{pmatrix} = 206 | \begin{bmatrix} 207 | a & b & c \\ 208 | d & e & f \\ 209 | g & h & i 210 | \end{bmatrix} 211 | \end{gather*} 212 | 213 | \begin{gather*} 214 | \left(\begin{array}{cc|c} 215 | a & b & c \\ 216 | d & e & f 217 | \end{array}\right) 218 | \end{gather*} 219 | 220 | Matrices can be embed inside another matrix. 221 | 222 | \begin{gather*} 223 | \begin{pmatrix} 224 | \begin{pmatrix} 225 | a_{11} & a_{12} \\ 226 | a_{21} & a_{22} \\ 227 | \end{pmatrix} 228 | & 0 & \cdots \\ 229 | 0 & 230 | \begin{pmatrix} 231 | b_{11} & b_{12} \\ 232 | b_{21} & b_{22} \\ 233 | \end{pmatrix} 234 | & \cdots \\ 235 | \vdots & \vdots & \ddots 236 | \end{pmatrix} 237 | \end{gather*} 238 | 239 | Cases: 240 | 241 | \begin{gather*} 242 | f(x) = \left\{ 243 | \begin{array}{ll} 244 | x & \text{if } x > 0, \\ 245 | 0 & \text{otherwise}. 246 | \end{array}\right. 247 | \end{gather*} 248 | 249 | \begin{gather*} 250 | f(n) = 251 | \begin{cases} 252 | n/2 & \quad \text{if } n \text{ is even} \\ 253 | -(n+1)/2 & \quad \text{if } n \text{ is odd} 254 | \end{cases} 255 | \end{gather*} 256 | 257 | \begin{table}[t] 258 | \centering 259 | \begin{tabular}{ll} 260 | \toprule 261 | \textbf{Code} & \textbf{Output} \\ 262 | \midrule 263 | \verb|\mathnormal{...}| & $\mathnormal{ABCDEF~abcdef~123456}$ \\ 264 | \verb|\mathrm{...}| & $\mathrm{ABCDEF~abcdef~123456}$ \\ 265 | \verb|\mathit{...}| & $\mathit{ABCDEF~abcdef~123456}$ \\ 266 | \verb|\mathbf{...}| & $\mathbf{ABCDEF~abcdef~123456}$ \\ 267 | \verb|\mathsf{...}| & $\mathsf{ABCDEF~abcdef~123456}$ \\ 268 | \verb|\mathtt{...}| & $\mathtt{ABCDEF~abcdef~123456}$ \\ 269 | \verb|\mathfrak{...}| & $\mathfrak{ABCDEF~abcdef~123456}$ \\ 270 | \verb|\mathcal{...}| & $\mathcal{ABCDEF}$ \\ 271 | \verb|\mathbb{...}| & $\mathbb{ABCDEF}$ \\ 272 | \bottomrule 273 | \end{tabular} 274 | \caption{Math Fonts}\label{tab:math-fonts} 275 | \end{table} 276 | 277 | \begin{table}[t] 278 | \centering 279 | \begin{tabular}{llr} 280 | \toprule 281 | \multicolumn{2}{c}{Item} \\ 282 | \cmidrule(r){1-2} 283 | Animal & Description & Price (\$) \\ 284 | \midrule 285 | Gnat & per gram & 13.65 \\ 286 | & each & 0.01 \\ 287 | Gnu & stuffed & 92.50 \\ 288 | Emu & stuffed & 33.33 \\ 289 | Armadillo & frozen & 8.99 \\ 290 | \bottomrule 291 | \end{tabular} 292 | \caption{An example of table}\label{tab:example} 293 | \end{table} 294 | 295 | \begin{figure*}[t] 296 | \centering 297 | \begin{subfigure}[b]{0.45\linewidth} 298 | \includegraphics[width=\linewidth]{example-image-a} 299 | \caption{Example Image A}\label{fig:example:a} 300 | \end{subfigure} 301 | ~% 302 | \begin{subfigure}[b]{0.45\linewidth} 303 | \includegraphics[width=\linewidth]{example-image-b} 304 | \caption{Example Image B}\label{fig:example:b} 305 | \end{subfigure} 306 | \caption{An example of figure}\label{fig:example} 307 | \end{figure*} 308 | 309 | \begin{figure}[t] 310 | \centering 311 | \includestandalone[width=0.8\linewidth]{./tikz-example} % without the `.tex` extension 312 | \caption{TikZ Figure in Article}\label{fig:tikz} 313 | \end{figure} 314 | 315 | \section{Figure \& Table} 316 | 317 | \Cref{tab:math-fonts} lists a variety of fonts available in the math mode. \Cref{tab:example} shows another example of table. 318 | 319 | \Cref{fig:example} consists of two figures: \cref{fig:example:a} and \cref{fig:example:b}. An figure drawn by TikZ in shown in \cref{fig:tikz}. 320 | 321 | \section{Theorems} 322 | 323 | \begin{definition}[Prime] 324 | A prime is a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers. 325 | \end{definition} 326 | 327 | \begin{theorem}[Euclid]\label{thm:euclid} 328 | For every prime $p$, there is a prime $p’>p$. 329 | \end{theorem} 330 | 331 | \begin{lemma} 332 | According to \cref{thm:euclid}, there are infinitely many primes. 333 | \end{lemma} 334 | 335 | % use restatable to repeat a theorem. 336 | \begin{restatable}[Fermat's Last Theorem]{theorem}{fermantlast}\label{thm:fermantlast}% 337 | Diophantine Equation \(x^n + y^n = z^n\), where $x$, $y$, $z$, and $n$ are integers, has no nonzero solutions for $n>2$. 338 | \end{restatable} 339 | 340 | \section{Algorithms \& Source Code} 341 | 342 | \begin{algorithm}[t] 343 | \caption{How to write algorithms}\label{alg:1} 344 | \KwData{this text} 345 | \KwResult{learn to write algorithm} 346 | initialization\; 347 | \While{not at end of this document}{ 348 | read current\; 349 | \eIf{understand}{ 350 | go to next section\; 351 | current section becomes this one\; 352 | }{ 353 | go back to the beginning\; 354 | } 355 | } 356 | \end{algorithm} 357 | 358 | \begin{lstlisting}[language=Python,float=t,caption={A example of listing},label=lst:1] 359 | def fib(): 360 | a, b = 0, 1 361 | while 1: 362 | yield a 363 | a, b = b, a + b 364 | \end{lstlisting} 365 | 366 | \Cref{alg:1} and \cref{lst:1} show the example of pseudo algorithm and source code highlight. 367 | 368 | \section{Cross-references}\label{sec:ref} 369 | 370 | You can reference to \cref{sec:ref}. Or add some footnote~\footnote{Use \url{https://www.google.com} when you encounter problems in \LaTeX.} 371 | 372 | \section{Bibliography} 373 | 374 | You can cite a paper like this~\cite{shannon1948}. 375 | Or cite multiple papers at the same time~\cite{merkle1989,roussopoulos1995}. 376 | It is also useful to cite the authors. For example, \citeauthor*{roussopoulos1995} proposed a method to process nearest neighbor queries. 377 | 378 | To add an item in the reference list but without direct citation using \verb|\nocite{}| command. 379 | 380 | \nocite{latextutoiral} 381 | 382 | \section*{Acknowledgment} 383 | 384 | Use \verb|\section*{}| command to create a section without numbering. It is commonly to be used in the section of acknowledgment. 385 | 386 | % Use the following command offered by biblatex to print the reference 387 | \printbibliography 388 | 389 | % To create appendix, it is often to use \appendix command offered by \usepackage{appendix}. 390 | % However, we use the \appendices command here, which is provided by IEEEtran class. 391 | \appendices 392 | 393 | \section{Proof of Theorem~\ref{thm:fermantlast}} 394 | 395 | % repeat the theorem 396 | \fermantlast* 397 | 398 | \begin{proof} 399 | There is a proof that was too large to fit in the margin. 400 | \end{proof} 401 | 402 | \end{document} 403 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Attribution 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 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public 379 | licenses. Notwithstanding, Creative Commons may elect to apply one of 380 | its public licenses to material it publishes and in those instances 381 | will be considered the “Licensor.” The text of the Creative Commons 382 | public licenses is dedicated to the public domain under the CC0 Public 383 | Domain Dedication. Except for the limited purpose of indicating that 384 | material is shared under a Creative Commons public license or as 385 | otherwise permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the 393 | public licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | -------------------------------------------------------------------------------- /slides/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[xcolor={dvipsnames},aspectratio=169,10pt]{beamer} 2 | 3 | \input{preamble.tex} 4 | 5 | \title{Introduction to \LaTeX} 6 | \subtitle{Writing papers the right way} 7 | \author{Cheng XU} 8 | \date{September 26, 2019} 9 | \titlegraphic{ 10 | \begin{tikzpicture}[overlay, remember picture] 11 | \node[% 12 | above right=0.35cm and -0.2cm of current page footer area.south west, 13 | anchor=south west, 14 | inner sep=0pt] {% 15 | \usebeamerfont{footline} 16 | \begin{tabular}{lm{.8\textwidth}} 17 | \href{http://creativecommons.org/licenses/by/4.0/}{\ccby} & 18 | This work is licensed under a \href{http://creativecommons.org/licenses/by/4.0/}{Creative Commons ``Attribution 4.0 International''} license. \par 19 | Get source of this slides and example document from \url{https://github.com/xu-cheng/latex-tutorial}. 20 | \end{tabular} 21 | }; 22 | \node[% 23 | above left=0.35cm and 0cm of current page footer area.south east, 24 | anchor=south east, 25 | inner sep=0pt]{\qrcode[height=1.5cm]{https://github.com/xu-cheng/latex-tutorial}}; 26 | \end{tikzpicture} 27 | } 28 | 29 | \begin{document} 30 | 31 | \maketitle% 32 | 33 | \begin{frame}{Contents} 34 | \setbeamertemplate{section in toc}[sections numbered] 35 | \tableofcontents[hideallsubsections] 36 | \end{frame} 37 | 38 | \section{Getting Started with \LaTeX} 39 | 40 | \begin{frame}{Introduction} 41 | \begin{itemize} 42 | \item \alert{\LaTeX{}} is a document preparation system and document markup language. 43 | \item It can be used to typeset articles, books, slides, posters, even graphics. 44 | \item \textbf{\textcolor{Green}{Pros}:} 45 | \begin{itemize} 46 | \item It separates presentation/format from contents. 47 | \item Since the source codes are plaintext, it works well with version control system such as git. 48 | \item Highly customizable through various of packages. 49 | \end{itemize} 50 | \item \textbf{\textcolor{Red}{Cons}:} 51 | \begin{itemize} 52 | \item There is no graphic interface to support WYSIWYG style editing. 53 | \item Not suitable to produce unstructured documents. 54 | \end{itemize} 55 | \end{itemize} 56 | \end{frame} 57 | 58 | \begin{frame}[fragile]{Installation} 59 | \begin{itemize} 60 | \item \textbf{Windows/Linux} 61 | \begin{itemize} 62 | \item TeXLive \url{https://www.tug.org/texlive/} 63 | \item Online installer: 64 | \begin{itemize} 65 | \item Windows \\ \url{http://mirror.ctan.org/systems/texlive/tlnet/install-tl-windows.exe} 66 | \item Linux \\ \url{http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz} 67 | \end{itemize} 68 | \item Offline ISO file: 69 | \footnotesize 70 | \url{http://mirror.ctan.org/systems/texlive/Images/} 71 | \end{itemize} 72 | \item \textbf{Mac} 73 | \begin{itemize} 74 | \item MacTeX \url{http://www.tug.org/mactex/} 75 | \item Or install through Homebrew (\url{https://brew.sh}) \\ 76 | \begin{minipage}{\linewidth+2.1em} 77 | \inputminted[fontsize=\scriptsize]{bash}{./minted/install_mactex.sh} 78 | \vspace{-2ex} 79 | \end{minipage} 80 | \end{itemize} 81 | \item TeXLive/MacTeX release major updates around May each year. \\ 82 | It is recommended to uninstall the old version and install the new version annually. 83 | \end{itemize} 84 | \end{frame} 85 | 86 | \begin{frame}{\LaTeX~editor} 87 | \begin{itemize} 88 | \item \LaTeX~source codes are plaintext. So you can use any editor you like. 89 | \item \textbf{Visual Studio Code \alert{[Recommend]}} 90 | \begin{itemize} 91 | \item \footnotesize \url{https://code.visualstudio.com} 92 | \item LaTeX Workshop \footnotesize \url{https://github.com/James-Yu/LaTeX-Workshop} 93 | \item Code Spell Checker \footnotesize \url{https://github.com/streetsidesoftware/vscode-spell-checker} 94 | \item Grammarly \footnotesize \url{https://github.com/znck/grammarly} 95 | \end{itemize} 96 | \item \textbf{Vim/Neovim} 97 | \begin{itemize} 98 | \item \footnotesize \url{https://www.vim.org} | \url{https://neovim.io} 99 | \item Vimtex \footnotesize \url{https://github.com/lervag/vimtex} 100 | \end{itemize} 101 | \item \textbf{Emacs} 102 | \begin{itemize} 103 | \item \footnotesize \url{https://www.gnu.org/s/emacs} 104 | \item AUCTeX \footnotesize \url{https://www.gnu.org/software/auctex} 105 | \end{itemize} 106 | \item \textbf{TeXstudio} 107 | \begin{itemize} 108 | \item \footnotesize \url{https://www.texstudio.org} 109 | \end{itemize} 110 | \end{itemize} 111 | \end{frame} 112 | 113 | \begin{frame}{Overleaf} 114 | \begin{itemize} 115 | \item \alert{Overleaf} (\url{https://www.overleaf.com/}) is a online, collaborative LaTeX editor 116 | \item Free for personal use 117 | \item \$15/month to share project among up to 10 collaborators 118 | \end{itemize} 119 | 120 | \begin{figure} 121 | \centering 122 | \includegraphics[width=.7\linewidth]{./figs/overleaf.png} 123 | \end{figure} 124 | \end{frame} 125 | 126 | \section{A Basic Document} 127 | 128 | \begin{frame}[fragile]{Hello, \LaTeX!} 129 | \begin{columns} 130 | \begin{column}{.7\linewidth} 131 | \begin{itemize} 132 | \item Create \mintinline{text}|hello.tex| file with following content. 133 | \inputminted{latex}{./minted/hello.tex} 134 | \item Compile it 135 | \begin{itemize} 136 | \item Click the build button in your \LaTeX~editor/IDE 137 | \item OR using command line: \bashinline|latexmk -pdf hello| 138 | \end{itemize} 139 | \item Open \mintinline{text}|hello.pdf| to preview the result 140 | \end{itemize} 141 | \end{column} 142 | \begin{column}{.3\linewidth} 143 | \begin{figure} 144 | \centering 145 | \includegraphics[width=\linewidth]{./figs/vscode-compile-project.png} 146 | \caption{Compile \LaTeX~Project in VSCode} 147 | \end{figure} 148 | \end{column} 149 | \end{columns} 150 | \end{frame} 151 | 152 | \begin{frame}[fragile]{Example of A Complex Document} 153 | \begin{itemize} 154 | \item Download the source code from \url{https://github.com/xu-cheng/latex-tutorial/archive/master.zip} 155 | \item The example document is located in the \mintinline{text}|example| folder. It contains: 156 | \begin{itemize} 157 | \item \mintinline{text}|main.tex| The main tex source 158 | \item \mintinline{text}|preamble.tex| A subfile to store format definitions 159 | \item \mintinline{text}|tikz-example.tex| A figure drawn using tikz 160 | \item \mintinline{text}|ref.bib| A database of references 161 | \end{itemize} 162 | \item Use \bashinline|latexmk -pdf main| to compile the document 163 | \item Access the same example in Overleaf: \url{https://www.overleaf.com/read/qsthqbjphhrz} 164 | \end{itemize} 165 | \end{frame} 166 | 167 | % \begin{noindent} 168 | \begin{frame}[fragile]{Comment, Command and Environment} 169 | \begin{itemize} 170 | \item \latexinline|%| starts a comment. e.g.~\latexinline|% this is hello.tex| 171 | \item \latexinline|\| starts a command. 172 | \begin{latexcode} 173 | \command % a command 174 | \command{} % also a command 175 | \command{arg} % a command with an argument 176 | \command{arg1}{arg2} % a command with multiple arguments 177 | \command[opt arg]{arg} % [] is for optional argument 178 | \end{latexcode} 179 | \item \latexinline|\begin{} ... \end{}| denotes an environment 180 | \begin{latexcode} 181 | \begin{envname} 182 | inside the environment 183 | \end{envname} 184 | % LaTeX environment can take arguments 185 | \begin{envname}{arg} \end{envname} 186 | \begin{envname}[opt arg]{arg} \end{envname} 187 | \end{latexcode} 188 | \end{itemize} 189 | \end{frame} 190 | % \end{noindent} 191 | 192 | \begin{frame}[fragile]{Source File Structure} 193 | \begin{itemize} 194 | \item A document starts with \latexinline|\documentclass{...}| command to specify the template 195 | \item Common templates include: 196 | \setlength{\multicolsep}{0pt} 197 | \setlength{\columnsep}{0pt} 198 | \begin{multicols}{3} 199 | \begin{itemize} 200 | \item \texttt{article} 201 | \item \texttt{book} 202 | \item \texttt{report} 203 | \item \texttt{letter} 204 | \item \texttt{beamer} \textsmaller{(slides)} 205 | \item \texttt{standalone} \textsmaller{(graphics)} 206 | \item \texttt{acmart} \textsmaller{(ACM~template)} 207 | \item \texttt{IEEEtrans} \textsmaller{(IEEE~template)} 208 | \item[] 209 | \end{itemize} 210 | \end{multicols} 211 | \item Template class can accept options, e.g.~\latexinline|\documentclass[a4paper,10pt]{article}| 212 | \end{itemize} 213 | 214 | \begin{block}{Class Options for \texttt{article}, \texttt{report}, \texttt{book}, \texttt{letter}} 215 | \begin{description}[\scriptsize\texttt{titlepage}, \texttt{notitlepage}] 216 | \scriptsize 217 | \item[\normalfont\texttt{10pt}, \texttt{11pt}, \texttt{12pt}] \quad Set font size. 218 | \item[\normalfont\texttt{a4paper}, \texttt{letterpaper}, \ldots] \quad Defines 219 | the paper size. 220 | \item[\normalfont\texttt{fleqn}] \quad Typesets displayed formulae left-aligned 221 | instead of centred. 222 | \item[\normalfont\texttt{leqno}] \quad Places the numbering of formulae on the 223 | left hand side instead of the right. 224 | \item[\normalfont\texttt{titlepage}, \texttt{notitlepage}] \quad Specifies whether a new page should be started after the document title or not. 225 | \item[\normalfont\texttt{onecolumn}, \texttt{twocolumn}] \quad Typeset the document in one column or two columns. 226 | \item[\normalfont\texttt{twoside, oneside}] \quad Specifies whether double or single sided output should be generated. 227 | \item[\normalfont\texttt{landscape}] \quad Changes the layout of the document to print in landscape mode. 228 | \item[\normalfont\texttt{openright, openany}] \quad Makes chapters begin either only on right hand pages or on the next page available. 229 | \end{description} 230 | \end{block} 231 | \end{frame} 232 | 233 | % \begin{noindent} 234 | \begin{frame}[fragile]{Source File Structure} 235 | \begin{itemize} 236 | \item The region after \latexinline|\documentclass| and before \latexinline|\begin{document}| is called \alert{preamble}. 237 | \item You can load packages and define format of the document here, e.g.~\latexinline|\usepackage{amsmath}| 238 | \item Package can be loaded with options, e.g.~\latexinline|\usepackage[style=ieee]{biblatex}| 239 | \item To find the package document: 240 | \begin{itemize} 241 | \item Run \bashinline|texdoc | in command line 242 | \item \url{http://www.texdoc.net} 243 | \end{itemize} 244 | \item You start the body of the text with \latexinline|\begin{document}|. 245 | \item Finally, \latexinline|\end{document}| denotes the end of the document. 246 | \end{itemize} 247 | \end{frame} 248 | % \end{noindent} 249 | 250 | \section{Typesetting Text} 251 | 252 | \begin{frame}[fragile]{Syntax} 253 | \begin{itemize} 254 | \item The main body of \LaTeX{} code is plain text. 255 | \item \LaTeX{} treats contiguous spaces or a single linebreak as a single space. \\ 256 | It starts a new paragraph after empty lines. 257 | \begin{latexexample} 258 | It does not matter whether 259 | you enter one or several 260 | spaces after a word. 261 | 262 | An empty line starts a new 263 | paragraph. 264 | \end{latexexample} 265 | \item \latexinline|\\| or \latexinline|\newline| starts a new line without starting a new paragraph. 266 | \end{itemize} 267 | \end{frame} 268 | 269 | \begin{frame}[fragile]{Special Characters and Symbols} 270 | \begin{itemize} 271 | \item Certain characters are reserved, you need to use escape command to typeset them. 272 | \begin{latexexample} 273 | \# \$ \% \^{} \& \_ \{ \} \~{} 274 | \textbackslash 275 | \end{latexexample} 276 | \item \latexinline|`text'| and \latexinline|``text''| typeset `single quoted text' and ``double quoted text'' 277 | \item There are four kinds of dashes 278 | \begin{itemize} 279 | \item \textbf{hyphen}: \latexinline|-|, e.g.~part-time 280 | \item \textbf{en-dash}: \latexinline|--|, e.g.~Pages 1--10 281 | \item \textbf{em-dash}: \latexinline|---|, e.g.~yes---or no? 282 | \item \textbf{minus sign}: \latexinline|-| inside math environment, e.g.~$-1$ 283 | \end{itemize} 284 | \item Use \latexinline|\ldots| instead of \latexinline|...| to typeset ellipsis, e.g.~a, b, c, \ldots 285 | \end{itemize} 286 | \end{frame} 287 | 288 | \begin{frame}[fragile]{Font Face \& Size} 289 | \begin{table} 290 | \centering 291 | \begin{tabular}{@{}>{\columncolor{mintedbg}}ll@{\qquad}>{\columncolor{mintedbg}}ll@{}} 292 | \latexinline|\textrm{...}| & \textrm{roman} & 293 | \latexinline|\textsf{...}| & \textsf{sans serif} \\ 294 | \latexinline|\texttt{...}| & \texttt{typewriter} & 295 | & \\ 296 | \latexinline|\textmd{...}| & \textmd{medium} & 297 | \latexinline|\textbf{...}| & \textbf{bold face} \\ 298 | \latexinline|\textup{...}| & \textup{upright} & 299 | \latexinline|\textit{...}| & \textit{italic} \\ 300 | \latexinline|\textsl{...}| & \textsl{slanted} & 301 | \latexinline|\textsc{...}| & \textsc{small caps} \\ 302 | \latexinline|\emph{...}| & \emph{emphasized} & 303 | \latexinline|\textnormal{...}| & \textnormal{document font} 304 | \end{tabular} 305 | \caption{Font Face Commands} 306 | \end{table} 307 | 308 | \begin{itemize} 309 | \item Put the text inside the above commands to change the font face. \\ 310 | e.g.~\latexinline|\textbf{this text will be in bold face}| 311 | \end{itemize} 312 | \end{frame} 313 | 314 | \begin{frame}[fragile]{Font Face \& Size} 315 | \begin{columns} 316 | \begin{column}{0.5\textwidth} 317 | \begin{table} 318 | \centering 319 | \begin{tabular}{@{}>{\columncolor{mintedbg}}ll} 320 | \latexinline|\tiny| & {\tiny tiny font} \\ 321 | \latexinline|\scriptsize| & {\scriptsize very small font} \\ 322 | \latexinline|\footnotesize| & {\footnotesize quite small font} \\ 323 | \latexinline|\small| & {\small small font} \\ 324 | \latexinline|\normalsize| & {\normalsize normal font} \\ 325 | \latexinline|\large| & {\large large font} \\ 326 | \latexinline|\Large| & {\Large large font} \\ 327 | \latexinline|\LARGE| & {\LARGE very large font} \\ 328 | \latexinline|\huge| & {\huge huge} \\ 329 | \latexinline|\Huge| & {\Huge largest} 330 | \end{tabular} 331 | \caption{Font Size Commands} 332 | \end{table} 333 | \end{column} 334 | \begin{column}{0.5\textwidth} 335 | \begin{itemize} 336 | \item These commands will affect font size in the following text 337 | \item Use \latexinline|{ ... }| to limit its effect range \\ 338 | e.g.~\latexinline|{\small small size text}| 339 | \end{itemize} 340 | \end{column} 341 | \end{columns} 342 | 343 | \end{frame} 344 | 345 | \begin{frame}[fragile]{Spacing} 346 | \begin{itemize} 347 | \item Use package \href{http://texdoc.net/texmf-dist/doc/latex/geometry/geometry.pdf}{\emph{geometry}} to change the paper margin 348 | \begin{latexcode} 349 | \usepackage[top=3cm,bottom=3cm,left=2.5cm,right=2.5cm]{geometry} 350 | \end{latexcode} 351 | \item To force a new page, use: 352 | \begin{itemize} 353 | \item \latexinline|\newpage|: create a new page 354 | \item \latexinline|\clearpage|: create a new page and flush all the floats 355 | \item \latexinline|\cleardoublepage|: In addition to \latexinline|\clearpage|, it makes the next page a right-hand page for two-sided printing 356 | \end{itemize} 357 | \item Force a space using \latexinline|~| (unbreakable) or \latexinline|\ | (breakable) 358 | \item Insert horizontal/vertical spaces with \latexinline|\hspace{1em}| or \latexinline|\vspace{1ex}| 359 | \item Create a line break and insert vertical spaces using \latexinline|\\ [1ex]| 360 | \item Fill space using \latexinline|\hfill| or \latexinline|\vfill| 361 | \end{itemize} 362 | \end{frame} 363 | 364 | \begin{frame}[fragile]{Length Unit in \LaTeX} 365 | \begin{table} 366 | \centering 367 | \begin{tabular}{lp{.7\linewidth}} 368 | \toprule 369 | \textbf{unit} & \textbf{meaning} \\ 370 | \midrule 371 | pt & a point is approximately 1/72.27 inch \\ 372 | mm & a millimeter \\ 373 | cm & a centimeter \\ 374 | in & inch \\ 375 | ex & roughly the height of an `x' (lowercase) in the current font \\ 376 | em & roughly the width of an `M' (uppercase) in the current font \\ 377 | mu & math unit equal to 1/18 em \\ 378 | \bottomrule 379 | \end{tabular} 380 | \caption{Length Unit in \LaTeX} 381 | \end{table} 382 | \end{frame} 383 | 384 | \begin{frame}[fragile]{Alignment} 385 | \begin{latexexample} 386 | \begin{center} 387 | text to be centered 388 | \end{center} 389 | 390 | \begin{flushleft} 391 | text to be flushed left 392 | \end{flushleft} 393 | 394 | \begin{flushright} 395 | text to be flushed right 396 | \end{flushright} 397 | \end{latexexample} 398 | \end{frame} 399 | 400 | \begin{frame}[fragile]{Hyphenation} 401 | \begin{itemize} 402 | \item \LaTeX{} hyphenates words whenever necessary 403 | \item You can custom the hyphenation using \latexinline|\hyphenation{}| in the preamble 404 | \item For example, \latexinline|\hyphenation{FORTRAN Hy-phen-a-tion}| instructs: 405 | \begin{itemize} 406 | \item Prevents ``FORTRAN'', ``Fortran'' and ``fortran'' from being hyphenated 407 | \item Allow ``hyphenation'' to be hyphenated as well as ``Hyphenation'' 408 | \end{itemize} 409 | \item Or use \latexinline|\-| inserts a discretionary hyphen into a word 410 | \begin{latexexample} 411 | I think this is: su\-per\-cal\-% 412 | i\-frag\-i\-lis\-tic\-ex\-pi\-% 413 | al\-i\-do\-cious 414 | \end{latexexample} 415 | \item \latexinline|\mbox{...}| causes its argument to be kept together under all circumstances 416 | \begin{latexexample} 417 | My phone number will change soon. 418 | It will be \mbox{0116 291 2319}. 419 | \end{latexexample} 420 | \end{itemize} 421 | \end{frame} 422 | 423 | \begin{frame}[fragile]{Document Structure} 424 | \begin{itemize} 425 | \item \LaTeX~is built off the idea \emph{structure} over \emph{formatting} 426 | \item You can structure the documents using following commands 427 | \begin{latexcode} 428 | \part{part name} % only available in book 429 | \chapter{chapter name} % available in book and report 430 | \section{section name} 431 | \subsection{subsection name} 432 | \subsubsection{subsubsection name} 433 | \end{latexcode} 434 | \item The star version commands (e.g.~\latexinline|\section*{}|) suppress the numbering and are not added in the table of contents. 435 | \item \latexinline|\tableofcontents| can be used to create table of contents. 436 | \item Use \latexinline|\appendix| to put rest of content in the appendix. 437 | \item For large project, you can put each chapter/section in a separated file. \\ 438 | Then use \latexinline|\input{file_name}| to include them in the root file. 439 | \end{itemize} 440 | \end{frame} 441 | 442 | \begin{frame}[fragile]{List Structures} 443 | \begin{itemize} 444 | \item There are three list structures in \LaTeX 445 | \begin{latexexample} 446 | \begin{enumerate} 447 | \item Item 1 448 | \item Item 2 449 | \end{enumerate} 450 | \begin{itemize} 451 | \item Item 1 452 | \item Item 2 453 | \end{itemize} 454 | \begin{description} 455 | \item[key1] Item 1 456 | \item[key2] Item 2 457 | \end{description} 458 | \end{latexexample} 459 | \end{itemize} 460 | \end{frame} 461 | 462 | \begin{frame}[fragile]{List Structures} 463 | \begin{itemize} 464 | \item You can use them in nested fashion 465 | \begin{latexexample} 466 | \begin{enumerate} 467 | \item Level 1 468 | \begin{enumerate} 469 | \item Level 2 470 | \end{enumerate} 471 | \item Level 1 472 | \begin{itemize} 473 | \item Level 2 474 | \end{itemize} 475 | \end{enumerate} 476 | \end{latexexample} 477 | \end{itemize} 478 | \end{frame} 479 | 480 | \begin{frame}[fragile]{List Structures} 481 | \begin{itemize} 482 | \item Use package \href{http://texdoc.net/texmf-dist/doc/latex/enumitem/enumitem.pdf}{\emph{enumitem}} to custom the list format 483 | \begin{latexcode} 484 | \usepackage{enumitem} 485 | \setlist{noitemsep,partopsep=0pt,topsep=.8ex} 486 | \setlist[enumerate,1]{label=\arabic*.,ref=\arabic*} 487 | \newlist{inlineenum}{enumerate*}{1} 488 | \setlist[inlineenum]{label=(\roman*),ref=(\roman*)} 489 | 490 | \begin{itemize}[label=-] 491 | \item Item 492 | \end{itemize} 493 | \end{latexcode} 494 | \end{itemize} 495 | \end{frame} 496 | 497 | \begin{frame}[fragile]{Math} 498 | \begin{itemize} 499 | \item Common mathematical packages 500 | \begin{latexcode} 501 | \usepackage{amsmath} 502 | \usepackage{amssymb} 503 | \usepackage{amsfonts} 504 | \usepackage{mathrsfs} 505 | \usepackage{latexsym} 506 | \end{latexcode} 507 | \item List of mathematical symbols \url{https://www.caam.rice.edu/~heinken/latex/symbols.pdf} 508 | \item ``Short Math Guide for \LaTeX'' (access by \texdoc{short-math-guide}{http://texdoc.net/texmf-dist/doc/latex/short-math-guide/short-math-guide.pdf}) for comprehensive guide 509 | \end{itemize} 510 | \end{frame} 511 | 512 | \begin{frame}[fragile]{Math Mode \& Environment} 513 | \begin{itemize} 514 | \item There are two math mode 515 | \begin{itemize} 516 | \item Inline math mode: \latexinline|$\sum_k^n k$| or \latexinline|\(\sum_k^n k\)| to typeset \(\sum_k^n k\) 517 | \item Display math mode: \latexinline|$$\sum_k^n k$$| or \latexinline|\[\sum_k^n k\]| to typeset 518 | \[\sum_k^n k\] 519 | \end{itemize} 520 | \item Use \latexinline|equation| environment to number the equation in display mode 521 | \begin{latexexample} 522 | \begin{equation} 523 | E = mc^2 524 | \end{equation} 525 | \end{latexexample} 526 | \item Use \latexinline|\tag| to change the equation label 527 | \begin{latexexample} 528 | \begin{equation} 529 | 1 + 1 = 3 \tag{dumb} 530 | \end{equation} 531 | \end{latexexample} 532 | \end{itemize} 533 | \end{frame} 534 | 535 | \begin{frame}[fragile]{Math Mode \& Environment} 536 | \begin{itemize} 537 | \item Use \latexinline|align| environment to align multiple equations 538 | % \begin{noindent} 539 | \begin{latexexample} 540 | \begin{align} 541 | B' &=-\nabla \times E, \\ 542 | E' &=\nabla \times B - 4\pi j, 543 | \end{align} 544 | \end{latexexample} 545 | % \end{noindent} 546 | \item Use \latexinline|\nonumber| to disable the number for some lines 547 | % \begin{noindent} 548 | \begin{latexexample} 549 | \begin{align} 550 | a &= b + c \nonumber \\ 551 | &= d + e 552 | \end{align} 553 | \end{latexexample} 554 | % \end{noindent} 555 | \end{itemize} 556 | \end{frame} 557 | 558 | \begin{frame}[fragile]{Math Mode \& Environment} 559 | \begin{itemize} 560 | \item \latexinline|align*| environment disable the number entirely 561 | % \begin{noindent} 562 | \begin{latexexample} 563 | \begin{align*} 564 | B' &=-\nabla \times E, \\ 565 | E' &=\nabla \times B - 4\pi j, 566 | \end{align*} 567 | \end{latexexample} 568 | % \end{noindent} 569 | \item \latexinline|gather|/\latexinline|gather*| display a set of consecutive equations, centered and with no alignment 570 | % \begin{noindent} 571 | \begin{latexexample} 572 | \begin{gather*} 573 | 2x - 5y = 8 \\ 574 | 3x^2 + 9y = 3a + c 575 | \end{gather*} 576 | \end{latexexample} 577 | % \end{noindent} 578 | \end{itemize} 579 | \end{frame} 580 | 581 | \begin{frame}[fragile]{Math Symbols} 582 | \begin{itemize} 583 | \item The following symbols that can be used directly in math environment 584 | \begin{mathexamples} 585 | + - = ! / ( ) [ ] < > | ' : * 586 | \end{mathexamples} 587 | \item Greek letters 588 | \begin{mathexamples} 589 | \alpha, \beta, \gamma, \pi, \phi, \varphi 590 | \end{mathexamples} 591 | \item Operators 592 | \begin{mathexamples} 593 | \cos(2\theta) = \cos^2\theta-\sin^2\theta 594 | \lim\limits_{x \to \infty} \exp(-x) = 0 595 | a \bmod b 596 | x \equiv a \pmod{b} 597 | \log{(N)} 598 | \end{mathexamples} 599 | \end{itemize} 600 | \end{frame} 601 | 602 | \begin{frame}[fragile]{Math --- Custom Operators} 603 | \begin{itemize} 604 | \item You can define your own operators 605 | \begin{mathexample} 606 | \operatorname{arg\,max}_a f(a) = 607 | \operatorname*{arg\,max}_b f(b) 608 | \end{mathexample} 609 | \item If it is frequently used, 610 | \begin{latexcode*}{fontsize=\scriptsize} 611 | % declared in preamble 612 | \DeclareMathOperator*{\argmax}{arg\,max} % or \DeclareMathOperator{\argmax}{arg\,max} 613 | 614 | % then used in the document 615 | \[ \argmax_c f(c) \] 616 | \end{latexcode*} 617 | \end{itemize} 618 | \end{frame} 619 | 620 | \begin{frame}[fragile]{Math --- Power, Indices, Fraction, Root} 621 | \begin{itemize} 622 | \item Powers and indices are equivalent to superscripts and subscripts in normal text mode. The caret (\latexinline|^|) character is used to raise something, and the underscore (\latexinline|_|) is for lowering. If more than one expression is raised or lowered, they should be grouped using curly braces (\latexinline|{| and \latexinline|}|). 623 | \begin{mathexamples} 624 | k_{n+1} = n^2 + k_n^2 - k_{n-1} 625 | n^{22} 626 | f(n) = n^5 + 4n^2 + 2 |_{n=17} 627 | \sum_{i=1}^{n} i 628 | \lim_{x \to \infty} \frac{1}{x} 629 | \end{mathexamples} 630 | \item Fraction and root 631 | \begin{mathexamples} 632 | \frac{n!}{k!(n-k)!} = \binom{n}{k} 633 | \sqrt{2} 634 | \sqrt[n]{1+x+x^2+x^3+\dots+x^n} 635 | \end{mathexamples} 636 | \end{itemize} 637 | \end{frame} 638 | 639 | \begin{frame}[fragile]{Math --- Delimiters} 640 | \begin{itemize} 641 | \item Brackets, braces and delimiters 642 | \begin{mathexamples} 643 | ( a ), [ b ], \{ c \}, | d |, \| e \|, 644 | \langle f \rangle, \lfloor g \rfloor, 645 | \lceil h \rceil, \ulcorner i \urcorner 646 | \end{mathexamples} 647 | \item Automatic sizing 648 | \begin{mathexamples} 649 | \left(\frac{x^2}{y^3}\right) 650 | P\left(A=2\middle|\frac{A^2}{B}>4\right) 651 | \left\{\frac{x^2}{y^3}\right\} 652 | \end{mathexamples} 653 | \item Manual sizing 654 | \begin{mathexamples} 655 | ( \big( \Big( \bigg( \Bigg( 656 | \end{mathexamples} 657 | \end{itemize} 658 | \end{frame} 659 | 660 | \begin{frame}[fragile]{Math --- Matrix} 661 | \begin{itemize} 662 | \item Matrices 663 | \begin{mathexample} 664 | \begin{matrix} 665 | a & b & c \\ 666 | d & e & f \\ 667 | g & h & i 668 | \end{matrix} 669 | \end{mathexample} 670 | \begin{mathexample} 671 | \begin{pmatrix} 672 | a & b & c \\ 673 | d & e & f \\ 674 | g & h & i 675 | \end{pmatrix} 676 | \end{mathexample} 677 | \item Other matrix environment with different delimiter: \latexinline|bmatrix|, \latexinline|Bmatrix|, \latexinline|vmatrix|, and \latexinline|Vmatrix| 678 | \end{itemize} 679 | \end{frame} 680 | 681 | \begin{frame}[fragile]{Math --- Array} 682 | \begin{itemize} 683 | \item Array 684 | \begin{mathexample} 685 | \begin{array}{c|c} 686 | 1 & 2 \\ 687 | \hline 688 | 3 & 4 689 | \end{array} 690 | \end{mathexample} 691 | \begin{mathexample} 692 | f(x) = \left\{ 693 | \begin{array}{ll} 694 | x & \text{if } x > 0, \\ 695 | 0 & \text{otherwise}. 696 | \end{array}\right. 697 | \end{mathexample} 698 | \item Cases 699 | \begin{mathexample} 700 | f(x) = \begin{cases} 701 | x & \text{if } x > 0, \\ 702 | 0 & \text{otherwise}. 703 | \end{cases} 704 | \end{mathexample} 705 | \end{itemize} 706 | \end{frame} 707 | 708 | \begin{frame}[fragile]{Math Fonts} 709 | \begin{table} 710 | \begin{tabular}{>{\columncolor{mintedbg}}ll} 711 | \latexinline|\mathnormal{...}| & $\mathnormal{ABCDEF~abcdef~123456}$ \\ 712 | \latexinline|\mathrm{...}| & $\mathrm{ABCDEF~abcdef~123456}$ \\ 713 | \latexinline|\mathit{...}| & $\mathit{ABCDEF~abcdef~123456}$ \\ 714 | \latexinline|\mathbf{...}| & $\mathbf{ABCDEF~abcdef~123456}$ \\ 715 | \latexinline|\mathsf{...}| & $\mathsf{ABCDEF~abcdef~123456}$ \\ 716 | \latexinline|\mathtt{...}| & $\mathtt{ABCDEF~abcdef~123456}$ \\ 717 | \latexinline|\mathfrak{...}| & $\mathfrak{ABCDEF~abcdef~123456}$ \\ 718 | \latexinline|\mathcal{...}| & $\mathcal{ABCDEF}$ \\ 719 | \latexinline|\mathbb{...}| & $\mathbb{ABCDEF}$ 720 | \end{tabular} 721 | \caption{Math Fonts} 722 | \end{table} 723 | \end{frame} 724 | 725 | \begin{frame}[fragile]{Math Spacing} 726 | \begin{table} 727 | \centering 728 | \begin{tabular}{lp{.7\linewidth}} 729 | \toprule 730 | \textbf{\LaTeX~code} & \textbf{Description} \\ 731 | \midrule 732 | \latexinline|\qquad| & twice of \latexinline|\quad| (= 36 mu) \\ 733 | \latexinline|\quad| & space equal to the current font size (= 18 mu) \\ 734 | \latexinline|\,| & 3/18 of \latexinline|\quad| (= 3 mu) \\ 735 | \latexinline|\:| & 4/18 of \latexinline|\quad| (= 4 mu) \\ 736 | \latexinline|\;| & 5/18 of \latexinline|\quad| (= 5 mu) \\ 737 | \latexinline|\!| & -3/18 of \latexinline|\quad| (= -3 mu) \\ 738 | \latexinline|\ | & space after backslash, equivalent of space in normal text \\ 739 | \bottomrule 740 | \end{tabular} 741 | \caption{Spacing in Math} 742 | \end{table} 743 | \end{frame} 744 | 745 | \begin{frame}[fragile]{Math --- Dots} 746 | \begin{table} 747 | \centering 748 | \begin{tabular}{ll>{\small}p{.7\linewidth}} 749 | \toprule 750 | \textbf{\LaTeX~code} & \textbf{Output} & \textbf{Description} \\ 751 | \midrule 752 | \latexinline|\dots| & $\dots$ & generic dots. It automatically manages whitespaces according to the context, it's a higher level command. \\ 753 | \latexinline|\ldots| & $\ldots$ & the output is similar to the previous one, but there is no automatic whitespace management; it works at a lower level. \\ 754 | \latexinline|\cdots| & $\cdots$ & These dots are centered relative to the height of a letter. \\ 755 | \latexinline|\vdots| & $\vdots$ & vertical dots \\ 756 | \latexinline|\ddots| & $\ddots$ & diagonal dots \\ 757 | \latexinline|\hdotsfor{n}| & & to be used in matrices, it creates a row of dots spanning $n$ columns. \\ 758 | \bottomrule 759 | \end{tabular} 760 | \caption{Dots in Math} 761 | \end{table} 762 | \end{frame} 763 | 764 | \begin{frame}[fragile]{Math --- Dots} 765 | \begin{table} 766 | \centering 767 | \begin{tabular}{ll>{\small}p{.5\linewidth}} 768 | \toprule 769 | \textbf{\LaTeX~code} & \textbf{Output} & \textbf{Description} \\ 770 | \midrule 771 | \latexinline|A_1,A_2,\dotsc,| & $A_1,A_2,\dotsc,$ & for ``dots with commas'' \\ 772 | \latexinline|A_1+\dotsb+A_N| & $A_1+\dotsb+A_N$ & for ``dots with binary operators/relations'' \\ 773 | \latexinline|A_1 \dotsm A_N| & $A_1 \dotsm A_N$ & for ``multiplication dots'' \\ 774 | \latexinline|\int_a^b \dotsi| & $\int_a^b \dotsi$ & for ``dots with integrals'' \\ 775 | \latexinline|A_1\dotso A_N| & $A_1\dotso A_N$ & for ``other dots'' (none of the above) \\ 776 | \bottomrule 777 | \end{tabular} 778 | \caption{Semantic Dots in Math} 779 | \end{table} 780 | 781 | \begin{itemize} 782 | \item It is recommended to use these semantically oriented commands. 783 | \end{itemize} 784 | \end{frame} 785 | 786 | \begin{frame}[fragile]{Figure and Table} 787 | \begin{itemize} 788 | \item To create a float block to place figure or table 789 | \begin{latexcode} 790 | % for figure 791 | \begin{figure} ... \end{figure} 792 | % for table 793 | \begin{table} ... \end{table} 794 | % star version put it across multiple columns 795 | \begin{figure*} ... \end{figure*} 796 | \begin{table*} ... \end{table*} 797 | \end{latexcode} 798 | \item Positioning can be denoted as an optional argument 799 | \begin{latexcode} 800 | \begin{figure}[placement specifier] ... \end{figure} 801 | \end{latexcode} 802 | \end{itemize} 803 | \end{frame} 804 | 805 | \begin{frame}[fragile]{Figure and Table} 806 | \begin{table} 807 | \small 808 | \begin{tabular}{lp{.8\linewidth}} 809 | \toprule 810 | \textbf{Specifier} & \textbf{Description} \\ 811 | \midrule 812 | h & Place the float here, i.e., approximately at the same point it occurs in the source text (however, not exactly at the spot) \\ 813 | t & Position at the top of the page. \\ 814 | b & Position at the bottom of the page. \\ 815 | p & Put on a special page for floats only. \\ 816 | ! & Override internal parameters LaTeX uses for determining ``good'' float positions. \\ 817 | H & Places the float at precisely the location in the LaTeX code. \par Require \latexinline|\usepackage{float}|. \\ 818 | \bottomrule 819 | \end{tabular} 820 | \caption{Placement Specifier for Floats} 821 | \end{table} 822 | 823 | \begin{itemize} 824 | \item You can use single or multiple specifiers. \LaTeX{} will attempt to apply the rules in descending priority. e.g. \latexinline|\begin{figure}[tbhp] ... \end{figure}|. 825 | \item Use \latexinline|\FloatBarrier| to prevent floats from being moved over it. (Require \latexinline|\usepackage{placeins}|) 826 | \end{itemize} 827 | \end{frame} 828 | 829 | \begin{frame}[fragile]{Figure} 830 | \begin{itemize} 831 | \item \latexinline|\usepackage{graphicx}| is commonly required to insert the figure. 832 | \item Use \latexinline|\includegraphics[opt]{figure-path}| to add the figure \\ 833 | \latexinline|opt| can be \latexinline|width=.5\linewidth|, \latexinline|height=10cm|, or \latexinline|scale=0.5|, etc. 834 | \item \latexinline|\textwidth| means the width of current page, \latexinline|\linewidth| means the width of the current column. 835 | \item Image can be in .png/.jpg/.pdf/.eps format. It is recommended to use .pdf or .eps vector formats. 836 | \item Common tools to draw the figure: 837 | \begin{itemize} 838 | \item \textbf{inkscape} \url{https://inkscape.org} 839 | \item \textbf{tikz} \texdoc{tikz}{http://texdoc.net/texmf-dist/doc/generic/pgf/pgfmanual.pdf}, \url{https://github.com/xiaohanyu/awesome-tikz} 840 | \item \textbf{gnuplot} \url{http://www.gnuplot.info} 841 | \item \textbf{matplotlib} \url{https://matplotlib.org} or \textbf{seaborn} \url{https://seaborn.pydata.org} 842 | \item \url{https://www.flaticon.com} offers many vector graph assets. 843 | \end{itemize} 844 | \end{itemize} 845 | \end{frame} 846 | 847 | \begin{frame}[fragile]{Caption} 848 | \begin{itemize} 849 | \item Use \latexinline|\caption{}| to add the caption, \latexinline|\caption*{}| to suppress the numbering. 850 | \item Package \href{http://texdoc.net/texmf-dist/doc/latex/caption/caption-eng.pdf}{\emph{caption}} provides the command \latexinline|\captionof{}{}| that lets you typeset a caption without a floating environment. 851 | \item It also allows to custom the caption format. 852 | \begin{latexcode} 853 | \usepackage{caption} 854 | \captionsetup{format=plain, font=small, labelfont=bf} 855 | \end{latexcode} 856 | \end{itemize} 857 | \end{frame} 858 | 859 | \begin{frame}[fragile]{Figure} 860 | \begin{itemize} 861 | \item An example of full figure block 862 | \begin{latexcode} 863 | \begin{figure}[t] % put the figure at the top of the page 864 | \centering 865 | \includegraphics[width=.8\linewidth]{path-to-the-figure-file} 866 | \caption{The caption of this figure} 867 | \end{figure} 868 | \end{latexcode} 869 | \end{itemize} 870 | \end{frame} 871 | 872 | \begin{frame}[fragile]{TikZ Figure} 873 | \begin{itemize} 874 | \item You can create a tikz figure in a standalone file. 875 | \begin{latexcode*}{fontsize=\scriptsize} 876 | \documentclass[tikz]{standalone} 877 | \usetikzlibrary{positioning} 878 | \begin{document} 879 | \begin{tikzpicture} 880 | \node[draw] (start) { Start }; 881 | \node[draw, right=2cm of start] (end) { End }; 882 | \draw[-latex] (start) -- (end); 883 | \end{tikzpicture} 884 | \end{document} 885 | \end{latexcode*} 886 | \item The standalone file can be compiled directly or included in the document. 887 | \begin{latexcode*}{fontsize=\scriptsize} 888 | % need to pass additional `-shell-escape` argument to the compiler 889 | \usepackage[mode=buildnew]{standalone} 890 | 891 | \begin{figure}[t] 892 | \centering 893 | \includestandalone[width=0.8\linewidth]{./figure} % without the `.tex` extension 894 | \caption{TikZ Figure in Article} 895 | \end{figure} 896 | \end{latexcode*} 897 | \end{itemize} 898 | \end{frame} 899 | 900 | \begin{frame}[fragile]{Formatting Tables} 901 | \begin{itemize} 902 | \item The \emph{tabular} environment defines the table 903 | \item Use package \href{http://texdoc.net/texmf-dist/doc/latex/booktabs/booktabs.pdf}{\emph{booktabs}} to create professional table 904 | % \begin{noindent} 905 | \begin{latexexample} 906 | \centering\small 907 | \begin{tabular}{llr} 908 | \toprule 909 | \multicolumn{2}{c}{Item} & \\ 910 | \cmidrule(r){1-2} 911 | Animal & Description & Price (\$) \\ 912 | \midrule 913 | Gnat & per gram & 13.65 \\ 914 | & each & 0.01 \\ 915 | Gnu & stuffed & 92.50 \\ 916 | Emu & stuffed & 33.33 \\ 917 | Armadillo & frozen & 8.99 \\ 918 | \bottomrule 919 | \end{tabular} 920 | \end{latexexample} 921 | % \end{noindent} 922 | \item More guidance: \url{https://en.wikibooks.org/wiki/LaTeX/Tables} 923 | \item \href{https://ctan.org/pkg/excel2latex}{\emph{excel2latex}} can be used to generate \LaTeX~code from excel table 924 | \end{itemize} 925 | \end{frame} 926 | 927 | \begin{frame}[fragile]{Subfloats} 928 | \begin{itemize} 929 | \item Use package \href{http://texdoc.net/texmf-dist/doc/latex/caption/subcaption.pdf}{\emph{subcaption}} to create subfigures or subtables 930 | \begin{latexcode} 931 | \begin{figure} 932 | \centering 933 | \begin{subfigure}[b]{0.5\textwidth} 934 | \includegraphics[width=\textwidth]{gull} 935 | \caption{A gull} 936 | \end{subfigure} 937 | ~%add desired spacing between images, e.g. ~, \quad, \hfill, \\ etc. 938 | \begin{subfigure}[b]{0.5\textwidth} 939 | \includegraphics[width=\textwidth]{tiger} 940 | \caption{A tiger} 941 | \end{subfigure} 942 | \caption{Pictures of animals} 943 | \end{figure} 944 | \end{latexcode} 945 | \end{itemize} 946 | \end{frame} 947 | 948 | \begin{frame}[fragile]{References} 949 | \begin{itemize} 950 | \item You can use \latexinline|\label{