Skip to content
Zhengyuan Zhu
Go back

Latex & Mathjax Usage

Latex

Environment Setup:

Editing LaTeX on Mac using Sublime and Skim

Install Package Control in Sublime Text

Install LaTex Tools

Install Skim

Basic Usage of the Environment

Commands and Environments (case sensitive)

1
2
3
4
\documentclass{...} //use document class
\usepackage{...} //load package
    \begin{document}
    \end{document}

Packages and Document Classes

Document Class \documentclass[<options>]{<class-name>}

<class-name> includes:

<options> includes:

 Example: Paper size A4, base font size 11pt, two-sided layout \documentclass[11pt,twoside,a4paper]{article}

File Organization

1
2
3
4
5
6
7
8
\include{<filename>}
\input{<filename>}

Using LaTeX to Typeset Text

UTF-8 Encoding

\usepackage[utf-8]{inputenc}

Typesetting Chinese

1
2
3
4
\documentclass{ctexart}
\begin{document}
Chinese LaTeX typesetting
\end{document}

Symbols in LaTeX

Spaces and paragraphs  One or multiple spaces & one or multiple line breaks have the same effect

Comment %

Document Elements

Chapter and Section Titles

1
\section{<title>} \subsection{<title>} \subsubsection{<title>} \paragraph{<title>} \subparagraph{<title>}

Insert URL Centered

\begin{center} \url{https://cmt.research.microsoft.com/NIPS2018/} \end{center}

Common Errors

Latex Chinese utf-8 encoding

Use CJKutf8 to solve the problem

1
2
3
4
5
6
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{<font>}
 ...
\end{CJK}
\end{document}

font is for simplified Chinese fonts. CJK comes with utf-8 simplified fonts gbsn (Song) and gkai (Kai). The following code is a simple example (make sure to save the tex file in utf-8 format):

1
2
3
4
5
6
7
8
%test.tex
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
This is a CJKutf8 example, using gbsn font.
\end{CJK}
\end{document}

Basic Usage of MathJax

    Name: alpha, uppercase: $A$, Tex: A, lowercase: $\alpha$, Tex: \alpha

Fonts

Adding Numbers to Formulas

1
Math formula\eqno number

Uncommon Errors

Cannot recognize rarely used symbols in formulas

Try importing package:

1
\usepackage{amssymb}        % prevent bugs for formula symbol

References


Share this post on:

Previous Post
Python Language Learning
Next Post
Handwritten Notes Directory
Jack the orange tabby cat
I'm Jack 🧡
Luna the tuxedo cat
I'm Luna! 🖤