LaTeX Tutorial

This tutorial shows how to use LaTeX in Memjogger.

 

  • 1. Introduction

    • 1.1. What is LaTeX?

      LaTeX is a special language that makes it possible, among other things, to type in complicated formulae using plain text and then, using special software, generate documents that displays them accordingly.

      For example, it enables you to change this text:

      \int f(x)

      into this:

      \[ \int f(x) \]

      Thanks to LaTeX you can produce professional texts and documents using standarized language and without a need for a special editor.

      It's very popular in the academic community - especially in mathematics and physics - and is supported by organizations such as American Mathematical Society which provides special additions to the language.

      For more information read the Wikipedia page about LaTeX.

    • 1.2. Using LaTeX in Memjogger

      Memjogger uses LaTeX to enable you to fill your flashcards with not only plain text but also more complicated symbols and to make studying things like mathematics or chemistry easier and more natural.

      When editing a flashcard you can mix normal text with a LaTeX code. All you need to do is to enclose LaTeX between special delimiters.

      When you want your special formula to be displayd in the same line as the content that precedes it, put your LaTeX code between \( and \). For example putting the following text into your card:

      The roots of a quadratic equation are \( \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \).

      will result in:

      The roots of a quadratic equation are \( \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \).

      Conversly, if you want to display a formula in a new line, enclose LaTeX code between \[ and \], i.e. write:

      The probability of getting k heads when flipping n coins is \[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]

      to achieve this:

      The probability of getting k heads when flipping n coins is \[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \].

      Note that depending on how you chose to display result of a particular LaTeX code (inline or in its own line) the result can be slightly different. Compare the following two examples of displaying \lim_{x\to\infty}\frac{1}{x}.

      Limit displayed inline looks like this: \( \lim_{x\to\infty}\frac{1}{x} \)

      Limit displayed in a new line looks like this: \[ \lim_{x\to\infty}\frac{1}{x} \]

      You can see that when using LaTeX in its inline mode it's displayed in a more compact form.

  • 2. Chemical Typesetting

    Memjogger uses mhchem package to make typesetting chemical molecular formulae and chemical equations more convenient.

    For example, to type \(3\,\mathrm{Cr}_2^{\strut}\mathrm{O}_7^{2-}\) in Plain LaTeX and get everything just right (e.g. things like subscripts alignment) one would need to write the following code: 3\,\mathrm{Cr}_2^{\strut}\mathrm{O}_7^{2-}.

    Thanks to mhchem the same effect can be achieved by \ce{3Cr_2O7^2-}.

    To find out more check out the Chemistry Examples section of this tutorial and the mhchem documentation.

  • 3. Examples

    • 3.1. Mathematics

      Limits & Calculus Examples
      \[ \lim_{x\to\infty}\frac{1}{x} \]\lim_{x\to\infty}\frac{1}{x}
      \( \int \! f(x) \, \mathrm{d}x \)\int \! f(x) \, \mathrm{d}x
      \( \int_a^b \! f(x) \, \mathrm{d}x \)\int_a^b \! f(x) \, \mathrm{d}x
    • 3.2. Chemistry

      The following examples comes from the mhchem package documentation.

      Basic Examples
      \( \ce{H2O} \)\ce{H2O}
      \( \ce{Sb2O3} \)\ce{Sb2O3}
      \( \ce{H+} \)\ce{H+}
      \( \ce{CrO4^2-} \)\ce{CrO4^2-}
      \( \ce{AgCl2-} \)\ce{AgCl2-}
      \( \ce{[AgCl2]-} \)\ce{[AgCl2]-}
      \( \ce{Y^{99}+} \)\ce{Y^{99}+}
      \( \ce{Y^{99+}} \)\ce{Y^{99+}}
      \( \ce{H2_{(aq)}} \)\ce{H2_{(aq)}}
      \( \ce{NO3-} \)\ce{NO3-}
      \( \ce{(NH4)2S} \)\ce{(NH4)2S}
      Amounts and Isotopes
      \( \ce{2H2O} \)\ce{2H2O}
      \( \ce{1/2H2O} \)\ce{1/2H2O}
      \( \ce{^{227}_{90}Th+} \)\ce{^{227}_{90}Th+}
      Bonds
      \( \ce{C6H5-CHO} \)\ce{C6H5-CHO}
      \( \ce{X=Y#Z} \)\ce{X=Y#Z}
      \( \ce{A\sbond B\dbond C\tbond D} \)\ce{A\sbond B\dbond C\tbond D}
      \( \ce{A\bond{-}B\bond{=}C\bond{#}D} \) \ce{A\bond{-}B\bond{=}C\bond{#}D}
      \( \ce{A\bond{~}B\bond{~-}C} \)\ce{A\bond{~}B\bond{~-}C}
      \( \ce{A\bond{~=}B\bond{~--}C\bond{-~-}D} \)\ce{A\bond{~=}B\bond{~--}C\bond{-~-}D}
      \( \ce{A\bond{...}B\bond{....}C} \)\ce{A\bond{...}B\bond{....}C}
      \( \ce{A\bond{->}B\bond{<-}C} \)\ce{A\bond{->}B\bond{<-}C}
      Formulae
      \( \ce{CO2 + C -> 2CO} \)\ce{CO2 + C -> 2CO}
      \( \ce{CO2 + C <- 2CO} \)\ce{CO2 + C <- 2CO}
      \( \ce{CO2 + C <=> 2CO} \)\ce{CO2 + C <=> 2CO}
      \( \ce{H+ + OH- <=>> H2O} \)\ce{H+ + OH- <=>> H2O}
      \( \ce{$A$ <-> $A’$} \)\ce{$A$ <-> $A’$}
      \( \ce{CO2 + C ->[\alpha] 2CO} \)\ce{CO2 + C ->[\alpha] 2CO}
      \( \ce{CO2 + C ->[\alpha][\beta] 2CO} \)\ce{CO2 + C ->[\alpha][\beta] 2CO}
      \( \ce{CO2 + C ->[\text{above}] 2CO} \)\ce{CO2 + C ->[\text{above}] 2CO}
      \( \ce{CO2 + C ->[\text{above}][\text{below}] 2CO} \)\ce{CO2 + C ->[\text{above}][\text{below}] 2CO}
      \( \ce{CO2 + C ->T[above][below] 2CO} \)\ce{CO2 + C ->T[above][below] 2CO}
      \( \ce{$A$ ->[\ce{+H2O}] $B$} \)\ce{$A$ ->[\ce{+H2O}] $B$}
      \( \ce{$A$ ->C[+H2O] $B$} \)\ce{$A$ ->C[+H2O] $B$}
      \( \ce{SO4^2- + Ba^2+ -> BaSO4 v} \)\ce{SO4^2- + Ba^2+ -> BaSO4 v}
      \( \ce{$A$ <->T[{enclose spaces!}] $A’$} \)\ce{$A$ <->T[{enclose spaces!}] $A’$}
      \( \ce{Zn^2+ <=>[\ce{+ 2OH-}][\ce{+ 2H+}] $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}$ \\ <=>C[+2OH-][{+ 2H+}] $\underset{\text{Hydroxozikat}}{\cf{[Zn(OH)4]^2-}}$ } \)\ce{Zn^2+ <=>[\ce{+ 2OH-}][\ce{+ 2H+}] $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2 v}}$ <=>C[+2OH-][{+ 2H+}] $\underset{\text{Hydroxozikat}}{\cf{[Zn(OH)4]^2-}}$ }
      \( K = \frac{[\ce{Hg^2+}][\ce{Hg}]}{[\ce{Hg2^2+}]} \)K = \frac{[\ce{Hg^2+}][\ce{Hg}]}{[\ce{Hg2^2+}]}
      \( \ce{Hg^2+ ->[\ce{I-}] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->C[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$ } \)\ce{Hg^2+ ->[\ce{I-}] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->C[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$ }
  • 4. Macros and Commands Reference

    \buildrel
    Places one symbol over another; use in the form \buildrel<superscript>\over<symbol>
    Examples
    \buildrel\mathrm{def}\over=\( \buildrel\mathrm{def}\over= \)
    \buildrel\alpha\beta\over\prec\( \buildrel\alpha\beta\over\prec \)
    \mathrm
    Forces use of a normal font instead of italic.
    Examples
    xyz \mathrm{xyz}\( xyz \mathrm{xyz} \)
  • 5. Symbols Reference

    • 5.1. Relations

      \( \leq \)\leq or \le \( \geq \)\geq or \ge \( \equiv \)\equiv
      \( \prec \)\prec \( \succ \)\succ \( \sim \)\sim
      \( \preceq \)\preceq \( \succeq \)\succeq \( \simeq \)\simeq
      \( \ll \)\ll \( \gg \)\gg \( \asymp \)\asymp
      \( \subset \)\subset \( \supset \)\supset \( \approx \)\approx
      \( \subseteq \)\subseteq \( \supseteq \)\supseteq \( \cong \)\cong
      \( \sqsubseteq \)\sqsubseteq \( \sqsupseteq \)\sqsupseteq \( \bowtie \)\bowtie
      \( \in \)\in \( \notin \)\notin \( \ni \)\ni or \owns
      \( \vdash \)\vdash \( \dashv \)\dashv \( \models \)\models
      \( \smile \)\smile \( \mid \)\mid \( \doteq \)\doteq
      \( \frown \)\frown \( \parallel \)\parallel \( \perp \)\perp
      \( \propto \)\propto

      You can negate a relation by preceding it with \not, e.g \not\in results in \( \not\in \).

    • 5.2. Greek Letters

      \( \alpha \)\alpha \( \iota \)\iota \( \varrho \)\varrho
      \( \beta \)\beta \( \kappa \)\kappa \( \sigma \)\sigma
      \( \gamma \)\gamma \( \lambda \)\lambda \( \varsigma \)\varsigma
      \( \delta \)\delta \( \mu \)\mu \( \tau \)\tau
      \( \epsilon \)\epsilon \( \nu \)\nu \( \upsilon \)\upsilon
      \( \varepsilon \)\varepsilon \( \xi \)\xi \( \phi \)\phi
      \( \zeta \)\zeta \( \omicron \)\omicron \( \varphi \)\varphi
      \( \eta \)\eta \( \pi \)\pi \( \chi \)\chi
      \( \theta \)\theta \( \varpi \)\varpi \( \psi \)\psi
      \( \vartheta \)\vartheta \( \rho \)\rho \( \omega \)\omega
    • 5.3. Greek Letters - Capitalized

      \( \Gamma \)\Gamma \( \Xi \)\Xi \( \Phi \)\Phi
      \( \Delta \)\Delta \( \Pi \)\Pi \( \Psi \)\Psi
      \( \Theta \)\Theta \( \Sigma \)\Sigma \( \Omega \)\Omega
      \( \Lambda \)\Lambda \( \Upsilon \)\Upsilon

      Other capitalized greek letters than specified in the above table have no seperate LaTeX command as they are the same as their roman counterparts. To type them in use \mathrm command, e.g. \mathrm{B} to get \( \mathrm{B} \).

    • 5.4. Arrows

      \( \leftarrow\)\leftarrow or \gets \( \longleftarrow \)\longleftarrow
      \( \Leftarrow \)\Leftarrow \( \Longleftarrow \)\Longleftarrow
      \( \rightarrow \)\rightarrow or \to \( \longrightarrow \)\longrightarrow
      \( \Rightarrow \)\Rightarrow \( \Longrightarrow \)\Longrightarrow
      \( \leftrightarrow \)\leftrightarrow \( \longleftrightarrow \)\longleftrightarrow
      \( \Leftrightarrow \)\Leftrightarrow \( \Longleftrightarrow \)\Longleftrightarrow
      \( \mapsto \)\mapsto \( \longmapsto \)\longmapsto
      \( \hookleftarrow \)\hookleftarrow \( \hookrightarrow \)\hookrightarrow
      \( \uparrow \)\uparrow \( \Uparrow \)\Uparrow
      \( \downarrow \)\downarrow \( \Downarrow \)\Downarrow
      \( \updownarrow \)\updownarrow \( \Updownarrow \)\Updownarrow
      \( \nearrow \)\nearrow \( \searrow \)\searrow
      \( \nwarrow \)\nwarrow \( \swarrow \)\swarrow
    • 5.5. Accents

      \( \hat a \)\hat \( \widehat a \)\widehat
      \( \check a \)\check \( \tilde a \)\tilde
      \( \widetilde a \)\widetilde \( \acute a \)\acute
      \( \grave a \)\grave \( \dot a \)\dot
      \( \ddot a \)\ddot \( \breve a \)\breve
      \( \bar a \)\bar \( \vec a \)\vec
    • 5.6. Operators

      \( \pm \)\pm \( \cap \)\cap \( \vee \)\vee or \lor
      \( \mp \)\mp \( \cup \)\cup \( \wedge \)\wedge or \land
      \( \setminus \)\setminus \( \uplus \)\uplus \( \oplus \)\oplus
      \( \cdot \)\cdot \( \sqcap \)\sqcap \( \ominus \)\ominus
      \( \times \)\times \( \sqcup \)\sqcup \( \otimes \)\otimes
      \( \ast \)\ast \( \triangleleft \)\triangleleft \( \oslash \)\oslash
      \( \star \)\star \( \triangleright \)\triangleright \( \odot \)\odot
      \( \diamond \)\diamond \( \wr \)\wr \( \dagger \)\dagger
      \( \circ \)\circ \( \bigcirc \)\bigcirc \( \ddagger \)\ddagger
      \( \bullet \)\bullet \( \bigtriangleup \)\bigtriangleup \( \amalg \)\amalg
      \( \div \)\div \( \bigtriangledown \)\bigtriangledown \( \sum \)\sum
      \( \bigcap \)\bigcap \( \bigodot \)\bigodot \( \prod \)\prod
      \( \bigcup \)\bigcup \( \bigotimes \)\bigotimes \( \coprod \)\coprod
      \( \bigsqcup \)\bigsqcup \( \bigoplus \)\bigoplus \( \int \)\int
      \( \bigvee \)\bigvee \( \biguplus \)\biguplus \( \oint \)\oint
      \( \bigwedge \)\bigwedge
    • 5.7. Delimiters

      \( \lbrack \)\lbrack or [ \( \lbrace \)\lbrace or \{ \( \langle \)\langle
      \( \rbrack \)\rbrack or ] \( \rbrace \)\rbrace or \} \( \rangle \)\rangle
      \( \vert \)\vert or | \( \lfloor \)\lfloor \( \lceil \)\lceil
      \( \Vert \)\Vert or \| \( \rfloor \)\rfloor \( \rceil \)\rceil
      \( [\![ \)[\![ \( (\!( \)(\\!( \( \langle\!\langle \)\langle\!\langle
      \( ]\!] \)]\!] \( )\!) \)\!) \( \rangle\!\rangle \)\rangle\!\rangle
    • 5.8. Other Symbols

      \( \aleph \)\aleph \( \prime \)\prime \( \forall \)\forall
      \( \hbar \)\hbar \( \emptyset \)\emptyset \( \exists \)\exists
      \( \imath \)\imath \( \nabla \)\nabla \( \neg \)\neg or \lnot
      \( \jmath \)\jmath \( \surd \)\surd \( \flat \)\flat
      \( \ell \)\ell \( \top \)\top \( \natural \)\natural
      \( \wp \)\wp \( \bot \)\bot \( \sharp \)\sharp
      \( \Re \)\Re \( \| \)\| \( \clubsuit \)\clubsuit
      \( \Im \)\Im \( \angle \)\angle \( \diamondsuit \)\diamondsuit
      \( \partial \)\partial \( \triangle \)\triangle \( \heartsuit \)\heartsuit
      \( \infty \)\infty \( \backslash \)\backslash \( \spadesuit \)\spadesuit
    • 5.9. Math Sequences

      \( \overline{x+y} \)\overline{x+y} \( \underline{x+y} \)\underline{x+y}
      \( \sqrt{x+2} \)\sqrt{x+2} \( \root n\of{x+2} \)\root n\of{x+2}
      \( {n+1\over 3} \){n+1\over 3} \( {n+1\atop 3} \){n+1\atop 3}
      \( {n+1\choose 3} \){n+1\choose 3} \( {n+1\brace 3} \){n+1\brace 3}
      \( {n+1\brack 3} \){n+1\brack 3}
    • 5.10. Non-Italic Function Names

      \( \arccos \)\arccos
      \( \cos \)\cos
      \( \csc \)\csc
      \( \exp \)\exp
      \( \ker \)\ker
      \( \limsup \)\limsup
      \( \min \)\min
      \( \sinh \)\sinh
      \( \arcsin \)\arcsin
      \( \cosh \)\cosh
      \( \deg \)\deg
      \( \gcd \)\gcd
      \( \lg \)\lg
      \( \ln \)\ln
      \( \Pr \)\Pr
      \( \sup \)\sup
      \( \arctan \)\arctan
      \( \cot \)\cot
      \( \det \)\det
      \( \hom \)\hom
      \( \lim \)\lim
      \( \log \)\log
      \( \sec \)\sec
      \( \tan \)\tan
      \( \arg \)\arg
      \( \coth \)\coth
      \( \dim \)\dim
      \( \inf \)\inf
      \( \liminf \)\liminf
      \( \max \)\max
      \( \sin \)\sin
      \( \tanh \)\tanh

More Help

Not using Memjogger yet?

Stay in touch