3

I want to align an equation:

\begin{align*}
a &= b\\
c &= d
\end{align*}

Which works. But having it in \mathbf{}:

\begin{align*}
\mathbf{a &= b}\\
c &= d
\end{align*}

gives me an error.

Of course, I could end the \mathbf at &= and apply it afterwards, but is there an easier way? (I have long and complicated equations)

2 Answers 2

2

you can use \boldmath, but be careful -- this will make all math within its scope bold:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
text $a + b$.
\boldmath
text $a + b$.
\begin{align*}
a &= b\\
c &= d
\end{align*}
\unboldmath
text $a + b$.
\end{document}

output of example code

you can also limit the scope by placing the intended material within braces.

2
  • ,@barbarabeeton -- I think the OP asks for a single line within the align environment to be in bold math, and not to repeat \mathbf, did I understand the question correctly?
    – AboAmmar
    Feb 19, 2017 at 14:40
  • @AboAmmar -- i may have misunderstood the question. if the op confirms that, i will delete this answer, since \boldmath can be used only outside a math environment. Feb 19, 2017 at 14:45
1

The error in your example is because the alignment markers & only work inside the same group. So, the easiest solution may be to locally bold the symbols you want using the bm package (better than \mathbf{...}).

\documentclass{article}
\usepackage{amsmath,bm}
\begin{document}

\begin{align*}
  \bm a &=\bm b\\
  c     &=    d
\end{align*}

\end{document}

enter image description here

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.