0

I have defined two commands for the font/style of questions and key concepts in my notes as follows:

\newcommand{\key}[1]{{\bfseries\sffamily#1}}
\newcommand{\qtxt}[1]{\textbf{#1}}

Where the commands can be altered at any time to change the appearance of these parts throughout the document (in case anyone is wondering why I wouldn't simply use \textbf{} itself).

However, whenever math symbols are included in either of these, I have to wrap them in \boldsymbol{ } (or equivalent) to get the desired (consistent) effect. Is there any way that I can define the above commands so that they will apply one rule to text and another rule to anything in $ $ environment?

  • 1
    there's a \boldmath command (switch) in the latex core. i'm not sure whether it copes with absolutely everything, but it's probably worth a try. – barbara beeton Dec 11 '15 at 16:33
1
\newcommand{\qtxt}[1]{\textbf{\boldmath#1}}

should do bold. Sans serif is trickier as it depends what you want, typically there won't be a "sans serif math italic" (whatever that would mean) to use as the default math symbol font.

  • Thank you for your time & solution. I can't believe it was that simple. Any suggestions on where to learn more about how this works? I would've thought that would render everything in a math environment - I'd like to understand how it is working / learn about how it implements. – Rax Adaam Dec 11 '15 at 16:42
  • @RaxAdaam \boldmath should be mentioned in any latex tutorial, it is a declaration that says any math in its scope should be set using the bold mathversion. It doesn't, itself, start math mode. – David Carlisle Dec 11 '15 at 16:52

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.