TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some math formulas where I need bold roman style for some math expressions. Since they appear quite often, I need a macro for them. The obvious way is to write \newcommand{\foo}[1]{\mathbf{#1}}, which works in principle. However, it falls apart when the command argument contains a superscript, and there is a subscript added outside the command, like so: \foo{x^k}_t which results in

x^k_t with wrong spacing

where the t subscript is too far away, presumably because it's outside an mbox. Using the bm package and defining \newcommand{\foo}[1]{\bm{#1}}, I get the correct spacing as I want it:

x^k_t with right spacing but wrong font

But now I'm back to the wrong font as it's no longer in Roman style. And all approaches I've tried to combine \bm and switching to a Roman style show up fail in one way or another. I can't seem to find a solution that will look like the second case, but use a Roman font like in the first case. Any ideas on how I could solve this? Thanks in advance!

share|improve this question
Must the subscript and superscript also be in bold roman, or in bold italic, or in ordinary math style? – Bernard Mar 15 '14 at 19:27
Good point, I guess I should have clarified some more. Whatever is inside the \foo{} should be in bold roman, but whatever is outside it, should be in ordinary math style. But as opposed to my first example (which has the fonts all correct), it should be right next to the x, rather than outside the mbox containing the x^k. – mindriot Mar 16 '14 at 1:26
up vote 4 down vote accepted

enter image description here

You can get from the markup you want to the markup barabra correctly said that you need:

$\foo{x}$, $\foo{x}_t$

$\foo{x^k}$, $\foo{x^k}_t$
share|improve this answer
Perfect, that did it. Thanks! – mindriot Mar 16 '14 at 9:41

you can use \mathbf to get the upright letters -- but you have to enter them separately for base and scripts:


output of example code

share|improve this answer
Thanks for your input! Yes, I could do that. But the thing is that in my case the x^k is inside the macro (e.g. \foo{x^k}_t), and in my case I can't separate the \mathbf{} command like that. I.e., I basically want to create a command \foo{x} which behaves exactly like \bm{x}, except it uses bold upright/roman characters instead of bold standard characters. I could modify my commands/macros to use multiple parameters to follow your suggestion, but it would be an awful mess of macros... – mindriot Mar 16 '14 at 1:20

You could modify the definition of \foo to instruct \bm to operate on \mathrm{#1} instead of "just" #1. (By the way, I'm assuming that since the main symbol and the superscript term should be in upright bold, the same goes for the subscript term. Please advise if this assumption is invalid.)

enter image description here

$\foo{x^k}$, $\foo{x^k_t}$
share|improve this answer
Thanks for your input! The difference in your example is, you have the "_t" inside the command parameter, where I wanted \foo{x^k}_t. I.e., t should not be set in bold upright, but in normal style. – mindriot Mar 16 '14 at 1:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.