Aurora编辑LaTex公式基本用法教程

来源:互联网 发布:全球互联网大会 知乎 编辑:程序博客网 时间:2024/05/29 05:56

LaTeX basics

Math mode

LaTeX has two primary modes of operation—text and math modes. Both are equally important when using LaTeX as a typesetting system; however, since the main purpose of Aurora is editing equations, the math mode is the one you will probably use most often. Thus, when you see Aurora initializing equations it creates to “$ $” or “\[ \]” and placing the caret in between, it does so to enter the math mode.

Spaces and line breaks are typically ignored by LaTeX and doubly so in math mode, because it can generally infer proper placement from the mathematical expression alone.

Inline versus display equations

LaTeX distinguishes formulas that are a part of a sentence, such as the following gratuitous display of Greek symbols , from formulas that stand by themselves, such as the Schrödinger equation below:

The former are called inline equations, whereas the latter are display equations.

For Aurora, the most important differences between the two lie in the sizes of certain operators (fractions, sum, integrals, and so on) and the placement of limits in expressions. Simply put, LaTeX tries to fit inline equations into a single line of text, but lets display equations claim as much space as they need:

$ $” (inline)$\lim_{\to 0} \frac{\sin x}{x} = 1$“\[ \]” (display)\[\lim_{\to 0} \frac{\sin x}{x} = 1\]

When creating a new equation using the “Insert equation” button on the Aurora toolbar or the “Insert Object…” command, Aurora initializes the formula in inline mode. To change the mode, simply change the dollar signs to \[ and\] or the other way around.

Commands

All the LaTeX commands—and that includes special symbols as well—begin with the backslash symbol \. For example, to insert the  sign into a formula, you might enter \pm. Many commands accept arguments, which go right after the command’s name. For example, an argument to the command that places a line over an expression (\overline) would be the expression to place that line over: \overline{A} gives .

Note that the curly braces in the example above are not strictly necessary, because the argument is only one character long. However, to make editing less error-prone, it is common to write braces even when they could be omitted.

Occasionally, a command may accept optional arguments—\sqrt, for example. These are given in square brackets right after the command name: \sqrt[3]{xy} produces .





Common expressions

What follows in this and next sections is but a very concise collection of most common and useful symbols available in LaTeX (and hence Aurora). It is primarily based on the material of:

  • (Not so) short introduction to LaTeX ,
  • Short Math Guide for LaTeX , and the
  • TeX Reference Card .

If you cannot find some symbol here or in the documents above, The Comprehensive LaTeX Symbol List thereference to over 3300 symbols that can be used in LaTeX (and thus, again, Aurora)—will most definitely have whatever it is you need.

Aurora’s default preamble includes both amsmath and amssymb; therefore, the examples below use symbols and commands from these packages indiscriminately. All these examples should be used in math mode unless noted otherwise.

Operations

square root

\sqrt{x+\sqrt{y}}

higher order roots

\sqrt[mn]{x+y} \quad \sqrt[3]{2}

root sign

\surd[x+y]

fractions

\frac{a+b}{x+\log\frac{Y}{Z}}

force large (display) fraction

\frac{a+b}{x+\log\dfrac{Y}{Z}}

continued fraction

1+\cfrac{2}{

  3+\cfrac{4}{

    5+\cfrac{6}{7+\dotsb}}} =

\frac{1}{\sqrt e - 1}

binomial

\binom{n+1}{k}

prime

y'' + y' + y = u

“mod”

\begin{array}{l}

  a\bmod n=b \\

  a\equiv b\pmod n \\

  a\equiv b\mod n \\

  a\equiv b\pod n

\end{array}

Subscripts and superscripts

subscripts

x_1, x_2 \quad a_{ij}

superscripts

x^\quad e^{2j\pi t} \quad

a_{ij}^2

multilevel subscripts

\sum_{\substack{

      1 \le m \le N, \\

      m\text{ odd}}} P(m)

nested sub/superscripts

a_{b_j} \quad e^{x^2}

sub- and superscripts before the symbol

{}_n C_k

subscripts and superscripts for large symbols

\sideset{^a_b}{'_c}\sum

 

Sums, integrals, and products

sum

\sum_{i=1}^{+\infty}

product

\prod_{\alpha \in U}

integral

\int_{x_0}^{x_1}

contour integral

\oint_C

double and triple integrals

\iint_\quad \iiint_S

even more integrals

\iiiint_\quad \idotsint_S

integrals with alternative limit placement

\int\limits_\alpha^\beta \quad

\iint\limits_S

unions and intersections

\bigcup_{\alpha\in S} \quad

\bigcap_{V\in\mathfrak{V}}

direct sums, co-products, and so on

\bigodot \quad \bigoplus

\bigotimes \quad \bigsqcup

\biguplus \quad \coprod

\bigvee \quad \bigwedge

Brackets

pairing brackets

\; ), [ \; ], \{ \\}

\lvert\;\rvert\lVert\;\rVert

\lceil\;\rceil\lfloor\;\rfloor

\langle\;\rangle

Aurora also defines the following two commands in its default preamble:

absolute value

\abs{u(t)}

norm

\norm{\hat{G}}_\infty

To make the brackets scale to the size of the enclosed expression, use \left and \right commands:

\left
\right

\left(

  \sum_{i=1}^{n} e^{2\pi j i^2}

\right)

plain

\sum_{i=1}^{n} e^{2\pi j i^2} )

Alternatively, the bracket size can be specified explicitly using the following commands:

\Biggl(  \biggl(  \Bigl(  \bigl\quad

\Biggr\} \biggr\} \Bigr\} \bigr\}

This may be necessary when \left and \right commands create delimiters that are visually too large:

\left
\right

\left[ \sum_j

      \left|\sum_i x_{ij}\right|^2

\right]^{1/2}

manually-sized

\biggl\sum_j

      \Bigl|\sum_i x_{ij}\Bigr|^2

\biggr]^{1/2}

or when \left and \right create brackets of the same size in nested expressions:

\left
\right

O\left(\left(

    m^2+n^2\right)\log n\right)

manually-sized

O\bigl((m^2+n^2)\log n\bigr)

Multiline formulas and piecewise functions

piecewise functions/cases

a_k = \begin{cases}

  k & \text{for $\le n/2$} \\

  n & \text{for $k=n/2$} \\

  k-1 & \text{otherwise}

\end{cases}

multiline equations (aligned at &)

\begin{split}\tan^2 x

  &\sin^2 x/\cos^2 x \\

  &1/\cos^2 x - 1

\end{split}

systems of equations

\left\{\begin{array}{l}

  ax+by=r_1 \\

  cx+dy=r_2

\end{array}\right.

Arrows

implication

x^2=4 \implies x=\pm 2

“if and only if”

x^2=4 \iff x=\pm 2

“tends to”

x\to+\infty

“gets”

A\gets B+C

sizable single horizontal arrows

A\xleftarrow{\rm today}B

B\xrightarrow{\rm tomorrow}C

\xrightarrow

    [\text{(except Fridays)}]

    {\text{every day}} D

sizable single vertical arrows

\left\uparrow\sum \right\downarrow \;

\Big\updownarrow

sizable double vertical arrows

\left\Uparrow\sum \right\Downarrow \;

\Big\Updownarrow

A large collection of arrows can be found in the symbols section.

Over- and underbraces and other embellishments

overline

\overline{A+B}

underline

\underline{A+B}

hat

\widehat{A+B}

tilde

\widetilde{A+B}

vector markers

\overrightarrow{AB} \text{ and }

\overleftarrow{BA}

overbrace

\overbrace{x_1+x_2+\cdots+x_k}^

      {\text{ in total}}

underbrace

m^n=\underbrace{m\cdot m\cdots m}_{n}

affixing arbitrary symbols

x\overset{?}{\ge}y

Function names

To get correct font and spacing around the names of mathematical functions, prefix the function name with \. For example, writing cos 2\pi\alpha gives  (incorrect), whereas \cos 2\pi\alpha gives  (correct). Full list of function names defined in LaTeX is given below:

\arccos

\exp

\log

\arcsin

\gcd

\max

\arctan

\hom

\min

\arg

\inf

\Pr

\cos

\injlim

\projlim

\cosh

\varinjlim

\varprojlim

\cot

\ker

\sec

\coth

\lg

\sin

\csc

\lim

\sinh

\deg

\liminf

\sup

\det

\varliminf

\tan

\dim

\limsup

\tanh

\ln

\varlimsup

 

To declare additional function names that behave like the ones above, use the \DeclareMathOperator command in the preamble: \DeclareMathOperator{\rank}{rank}, after which \rank A will produce . Alternatively, using \operatorname{rank} A inline will also produce .

Matrices

matrix (square-bracketed)

\begin{bmatrix}

      \lambda \\

      1 & \lambda \\

      & \ddots & \ddots \\

      & & 1 & \lambda

\end{bmatrix}_{n\times n}

alternative delimiters

\begin{pmatrix}a\\b\\c\end{pmatrix},

\begin{Bmatrix}a\\b\\c\end{Bmatrix},

\begin{vmatrix}a\\b\\c\end{vmatrix},

\begin{Vmatrix}a\\b\\c\end{Vmatrix},

\begin{matrix}a\\b\\c\end{matrix}

inline matrices

(\begin{smallmatrix}1 && 2 \\

3 && 4\end{smallmatrix})

Punctuation

dots between commas

x_1, x_2\dotsc, x_n

dots between binary operations

x_1 + x_2 + \dotsb + x_n

dots between integrals

\int\dotsi\int

dots between multiplication signs

x(x+1)\dotsm(x+n)

colon (meaning “such that” or when defining domains)

f\colon \mathbb{N}\to\mathbb{R}

vertical and diagonal

\vdots \quad \ddots

Fonts

Normally, everything typed in math mode is considered to be a part of the formula and is typeset as such—spaces are ignored, most symbols come out in medium-weight italics, and so on. If you want to use a different mathematical font or to enter a few words of regular text in math mode like in the piecewise example above, the following commands can help:

normal text

x+\frac{1}{x} \ge 2

\text{ for all $x>0$}

(note that this is one of the rare cases when spaces matter in LaTeX; also note that you can switch back to math mode in \text)

bold text, upright

\textbf{I am Jack's bold text.}

bold math, upright

AB\mathbf{CD}EF

bold math, italic

AB\boldsymbol{C}\boldsymbol{D}EF

“poor man’s bold”

AB\pmb{C}\pmb{D}EF

(overlays several copies of a symbol with slight offsets on top of each other)

calligraphic
(uppercase Latin letters only)

\begin{array}{c}

\mathcal{ABCDEFGHIJKLM} \\

\mathcal{NOPQRTSUVWXYZ}\end{array}

blackboard bold (uppercase Latin letters only)

\begin{array}{c}

\mathbb{ABCDEFGHIJKLM} \\

\mathbb{NOPQRTSUVWXYZ}\end{array}

Fraktur
(Latin letters and digits only)

\begin{array}{c}

\mathfrak{ABCDEFGHIJKLM} \\

\mathfrak{NOPQRTSUVWXYZ} \\

\mathfrak{abcdefghijklm} \\

\mathfrak{nopqrtsuvwxyz} \\

\mathfrak{0123456789}\end{array}

sans-serif font

\begin{array}{c}

\mathsf{ABCDEFGHIJKLM} \\

\mathsf{NOPQRTSUVWXYZ} \\

\mathsf{abcdefghijklm} \\

\mathsf{nopqrtsuvwxyz} \\

\mathsf{0123456789}\end{array}

typewriter

\begin{array}{c}

\mathtt{ABCDEFGHIJKLM} \\

\mathtt{NOPQRTSUVWXYZ} \\

\mathtt{abcdefghijklm} \\

\mathtt{nopqrtsuvwxyz} \\

\mathtt{0123456789}\end{array}

Spacing

The following commands can be used to fine-tune spacing in math mode:

default (none)

x y

quad (width of )

x\quad y

 quad

x\,y

 quad

x\:y

 quad

x\;y

 quad

x\ y

double quad

x\qquad y

ve  quad

x\!y

custom spacing
(1 mu =  quad)

x\mspace{-19mu}y

virtual space

\Gamma_{ij}^{\phantom{ij}k}









Commonly used symbols

Greek letters

\alpha

{\rm A}

\xi

\Xi

\beta

{\rm B}

o

{\rm O}

\gamma

\Gamma

\pi

\Pi

\delta

\Delta

\varpi

\epsilon

{\rm E}

\rho

{\rm P}

\varepsilon

\varrho

\zeta

{\rm Z}

\sigma

\Sigma

\eta

{\rm H}

\varsigma

\theta

\Theta

\tau

{\rm T}

\vartheta

\upsilon

\Upsilon

\iota

{\rm I}

\phi

\Phi

\kappa

{\rm K}

\varphi

\lambda

\Lambda

\chi

{\rm X}

\mu

{\rm M}

\psi

\Psi

\nu

{\rm N}

\omega

\Omega

Various alphabetic symbols

\aleph

\eth

\circledS

\beth

\hbar

\Bbbk

\daleth

\hslash

\Finv

\gimel

\mho

\Game

\complement

\partial

\Im

\ell

\wp

\Re

Binary operators

+

\circledcirc

\oplus

-

\cup

\oslash

/

\Cup

\otimes

\amalg

\curlyvee

\pm

\ast

\curlywedge

\rightthreetimes

\barwedge

\dagger

\rtimes

\bigcirc

\ddagger

\setminus

\bigtriangledown

\diamond

\smallsetminus

\bigtriangleup

\div

\sqcap

\boxdot

\divideontimes

\sqcup

\boxminus

\dotplus

\star

\boxplus

\doublebarwedge

\times

\boxtimes

\gtrdot

\triangleleft

\bullet

\intercal

\triangleright

\cap

\leftthreetimes

\uplus

\Cap

\lessdot

\vee

\cdot

\ltimes

\veebar

\centerdot

\mp

\wedge

\circ

\odot

\wr

\circledast

\ominus

Relation operators

<

\gnsim

\nless

=

\gtrapprox

\nprec

>

\gtreqless

\npreceq

\approx

\gtreqqless

\nsim

\approxeq

\gtrless

\nsucc

\asymp

\gtrsim

\nsucceq

\backsim

\gvertneqq

\prec

\backsimeq

\leq

\precapprox

\bumpeq

\leqq

\preccurlyeq

\Bumpeq

\leqslant

\preceq

\circeq

\lessapprox

\precnapprox

\cong

\lesseqgtr

\precneqq

\curlyeqprec

\lessgtr

\precnsim

\curlyeqsucc

\lesssim

\precsim

\doteq

\ll

\risingdotseq

\doteqdot

\lll

\sim

\eqcirc

\lnapprox

\simeq

\eqsim

\lneq

\succ

\eqslantgtr

\lneqq

\succapprox

\eqslantless

\lnsim

\succcurlyeq

\equiv

\lvertneqq

\succeq

\fallingdotseq

\ncong

\succnapprox

\ge

\neq

\succneqq

\geqq

\ngeq

\succnsim

\geqslant

\ngeqq

\succsim

\gg

\ngeqslant

\thickapprox

\ggg

\ngtr

\thicksim

\gnapprox

\nleq

\triangleq

\gneq

\nleqq

\gneqq

\nleqslant

Most operators may be negated by prefixing them with \not like so: \not\approx gives .

Empty set may be written either as \varnothing for  or as \emptyset for .

Relation operators: sets and miscellaneous

\backepsilon

\ntriangleright

\subsetneqq

\because

\ntrianglerighteq

\supset

\between

\nvdash

\Supset

\blacksquare

\nVdash

\supseteq

\blacktriangleleft

\nvDash

\supseteqq

\blacktriangleright

\nVDash

\supsetneq

\bowtie

\parallel

\supsetneqq

\dashv

\perp

\therefore

\frown

\pitchfork

\trianglelefteq

\in

\propto

\trianglerighteq

\mid

\shortmid

\varpropto

\models

\shortparallel

\varsubsetneq

\ni (or \owns)

\smallfrown

\varsubsetneqq

\nmid

\smallsmile

\varsupsetneq

\notin

\smile

\varsupsetneqq

\nparallel

\sqsubset

\vartriangle

\nshortmid

\sqsubseteq

\vartriangleleft

\nshortparallel

\sqsupset

\vartriangleright

\nsubseteq

\sqsupseteq

\vdash

\nsubseteqq

\subset

\Vdash

\nsupseteq

\Subset

\vDash

\nsupseteqq

\subseteq

\Vvdash

\ntriangleleft

\subseteqq

\ntrianglelefteq

\subsetneq

Arrows

\circlearrowleft

\Lleftarrow

\nwarrow

\circlearrowright

\longleftarrow

\rightarrow

\curvearrowleft

\Longleftarrow

\Rightarrow

\curvearrowright

\longleftrightarrow

\rightarrowtail

\downdownarrows

\Longleftrightarrow

\rightharpoondown

\downharpoonleft

\longmapsto

\rightharpoonup

\downharpoonright

\longrightarrow

\rightleftarrows

\hookleftarrow

\Longrightarrow

\rightleftharpoons

\hookrightarrow

\looparrowleft

\rightrightarrows

\leftarrow

\looparrowright

\rightsquigarrow

\Leftarrow

\Lsh

\Rrightarrow

\leftarrowtail

\mapsto

\Rsh

\leftharpoondown

\multimap

\searrow

\leftharpoonup

\nLeftarrow

\swarrow

\leftleftarrows

\nLeftrightarrow

\twoheadleftarrow

\leftrightarrow

\nRightarrow

\twoheadrightarrow

\Leftrightarrow

\nearrow

\upharpoonleft

\leftrightarrows

\nleftarrow

\upharpoonright





from: http://elevatorlady.ca/doc/refcard/basics.html

http://elevatorlady.ca/doc/refcard/expressions.html

http://elevatorlady.ca/doc/refcard/symbols.html

0 0