3

I am writing equations in wikidocs using markdown and latex. I tried to align the equations along the equal sign but I can't find the solution. The following is the latex that I wrote currently.

$$\begin{align}
Then,\ (x+z)+t & = x+(z+t)\ (\because Rule2) \\
& = x+0_V \\
& = x\ (\because Rule3) \\
\end{align}$$

The following is the resulted equation on the wikidocs. enter image description here I found this link R Markdown Math Equation Alignment, but I still don't know what the problem is. Could you help me please?

tesio
  • 401
  • 2
  • 6
  • 10

2 Answers2

6

As $$...$$ establishes an equation math mode environment, as does \begin{align}, it is not possible to use the align environment inside $$...$$; it can only be used (in real LaTeX source, that is) outside math mode, because it wants to switch to math mode all by itself.

You should use \begin{aligned}...\end{aligned} — note ist's aligned, not align —, as that is an environment meant to be used inside math mode. As such it is suited for use inside the $$...$$ fencing.

x a
  • 310
  • 3
  • 5
4

I ran your code on my system and it aligns just fine. Make sure you have the latest version of tools and packages installed. A minimal working example would be useful too.

Tom
  • 532
  • 3
  • 11
  • Plain text in math mode has to be put in `\text{…}` if available (`amsmath`) or at least wrapped into an `\mbox{…}`. Otherwise you end up in text rendered as math variables, i.e. in italics (as you can see in the demo renderings). That is not good practice. – x a May 05 '23 at 20:47