Skip to content

LaTeX

  • traps
  • resources
  • VScode extension
  • customized commands
  • LaTex Notes
    • font:
    • some commands
    • Figure
      • tikz
    • Alignment
    • symbols
      • symbol search
      • Hand-written Symbol Recognition
      • all native symbols:
        • note on symbols:
      • common math symbols:
  • LaTeX Study with overleaf
    • General
    • Part 1
      • General
      • Escape Char
      • Math
      • Environments
    • Part 2
    • More commands
    • Table and graph
    • bibTeX
    • more commands
    • Part 3
      • rearrange content :
      • Presentation / slide / PPT
      • Figure
      • Todo notes
      • Spreadsheet

traps#

:TAG:bad-char;illegal-char The character, Unicode character − (U+2212), is not minus sign. It won't be reported in tikz environment. Use Highlight Bad Chars to avoid this.

resources#

https://www.math.uh.edu/~torok/math_6298/latex

VScode extension#

There are also some thing in the other file called VScode, #extension and I didn't move it here

I use: LaTeX Workshop To use chinese chars:

1
2
\usepackage{CJKutf8}
\begin{CJK}{UTF8}{gbsn}肯定前件\end{CJK}

customized commands#

AKA LaTeX Macros

1
2
\newcommand{\name}[no_of_parameters]{defn_of_command}
\newcommand{\name}[no_of_parameters][default_1st_variable]{defn_of_command}

https://www.math.uh.edu/~torok/math_6298/latex/macros.html

To use slot https://www.overleaf.com/learn/latex/Environments https://www.math.uh.edu/~torok/math_6298/latex/new-environments.html

1
\newenvironment{env_name}[number_of_parameters]{def_begin}{def_end} \renewenvironment{env_name}[number_of_parameters]{def_begin}{def_end}
  • def_begin is the text substituted for every occurrence of \begin{env_name};
  • def_end is the text substituted for every occurrence of \end{env_name};
  • if the number of parameters is zero, the square bracket can be omitted, or used as [0];
  • there can be at most 9 parameters; they are referred to in def_begin by #1, #2,..., #9;
  • NOTE: these parameters cannot be refered to in def_end.

LaTex Notes#

font:#

https://tex.stackexchange.com/questions/58098/what-are-all-the-font-styles-i-can-use-in-math-mode

cmd content
\mathup Upright serif
\mathbfup Bold upright serif
\mathit Italic serif
\mathbfit Bold italic serif
\mathsfup Upright sans-serif
\mathsfit Italic sans-serif
\mathbfsfup Bold upright sans-serif
\mathbfsfit¹ Bold italic sans-serif
\mathtt Typewriter
\mathbb Blackboard bold
\mathbbit Blackboard bold italic
\mathscr Script
\mathbfscr Bold script²
\mathcal Calligraphic
\mathbfcal Bold calligraphic²
\mathfrak Fraktur
\mathbffrak Bold Fraktur²
\mathbf

some commands#

to show the LaTeX sign $\LaTeX$ , use $\LaTeX$. Not $\Latex$, nor $\latex$ \multicolumn is for tabular table. \minipage can insert a mini table... More at http://noodle.med.yale.edu/latex/latex2e-html/ltx-267.html \newcommand vs. \DeclareMathOperator. Use the second one since it is more specific (holds more information)

\operatorname instead of \text

Figure#

tikz#

examples tutorial some references: overleaf

  • package: \usepackage{tikz}
  • style: \begin{tikzpicture}[CLASSNAME/.style={STYLES}] e.g. \begin{tikzpicture}[darkstyle/.style={circle,draw,fill=gray!40,minimum size=20}] NOTE: no empty line after \begin{tikzpicture}
  • elements: \node[CLASSNAME,STYLE] e.g. \node[darkstyle,minimum size=20]
  • loop: \foreach \x/y in {0/1,3/4}
  • nested loop: \foreach \x in {0,...,4} \foreach \y in {0,...,4}
  • draw line: \draw (\x\y)--(\x\yi) (\y\x)--(\yi\x) ; \draw[dotted] or \draw[densely dotted] or \draw[loosely dotted],
  • color a region \draw[fill=red] (0,11) -- (3,8) -- (3,4) -- (0,7) -- cycle;

Alignment#

multicols package. http://mirrors.ctan.org/macros/latex/required/tools/multicol.pdf

1
2
3
4
5
\begin{multicols}{2}
Column 1
\columnbreak
Column 2
\end{multicols}

\Big( gives a bigger parenthesis, it works for more symbols. $\Big($

symbols#

Hand-written Symbol Recognition#

Detexify: http://detexify.kirelabs.org/classify.html

all native symbols:#

The Comprehensive $\LaTeX$ Symbol List: https://ctan.javinator9889.com/info/symbols/comprehensive/symbols-a4.pdf

note on symbols:#

The symbol we used for congruent before is not showing on Mac. Seems that $\cong$ ($\cong$) is more commonly used now.

common math symbols:#

$\LaTeX$ Mathematical Symbols : https://www.caam.rice.edu/~heinken/latex/symbols.pdf

LaTeX Study with overleaf#

General#

With plan from overleaf https://www.overleaf.com/learn/latex/Free_online_introduction_to_LaTeX_(part_1)

Part 1#

200805

General#

  • Commands start with a backslash \.
  • Every document starts with a \documentclass command.
  • Single quotes:
1
`text' and ``text'' % will be compiled to ‘text’ and “text”.

$text' and ``text''$ -- Apparently, Obsidian does not use the Full LaTeX Engine.\begin{ENV_NAME} \end{ENV_NAME}`define a environment of ENV_NAME

Escape Char#

1
2
3
4
% percent sign
# hash (pound / sharp) sign
& ampersand
$ dollar sign

need to escape it by preceding it with a backslash

Math#

Use

  • caret ^ for superscripts and underscore _ for subscripts.
  • curly braces { } to group superscripts and subscripts.
  • don’t put blank lines in your mathematics.
  • use \operatorname for non-common mathematical operators.

Environments#

  • align* environment An ampersand & separates the left column from the right column double backslash \\ starts a new line.

Part 2#

200806

More commands#

  • \section \subsection gives automatic index number
  • \label \ref for automatic numbering
  • \title{A_TITLE} will not show title, \maketitle does.
  • square brackets [ ]for optional arguments, instead of braces{ }.

Table and graph#

  • tabular environment from the tabularx package
  • begin{tabular}{lrr}, the {lrr} specifies column alignment — left, right, right, and
  • {|l|r|r|} indicates the vertical lines. \hline for horizontal lines
  • ampersand & separates columns, double backslash \\ starts a new row. (like align* ENV)

bibTeX#

  • need a .bib file for references in bibtex database format.
  • natbib package with \citet and \citep. to show citation. \citetcomplied to only year and \citep to both author and year.
  • \bibliography{bib-example} and \bibliography{bib-example} tells the format and origin of the .bib file.

more commands#

  • \tableofcontents generates a table of contents from \section.
  • \documentclass{scrartcl} or \documentclass[12pt]{IEEEtran} changes the document class, which I don't yet know what it means.
  • \newcommand{\NEWCOMMAND}{CONTENT_OF_COMMAND}can program a 'macro', e.g. \newcommand{\rperf}{% \rho_{\text{perf}}}

    but this is more like a 'shortcut' because it does not accept param/arg.

Part 3#

rearrange content :#

  • tool
    • LaTeX Study > Todo notes
  • other format than a document
    • LaTeX Study > Presentation slide PPT
    • LaTeX Study > Figure
    • LaTeX Study > Spreadsheet

Presentation / slide / PPT#

-beamer package for creating presentations. \documentclass{beamer}

  • \begin{frame}, then \frametitle{FRAME_TITLE} entitle a frame with FRAME_TITLE
  • \sections to group frames, then the \tableofcontents will generate an outline
  • columns and column environments break the slide into columns.
    • argument for each column determines its width. e.g. \begin{column}{0.4\textwidth}
    • multicol package automatically breaks your content into columns
  • \usetheme{Darmstadt} to use theme from https://deic-web.uab.cat/~iblanes/beamer_gallery/index_by_theme.html
  • Animation
  • \pause, \only, \alt, and \uncover

Figure#

  • TikZ is a package for drawing figures in LATEX. \begin{tikzpicture} \draw (0,0) -- (1,1); % a line \end{tikzpicture}
  • default coordinates are centimetres
  • it should be another independent doc from LaTeX Study https://texample.net/tikz/

Todo notes#

  • Notes with todonotes package
  • the \newcommand accepts arg. In this way: \newcommand{\CMD_NAME}[1]{\CMD_CONTENT{ #1 }}

    use { #1 } to reference arg [1] * \listoftodos

Spreadsheet#

  • spreadtab package