2

Can I use \mathrm{} without putting it again when I go to another line? For example, I write:

\mathrm{x+2 = 2 \Rightarrow } \\\ \mathrm{\Rightarrow x = 0}

Which means:

[tex]\mathrm{x+2 = 2} \\ \\ \mathrm{\Rightarrow x = 0}[/tex]

But I would like to write.

\mathrm{x+2 = 2 \\\ \Rightarrow x = 0} (to use \mathrm{} one single time)

Is this possible?

Henri Menke
  • 109,596

2 Answers2

6

Each alignment cell is a group so you can not have { starting a group in one cell that matches a } in another.

If you need upright variable names then the markup should be

\begin{align}
           \mathrm{x}+2 &= 2 \Rightarrow  \\
 \Rightarrow \mathrm{x} &= 0
\end{align}

with the \mathrm just around the variable, however if this is conventional mathematics (as opposed to for example referring to variables in some computer program) then it is highly unusual to use upright Roman for variable names.

David Carlisle
  • 757,742
6

With unicode-math (needs lualatex or xelatex) you could force all variables to use upright style:

\documentclass{article}
\usepackage{amsmath}
\usepackage[math-style=upright]{unicode-math}
\begin{document}
\begin{align}
           x+2 &= 2 \Rightarrow  \\
 \Rightarrow x &= 0
\end{align}
\end{document}

enter image description here

Ulrike Fischer
  • 327,261