Wikipédia:Atelier TeX/Exemples

Un article de Wikipédia, l'encyclopédie libre.

Voici quelques exemples de ce qui est possible avec TeX :

[modifier] Divers

[modifier] Typographie

Par défaut, l'écriture est en italique.

Normal ABCDEFGHIJKLM

NOPQRSTUVWXYZ

ABCDEFGHIJKLM \,

NOPQRSTUVWXYZ \,

Blackboard gras \mathbb{A B C D E F G H I J K L M}
\mathbb{N O P Q R S T U V W X Y Z}
\mathbb{A B C D E F G H I J K L M}
\mathbb{N O P Q R S T U V W X Y Z}\,
\N \Z \Q \R \C \N\ \Z\ \Q\ \R\ \C
Fraktur \mathfrak{a b c d e f g h i j k l m}

\mathfrak{n o p q r s t u v w x y z}
\mathfrak{A B C D E F G H I J K L M}
\mathfrak{N O P Q R S T U V W X Y Z}

\mathfrak{a b c d e f g h i j k l m}

\mathfrak{n o p q r s t u v w x y z}
\mathfrak{A B C D E F G H I J K L M}
\mathfrak{N O P Q R S T U V W X Y Z}

Gras \mathbf{ABCDEFGHIJKLM}

\mathbf{NOPQRSTUVWXYZ}

\mathbf{ABCDEFGHIJKLM}\,

\mathbf{NOPQRSTUVWXYZ}\,

Roman \mathrm{ABCDEFGHIJKLM}

\mathrm{NOPQRSTUVWXYZ}

\mathrm{ABCDEFGHIJKLM}\,

\mathrm{NOPQRSTUVWXYZ}\,

Script \mathcal{ABCDEFGHIJKLM}

\mathcal{NOPQRSTUVWXYZ}

\mathcal{ABCDEFGHIJKLM}\,

\mathcal{NOPQRSTUVWXYZ}\,

[modifier] Caractères spéciaux

Lettres grecques minuscules (sans omicron !) \alpha \beta \gamma \digamma \delta \epsilon \varepsilon \zeta \eta \theta \vartheta \iota \kappa \varkappa \lambda \mu \nu \xi o \pi \varpi \rho \varrho \sigma \varsigma \tau \upsilon \phi \varphi \chi \psi \omega \alpha\; \beta\; \gamma\; \digamma\; \delta\; \epsilon\; \varepsilon\; \zeta\; \eta\; \theta\; \vartheta\; \iota\; \kappa\; \varkappa\; \lambda\; \mu\; \nu\,

\xi\; o\; \pi\; \varpi\; \rho\; \varrho\; \sigma\; \varsigma\; \tau\; \upsilon\; \phi\; \varphi\; \chi\; \psi\; \omega \,

Lettres grecques majuscules (sans Omicron !) \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta \Iota \Kappa \Lambda \Mu \Nu \Xi O \Pi \Rho \Sigma \Tau \Upsilon \Phi \Chi \Psi \Omega \Alpha \; \Beta \; \Gamma \; \Delta \; \Epsilon \; \Zeta \; \Eta \; \Theta \; \Iota \; \Kappa \; \Lambda \; \Mu \,

\Nu \; \Xi\; O\; \Pi\; \Rho\; \Sigma\; \Tau\; \Upsilon\; \Phi\; \Chi\; \Psi\; \Omega\,

Hébreu \aleph \beth \daleth \gimel \aleph \; \beth \; \daleth \; \gimel
Diacritiques et accents
\acute{a} \grave{a} \hat{a} \tilde{a} \breve{a} \check{a} \bar{a} \ddot{a} \dot{a} \acute{a} \grave{a} \hat{a} \tilde{a} \breve{a}\,\! \check{a} \bar{a} \ddot{a} \dot{a}\,\!

[modifier] Couleurs

Pour plus de détails voir Atelier TeX/Exemples/Couleurs (liste des 68 couleurs disponibles)

Il peut être utile de mettre certaines parties en couleurs :

  • x=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}
    x=\frac{-b\pm\sqrt{\color{Red}b^2-4ac}}{2a}
Attention 
Les couleurs doivent être utilisées seulement en cas de nécessité. Elles doivent respecter les conventions de style et être choisies de telle façon que les daltoniens puissent les distinguer.

[modifier] Mathématiques

[modifier] Polynôme

ax2 + bx + c = 0

<math>ax^2 + bx + c = 0</math>

x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}

<math>x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}</math>

[modifier] Délimiteurs : Parenthèses, etc.

Parenthèses \left( \frac{a}{b} \right) \left( \frac{a}{b}  \right) Crochets \left[ \frac{a}{b} \right] \left[ \frac{a}{b}  \right]
Accolades \left\{ \frac{a}{b} \right\} \left\{ \frac{a}{b}  \right\} Chevrons \left\langle \frac{a}{b} \right\rangle \left\langle \frac{a}{b}  \right\rangle
Barres
(de valeur absolue, par exemple)
\left| \frac{a}{b} \right| \left| \frac{a}{b}  \right| Flèches \left \Uparrow \frac{a}{b} \right \Downarrow \left \Uparrow \frac{a}{b} \right \Downarrow
Taille des délimiteurs \big( \Big( \bigg( \Bigg( ... \Bigg] \bigg] \Big] \big] 	\big( \Big( \bigg( \Bigg( \cdots \Bigg] \bigg] \Big] \big]
Attention à mettre \left( et pas juste (, idem pour \right) et )
Mauvais ( \frac{1}{2} ) <math>( \frac{1}{2} )</math> Mieux \left( \frac{1}{2} \right) <math>\left( \frac{1}{2} \right)</math>
Utilisez un point . pour faire disparaître le délimiteurs
\left. fait disparaître le délimiteur gauche
\left. {A \over B} \right\} \to X \left. {A \over B} \right\} \to X

[modifier] Fractions

S_{new} = S_{old} + \frac{ \left( 5-T \right) ^2} {2}

<math>S_{new} = S_{old} + \frac{ \left( 5-T \right) ^2} {2}</math>

[modifier] Intégrales

\int_a^x \int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy

<math>\int_a^x \int_a^s f(y)\,dy\,ds = \int_a^x f(y)(x-y)\,dy</math>

[modifier] Somme

\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n}{3^m\left(m\,3^n+n\,3^m\right)}

<math>\sum_{m=1}^\infty\sum_{n=1}^\infty\frac{m^2\,n} {3^m\left(m\,3^n+n\,3^m\right)}</math>

[modifier] Équation différentielle

u'' + p(x)u' + q(x)u=f(x),\quad x>a

<math>u'' + p(x)u' + q(x)u=f(x),\quad x>a</math>

[modifier] Nombres complexes

|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)\,

<math>|\bar{z}| = |z|, |(\bar{z})^n| = |z|^n, \arg(z^n) = n \arg(z)\,</math>

[modifier] Limites

\lim_{z\rightarrow z_0} f(z)=f(z_0)\,

<math>\lim_{z\rightarrow z_0} f(z)=f(z_0)\,</math>

[modifier] Équation intégrale

\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R}\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR

<math>\phi_n(\kappa) = \frac{1}{4\pi^2\kappa^2} \int_0^\infty \frac{\sin(\kappa R)}{\kappa R} \frac{\partial}{\partial R}\left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR</math>

[modifier] Chimie

Par défaut en TeX, le texte est en écriture italique : ZnO. En chimie, il faut donc toujours utiliser \mathrm{texte en romaine} ou simplement \rm pour avoir le texte en écriture romaine (ou écriture droite) : ZnO.

[modifier] Formules simples

  •  \mathrm{ZnO}\, : <math> \mathrm{ZnO}\,</math>,
  •  \mathrm{CH_3OH}\, : <math> \mathrm{CH_3OH}\,</math>
  • le tiret bas : _ permet d'écrire en indice.
  •  \mathrm{Fe_2(SO_4)_3}\, : <math> \mathrm{Fe_2(SO_4)_3}\,</math>
  • \mathrm{F^-}\, : <math>\mathrm{F^-}\,</math>
  • l'accent circonflexe ^ permet d'écrire une puissance.
  • \mathrm{AlF_4^-}\, : <math>\mathrm{AlF_4^-}\,</math>
  • \mathrm{Al^{3+}}\, : <math>\mathrm{Al^{3+}}\,</math>
  • Si la chaine de caractères en puissance comporte plusieurs caractères, elle doit être mise entre des accolades {XXX}.
  • {}^{14}_{\ 6}\mathrm C\, : <math>{}^{14}_{\ 6}\mathrm C\,</math>
  • on peut combiner indice et exposant ou placer un exposant ou un indice sur du vide à l'aide de {}.

[modifier] Formule développée plane

À l'aide d'un tableau (array), on peut dessiner certaines formules développées de molécule. Exemple de l'éthane :

<math>
  \begin{array}{lcl}
&\rm H &\rm H\\
&| &|\\
\rm H-\!\!\!\! &\rm C-\!\!\!\! &\rm C - H\\
&| &|\\
&\rm H &\rm H\\
  \end{array}
</math>


  \begin{array}{lcl}
&\rm H &\rm H\\
&| &|\\
\rm H-\!\!\!\! &\rm C-\!\!\!\! &\rm C - H\\
&| &|\\
&\rm H &\rm H\\
  \end{array}


[modifier] Les réactions

[modifier] Flèches

  • Flèches simple :
    • ajustage automatique au texte inscrit :
    \xrightarrow[exemple de texte long souscrit]{\rm exemple\ de\ texte\ suscrit} : <math>\xrightarrow[exemple de texte long souscrit]{\rm exemple\ de\ texte\ suscrit}</math>
    • la longueur peut être ajuster en utilisant un ou plusieurs \qquad :
    \begin{matrix} & \\\mathrm{\overrightarrow{\qquad}}   \\\end{matrix} : <math>\begin{matrix} & \\\mathrm{\overrightarrow{\qquad}} \\\end{matrix}</math>
    \begin{matrix} & \\\mathrm{\overrightarrow{\qquad\qquad}}   \\\end{matrix} : <math>\begin{matrix} & \\\mathrm{\overrightarrow{\qquad\qquad}} \\\end{matrix}</math>
    \begin{matrix} & \\\mathrm{\overrightarrow{\qquad\qquad\qquad}}   \\\end{matrix} : <math>\begin{matrix} & \\\mathrm{\overrightarrow{\qquad\qquad\qquad}} \\\end{matrix}</math>
  • Flèche double :
  • \rightleftarrows : <math>\rightleftarrows</math>

[modifier] Harpons

  • Harpons :
    \rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown : <math>\rightharpoonup \rightharpoondown \leftharpoonup \leftharpoondown</math>
  • Harpon double :
    \rightleftharpoons : <math>\rightleftharpoons</math>

[modifier] Exemples de réactions

\mathrm{AgCl \qquad \overrightarrow{\leftarrow} \qquad Ag^+ + Cl^-}

  • \mathrm{AgCl \qquad \overrightarrow{\leftarrow} \qquad Ag^+ + Cl^-}

\begin{matrix} & \\ \mathrm{2Al^0} & \overrightarrow{\qquad} & \mathrm{2Al^{3+} + 3e^-}\   \\\end{matrix}

  • <math>\begin{matrix} & \\ \mathrm{2Al^0} & \overrightarrow{\qquad} & \mathrm{2Al^{3+} + 3e^-}\ \\\end{matrix}</math>

\begin{matrix} & {}_{\rm{T\ >\ 90^\circ\ C }} & \\ \mathrm{ZnS +  Fe_2(SO_4)_3} & \overrightarrow{\qquad\qquad\qquad} & \mathrm{ZnSO_4 + 2FeSO_4 + S\ (solide)}\ \\\end{matrix}

  • <math>\begin{matrix} & {}_{\rm{T\ >\ 90^\circ\ C }} & \\ \mathrm{ZnS + Fe_2(SO_4)_3} & \overrightarrow{\qquad\qquad\qquad} & \mathrm{ZnSO_4 + 2FeSO_4 + S\ (solide)}\ \\\end{matrix}</math>

\begin{matrix} & \\ \mathrm{ZnS + 3/2 O_2} & \overrightarrow{\qquad} & \mathrm{ZnO + SO_2} & {\rm \Delta\ H} =  - 445\  {\rm  KJ/mole\ de\ ZnS\ entre\ 800\ et\ 1000^\circ\ C}   \\\end{matrix}

  • <math>\begin{matrix} & \\ \mathrm{ZnS + 3/2 O_2} & \overrightarrow{\qquad} & \mathrm{ZnO + SO_2} & {\rm \Delta\ H} = - 445\ {\rm KJ/mole\ de\ ZnS\ entre\ 800\ et\ 1000^\circ\ C} \\\end{matrix}</math>

\mathrm{X_{\alpha} Y_{\beta} (solide)} {\qquad}\overrightarrow{\rm{\leftarrow }}{\qquad} \alpha \mathrm{X^{\beta+} (aqueux)+\beta Y^{\alpha-} (aqueux)}

  • <math>\mathrm{X_{\alpha} Y_{\beta} (solide)} {\qquad}\overrightarrow{\rm{\leftarrow }}{\qquad} \alpha \mathrm{X^{\beta+} (aqueux)+\beta Y^{\alpha-} (aqueux)} </math>

\begin{matrix} & {\rm air\ (source\ de\ diazote)} + {\rm dihydrog\grave{e}ne} + {\rm eau} & \overrightarrow{\qquad\qquad} & {\rm ammoniac} + {\rm dioxyde\ de\ carbone} \end{matrix}

  • <math>\begin{matrix} & {\rm air\ (source\ de\ diazote)} + {\rm dihydrog\grave{e}ne} + {\rm eau} & \overrightarrow{\qquad\qquad} & {\rm ammoniac} + {\rm dioxyde\ de\ carbone} \end{matrix}</math>

[modifier] Voir aussi

b:Accueil

Wikibooks propose un ouvrage abordant ce sujet : Programmation LaTeX.