File: mathematics.txt

package info (click to toggle)
python-docutils 0.19%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,668 kB
  • sloc: python: 45,630; lisp: 14,475; xml: 1,789; javascript: 1,032; sh: 130; makefile: 104
file content (1100 lines) | stat: -rw-r--r-- 51,220 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
.. include:: ../../header2.txt

============================
LaTeX syntax for mathematics
============================

.. role:: m(math)
.. default-role:: math
.. |latex| replace:: L\ :sup:`A`\ T\ :sub:`E`\ X

:abstract: Docutils supports mathematical content with a `"math"
           directive`__ and `role`__. The input format is *LaTeX math
           syntax*\ [#math-syntax]_ with support for Unicode symbols.

.. sectnum::
.. contents::

__ https://docutils.sourceforge.io/docs/ref/rst/directives.html#math
__ https://docutils.sourceforge.io/docs/ref/rst/roles.html#math

Inline formulas and displayed equations
=======================================

The **math role** can be used for inline mathematical expressions:
``:math:`\psi(r) = \exp(-2r)``` will produce :m:`\psi(r)=\exp(-2r)`.
Inside the backtics you can write anything you would write between dollar
signs in a LaTeX document.  [#math-syntax]_
.. tip::

  If you put ``.. default-role:: math`` at the top of your
  document, you can write ```x^2``` instead of the longer
  version: ``:math:`x^2```.  You can also introduce an
  abbreviation like this ``.. role:: m(math)``.  That will allow
  you to write ``:m:`x^2``` or ```x^2`:m:``.


The **math directive** is used for displayed equations. It corresponds to
an ``equation*`` or ``align*`` environment in a LaTeX document. If you
write::

  .. math:: \psi(r) = e^{-2r}

you will get:

.. math:: \psi(r) = e^{-2r}

A more complex example is the definition of the `Fourier transform`_::

  .. math::
     :name: Fourier transform

     (\mathcal{F}f)(y)
      = \frac{1}{\sqrt{2\pi}^{\ n}}
        \int_{\mathbb{R}^n} f(x)\,
        e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.

which is rendered as:

.. math::
   :name: Fourier transform

     (\mathcal{F}f)(y)
      = \frac{1}{\sqrt{2\pi}^{\ n}}
        \int_{\mathbb{R}^n} f(x)\,
        e^{-\mathrm{i} y \cdot x} \,\mathrm{d} x.

The ``:name:`` option puts a label on the equation that can be
linked to by `hyperlink references`_.

Displayed equations can use ``\\`` and ``&`` for line shifts and alignments::

  .. math::

   a &= (x + y)^2         &  b &= (x - y)^2 \\
     &= x^2 + 2xy + y^2   &    &= x^2 - 2xy + y^2

LaTeX output will wrap it in an ``align*`` environment.
The result is:

.. math::

   a &= (x + y)^2         &  b &= (x - y)^2 \\
     &= x^2 + 2xy + y^2   &    &= x^2 - 2xy + y^2


.. [#math-syntax] The supported LaTeX commands include AMS extensions
   (see, e.g., the `Short Math Guide`_). Some of the shown symbols
   require the "amssymb" `LaTeX package`_ (or another package providing
   the AMS symbol macros) when exported with the "latex" writer.

   The support is limited to a subset of *LaTeX math* by the conversion
   required for many output formats.  For HTML, the `math_output`_
   configuration setting (or the corresponding ``--math-output`` command
   line option) selects between alternative output formats with different
   subsets of supported elements. If a writer does not support math
   typesetting, the content is inserted verbatim.

.. _hyperlink references:
   ../ref/rst/restructuredtext.html#hyperlink-references
.. _Short Math Guide:
   https://mirrors.ctan.org/info/short-math-guide/short-math-guide.pdf
.. _math_output:
   https://docutils.sourceforge.io/docs/user/config.html#math-output
.. _LaTeX package:
   ../../user/latex.html#latex-document-classes-and-packages


Mathematical symbols
====================

The following tables are adapted from the first edition of
"The LaTeX Companion" (Goossens, Mittelbach, Samarin) and the
AMS `Short Math Guide`_.


Accents and embellishments
--------------------------

The "narrow" accents are intended for a single-letter base.

.. class:: colwidths-auto

  =========== =============  =========== =============  ============== ================
  `\acute{x}` ``\acute{x}``  `\dot{t}`   ``\dot{t}``    `\hat{x}`      ``\hat{x}``
  `\bar{v}`   ``\bar{v}``    `\ddot{t}`  ``\ddot{t}``   `\mathring{x}` ``\mathring{x}``
  `\breve{x}` ``\breve{x}``  `\dddot{t}` ``\dddot{t}``  `\tilde{n}`    ``\tilde{n}``
  `\check{x}` ``\check{x}``  `\grave{x}` ``\grave{x}``  `\vec{x}`      ``\vec{x}``
  =========== =============  =========== =============  ============== ================

When adding an accent to an i or j in math, dotless variants can be
obtained with ``\imath`` and ``\jmath``: `\hat \imath`, `\vec{\jmath}`.

For embellishments that span multiple symbols, use:

.. class:: colwidths-auto

  ========================== ============================  =========================== =============================
  `\widetilde{gbi}`          ``\widetilde{gbi}``           `\widehat{gbi}`             ``\widehat{gbi}``
  `\overline{gbi}`           ``\overline{gbi}``            `\underline{gbi}`           ``\underline{gbi}``
  `\overbrace{gbi}`          ``\overbrace{gbi}``           `\underbrace{gbi}`          ``\underbrace{gbi}``
  `\overleftarrow{gbi}`      ``\overleftarrow{gbi}``       `\underleftarrow{gbi}`      ``\underleftarrow{gbi}``
  `\overrightarrow{gbi}`     ``\overrightarrow{gbi}``      `\underrightarrow{gbi}`     ``\underrightarrow{gbi}``
  `\overleftrightarrow{gbi}` ``\overleftrightarrow{gbi}``  `\underleftrightarrow{gbi}` ``\underleftrightarrow{gbi}``
  ========================== ============================  =========================== =============================


Binary operators
----------------
.. class:: colwidths-auto

  ================== ====================  ================= ===================  ================== ====================
  `*`                ``*``                 `\circledast`     ``\circledast``      `\ominus`          ``\ominus``
  `+`                ``+``                 `\circledcirc`    ``\circledcirc``     `\oplus`           ``\oplus``
  `-`                ``-``                 `\circleddash`    ``\circleddash``     `\oslash`          ``\oslash``
  `:`                ``:``                 `\cup`            ``\cup``             `\otimes`          ``\otimes``
  `\Cap`             ``\Cap``              `\curlyvee`       ``\curlyvee``        `\pm`              ``\pm``
  `\Cup`             ``\Cup``              `\curlywedge`     ``\curlywedge``      `\rightthreetimes` ``\rightthreetimes``
  `\amalg`           ``\amalg``            `\dagger`         ``\dagger``          `\rtimes`          ``\rtimes``
  `\ast`             ``\ast``              `\ddagger`        ``\ddagger``         `\setminus`        ``\setminus``
  `\bigcirc`         ``\bigcirc``          `\diamond`        ``\diamond``         `\smallsetminus`   ``\smallsetminus``
  `\bigtriangledown` ``\bigtriangledown``  `\div`            ``\div``             `\sqcap`           ``\sqcap``
  `\bigtriangleup`   ``\bigtriangleup``    `\divideontimes`  ``\divideontimes``   `\sqcup`           ``\sqcup``
  `\boxdot`          ``\boxdot``           `\dotplus`        ``\dotplus``         `\star`            ``\star``
  `\boxminus`        ``\boxminus``         `\doublebarwedge` ``\doublebarwedge``  `\times`           ``\times``
  `\boxplus`         ``\boxplus``          `\gtrdot`         ``\gtrdot``          `\triangleleft`    ``\triangleleft``
  `\boxtimes`        ``\boxtimes``         `\intercal`       ``\intercal``        `\triangleright`   ``\triangleright``
  `\bullet`          ``\bullet``           `\leftthreetimes` ``\leftthreetimes``  `\uplus`           ``\uplus``
  `\cap`             ``\cap``              `\lessdot`        ``\lessdot``         `\vee`             ``\vee``
  `\cdot`            ``\cdot``             `\ltimes`         ``\ltimes``          `\veebar`          ``\veebar``
  `\centerdot`       ``\centerdot``        `\mp`             ``\mp``              `\wedge`           ``\wedge``
  `\circ`            ``\circ``             `\odot`            ``\odot``           `\wr`              ``\wr``
  ================== ====================  ================= ===================  ================== ====================


Extensible delimiters
---------------------
Unless you indicate otherwise, delimiters in math formulas remain at the
standard size regardless of the height of the enclosed material. To get
adaptable sizes, use ``\left`` and ``\right`` prefixes, for example
`g(A,B,Y) = f \left(A,B,X=h^{[X]}(Y)\right)` or

.. math:: a_n = \left(\frac{1}{2}\right)^n

Use ``.`` for "empty" delimiters:

.. math:: A = \left . \frac{1}{1-n}\, \right |_{n=0}^\infty

See also the commands for fixed `delimiter sizes`_ below.

The following symbols extend when used with ``\left`` and ``\right``:

Pairing delimiters
~~~~~~~~~~~~~~~~~~
.. class:: colwidths-auto

  =============== =================   ========================= ===========================
  `( )`           ``( )``             `\langle \rangle`         ``\langle \rangle``
  `[ ]`           ``[ ]``             `\lceil  \rceil`          ``\lceil \rceil``
  `\{ \}`         ``\{ \}``           `\lfloor \rfloor`         ``\lfloor \rfloor``
  `\lvert \rvert` ``\lvert \rvert``   `\lgroup \rgroup`         ``\lgroup \rgroup``
  `\lVert \rVert` ``\lVert \rVert``   `\lmoustache \rmoustache` ``\lmoustache \rmoustache``
  =============== =================   ========================= ===========================


Nonpairing delimiters
~~~~~~~~~~~~~~~~~~~~~
.. class:: colwidths-auto

  ==== ======  ============ ==============  ============ ==============
  `|`  ``|``   `\vert`      ``\vert``       `\arrowvert` ``\arrowvert``
  `\|` ``\|``  `\Vert`      ``\Vert``       `\Arrowvert` ``\Arrowvert``
  `/`  ``/``   `\backslash` ``\backslash``  `\bracevert` ``\bracevert``
  ==== ======  ============ ==============  ============ ==============

The use of ``|`` and ``\|`` for pairs of vertical bars may produce
incorrect spacing, e.g., ``|k|=|-k|`` produces `|k| = |−k|` and
``|\sin(x)|`` produces `|\sin(x)|`. The pairing delimiters, e.g.
`\lvert -k\rvert` and `\lvert\sin(x)\rvert`, prevent this problem
(in LaTeX and MathJax).

.. TODO: fix spacing before unary minus (see also cases example below).

Extensible vertical arrows
--------------------------
.. class:: colwidths-auto

  ===============================  ======================================
  `\uparrow`     ``\uparrow``      `\Uparrow`     ``\Uparrow``
  `\downarrow`   ``\downarrow``    `\Downarrow`   ``\Downarrow``
  `\updownarrow` ``\updownarrow``  `\Updownarrow` ``\Updownarrow``
  ===============================  ======================================


Functions (named operators)
---------------------------
.. class:: colwidths-auto

  ========= ===========  ========= ===========  ============= ================
  `\arccos` ``\arccos``  `\gcd`    ``\gcd``     `\Pr`         ``\Pr``
  `\arcsin` ``\arcsin``  `\hom`    ``\hom``     `\projlim`    ``\projlim``
  `\arctan` ``\arctan``  `\inf`    ``\inf``     `\sec`        ``\sec``
  `\arg`    ``\arg``     `\injlim` ``\injlim``  `\sin`        ``\sin``
  `\cos`    ``\cos``     `\ker`    ``\ker``     `\sinh`       ``\sinh``
  `\cosh`   ``\cosh``    `\lg`     ``\lg``      `\sup`        ``\sup``
  `\cot`    ``\cot``     `\lim`    ``\lim``     `\tan`        ``\tan``
  `\coth`   ``\coth``    `\liminf` ``\liminf``  `\tanh`       ``\tanh``
  `\csc`    ``\csc``     `\limsup` ``\limsup``  `\varlimsup`  ``\varlimsup``
  `\deg`    ``\deg``     `\ln`     ``\ln``      `\varliminf`  ``\varliminf``
  `\det`    ``\det``     `\log`    ``\log``     `\varprojlim` ``\varprojlim``
  `\dim`    ``\dim``     `\max`    ``\max``     `\varinjlim`  ``\varinjlim``
  `\exp`    ``\exp``     `\min`    ``\min``
  ========= ===========  ========= ===========  ============= ================

Named operators outside the above list can be typeset with
``\operatorname{name}``, e.g.

.. math:: \operatorname{sgn}(-3) = -1.

.. TODO: \operatorname* for function name with limits.

The ``\DeclareMathOperator`` command can only be used in the
`LaTeX preamble`_.

.. _LaTeX preamble: latex.html#latex-preamble


Greek letters
-------------

Greek letters that have Latin look-alikes are rarely used in math
formulas and not supported by LaTeX.

.. class:: colwidths-auto

  ========== ============  ========== ============  ========== ============  ============== ===============
  `\Gamma`   ``\Gamma``    `\alpha`   ``\alpha``    `\mu`      ``\mu``       `\omega`       ``\omega``
  `\Delta`   ``\Delta``    `\beta`    ``\beta``     `\nu`      ``\nu``       `\digamma`     ``\digamma``
  `\Lambda`  ``\Lambda``   `\gamma`   ``\gamma``    `\xi`      ``\xi``       `\varepsilon`  ``\varepsilon``
  `\Phi`     ``\Phi``      `\delta`   ``\delta``    `\pi`      ``\pi``       `\varkappa`    ``\varkappa``
  `\Pi`      ``\Pi``       `\epsilon` ``\epsilon``  `\rho`     ``\rho``      `\varphi`      ``\varphi``
  `\Psi`     ``\Psi``      `\zeta`    ``\zeta``     `\sigma`   ``\sigma``    `\varpi`       ``\varpi``
  `\Sigma`   ``\Sigma``    `\eta`     ``\eta``      `\tau`     ``\tau``      `\varrho`      ``\varrho``
  `\Theta`   ``\Theta``    `\theta`   ``\theta``    `\upsilon` ``\upsilon``  `\varsigma`    ``\varsigma``
  `\Upsilon` ``\Upsilon``  `\iota`    ``\iota``     `\phi`     ``\phi``      `\vartheta`    ``\vartheta``
  `\Xi`      ``\Xi``       `\kappa`   ``\kappa``    `\chi`     ``\chi``
  `\Omega`   ``\Omega``    `\lambda`  ``\lambda``   `\psi`     ``\psi``
  ========== ============  ========== ============  ========== ============  ============== ===============

In LaTeX, the default font for capital Greek letters is upright/roman.
*Italic* capital Greek letters can be obtained by loading a `package
providing the "ISO" math style`__. They are used by default in MathML.

Individual Greek italic capitals can also be achieved preceding the
letter name with ``var`` like ``\varPhi``:
`\varGamma\ \varDelta\ \varLambda\ \varPhi\ \varPi\ \varPsi\ \varSigma\
\varTheta\ \varUpsilon\ \varXi\ \varOmega`


__ https://mirrors.ctan.org/macros/latex/contrib/isomath/isomath.html#table-2


Letterlike symbols
------------------
.. class:: colwidths-auto

  ============= ===============  ========== ============  ========== ============  =========== =============
  `\forall`     ``\forall``      `\aleph`   ``\aleph``    `\hbar`    ``\hbar``     `\ell`      ``\ell``
  `\complement` ``\complement``  `\beth`    ``\beth``     `\hslash`  ``\hslash``   `\wp`       ``\wp``
  `\exists`     ``\exists``      `\gimel`   ``\gimel``    `\Im`      ``\Im``       `\Re`       ``\Re``
  `\Finv`       ``\Finv``        `\daleth`  ``\daleth``   `\imath`   ``\imath``    `\circledR` ``\circledR``
  `\Game`       ``\Game``        `\partial` ``\partial``  `\jmath`   ``\jmath``    `\circledS` ``\circledS``
  `\mho`        ``\mho``         `\eth`     ``\eth``      `\Bbbk`    ``\Bbbk``
  ============= ===============  ========== ============  ========== ============  =========== =============

Mathematical Alphabets
----------------------

Mathematical alphabets select a combination of font attributes (shape,
weight, family) [#]_. They are intended for mathematical variables where
style variations are important semantically.

.. class:: colwidths-auto

  ===============  ============================  ==========================
  command          example                       result
  ===============  ============================  ==========================
  ``\mathbf``      ``\mathbf{r}^2=x^2+y^2+z^2``  `\mathbf{r}^2=x^2+y^2+z^2`
  ``\mathbb``      ``\mathbb{R \subset C}``      `\mathbb{R \subset C}`
  ``\mathcal``     ``\mathcal{F}f(x)``           `\mathcal{F}f(x)`
  ``\mathfrak``    ``\mathfrak{a}``              `\mathfrak{a}`
  ``\mathit``      ``\mathit{\Gamma}``           `\mathit{\Gamma}`
  ``\mathrm``      ``s_\mathrm{out}``            `s_\mathrm{out}`
  ``\mathsf``      ``\mathsf x``                 `\mathsf x`
  ``\mathtt``      ``\mathtt{0.12}``             `\mathtt{0.12}`
  ===============  ============================  ==========================

.. [#] TeX’s *math alphabets* correspond to the `mathematical
   alphanumeric symbols`__ block in Unicode and the "mathvariant" `style
   attribute`__ in MathML.

   __ https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols
   __ https://developer.mozilla.org/en-US/docs/Web/MathML/Attribute

Additional alphabets are defined in LaTeX packages, e.g.

.. class:: colwidths-auto

  ===========  =============  ======================
  TeX command  LaTeX package  MathML "mathvariant"
  ===========  =============  ======================
  mathbfit     isomath_       bold-italic
  mathsfit     isomath_       sans-serif-italic
  mathsfbfit   isomath_       sans-serif-bold-italic
  mathscr      mathrsfs_      script
  ===========  =============  ======================
.. _isomath: https://www.ctan.org/pkg/isomath
.. _mathrsfs: https://www.ctan.org/pkg/mathrsfs

This can be used to typeset vector symbols in bold italic
in line with the International Standard [ISO-80000-2].

.. ``\mathbfit{r}^2=x^2+y^2+z^2`` becomes

   .. math:: \mathbfit{r}^2=x^2+y^2+z^2.

The package mathrsfs_ (and some drop-in replacements) define the ``\mathscr``
macro that selects a differently shaped "script" alphabet.
Compare `\mathscr{A, B, …, Z, a, b, …, z}`
with `\mathcal{A, B, …, Z, a, b, …, z}`.


In contrast to the math alphabet selectors, ``\boldsymbol`` only changes
the *font weight*. In LaTeX, it can be used to get a bold version of any
mathematical symbol (for other output formats, results are mixed):

.. math::
   \boldsymbol{\cos(x)\pm\alpha \approx 3\Gamma \quad \forall x\in\mathbb{R}}


Miscellaneous symbols
---------------------
.. class:: colwidths-auto

==================== ======================  ================ ==================  ================= ===================
`\#`                 ``\#``                  `\clubsuit`      ``\clubsuit``       `\neg`            ``\neg``
`\&`                 ``\&``                  `\diamondsuit`   ``\diamondsuit``    `\nexists`        ``\nexists``
`\angle`             ``\angle``              `\emptyset`      ``\emptyset``       `\prime`          ``\prime``
`\backprime`         ``\backprime``          `\exists`        ``\exists``         `\sharp`          ``\sharp``
`\bigstar`           ``\bigstar``            `\flat`          ``\flat``           `\spadesuit`      ``\spadesuit``
`\blacklozenge`      ``\blacklozenge``       `\forall`        ``\forall``         `\sphericalangle` ``\sphericalangle``
`\blacksquare`       ``\blacksquare``        `\heartsuit`     ``\heartsuit``      `\square`         ``\square``
`\blacktriangle`     ``\blacktriangle``      `\infty`         ``\infty``          `\surd`           ``\surd``
`\blacktriangledown` ``\blacktriangledown``  `\lozenge`       ``\lozenge``        `\top`            ``\top``
`\bot`               ``\bot``                `\measuredangle` ``\measuredangle``  `\triangle`       ``\triangle``
`\diagdown`          ``\diagdown``           `\nabla`         ``\nabla``          `\triangledown`   ``\triangledown``
`\diagup`            ``\diagup``             `\natural`       ``\natural``        `\varnothing`     ``\varnothing``
==================== ======================  ================ ==================  ================= ===================


Punctuation
-----------
.. class:: colwidths-auto

=== =====  ======== ===============  ======== ==========
`.` ``.``  `!`      ``!``            `\vdots` ``\vdots``
`/` ``/``  `?`      ``?``            `\dotsb` ``\dotsb``
`|` ``|``  `\colon` ``\colon`` [#]_  `\dotsc` ``\dotsc``
`'` ``'``  `\cdots` ``\cdots``       `\dotsi` ``\dotsi``
`;` ``;``  `\ddots` ``\ddots``       `\dotsm` ``\dotsm``
`:` ``:``  `\ldots` ``\ldots``       `\dotso` ``\dotso``
=== =====  ======== ===============  ======== ==========

.. [#] Punctuation (not ratio):
       Compare spacing in `a\colon b\to c` to `a:b = c`.

Relation symbols
----------------

Arrows
~~~~~~
.. class:: colwidths-auto

  ====================== ========================  ===================== =======================
  `\circlearrowleft`     ``\circlearrowleft``      `\circlearrowright`   ``\circlearrowright``
  `\curvearrowleft`      ``\curvearrowleft``       `\curvearrowright`    ``\curvearrowright``
  `\hookleftarrow`       ``\hookleftarrow``        `\hookrightarrow`     ``\hookrightarrow``
  `\leftarrow`           ``\leftarrow``            `\rightarrow`         ``\rightarrow``
  `\Leftarrow`           ``\Leftarrow``            `\Rightarrow`         ``\Rightarrow``
  `\leftarrowtail`       ``\leftarrowtail``        `\rightarrowtail`     ``\rightarrowtail``
  `\leftharpoondown`     ``\leftharpoondown``      `\rightharpoondown`   ``\rightharpoondown``
  `\leftharpoonup`       ``\leftharpoonup``        `\rightharpoonup`     ``\rightharpoonup``
  `\leftleftarrows`      ``\leftleftarrows``       `\rightrightarrows`   ``\rightrightarrows``
  `\leftrightarrow`      ``\leftrightarrow``       `\Leftrightarrow`     ``\Leftrightarrow``
  `\leftrightarrows`     ``\leftrightarrows``      `\rightleftarrows`    ``\rightleftarrows``
  `\leftrightharpoons`   ``\leftrightharpoons``    `\rightleftharpoons`  ``\rightleftharpoons``
  `\leftrightsquigarrow` ``\leftrightsquigarrow``  `\rightsquigarrow`    ``\rightsquigarrow``
  `\Lleftarrow`          ``\Lleftarrow``           `\Rrightarrow`        ``\Rrightarrow``
  `\longleftarrow`       ``\longleftarrow``        `\longrightarrow`     ``\longrightarrow``
  `\Longleftarrow`       ``\Longleftarrow``        `\Longrightarrow`     ``\Longrightarrow``
  `\longleftrightarrow`  ``\longleftrightarrow``   `\Longleftrightarrow` ``\Longleftrightarrow``
  `\looparrowleft`       ``\looparrowleft``        `\looparrowright`     ``\looparrowright``
  `\Lsh`                 ``\Lsh``                  `\Rsh`                ``\Rsh``
  `\mapsto`              ``\mapsto``               `\longmapsto`         ``\longmapsto``
  `\multimap`            ``\multimap``
  `\nleftarrow`          ``\nleftarrow``           `\nrightarrow`        ``\nrightarrow``
  `\nLeftarrow`          ``\nLeftarrow``           `\nRightarrow`        ``\nRightarrow``
  `\nleftrightarrow`     ``\nleftrightarrow``      `\nLeftrightarrow`    ``\nLeftrightarrow``
  `\nwarrow`             ``\nwarrow``              `\nearrow`            ``\nearrow``
  `\swarrow`             ``\swarrow``              `\searrow`            ``\searrow``
  `\twoheadleftarrow`    ``\twoheadleftarrow``     `\twoheadrightarrow`  ``\twoheadrightarrow``
  `\upharpoonleft`       ``\upharpoonleft``        `\upharpoonright`     ``\upharpoonright``
  `\downharpoonleft`     ``\downharpoonleft``      `\downharpoonright`   ``\downharpoonright``
  `\upuparrows`          ``\upuparrows``           `\downdownarrows`     ``\downdownarrows``
  ====================== ========================  ===================== =======================

Synonyms: `\gets` ``\gets``, `\to` ``\to``, `\restriction` ``\restriction``.

Comparison
~~~~~~~~~~

.. class:: colwidths-auto

================ ==================  ============= ===============  ============= ===============  =============== =================
`<`              ``<``               `\geq`           ``\geq``      `\ll`         ``\ll``          `\prec`         ``\prec``
`=`              ``=``               `\geqq`       ``\geqq``        `\lll`        ``\lll``         `\precapprox`   ``\precapprox``
`>`              ``>``               `\geqslant`   ``\geqslant``    `\lnapprox`   ``\lnapprox``    `\preccurlyeq`  ``\preccurlyeq``
`\approx`        ``\approx``         `\gg`         ``\gg``          `\lneq`       ``\lneq``        `\preceq`       ``\preceq``
`\approxeq`      ``\approxeq``       `\ggg`        ``\ggg``         `\lneqq`      ``\lneqq``       `\precnapprox`  ``\precnapprox``
`\asymp`         ``\asymp``          `\gnapprox`   ``\gnapprox``    `\lnsim`      ``\lnsim``       `\precneqq`     ``\precneqq``
`\backsim`       ``\backsim``        `\gneq`       ``\gneq``        `\ncong`      ``\ncong``       `\precnsim`     ``\precnsim``
`\backsimeq`     ``\backsimeq``      `\gneqq`      ``\gneqq``       `\neq`        ``\neq``         `\precsim`      ``\precsim``
`\bumpeq`        ``\bumpeq``         `\gnsim`      ``\gnsim``       `\ngeq`       ``\ngeq``        `\risingdotseq` ``\risingdotseq``
`\Bumpeq`        ``\Bumpeq``         `\gtrapprox`  ``\gtrapprox``   `\ngeqq`      ``\ngeqq``       `\sim`          ``\sim``
`\circeq`        ``\circeq``         `\gtreqless`  ``\gtreqless``   `\ngeqslant`  ``\ngeqslant``   `\simeq`        ``\simeq``
`\cong`          ``\cong``           `\gtreqqless` ``\gtreqqless``  `\ngtr`       ``\ngtr``        `\succ`         ``\succ``
`\curlyeqprec`   ``\curlyeqprec``    `\gtrless`    ``\gtrless``     `\nleq`       ``\nleq``        `\succapprox`   ``\succapprox``
`\curlyeqsucc`   ``\curlyeqsucc``    `\gtrsim`     ``\gtrsim``      `\nleqq`      ``\nleqq``       `\succcurlyeq`  ``\succcurlyeq``
`\doteq`         ``\doteq``          `\leq`        ``\leq``         `\nleqslant`  ``\nleqslant``   `\succeq`       ``\succeq``
`\doteqdot`      ``\doteqdot``       `\leqq`       ``\leqq``        `\nless`      ``\nless``       `\succnapprox`  ``\succnapprox``
`\eqcirc`        ``\eqcirc``         `\leqslant`   ``\leqslant``    `\nprec`      ``\nprec``       `\succneqq`     ``\succneqq``
`\eqsim`         ``\eqsim``          `\lessapprox` ``\lessapprox``  `\npreceq`    ``\npreceq``     `\succnsim`     ``\succnsim``
`\eqslantgtr`    ``\eqslantgtr``     `\lesseqgtr`  ``\lesseqgtr``   `\nsim`       ``\nsim``        `\succsim`      ``\succsim``
`\eqslantless`   ``\eqslantless``    `\lesseqqgtr` ``\lesseqqgtr``  `\nsucc`      ``\nsucc``       `\thickapprox`  ``\thickapprox``
`\equiv`         ``\equiv``          `\lessgtr`    ``\lessgtr``     `\nsucceq`    ``\nsucceq``     `\thicksim`     ``\thicksim``
`\fallingdotseq` ``\fallingdotseq``  `\lesssim`    ``\lesssim``                                    `\triangleq`    ``\triangleq``
================ ==================  ============= ===============  ============= ===============  =============== =================

The commands ``\lvertneqq`` and ``\gvertneqq`` are not supported by
LateX2MathML, as there is no corresponding Unicode character.

Synonyms: `\ne` ``\ne``, `\le` ``\le``, `\ge` ``\ge``,
`\Doteq` ``\Doteq``, `\llless` ``\llless``, `\gggtr` ``\gggtr``.

Symbols can be negated prepending ``\not``, e.g.
`\not=` ``\not=``, `\not\equiv` ``\not\equiv``,
`\not\gtrless` ``\not\gtrless``, `\not\lessgtr` ``\not\lessgtr``.

Miscellaneous relations
~~~~~~~~~~~~~~~~~~~~~~~
.. class:: colwidths-auto

  ===================== =======================  =================== =====================  =================== =====================
  `\backepsilon`        ``\backepsilon``         `\ntrianglelefteq`  ``\ntrianglelefteq``   `\subseteq`         ``\subseteq``
  `\because`            ``\because``             `\ntriangleright`   ``\ntriangleright``    `\subseteqq`        ``\subseteqq``
  `\between`            ``\between``             `\ntrianglerighteq` ``\ntrianglerighteq``  `\subsetneq`        ``\subsetneq``
  `\blacktriangleleft`  ``\blacktriangleleft``   `\nvdash`           ``\nvdash``            `\subsetneqq`       ``\subsetneqq``
  `\blacktriangleright` ``\blacktriangleright``  `\nVdash`           ``\nVdash``            `\supset`           ``\supset``
  `\bowtie`             ``\bowtie``              `\nvDash`           ``\nvDash``            `\Supset`           ``\Supset``
  `\dashv`              ``\dashv``               `\nVDash`           ``\nVDash``            `\supseteq`         ``\supseteq``
  `\frown`              ``\frown``               `\parallel`         ``\parallel``          `\supseteqq`        ``\supseteqq``
  `\in`                 ``\in``                  `\perp`             ``\perp``              `\supsetneq`        ``\supsetneq``
  `\mid`                ``\mid``                 `\pitchfork`        ``\pitchfork``         `\supsetneqq`       ``\supsetneqq``
  `\models`             ``\models``              `\propto`           ``\propto``            `\therefore`        ``\therefore``
  `\ni`                 ``\ni``                  `\shortmid`         ``\shortmid``          `\trianglelefteq`   ``\trianglelefteq``
  `\nmid`               ``\nmid``                `\shortparallel`    ``\shortparallel``     `\trianglerighteq`  ``\trianglerighteq``
  `\notin`              ``\notin``               `\smallfrown`       ``\smallfrown``        `\varpropto`        ``\varpropto``
  `\nparallel`          ``\nparallel``           `\smallsmile`       ``\smallsmile``        `\vartriangle`      ``\vartriangle``
  `\nshortmid`          ``\nshortmid``           `\smile`            ``\smile``             `\vartriangleleft`  ``\vartriangleleft``
  `\nshortparallel`     ``\nshortparallel``      `\sqsubset`         ``\sqsubset``          `\vartriangleright` ``\vartriangleright``
  `\nsubseteq`          ``\nsubseteq``           `\sqsubseteq`       ``\sqsubseteq``        `\vdash`            ``\vdash``
  `\nsubseteqq`         ``\nsubseteqq``          `\sqsupset`         ``\sqsupset``          `\Vdash`            ``\Vdash``
  `\nsupseteq`          ``\nsupseteq``           `\sqsupseteq`       ``\sqsupseteq``        `\vDash`            ``\vDash``
  `\nsupseteqq`         ``\nsupseteqq``          `\subset`           ``\subset``            `\Vvdash`           ``\Vvdash``
  `\ntriangleleft`      ``\ntriangleleft``       `\Subset`           ``\Subset``
  ===================== =======================  =================== =====================  =================== =====================

Synonyms: `\owns` ``\owns``.

Symbols can be negated prepending ``\not``, e.g.
`\not\in` ``\not\in``, `\not\ni` ``\not\ni``.

The commands ``\varsubsetneq``, ``\varsubsetneqq``, ``\varsupsetneq``,
and ``\varsupsetneqq`` are not supported by LateX2MathML, as there is no
corresponding Unicode character.

Variable-sized operators
------------------------
.. class:: colwidths-auto

  =========================  =========================  =========================  ===========================
  `\sum`      ``\sum``       `\prod`     ``\prod``      `\bigcap`   ``\bigcap``    `\bigodot`   ``\bigodot``
  `\int`      ``\int``       `\coprod`   ``\coprod``    `\bigcup`   ``\bigcup``    `\bigoplus`  ``\bigoplus``
  `\oint`     ``\oint``      `\bigwedge` ``\bigwedge``  `\biguplus` ``\biguplus``  `\bigotimes` ``\bigotimes``
  `\smallint` ``\smallint``  `\bigvee`   ``\bigvee``    `\bigsqcup` ``\bigsqcup``
  =========================  =========================  =========================  ===========================

Larger symbols are used in displayed formulas, sum-like symbols have
indices above/below the symbol (see also `scripts and limits`_):

.. math:: \sum_{n=1}^N a_n \qquad
          \int_0^1f(x)\,dx \qquad
          \prod_{i=1}^{10} b_i \ldots

Notations
=========

Top and bottom embellishments
-----------------------------

See `Accents and embellishments`_.

Extensible arrows
-----------------

\xleftarrow and \xrightarrow produce arrows that extend automatically to
accommodate unusually wide subscripts or superscripts. These commands
take one optional argument (the subscript) and one mandatory argument
(the superscript, possibly empty)::

  A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C

results in

.. math:: A \xleftarrow{n+\mu-1} B \xrightarrow[T]{n\pm i-1} C

Affixing symbols to other symbols
---------------------------------

In addition to the standard `accents and embellishments`_, other symbols
can be placed above or below a base symbol with the ``\overset`` and
``\underset`` commands. The symbol is set in "scriptstyle" (smaller font
size). For example, writing ``\overset{*}{X}`` becomes `\overset{*}{X}`
and ``\underset{+}{M}`` becomes `\underset{+}{M}`.


Matrices
--------

The ``matrix`` and ``cases`` environments can also contain ``\\`` and
``&``::

  .. math::
     \left ( \begin{matrix} a & b \\ c & d \end{matrix}\right)

Result:

.. math::
     \left ( \begin{matrix} a & b \\ c & d \end{matrix} \right)

The environments ``pmatrix``, ``bmatrix``, ``Bmatrix``, ``vmatrix``, and
``Vmatrix`` have (respectively) ( ), [ ], { }, \| \|, and `\Vert\ \Vert`
delimiters built in, e.g.

.. math:: \begin{pmatrix} a & b \\ c & d \end{pmatrix} \qquad
          \begin{bmatrix} a & b \\ c & d \end{bmatrix} \qquad
          \begin{Vmatrix} a & b \\ c & d \end{Vmatrix}

To produce a small matrix suitable for use in text, there is a
``smallmatrix`` environment
`\bigl(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\bigr)`
that comes closer to fitting within a single text line than a normal
matrix.


For piecewise function definitions there is a ``cases`` environment:

.. math:: \mathrm{sgn}(x) = \begin{cases}
                                        -1 & x<0\\
                              \phantom{-}1 & x>0
                            \end{cases}

Spacing commands
----------------

Horizontal spacing of elements can be controlled with the following
commands:

.. class:: colwidths-auto

  ======================  ========  =====================  ==================
  :m:`3\qquad 4`                    ``3\qquad 4``          = 2em
  :m:`3\quad 4`                     ``3\quad 4``           = 1em
  :m:`3~4`                ``3~4``   ``3\nobreakspace 4``
  :m:`3\ 4`               ``3\ 4``                         escaped space
  :m:`3\;4`               ``3\;4``  ``3\thickspace 4``
  :m:`3\:4`               ``3\:4``  ``3\medspace 4``
  :m:`3\,4`               ``3\,4``  ``3\thinspace 4``
  :m:`3  4`               ``3  4``                         regular space [#]_
  :m:`3\!4`               ``3\!4``  ``3\negthinspace 4``
  :m:`3\negmedspace 4`              ``3\negmedspace 4``
  :m:`3\negthickspace 4`            ``3\negthickspace 4``
  `3\hspace{1ex}4`                  ``3\hspace{1ex}4``     custom length
  `3\mspace{20mu}4`                 ``3\mspace{20mu}4``    custom length [#]_
  ======================  ========  =====================  ==================

.. [#] Whitespace characters are ignored in LaTeX math mode.
.. [#] Unit must be 'mu' (1 mu = 1/18em).

Negative spacing does not work with MathML (in Firefox 78).

There are also three commands that leave a space equal to the height and
width of its argument. For example ``\phantom{XXX}`` results in space as
wide and high as three X’s:

.. math:: \frac{\phantom{XXX}+1}{XXX-1}

The commands ``\hphantom`` and ``\vphantom`` insert space with the
width or height of the argument. They are not supported with `math_output`_
MathML.

Roots
-----

.. class:: colwidths-auto

  =========  ====================  ==================
  command    example               result
  =========  ====================  ==================
  ``\sqrt``  ``\sqrt{x^2-1}``      `\sqrt{x^2-1}`
  ..         ``\sqrt[3n]{x^2-1}``  `\sqrt[3n]{x^2-1}`
  ..         ``\sqrt\frac{1}{2}``  `\sqrt\frac{1}{2}`
  =========  ====================  ==================

Boxed formulas
--------------

The command ``\boxed`` puts a box around its argument:

.. math:: \boxed{\eta \leq C(\delta(\eta) +\Lambda_M(0,\delta))}



Fractions and related constructions
===================================

The ``\frac`` command takes two ar guments, numerator and denominator,
and typesets them in normal fraction form. For example, ``U = \frac{R}{I}``
produces `U = \frac{R}{I}`. Use ``\dfrac`` or ``\tfrac`` to
force text style and display style respectively.

.. math:: \frac{x+1}{x-1}  \quad
          \dfrac{x+1}{x-1} \quad
          \tfrac{x+1}{x-1}

and in text: `\frac{x+1}{x-1}`, `\dfrac{x+1}{x-1}`, `\tfrac{x+1}{x-1}`.

For binomial expressions such as `\binom{n}{k}`,
there are ``\binom``, ``\dbinom`` and ``\tbinom`` commands::

  2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}

prints

.. math::  2^k-\binom{k}{1}2^{k-1}+\binom{k}{2}2^{k-2}

The ``\cfrac`` command for continued fractions uses displaystyle and
padding for sub-fractions:

.. math:: \frac{\pi}{4} = 1 + \cfrac{1^2}{
                              2 + \cfrac{3^2}{
                                  2 + \cfrac{5^2}{
                                      2 + \cfrac{7^2}{2 + \cdots}
                              }}}
          \qquad \text{vs.}\qquad
          \frac{\pi}{4} = 1 + \frac{1^2}{
                              2 + \frac{3^2}{
                                  2 + \frac{5^2}{
                                      2 + \frac{7^2}{2 + \cdots}
                              }}}

It supports the optional argument ``[l]`` or ``[r]`` for
left or right placement of the numerator:

.. math::  \cfrac[l]{x}{x-1} \quad
           \cfrac{x}{x-1}    \quad
           \cfrac[r]{x}{x-1}


Delimiter sizes
===============

Besides the automatic scaling of `extensible delimiters`_ with ``\left``
and ``\right``, there are four commands to manually select delimiters of
fixed size:

.. class:: colwidths-auto

  =========  ==============  ==============  ==============  ==============  ===============  ===============
  Sizing     no              ``\left``       ``\bigl``       ``\Bigl``       ``\biggl``       ``\Biggl``
  command                    ``\right``      ``\bigr``       ``\Bigr``       ``\biggr``       ``\Biggr``
  ---------  --------------  --------------  --------------  --------------  ---------------  ---------------
  Result     `\displaystyle  `\displaystyle  `\displaystyle  `\displaystyle  `\displaystyle   `\displaystyle
             (b)             \left(b\right)  \bigl(b\bigr)   \Bigl(b\Bigr)   \biggl(b\biggr)  \Biggl(b\Biggr)
             (\frac{c}{d})`  \left(\frac{c}  \bigl(\frac{c}  \Bigl(\frac{c}  \biggl(\frac{c}  \Biggl(\frac{c}
                             {d}\right)`     {d}\bigr)`      {d}\Bigr)`      {d}\biggr)`      {d}\Biggr)`
  =========  ==============  ==============  ==============  ==============  ===============  ===============

There are two or three situations where the delimiter size is commonly
adjusted using these commands:

The first kind of adjustment is done for cumulative operators with
limits, such as summation signs. With ``\left`` and ``\right`` the
delimiters usually turn out larger than necessary, and using the ``Big``
or ``bigg`` sizes instead gives better results:

.. math::
   \left[\sum_i a_i\left\lvert\sum_j x_{ij}\right\rvert^p\right]^{1/p}
   \text{ versus }
   \biggl[\sum_i a_i\Bigl\lvert\sum_j x_{ij}\Bigr\rvert^p\biggr]^{1/p}

The second kind of situation is clustered pairs of delimiters, where
\left and \right make them all the same size (because that is adequate to
cover the encompassed material), but what you really want is to make some
of the delimiters slightly larger to make the nesting easier to see.

.. math:: \left((a_1 b_1) - (a_2 b_2)\right)
          \left((a_2 b_1) + (a_1 b_2)\right)
          \quad\text{versus}\quad
          \bigl((a_1 b_1) - (a_2 b_2)\bigr)
          \bigl((a_2 b_1) + (a_1 b_2)\bigr)

The third kind of situation is a slightly oversize object in running
text, such as `\left|\frac{b'}{d'}\right|` where the delimiters produced
by ``\left`` and ``\right`` cause too much line spreading. [#]_ In that case
``\bigl`` and ``\bigr`` can be used to produce delimiters that are larger
than the base size but still able to fit within the normal line spacing:
`\bigl|\frac{b'}{d'}\bigr|`.

.. [#] With MathML, an example would be parentheses
   around a ``smallmatrix`` environment
   `\left(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\right)`
   vs. `\Bigl(\begin{smallmatrix} a & b \\ c & d \end{smallmatrix}\Bigr)`.

Text
====

The main use of the command ``\text`` is for words or phrases in a
display. It is similar to ``\mbox`` in its effects but, unlike ``\mbox``,
automatically produces subscript-size text if used in a subscript,
``k_{\text{B}}T`` becomes `k_{\text{B}}T`.

Whitespace is kept inside the argument:

.. Math:: f_{[x_{i-1},x_i]} \text{ is monotonic for }  i = 1,\,…,\,c+1


The text may contain math commands wrapped in ``$`` signs, e.g.

.. math:: (-1)^{n_i} = \begin{cases} -1 \quad \text{if $n_i$ is odd,} \\
                                     +1 \quad \text{if $n_i$ is even.}
                       \end{cases}

.. TODO ignore {}, handle text-mode commands

.. TODO: ``\mod`` and its relatives
         --------------------------

  Commands ``\mod``, ``\bmod``, ``\pmod``, ``\pod`` deal with the special
  spacing conventions of “mod” notation. ``\mod`` and ``\pod`` are
  variants of ``\pmod`` preferred by some authors; ``\mod`` omits the
  parentheses, whereas ``\pod`` omits the “mod” and retains the
  parentheses.

  \gcd(n,m\bmod n) ;\quad x\equiv y\pmod b
  ;\quad x\equiv y\mod c ;\quad x\equiv y\pod d


Integrals and sums
==================

The limits on integrals, sums, and similar symbols are placed either to
the side of or above and below the base symbol, depending on convention
and context. In inline formulas and fractions, the limits on sums, and
similar symbols like

.. math:: \lim_{n\to\infty} \sum_1^n \frac{1}{n}

move to index positions: `\lim_{n\to\infty} \sum_1^n \frac{1}{n}`.

Altering the placement of limits
--------------------------------

The commands ``\intop`` and ``\ointop`` produce integral signs with
limits as in sums and similar: `\intop_0^1`, `\ointop_c` and

.. math:: \intop_0^1 \quad \ointop_c
             \quad \text{vs.} \quad
          \int^1_0   \quad \oint_c

The commands ``\limits`` and ``\nolimits`` override the default placement
of the limits for any operator; ``\displaylimits`` forces standard
positioning as for the \sum command. They should follow immediately after
the operator to which they apply.

Compare the same term with default positions, ``\limits``, and
``\nolimits`` in inline and display mode: `\lim_{x\to0}f(x)`,
`\lim\limits_{x\to0}f(x)`, `\lim\nolimits_{x\to0}f(x)`, vs.

.. math:: \lim_{x\to0}f(x), \quad
          \lim\limits_{x\to0}f(x) \quad
          \lim\nolimits_{x\to0}f(x).

.. TODO: \substack

.. TODO: \sideset


Changing the size of elements in a formula
==========================================

The declarations [#]_ ``\displaystyle``, ``\textstyle``,
``\scriptstyle``, and ``\scriptscriptstyle``, select a symbol size and
spacing that would be applied in (respectively) display math, inline
math, first-order subscript, or second-order subscript, even when the
current context would normally yield some other size.

For example ``:math:`\displaystyle \sum_{n=0}^\infty
\frac{1}{n}``` is printed as `\displaystyle \sum_{n=0}^\infty \frac{1}{n}`
rather than `\sum_{n=0}^\infty \frac{1}{n}` and ::

  \frac{\scriptstyle\sum_{n > 0} z^n}
  {\displaystyle\prod_{1\leq k\leq n} (1-q^k)}

yields

.. math::

  \frac{\scriptstyle\sum_{n > 0} z^n}
  {\displaystyle\prod_{1\leq k\leq n} (1-q^k)}
  \text{ instead of the default }
  \frac{\sum_{n > 0} z^n}
  {\prod_{1\leq k\leq n} (1-q^k)}.

.. [#] "Declarations" are commands that affect processing of the current
   "group". In particular, notice where the braces fall that delimit the
   effect of the command: Right: ``{\displaystyle ...}`` Wrong:
   ``\displaystyle{...}``.

   With math_output_ MathML, the declaration must be the first element
   after the opening bracket.


Appendix
========

Tests
-----


Font changes
~~~~~~~~~~~~

Math alphabet macros change the default alphabet ("mathvariant" in
MathML), leaving some symbols unchanged:

:normal: `abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R`
:mathrm: `\mathrm{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathit: `\mathit{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathsf: `\mathsf{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathbb: `\mathbb{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathbf: `\mathbf{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathcal: `\mathcal{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`
:mathscr: `\mathscr{abs(x) \pm \alpha \approx 3 \Gamma  \quad \forall x \in R}`

Unicode supports the following blackboard-bold characters:
`\mathbb{a \ldots z A \ldots Z 0 \ldots 9
\mathbb\Gamma \mathbb{\Pi} \mathbb {\Sigma} \mathbb\gamma \mathbb\pi}`.


Inferred <mrow>s in MathML
~~~~~~~~~~~~~~~~~~~~~~~~~~

The elements <msqrt>, <mstyle>, <merror>, <mpadded>, <mphantom>, <menclose>,
<mtd>, <mscarry>, and <math> treat their contents as a single inferred mrow
formed from all their children.

.. math:: a = \sqrt 2 + x,\quad
          b = \sqrt{1+x^2},\quad
          c = \sqrt\frac{\sin(x)}{23},

inline: :math:`a = \sqrt 2 + x, b = \sqrt{1+x^2}, c = \sqrt\frac{\sin(x)}{23}`.


Scripts and Limits
~~~~~~~~~~~~~~~~~~

Accents should be nearer to the base (in MathML Firefox 78, it's vice versa!):
`\bar a \overline a, \bar l \overline l, \bar i \overline i`,
`\vec{r}` `\overrightarrow{r}`.

Sub- and superscript may be given in any order:
`x_i^j = x^j_i` and `\int_0^1 = \int^1_0`.

Double exponent: `x^{10^4}`, `r_{T_\mathrm{in}}` and `x_i^{n^2}`.


Nested groups
~~~~~~~~~~~~~

tex-token returns "{" for nested groups:

.. math:: \text{das ist ein  {toller} text (unescaped \{ and \} is
                ignored by LaTeX)}

Big delimiters and symbols
~~~~~~~~~~~~~~~~~~~~~~~~~~
Compare automatic sizing with fixed sizes:

.. math:  \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\


.. math::
  \left( 3                          \right)
  \left( f(x)                       \right)
  \left( \bar x                     \right)
  \left( \overline x                \right)
  \left( n_i                        \right) &= () \\
  \left( \underline x               \right) &= \bigl(\text{big}\bigr)\\
  \left( 3^2                        \right)
  \left( \sqrt{3}                   \right)
  \left( \sqrt{3^2}                 \right)
  \left( \sum                       \right)
  \left( \bigotimes                 \right)
  \left( \prod                      \right) &= \Bigl(\text{Big}\Bigr)\\
  \left( \frac{3  }{2}              \right)
  \left( \frac{3^2}{2^4}            \right)
  \binom{3  }{2}
  \begin{pmatrix} a & b \\ c & d \end{pmatrix}
  \left( \frac{1}{\sqrt 2}          \right)
  \left( \int                       \right)
  \left( \int_0                     \right)
  \left( \int^1                     \right)
  \left( \int_0^1                   \right) &= \biggl(\text{bigg}\biggr)\\
  \left( \frac{\sqrt 2}{2}          \right)
  \left( \sum_0                     \right)
  \left( \sum^1                     \right)
  \left( \sum_0^1                   \right)
  \left( \frac{\frac1x}{\frac{1}{n}}\right) &= \Biggl(\text{Bigg}\Biggr)\\
  \left( \intop_0                   \right)
  \left( \intop^1                   \right)
  \left( \intop_0^1                 \right)

And in text:

:`()`:                        `\left(3                          \right)
                              \left( f(x)                       \right)
                              \left( \bar x                     \right)
                              \left( \overline x                \right)
                              \left( n_i                        \right)
                              \left( \sum                       \right)
                              \left( \sum_0                     \right)
                              \left( \prod                      \right)`


:`\bigl(\text{big}\bigr)`:    `\left(\underline x               \right)
                              \left( 3^2                        \right)
                              \binom{3}{2}
                              \left(\begin{smallmatrix} a & b \\
                              c & d \end{smallmatrix}           \right)
                              \left( \bigotimes                 \right)`

:`\Bigl(\text{Big}\Bigr)`:    `\left(\sqrt{3}                   \right)
                              \left( \sqrt{3^2}                 \right)
                              \left( \frac{3}{2}                \right)
                              \left( \frac{3^2}{2^4}            \right)
                              \left( \frac{\sqrt 2}{2}          \right)
                              \left( \int                       \right)
                              \left( \int_0                     \right)
                              \left( \int^1                     \right)
                              \left( \int_0^1                   \right)
                              \left( \sum^1                     \right)
                              \left( \sum_0^1                   \right)
                              \left( \frac{\frac1x}{\frac{1}{n}}\right)`





Test ``\left``, ``\right``, and the  \bigl/\bigr, … size commands
with all extensible delimiters.

.. math::
   \left.(b\right)\ \bigl(b\Bigr)\ \biggl(b\Biggr)
   \quad
   \left.[b\right]\ \bigl[b\Bigr]\ \biggl[b\Biggr]
   \quad
   \left.\{b\right \} \ \bigl\{b\Bigr \} \ \biggl\{b\Biggr \}
   \quad
   \left.\langle b\right\rangle\ \bigl\langle b\Bigr\rangle\ \biggl\langle b\Biggr\rangle

   \left.\lceil b\right\rceil\ \bigl\lceil b\Bigr\rceil\ \biggl\lceil b\Biggr\rceil
   \quad
   \left.\lfloor b\right\rfloor\ \bigl\lfloor b\Bigr\rfloor\ \biggl\lfloor b\Biggr\rfloor
   \quad
   \left.\lvert b\right\rvert\ \bigl\lvert b\Bigr\rvert\
   \biggl\lvert b\Biggr\rvert
   \quad
   \left.\lVert b\right\rVert\ \bigl\lVert b\Bigr\rVert\
   \biggl\lVert b\Biggr\rVert

   \left.\lgroup b\right\rgroup\ \bigl\lgroup b\Bigr\rgroup\ \biggl\lgroup b\Biggr\rgroup
   \quad
   \left.\lmoustache b\right\rmoustache\ \bigl\lmoustache b\Bigr\rmoustache\ \biggl\lmoustache b\Biggr\rmoustache
   \quad
   \left./b\right\backslash\ \bigl/b\Bigr\backslash\ \biggl/b\Biggr\backslash

   \left.|b\right\|\ \bigl|b\Bigr\|\ \biggl|b\Biggr\|
   \quad
   \left.\vert b\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert
   \quad
   \left.\arrowvert b\right\Arrowvert\ \bigl\arrowvert b\Bigr\Arrowvert\ \biggl\arrowvert b\Biggr\Arrowvert
   \quad
   \left.\bracevert b\right\bracevert\ \bigl\bracevert b\Bigr\bracevert\ \biggl\bracevert b\Biggr\bracevert
   \quad
   \left.\vert b\right\Vert\ \bigl\vert b\Bigr\Vert\ \biggl\vert b\Biggr\Vert


Variable-sized operators:

Inline: `\int\ \iint\ \iiint\ \iiiint\ \idotsint \oint\ \smallint\
\sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\ \biguplus\
\bigsqcup\ \bigodot\ \bigoplus\ \bigotimes` and Display:

.. math:: \int\ \iint\ \iiint\ \iiiint\ \idotsint\ \oint\ \smallint\
   \sum\ \prod\ \coprod\ \bigwedge\ \bigvee\ \bigcap\ \bigcup\
   \biguplus\ \bigsqcup\ \bigodot\ \bigoplus\ \bigotimes

.. math:: \int_1 f\ \intop_1 f\ \iint_1 f\ \smallint_1 f\ \sum_1\
   \prod_1\ \bigwedge_1\ \bigcap_1\ \biguplus_1\ \bigodot_1\ \int^N\
   \intop^N\ \iiiint^N\ \oint^N\ \smallint^N\ \sum^N\ \coprod^N\
   \bigvee^N\ \bigcup^N\ \bigsqcup^N\ \bigotimes^N

.. math:: \int_1^N\ \intop_1^N\ \iint_1^N\ \iiint_1^N\ \iiiint_1^N\
   \idotsint_1^N\ \oint_1^N\ \smallint_1^N\ \sum_1^N\ \prod_1^N\
   \coprod_1^N\ \bigwedge_1^N\ \bigvee_1^N\ \bigcap_1^N\ \bigcup_1^N
   \ \biguplus_1^N\ \bigsqcup_1^N\ \bigodot_1^N\ \bigoplus_1^N\
   \bigotimes_1^N


Text
~~~~

The text may contain non-ASCII characters: `n_\text{Stoß}`.

Some text-mode LaTeX commands are supported with math_output_ "html".
In other output formats, use literal Unicode: `\text{ç é è ë ê ñ ů ž ©}`
to get the result of the accent macros
`\text{\c{c} \'e \`e \"e \^e \~n \r{u} \v{z} \textcircled{c}}`.