TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

The purpose for this would be to leave scripts out of the equation. For example,


would print the 0 as boldface, too. I know I can probably write


But that would mean I have to reformat my whole paper, which defeats the basic purpose of defining a command.

Edit: It would be awesome to keep all scripts as original, but leave all others as-is. This would be preferable.

share|improve this question
but, if you don't want the 0 to be bold, wouldn't it be enough to write \vec{x}_0? Edit: While that might also mean, you have to go through your paper again, in my honest opinion \vec{x}_0 is the semantically correct way to write what you mean, i.e. that you have several vectors x0, x1,... – Ronny May 17 '13 at 12:02
@Ronny True enough. I could rewrite the paper (about 70 kB), but it would be an awesome journey into TeX if I could see how it's done. – Hameer Abbasi May 17 '13 at 12:09
I don't understand your issue. What do you want to achieve? – Marco Daniel May 17 '13 at 12:34
@MarcoDaniel I think you can now look over the answers. I want to define a command that either 1) Boldfaces everything but scripts, or 2) Boldfaces letters, but not numbers. – Hameer Abbasi May 17 '13 at 12:53
up vote 5 down vote accepted

You have made an error in typing vectors after redefining \vec. The subscript mustn't go in the argument.

However, if your vectors are all of the form \vec{<single letter><optional subscript>}, that is, either \vec{v} or \vec{v_{0}}, you can solve the problem by a double command:


I recommend not using \ensuremath, because vectors are undoubtedly math to me. If you have many \vec outside math mode, then do


but, for the future, restrain from using \ensuremath for this kind of things. You appear to have saved some keystrokes when typing

the vector \vec{v} is non zero

but actually you're losing information. And, anyway, you have to type

with $\vec{v}\ne\vec{0}$.
share|improve this answer

I agree with @egreg that you shouldn't really use this markup, but anyway:

enter image description here


\renewcommand{\vec}[1]{{\mathbf{\xdef\zz{\textfont1 \the\textfont\the\fam}}\mathpalette\myvec{#1}}}


$\mathbf{v_0}+a + 1$

$\vec{v_0}+ a + 1$

share|improve this answer
People seem to produce images so easily from TeX. Is there a way to do this within TeX SE or something? – Hameer Abbasi May 17 '13 at 12:50
@HameerAbbasi No I just take a screenshot of the pdf preview and crop it in a bitmap editor and save as png – David Carlisle May 17 '13 at 12:53

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.