I would like to know if the MaTeX package from our colleague Szabolcs can align the calculation steps as possible by the code below:


%% Language and font encodings

%% Sets page size and margins

%% Useful packages
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\title{Your Paper}

\usepackage{amsmath, amssymb}


V &= \int_0^H dV\\
  &= \int_0^H A'\,dh\\
  &= \int_0^H \frac{Ah^2}{H^2}\,dh\\
  &= \frac{A}{H^2}\left|\frac{h^3}{3}\right|_0^H\\
  &= \frac{A}{H^2}\cdot\frac{H^3}{3}\\
  &= \frac{1}{3}AH



enter image description here

Information: The above code is not for Mathematica software, but it is a reference for LaTeX language users.

The code below (this one yes) is what I would like to align in Mathematica software:

MaTeX["\\int_0^r 2\\pi r\\,dr = 2\\pi \\int_0^r r\\,dr = \
2\\pi\\bigg\vert_0^r \\frac{r^2}{2} = \\bigg(2\\pi \
\\frac{r^2}{2}\\bigg)-\\bigg(2\\pi \\frac{0^2}{2}\\bigg) = \
\\frac{2\\pi r^2}{2} = \\ boldsymbol{\\pi r^2}"]

Is the \begin{align} function available in this package?

  • $\begingroup$ This is discussed both on the webpage you linked to and the builtin documentation. MaTeX interprets commands in inline mode, so align cannot be used. But aligned can, as @Nasser said. $\endgroup$ – Szabolcs Jul 6 '17 at 4:07

Use aligned from amsmath (I do not think align or align* works in Matex)



V&= \\int_0^H dV\\\\
&= \\int_0^H A'\\,dh\\\\
&= \\int_0^H\\frac{Ah^2}{H^2}\\,dh\\\\
&= \\frac{A}{H^2}\\left|\\frac{h^3}{3}\\right|_0^H\\\\
&= \\frac{A}{H^2}\\cdot\\frac{H^3}{3}\\\\
&= \\frac{1}{3}AH


Mathematica graphics

Second example

\\int_0^r 2\\pi r\\,dr &= 2\\pi \\int_0^r r\\,dr \\\\
&= 2\\pi\\bigg\\vert_0^r \\frac{r^2}{2} \\\\
&= \\bigg(2\\pi \\frac{r^2}{2}\\bigg)-\\bigg(2\\pi \\frac{0^2}{2}\\bigg) \\\\
&= \\frac{2\\pi r^2}{2} \\\\
&= \\boldsymbol{\\pi r^2}


Mathematica graphics

  • $\begingroup$ For kindness. Could you post using my second example? $\endgroup$ – LCarvalho Jul 5 '17 at 21:58
  • $\begingroup$ What you did is correct ... $\endgroup$ – LCarvalho Jul 5 '17 at 22:10

MaTeX interprets TeX commands in inline math mode. Only those commands work that are allowed in inline math mode.

As @Nasser said, in this case use aligned instead of align (and make sure that the amsmath package is loaded—it is in the default "BasePreamble" option value).

This is discussed both on the webpage you linked to, and the builtin documentation. Please check the documentation (in particular the Possible Issues section) when encountering problems like this. It has answers to the most common questions.

enter image description here

  • $\begingroup$ How nice. The father of this package has found my question. I disclose your package a lot. $\endgroup$ – LCarvalho Jul 6 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.