6

We can boldify math equations using \mathbf{} and normal text using \textbf{}.

Suppose I want to boldify a line which contains both normal text and mathematical part simultaneously using a single command. Is it possible?

Let us consider the following example:

                          Since $s=9, s*s$ becomes 81

I have to do as follows

             \textbf{Since} $\mathbf{s=9, s*s}$ \textbf{becomes} 81

Instead of this, is there any newtag, that make whole text bold?

  • Do you want letters and symbols to be bold while in math mode, or just the letters? (\mathbf works only on letters.) – Mico Feb 29 '16 at 7:37
  • The input is incorrect: Since $s=9$, $s*s$ becomes 81. You need two formulas, not one. – egreg Feb 29 '16 at 9:28
6

Yo can apply \boldmath:

enter image description here

Surrounding it with {...} limits the scope to be just within the curly braces so subsequent text is not effected.

Notes:

  • As per egreg's suggestion I have replaced $s=9, s*s$ with $s=9$, $s*s$. The , is not really part of the math, thus, it should be outside. This yields better spacing.

Code:

\documentclass{article}
\begin{document}
Since $s=9$, $s*s$ becomes 81

{\bfseries\boldmath Since $s=9$, $s*s$ becomes 81}

Since $s=9$, $s*s$ becomes 81

\end{document}
  • 1
    Could you please change the code $s=9, s*s$ into $s=9$, $s*s$? – egreg Feb 29 '16 at 9:29
  • @egreg: Good point. Have corrected. – Peter Grill Feb 29 '16 at 9:51
3

Run with lualatex or `xelatex

\documentclass{article} 
\usepackage{unicode-math}
\setmathfont{xits-math.otf}
\setmathfont[version=bold]{xits-mathbold.otf}
\newcommand\allBold[1]{{\bfseries\mathversion{bold}#1}}
\newcommand\allbold[1]{{\bfseries\boldmath#1}}
\begin{document}

Since $s=9, s*s$ becomes 81 $\displaystyle\int_a^b f(x)\mathrm{d}x$

\allbold{Since $s=9, s*s$ becomes 81 $\displaystyle\int_a^b f(x)\mathrm{d}x$}

\allBold{Since $s=9, s*s$ becomes 81 $\displaystyle\int_a^b f(x)\mathrm{d}x$}

Since $s=9, s*s$ becomes 81 $\displaystyle\int_a^b f(x)\mathrm{d}x$
\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.