A Quick Guide to LATEX
Total Page:16
File Type:pdf, Size:1020Kb
A quick guide toLATEX What is LATEX? Text decorations Lists LATEX (usually pronounced “LAY teck,” sometimes “LAH teck,” and Your text can be italic (\textit{italic}), bold (\textbf{bold}), or You can produce ordered and unordered lists. never “LAY tex”) is a format, or collection of macro commands, for underlined (\underline{underlined}). description command output TEX, the standard for most professional mathematics and scientific Your math can contain bold, R (\mathbf{R}), or blackboard bold, ℝ writing. T X is a powerful typesetting engine created by Donald (\mathbb{R}). You may want to used these to express the sets of real \begin{itemize} E • Thing 1 Knuth of Stanford University (his first version appeared in 1978). numbers (ℝ or R), integers (ℤ or Z), rational numbers (ℚ or Q), \item Thing 1 unordered list \item Thing 2 Leslie Lamport was responsible for creating LATEX, a popular set of and natural numbers (ℕ or N). • Thing 2 \end{itemize} user commands for TEX. A team of LATEX programmers created the For text appearing inside a math expression, use \text. \begin{enumerate} current version, LATEX 2휀. (0,1]=\{x\in\mathbb{R}:x>0\text{ and }x\le 1\} yields \item Thing 1 1. Thing 1 (0, 1] = {푥 ∈ ℝ ∶ 푥 > 0 and 푥 ≤ 1}. ordered list \item Thing 2 Mathematics \text 2. Thing 2 (Without the command it treats “and” as three variables: \end{enumerate} Math vs. text vs. functions (0, 1] = {푥 ∈ ℝ ∶ 푥 > 0푎푛푑푥 ≤ 1}.) In properly typeset mathematics, the variables appear in italics (for Spaces and new lines Symbols (in math mode) example, 푓 (푥) = 푥2+2푥−3). The exception to this rule is predefined The basics functions (for example, sin(푥)). Thus it is important to always treat LATEX ignores extra spaces and new lines. For example, text, variables, and functions correctly. See the difference between This sentence will look description command output 푥 and x, -1 and −1, and 푠푖푛(푥) and sin(푥). fine after it is compiled. addition + + There are two ways to present a mathematical expression – inline or This sentence will look fine after it is compiled. subtraction - − as a display. Leave one full empty line between two paragraphs. Place \\ at the plus or minus \pm ± end of a line to create a new line (but not create a new paragraph). multiplication (times) \times × Inline mathematical expressions This multiplication (dot) \cdot ⋅ Inline math expressions occur as part of the normal flow of text. To compiles division symbol \div ÷ produce an inline expression, place the math expression between division (slash) / / dollar signs ($). For example, typing $90^{\circ}$ is the same as like\\ circle plus \oplus ⊕ $\frac{\pi}{2}$ radians yields 90∘ is the same as 휋 radians. circle times \otimes ⊗ 2 this. equal = = Displayed mathematical expressions This compiles not equal \ne ≠ like Displays are mathematical expressions that are given their own line less than < < this. and are centered on the page. These are usually used for important greater than > > \noindent equations that deserve to be showcased on their own line or for large Use to prevent a paragraph from indenting. less than or equal to \le ≤ equations that cannot fit inline. To produce displayed mathematics, greater than or equal to \ge ≥ place the mathematical expression between the symbols \[ and \]. Comments approximately equal to \approx ≈ Typing \[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\] yields Use % to create a comment. Nothing on the line after the % will infinity \infty ∞ be typeset. $f(x)=\sin(x)$ %this is the sine function yields dots 1,2,3,\ldots 1, 2, 3, … −푏 ± √푏2 − 4푎푐 푓 (푥) = sin(푥). dots 1+2+3+\cdots 1 + 2 + 3 + ⋯ 푥 = . fraction \frac{a}{b} 푎 2푎 푏 Delimiters square root \sqrt{x} √푥 Display style 푛th root \sqrt[n]{x} 푛√푥 description command output a^b 푏 To get full-size inline math, use \displaystyle. Use this sparingly. exponentiation 푎 a_b Typing this $\displaystyle \sum_{n=1}^{\infty}\frac{1}{n}$, parentheses (x) (x) subscript 푎푏 |x| and not this $\sum_{n=1}^{\infty}\frac{1}{n}$ yields square brackets [x] [x] absolute value |푥| ∞ natural log \ln(x) ln(푥) 1 ∞ curly braces \{x\} {x} this ∑ , and not this ∑ 1 . logarithms \log_{a}b log 푏 푛 푛=1 푛 푎 푛=1 To automatically make delimiters large enough to fit the content, use exponential function e^x=\exp(x) 푒푥 = exp(푥) Images them together with \right and \left. For example, \left\{ \sin degree \deg(f) deg(푓 ) \left( \frac{1}{n} \right) \right\} _{n}^{\infty} produces You can put images (pdf, png, jpg, or gif) in your document. They ∞ need to be in the same location as your .tex file when you compile 1 {sin ( )} . the document. Omit [width=.5in] if you want the image to be full- 푛 sized. 푛 \begin{figure}[tbp] Curly braces are non-printing characters that are used to gather text \includegraphics[width=.5in]{imagename.jpg} that has more than one character. Observe the differences between \caption{The (optional) caption goes here.} the four expressions x^2, x^{2}, x^2t, x^{2t} when typeset: 푥2, 푥2, \end{figure} 푥2푡, 푥2푡. Functions Calculus Number theory description command output description command output description command output maps to \to → 푑푓 \mid derivative \frac{df}{dx} divides ∣ composition \circ ∘ 푑푥 does not divide \not \mid ∤ |x|=\begin{cases} derivative f' 푓 ′ div \operatorname{div} div piecewise x & x\ge 0\\ {⎧푥 푥 ≥ 0 |푥| = mod \mod mod function -x & x<0 ⎨ 휕푓 ⎩{−푥 푥 < 0 partial derivative \frac{\partial f}{\partial x} greatest common divisor \gcd gcd \end{cases} 휕푥 ceiling \lceil x \rceil ⌈푥⌉ Greek and Hebrew letters integral \int ∫ floor \lfloor x \rfloor ⌊푥⌋ double integral \iint ∬ command output command output triple integral \iiint ∭ Geometry and trigonometry limits \lim_{x\to \infty} lim \alpha 훼 \tau 휏 푥→∞ description command output ∞ \beta 훽 \theta 휃 summation \sum_{n=1}^{\infty}a_n ∑ 푎 angle \angle ABC ∠퐴퐵퐶 \chi 휒 \upsilon 휐 푛 푛=1 degree 90^{\circ} 90∘ \delta 훿 \xi 휉 ∞ triangle \triangle ABC △퐴퐵퐶 \epsilon 휖 \zeta 휁 product \prod_{n=1}^{\infty}a_n ∏ 푎푛 \varepsilon 휀 \Delta ∆ 푛=1 segment \overline{AB} 퐴퐵 sine \sin sin \eta 휂 \Gamma Γ Logic \gamma 훾 \Lambda Λ cosine \cos cos tangent \tan tan \iota 휄 \Omega Ω description command output \kappa 휅 \Phi Φ cotangent \cot cot \lambda 휆 \Pi Π not \sim ∼ secant \sec sec \mu 휇 \Psi Ψ and \land ∧ cosecant \csc csc \nu 휈 \Sigma Σ or \lor ∨ inverse sine \arcsin arcsin \omega 휔 \Theta Θ if...then \to → inverse cosine \arccos arccos \phi 휙 \Upsilon Υ if and only if \leftrightarrow ↔ inverse tangent \arctan arctan \varphi 휑 \Xi Ξ logical equivalence \equiv ≡ \pi 휋 \aleph ℵ therefore \therefore ∴ Symbols (in text mode) \psi 휓 \beth ℶ there exists \exists ∃ These symbols do not have to be surrounded by dollar signs. \rho \daleth for all \forall ∀ 휌 ℸ description command output \sigma 휎 \gimel ℷ implies \Rightarrow ⇒ equivalent \Leftrightarrow ⇔ dollar sign \$ $ Set theory percent \% % Linear algebra \& description command output ampersand & \# description command output pound # set brackets \{1,2,3\} {1, 2, 3} backslash \textbackslash \ element of \in ∈ vector \vec{v} ⃗푣 left quote marks `` “ not an element of \not\in ∉ vector \mathbf{v} v right quote marks '' ” subset of \subset ⊂ norm ||\vec{v}|| || ⃗푣|| single left quote ` ‘ subset of \subseteq ⊆ \left[ single right quote ' ’ not a subset of \not\subset ⊄ \begin{array}{ccc} hyphen X-ray X-ray contains \supset ⊃ 1 & 2 & 3 \\ 1 2 3 en-dash pp. 5--15 pp. 5–15 ⎡ ⎤ contains \supseteq ⊇ matrix 4 & 5 & 6\\ ⎢ 4 5 6 ⎥ em-dash Yes---or no? Yes—or no? union \cup ∪ 7 & 8 & 0 ⎣ 7 8 0 ⎦ intersection \cap ∩ \end{array} A 10 Getting started with and LTEX big union \bigcup_{n=1}^{10}A_n ⋃ 퐴 \right] 푛=1 푛 LATEX collaborative authoring online: https://overleaf.com 10 A https://overleaf.com/learn big intersection \bigcap_{n=1}^{10}A_n ⋂ 퐴 \left| Overleaf LTEX documentation: 푛=1 푛 A empty set \emptyset ∅ \begin{array}{ccc} Learn LTEX in 30 minutes: https://overleaf.com/learn/latex/Learn_LaTeX_in_30_minutes power set \mathcal{P} 풫 1 & 2 & 3 \\ ∣ 1 2 3 ∣ ∣ ∣ minimum \min min determinant 4 & 5 & 6 \\ ∣ 4 5 6 ∣ Comprehensive TEX Archive Network: http://www.ctan.org/ ∣ ∣ maximum \max max 7 & 8 & 0 ∣ 7 8 0 ∣ TEX Users Group: http://www.tug.org/ supremum \sup sup \end{array} Want to work offline? Local install options for Linux or Windows: infimum \inf inf \right| TEX Live; MacOS: MacTEX; Windows: MiKTEX limit superior \limsup lim sup determinant \det(A) det(퐴) limit inferior \liminf lim inf trace \operatorname{tr}(A) tr(퐴) Based on the version by Dave Richeson, Dickinson College, \overline{A} dimension \dim(V) dim(푉) http://divisbyzero.com/. Reproduced with permission. closure 퐴.