# \boldsymbol doesn't work as expected inside equation environment

I would like to obtain a bold equation inside an equation environment. I've tried

$$\boldsymbol{x=y}$$


but x=y is not rendered bold. What's going wrong here? If I write \boldsymbol{x=y} (without the surrounding equation environment), x=y is rendered bold as expected.

(Moreover, I would like to know how I can render an equation reference bold. I've tried \textbf{\eqref{eq:my-equation}} but again the text is not rendered bold.)

EDIT: Complete example compiled on overleaf with XeLaTex:

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, mathtools, thmtools, unicode-math}
\usepackage{hyperref, cleveref}

\begin{document}

$$\label{eq:my-equation} \boldsymbol{x=y}$$
\eqref{eq:my-equation}

\end{document}

• please always provide an example that reproduces the problem, by default \boldsymbol would make that bold, although it is bad markup, it should just be applied to single symbols not a complete term such as x=y, similarly by default \textbf would make the reference bold. Perhaps you are using a font set with no bold,impossible to say unless you provide a document that shows the problem Jul 4, 2019 at 8:21
• Use {\boldmath$$x=y$$ \unboldmath, for instance. Jul 4, 2019 at 8:21
• @DavidCarlisle I've added a complete example. Jul 4, 2019 at 9:18
• you added unicode-math (which enables a completely different math layout engine to the classic one that completely changes your question) are you using luatex or xetex. Jul 4, 2019 at 9:37
• @DavidCarlisle I'm using XeLaTex. Jul 4, 2019 at 12:57

with unicode-math \symbf selects a bold from the same font and as in classic latex \boldmath switches all math for to a bold font if it is available. Currently however there are not many bold unicode math fonts available and so you are limited to the bold math alphabet within the main font.

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, mathtools, thmtools, unicode-math}
\usepackage{hyperref, cleveref}

\begin{document}

$$\label{eq:my-equation} x=y$$
\eqref{eq:my-equation} \textbf{(\ref{eq:my-equation})}

$$\label{eq:my-equation2} \symbf{x} \symbf{=} \symbf{y}$$
\eqref{eq:my-equation2} \textbf{(\ref{eq:my-equation2})}

{\boldmath

$$\label{eq:my-equation3} x = y$$
\eqref{eq:my-equation3} \textbf{(\ref{eq:my-equation3})}
}

\end{document}
\end{document}

• My actual equation is longer than x=y. Do I really need to type \symbf x\symbf =\symbf y or can I use \symbf{x=y} instead? Jul 4, 2019 at 13:01
• @0xbadf00d it would work to do that yes, although arguably it is poorer markup Jul 4, 2019 at 13:03
• (a) Why is it poorer markup? My real equation has about 24 symbols. Would be hard to read in the code if would need to write \symbf before each symbol. (b) There is another problem: It seems like \symbf x is rendering an "upright" x. Is it possible to get the italicized x as it is rendered by $x$? Jul 4, 2019 at 13:10
• @0xbadf00d \symbbit is bold math italic . Using {...} around the whole expression is (apart from the font change) like using {....} around the expression and that has an effect on spacing in math mode. Also what you want is bold version of what is there, so you probably want \log to stay log but become bold, = to stay non slanted but become bold that is what \boldmath would do if you had a bold math font Jul 4, 2019 at 13:14

This will give bold math:

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, mathtools, thmtools, unicode-math}
\usepackage{hyperref, cleveref}

\begin{document}

$$\label{eq:my-equation} \pmb{x=y}$$

{\bfseries(\ref{eq:my-equation})}

\end{document}


• \pmb should only be used as an absolute last resort it is not bold but just overprinting three copies of the text offset slightly Jul 4, 2019 at 9:45