# Is it wise to use \tensor for bold letters?

I want to use bold math-letters e.g. \mathbf{p_1}^2. The problem with \mathbf{p_1}^2 is that the 1 and 2 sub/superscripts are not aligned under each other. I can fix this by writing \mathbf{p_1^2} but then both the sub and superscript appears bold, I only want one of them bold (the 1 in the subscript). So what is the best solution to this? Is it wise to use the \tensor package to do this (if possible), what if one has thousands of these in a book/article, wouldn't calling the tensor package for each of them make compiling extremely slow?

-
I think you should change the title of this question to something more relevant. The question doesn't mention the \tensor command anywhere. – Andrew Swann Apr 29 '14 at 14:27
It did, it just wasn't highlighted, it is fixed now. But I agree, the title sucks. – Faq Apr 29 '14 at 14:31

This should be sufficiently clean; the bold subscript is not really a subscript, but part of the name, so it's treated as an optional argument.

\documentclass{article}
\usepackage{xparse}
\NewDocumentCommand{\tens}{mo}
{% #1 = variable name, #2 = subscript (optional)
\mathbf{#1}\IfValueT{#2}{_\mathbf{#2}}%
}

\begin{document}
$\tens{p}[1]^{2}$ and $\tens{p}^{2}$
\end{document}

-

You could use bm (boldmath)

\documentclass{article}
\usepackage{bm}
\begin{document}
$$\bm{p_{1}}^2$$
\end{document}
-
Hmm...then the p get kind of italized, cool. I have to think about this one for a minute. – Faq Apr 29 '14 at 14:35
Yeah. Not sure if that's what you're looking for, but I thought I'd throw it out there anyway. You could also incorporate this into the solution provided by @egreg, i.e., defining a new command. – erik Apr 29 '14 at 14:40
Actually @erik, it is good that you did that, I might use it instead (or in the future). Thanks bro. – Faq Apr 29 '14 at 15:00