Difference between revisions of "Public:Writing LaTeX"

m
(Commutative diagrams: XyJax documentation)
Line 27: Line 27:


== Commutative diagrams ==
== Commutative diagrams ==

=== Matrices/arrays ===
For commutative diagrams the simplest option is to just use arrays:
For commutative diagrams the simplest option is to just use arrays:


Line 67: Line 69:
\]
\]


=== CD package ===
Another option is to use CD
Another option is to use CD
<math>\require{amscd}</math>
<math>\require{amscd}</math>
Line 76: Line 79:
However, CD doesn't support diagnoal arrows [https://math.meta.stackexchange.com/questions/14986/is-it-possible-to-draw-a-diagonal-arrow-in-a-commutative-diagram]. Note that to use CD one has to include <code>&lt;math&gt;\require{amscd}&lt;/math&gt;</code> somewhere in the text. Basic documentation of CD can be found [https://www.jmilne.org/not/Mamscd.pdf here].
However, CD doesn't support diagnoal arrows [https://math.meta.stackexchange.com/questions/14986/is-it-possible-to-draw-a-diagonal-arrow-in-a-commutative-diagram]. Note that to use CD one has to include <code>&lt;math&gt;\require{amscd}&lt;/math&gt;</code> somewhere in the text. Basic documentation of CD can be found [https://www.jmilne.org/not/Mamscd.pdf here].


=== Xy package ===
<!--
If one prefers to use TikZ diagrams or XY, it's possible to prepare the diagram in [http://presheaf.com/ presheaf.com] and then just add a link to the generated image. For example, this one


And finally, with [https://sonoisa.github.io/xyjax-v3/xyjax-v3.html XyJax package], we can now create fancy diagrams with diagonal arrows!
<center>
http://presheaf.com/cache/d3e436z2t5w3p603o2v6838s494d1r32.png
</center>


\begin{xy}
or (preferably) also include a link to the source (so that it can be easily eddited if needed):
\xymatrix {
U \ar@/_/[ddr]_y \ar@{.>}[dr]|{\langle x,y \rangle} \ar@/^/[drr]^x \\
& X \times_Z Y \ar[d]^q \ar[r]_p & X \ar[d]_f \\
& Y \ar[r]^g & Z
}
\end{xy}

The basic pattern is:
<code>
\begin{xy}
\xymatrix {
...
}
\end{xy}
</code>


<center>
[http://presheaf.com/?d=d3e436z2t5w3p603o2v6838s494d1r32 <img src="http://presheaf.com/cache/d3e436z2t5w3p603o2v6838s494d1r32.png" title="click to go to presheaf.com for editing"/>]
</center>


[https://sonoisa.github.io/xyjax-v3/xyjax-v3.html This page] at the bottom includes more example diagrams. For more details about the syntax see the original [https://www.tug.org/applications/Xy-pic/ Xy pic docummentation].
The problem with this approach is that it's not as reliable (we had a couple of images disappearing in time). Please always include the source of the diagram from presheaf.com also in the HTML comment on the page in between <code>&lt;!--</code> and <code>--&gt;</code>.
-->


== Collapsible sections ==
== Collapsible sections ==

Revision as of 22:48, 2 November 2022

\( \newcommand\Ek{\mathbb E_k} \newcommand\Pk{\mathbb P_k} \)

This page serves as an example of how to write LaTeX formulas on this wiki. Go to Edit of this page to see how it's done (especially see the top of the text where I define new macros the same way as we would do in the regular LaTeX). Internally it uses MathJax as its LaTeX engine. See this mathoveflow thread for reference.

Note that there are minor differences with LaTeX on this Wiki. Inline mathematics is typeset with \(...\), and <math> HTML tag. This means that $...$ won't work! And display style maths is written with \[...\], \begin{XXX}...\end{XXX}, where XXX can be, for example, align.


See for example this \(\Ek A\) and \(\Pk A\) and also the following:

\[ \Ek A =\ ... \] and \begin{align} \Pk A = ... \end{align}

Note that the advantage of \(...\) is that it is also valid LaTeX, so it can be then just copy-pasted into papers, when in rush :-).

Commutative diagrams

Matrices/arrays

For commutative diagrams the simplest option is to just use arrays:

\[ \begin{array}{ccc} 0 & \xrightarrow{i} & A & \xrightarrow{f} & B & \xrightarrow{q} & C & \xrightarrow{d} & 0\\ \downarrow & \searrow & \downarrow & \nearrow & \downarrow & \searrow & \downarrow & \nearrow & \downarrow\\ 0 & \xrightarrow{j} & D & \xrightarrow{g} & E & \xrightarrow{r} & F & \xrightarrow{e} & 0 \end{array}\]

or like so \[ \newcommand{\ra}[1]{\kern-1.5ex\xrightarrow{\ \ #1\ \ }\phantom{}\kern-1.5ex} \newcommand{\ras}[1]{\kern-1.5ex\xrightarrow{\ \ \smash{#1}\ \ }\phantom{}\kern-1.5ex} \newcommand{\da}[1]{\bigg\downarrow\raise.5ex\rlap{\scriptstyle#1}} \begin{array}{c} 0 & \ra{f_1} & A & \ra{f_2} & B & \ra{f_3} & C & \ra{f_4} & D & \ra{f_5} & 0 \\ \da{g_1} & & \da{g_2} & & \da{g_3} & & \da{g_4} & & \da{g_5} & & \da{g_6} \\ 0 & \ras{h_1} & 0 & \ras{h_2} & E & \ras{h_3} & F & \ras{h_4} & 0 & \ras{h_5} & 0 \\ \end{array} \] Complicated diagrams can be made by just stacking arrays/matrices in layers, e.g. \[ \matrix{ \mathbb C(A) & \xrightarrow{h_t} & B \\ {}_{\epsilon^{\mathbb C}} \downarrow & \matrix{ \nwarrow {}^{\iota_f} & & {}^g \nearrow \\ & \mkern-20mu X \xrightarrow{\quad\phi\quad} Y \mkern-20mu & \\ \swarrow {}_{f} & & {}_{\iota_g} \searrow } & \uparrow {}_{\epsilon^{\mathbb D}} \\ A & \underset{h_b}{\xleftarrow{\quad}} & \mathbb D(B) } \]

CD package

Another option is to use CD \(\require{amscd}\) \begin{CD} \mathbb{Z}/p^n\mathbb{Z} @>{\theta_{n+1,\alpha}}>> U_1/U_{n+1}\\ @VVV @VVV\\ \mathbb{Z}/p^{n-1}\mathbb{Z} @>{\theta_{n,\alpha}}>> U_1/U_n \end{CD} However, CD doesn't support diagnoal arrows [1]. Note that to use CD one has to include <math>\require{amscd}</math> somewhere in the text. Basic documentation of CD can be found here.

Xy package

And finally, with XyJax package, we can now create fancy diagrams with diagonal arrows!

\begin{xy} \xymatrix { U \ar@/_/[ddr]_y \ar@{.>}[dr]|{\langle x,y \rangle} \ar@/^/[drr]^x \\ & X \times_Z Y \ar[d]^q \ar[r]_p & X \ar[d]_f \\ & Y \ar[r]^g & Z } \end{xy}

The basic pattern is: \begin{xy} \xymatrix { ... } \end{xy}


This page at the bottom includes more example diagrams. For more details about the syntax see the original Xy pic docummentation.

Collapsible sections

For writing parts of text that are collapsed and the viewer needs to click on "Expand" to see them, there is a simple trick. Just put the desired text within a div like this:

<div class="mw-collapsible mw-collapsed"> ... </div>

This is especially handy when hiding proofs, which can be done as follows:

<div class="proof mw-collapsible mw-collapsed"> (a proof goes here) </div>