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?

  • 2
    I do not see any reason why one would use mathrm here in the first place. Please explain – daleif Jun 13 at 10:30
  • 5
    no, every alignment cell is a group, so & or \\ separates groups as if they were }{ – David Carlisle Jun 13 at 10:35
  • @daleif Because it looks better :) – Dan Avrămescu Jun 13 at 10:39
  • 1
    @DanAvrămescu nope, tradition for a long time, don't change it, you'll confuse your readers. – daleif Jun 13 at 10:40
  • 1
    Welcome to TeX.SE!! – manooooh Jun 13 at 10:59
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

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.

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.