Showing posts with label Symbols. Show all posts
Showing posts with label Symbols. Show all posts

Sunday, 27 May 2012

Math in LaTeX


LaTeX is a widely used document markup language and a document preparation system for high-quality typesetting. Based on Donald E. Kruth’s TeX typesetting, it is used for producing scientific and mathematical documents of high typographic quality. However it is quite different from the word processors such as MS Word or LibreOffice etc. which uses the WYSIWYG approach. 

Getting to the basics of it, every LaTeX document must contain the following 3 components (every thing else being optional):

\documentclass{article}
\begin{document}
\end{document}

Here the 1st line tells LaTeX the type of document (article, report, book, letter), and the body of the document must occur between \begin{document} & \end{document} commands. Any text after \end{document} is ignored. 

Few commonly used commands: \pagestyle (controls page numbering and headings), \title, \author, \date, \section (creating separate sections) \tableofcontents etc. 

Math Mode: LaTeX uses a special math mode to display mathematics, as LaTeX typesets math notations differently than the normal text. Special environments have been declared for this purpose, 3 commonly used environments in math mode :

1. math environment : text formulae are displayed inline (within the body of the text) [ TeX shorthand $....$ ]
2. displaymath environment – displayed formulae are separate from the main text [ TeX shorthand $$....$$ ]
3. equation environment

An example:

\documentclass{article}
\begin{document}
$$ \frac{d}{dx}\left( \int\limits_{0}^{x} f(u)\,du\right)=f(x)$$
\end{document}

will produce :
 

Math symbols : the symbols in Math formula fall into different classes : Ord (simple/ordinary), Op (prefix operator), Bin (binary operator), Rel (relation/comparison), Open (left/opening delimiter), Close (right/closing delimiter), Pun (postfix/punctuation). It comprises of

Latin Letters, Arabic numerals (0-9), Greek letters are simple symbols. Example of Greek letters in LaTeX are \Gamma, \alpha, \beta etc. 
Other alphabetic symbols: \complement, \partial, \daleth etc
Misc. Simple Symbols: \#, \&,  \angle, \infty, \exists, \forall etc.
Binary Operator Symbols: *, +, -, \cdot, \div, \pm, etc.
Relational Symbols: <, =, >, \approx, \gg,  \ll, \prec etc.
Relation Symbols (arrows): \leftarrow, \Leftrightarrow, \rightarrow, \curvearrowleft, \curvearrowright etc.
Relation Symbols (Misc): \parallel, \backepsilon, \because, \in, \mid, \nparallel, \sqsubset, \subset etc.
Cumulative Operators: \int, \oint, \prod, \sum, \bigcap, \bigup, \bigsqup, \bigvee, etc.
Punctuation: . ; / | , ; \colon : ! ?
Pairing delimiters: (, ), [, ], \lbrace, \rbrace, \langle, \rangle, \lceil, \rceil, \lfloor, \rfloor etc.
Non-Pairing Extensible Symbols: \backlash, /, \vert etc.
Extensible vertical arrows: \uparrow, \Uparrow, \downarrow etc.
Accents: \bar{x}, \vec{x}, \dot{x}, \hat{x}, \acute{x}, etc.
Named Operators: \cos, \cot, \det, \lg, \lim, \ln, \log, \inf, \dim, \max, \min, \sin, \sup, \tan,

Another Example:

\documentclass{article}
\begin{document}
$$ \left(1+x\right)^n = 1 + nx + \frac{n\left(n-1\right)}{2!}x^2 + \frac{n\left(n-1\right)\left(n-2\right)}{3!}x^3 + \frac{n\left(n-1\right)\left(n-2\right)\left(n-3\right)}{4!}x^4 + \ldots $$
\end{document}

will produce: