0

According to this link: Question about bolding math and text simultaneously, using

\boldmath{\bfseries{}}

simultaneously will make both math and text bold in an equation environment.

However, if you define a new command, this does not always work. As an example:

\newcommand{\exampleOne}{\text{example}(a,b,\bar{c})}
\boldmath{\bfseries{\exampleOne}}

cannot be compiled at all. I think using \bar{c} prevents this way of bolding text and equation simultaneously to work. Is there a way to solve this problem and make everything bold in a math environment?

  • 1
    Welcome to TeX.SX! Note that you cannot use digits in command names. – GuM Oct 1 '18 at 15:55
  • 1
    Also, you shouldn’t say \boldmath\bfseries{something}, but rather {\boldmath\bfseries something}. Besides looking for code snippets on the Internet, have you read an introductory guide to LaTeX? ;-) ;-) ;-) – GuM Oct 1 '18 at 15:57
  • You are right. However, even if I make it like this: \newcommand{\exampleOne}{\text{example}(a,b,\bar{c})} \boldmath{\bfseries{exampleOne}} it does not work... – burak Oct 1 '18 at 16:12
  • 1
    “It does not work” isn’t very meaningful: it does not produce bold math, or it doesn’t compile? In any case, I did not say \boldmath{\bfseries{\exampleOne}}, I said {\boldmath\bfseries \exampleOne}. You should also define \exampleOne as follows: \newcommand{\exampleOne}{Example: $(a,b,\bar{c})$}. I repeat, read an introductory guide to LaTeX before attempting to write code in it. – GuM Oct 1 '18 at 20:43
  • Sorry. It doesn't compile. Strangely it doesn't give any errors as well. It just stays in the process of building for a long time even if I use the version you suggested. – burak Oct 2 '18 at 10:44
1

You have to issue \boldmath and \bfseries outside math mode. You cannot switch the math version after having entered math mode. That you cannot switch the text font within math mode should be obvious.

To undo the effect of \boldmath and \bfseries, you can either issue \unboldmath\mdseries or just enclose it in a group, i.e. {\boldmath\bfseries...}

\documentclass{article}
\usepackage{amsmath}
\newcommand{\exampleOne}{\text{example}(a,b,\bar{c})}
\begin{document}

\boldmath\bfseries
\[ \exampleOne \]
\unboldmath\mdseries

\end{document}

enter image description here

| improve this answer | |
  • Thanks a lot. This has worked. Now I need to find a way to add this property to a description like environment. – burak Oct 2 '18 at 10:26

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.