Icey One
My wish is to see you again, even across the world.
LaTeX Note

This post is used to record my $ \LaTeX $ study notes, you can also use it as a dictionary of common symbols. It will be updated for a long time, please make good use the search key (Cltr + F or ⌘ + F)

If you are a LaTeX beginner, I recommend you to read lshort – A short introduction to $ \LaTeX2e $ . I suggest you read it three times, read it once, do it again, and then try to find a paper for $ \LaTeX $ typesetting by yourself for the third time, and check this book again if you find any problems. If you’re just writing notes/homework, this book is perfectly adequate.

1. Packages Usage

1.1 Hyperref

1
2
3
4
5
\usepackage[colorlinks,
            linkcolor=red,			% modify link color of hyperlinks
            anchorcolor=blue,		% modify link color of lables
            citecolor=green,		% modify link color of references
            ]{hyperref}

1.2 Listings

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
\usepackage{listings} % generate code fence, if you don't need, please remove it and the follwing
\lstset{ %
    language = ,                      % the language of the code
    basicstyle = \footnotesize,       % the size of the fonts that are used for the code
    numbers = left,                   % where to put the line-numbers
    numberstyle = \tiny\color[RGB]{0,0,0},  % the style that is used for the line-numbers
    stepnumber = 1,                   % the step between two line-numbers. If it's 1, each line will be numbered
    numbersep = 14pt,                 % how far the line-numbers are from the code
    backgroundcolor = \color{white},  % choose the background color. You must add \usepackage{color}
    showspaces = false,               % show spaces adding particular underscores
    showstringspaces = false,         % underline spaces within strings
    showtabs = false,                 % show tabs within strings adding particular underscores
    frame = single,                   % adds a frame around the code
    rulecolor = \color{black},        % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here))
    tabsize = 2,                      % sets default tabsize to 2 spaces
    captionpos = b,                   % sets the caption-position to bottom
    breaklines = true,                % sets automatic line breaking
    breakatwhitespace = false,        % sets if automatic breaks should only happen at whitespace
    title = \lstname,                 % show the filename of files included with \lstinputlisting; also try caption instead of title
    keywordstyle = \color{blue},      % keyword style
    commentstyle = \color{dkgreen},   % comment style
    stringstyle = \color{mauve},      % string literal style
    escapeinside = {\%*}{*)},         % if you want to add LaTeX within your code
    morekeywords = {*,...}            % if you want to add more keywords to the set
  }

2. Download & Configure

This section introduces how to download $ \LaTeX $ and use it in VS Code.

2.1 Install

Download and install the version of $ \LaTeX $ and VS Code that suits you. Install $ \LaTeX $-Workshop in VS Code Extensions. Now we can’t compile .tex files, need to modify config.

2.2 Configure

  1. Click Setting in the lower left
  2. Click Open Setings (JSON)` in the upper right.

The following is my configuration, just copy it.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/------------------------------LaTeX config----------------------------------
    // setting whether to auto build 
    "latex-workshop.latex.autoBuild.run":"never",
    // Show context menu 
    "latex-workshop.showContextMenu":true,
    // intelligent spilling
    "latex-workshop.intellisense.package.enabled": true,
    //set whether to pop up the bubble setting when a compilation error occurs
    "latex-workshop.message.error.show": false,
    "latex-workshop.message.warning.show": false,
    // setting command and tools for compile
    "latex-workshop.latex.tools": [
        {
            "name": "xelatex",
            "command": "xelatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "pdflatex",
            "command": "pdflatex",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "%DOCFILE%"
            ]
        },
        {
            "name": "latexmk",
            "command": "latexmk",
            "args": [
                "-synctex=1",
                "-interaction=nonstopmode",
                "-file-line-error",
                "-pdf",
                "-outdir=%OUTDIR%",
                "%DOCFILE%"
            ]
        },
        {
            "name": "bibtex",
            "command": "bibtex",
            "args": [
                "%DOCFILE%"
            ]
        }
    ],
    // configure compile rule set
    "latex-workshop.latex.recipes": [
        {
            "name": "XeLaTeX",
            "tools": [
                "xelatex"
            ]
        },
        {
            "name": "XeLaTeX*2",
            "tools": [
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "PDFLaTeX",
            "tools": [
                "pdflatex"
            ]
        },
        {
            "name": "PDFLaTeX*2",
            "tools": [
                "pdflatex",
                "pdflatex"
            ]
        },
        {
            "name": "BibTeX",
            "tools": [
                "bibtex"
            ]
        },
        {
            "name": "LaTeXmk",
            "tools": [
                "latexmk"
            ]
        },
        {
            "name": "xelatex -> bibtex -> xelatex*2",
            "tools": [
                "xelatex",
                "bibtex",
                "xelatex",
                "xelatex"
            ]
        },
        {
            "name": "pdflatex -> bibtex -> pdflatex*2",
            "tools": [
                "pdflatex",
                "bibtex",
                "pdflatex",
                "pdflatex"
            ]
        }
    ],
    //clean up files
    "latex-workshop.latex.clean.fileTypes": [
        //"*.aux",
        "*.bbl",
        "*.blg",
        "*.idx",
        "*.ind",
        "*.lof",
        "*.lot",
        //"*.out",
        "*.toc",
        "*.acn",
        "*.acr",
        "*.alg",
        "*.glg",
        "*.glo",
        "*.gls",
        "*.ist",
        "*.fls",
        "*.log",
        "*.fdb_latexmk"
    ],
    // auto clean files when compile errors
    "latex-workshop.latex.autoClean.run": "onFailed",
    // using the last recipe to compile it
    "latex-workshop.latex.recipe.default": "lastUsed",
    // reverse sync between .tex and .pdf. ctrl/cmd +click(default) or double click
    "latex-workshop.view.pdf.internal.synctex.keybinding": "double-click",
    "latex-workshop.view.pdf.viewer": "tab",

If you want to know how to modify or have other question, please read $ \LaTeX $-Workshop Wiki .

3. Mathematics Symbols

If no statement is added, this section defaults add amsmath package.

3.1 Greek Letters

Symbol Code Symbol Code
$ \alpha $ \alpha $ \nu $ \nu
$ \beta $ \beta $ \xi $ \xi
$ \gamma $ \gamma o o
$ \delta $ \delta $ \pi $ and $ \varpi $ \pi and \varpi
$ \epsilon $ and $\varepsilon$ \epsilon and \varepsilon $ \rho $ and $ \varrho $ \rho and \varrho
$ \zeta $ \zeta $ \sigma $ and $ \varsigma $ \sigma and \varsimga
$ \eta $ \eta $ \tau $ \tau
$ \theta $ and $ \vartheta $ \theta and vartheta $ \upsilon $ upsilon
$ \iota $ \iota $ \phi $ and $ \varphi $ \phi and \varphi
$ \kappa $ \kappa $ \chi $ \chi
$ \lambda $ \lambda $ \psi $ \psi
$ \mu $ \mu $ \omega $ \omega

3.2 Operators

3.2.1 Functions

Symbol Code
$ \sin $, $ \arcsin $ and $ \sinh $, etc. \sin, \arcsin and \sinh, etc.
$ \exp $ \exp
$ \log $, $ \ln $ and $ \lg $ log, ln and lg
$ \dim $ $ \det $ and $ \deg $ \dim, \det and deg
$ \bmod $ and $ \pmod{b} $ \bmod, \pmod{b}
$ \lim $, $ \limsup $ and $ \liminf $ \lim, \limsup and \liminf
$ \sup $, $ \inf $, $ \max $ and $ \min $ \sup, \inf, \max and \min
$ \nabla $ \nabla

3.2.2 can Add \not

You can add \not prefix, which means the opposite meaning, for example \notin

Symbol Code
$ \ge $ and $ \le $ \ge and \le
$ \in $ and $ \ni $ \in and \ni
$ \subset $ and $ \subseteq $ \subset and \subseteq
$ \supset $ and $ \supseteq $ \supset and \supseteq

3.2.3 Can’t Add \not

Symbol Code
$ \pm $ and $ \mp $ \pm and \mp
$ \times $ and $ \div $ \times and \div
$ \cdot $, $ \oplus $ and $ \otimes $ \cdot, \oplus and otimes
$ \cup $, $ \cap $ and $ \sqcup $ \cup, cup and \sqcup
$ \gets $ and $ \to $ \gets and \to
$ \implies $ and $ \iff $ \implies and \iff

3.2.4 Big Operators

Symbol Name
$ \sum $ and $ \prod $ \sum and \prob
$ \bigcup $ \bigcup
$ \int $, $ \oint $ and $ \iint $ \int, \oint and \iint

3.3 Math Letters

Symbol Code Remark
$ \mathbb{A} $ \mathbb{A} amssymb
$ \mathscr{A} $ \mathscr{A} mathrsfs
$ \mathcal{A} $ \mathbal{A}