I have to Amino acids as variable-names within LaTeX. So far I am using (and found out):
\documentclass{a4paper}{article}
\newcommand\dTRP{\mathit{d-TRP}}
\begin{document}
$[\dTRP] = 3$ (Ignore the missing units :-) - MWE )
\end{document}
The hyphen between "d" and "TRP" is just too long and seems to contain small spaces between "d" and "TRP" which is not very appealing to me and I suppose that I didn't do it the genuine way.
Best Answer
You should use
\textit
instead of\mathit
.With
\mathit
, the tex engine interprets the groups of characters as "words" (compare, for example the output of$TRP$
and$\mathit{TRP}$
), but non-letter characters are still denoting the mathematical symbol. In particular, here, the hyphen is a minus. The glyph is different, and the spacing is different.On the other hand,
\textit
deals with elements of text, so words in the usual sense (so, possibly-containing hyphens).To sum up:
$d-TRP$
should mean "variable d minus variable T times variable R times variable P"$\mathit{d-DRP}$
should mean "variable d minus variable TRP" (and is poorly coded for that purpose)$\textit{d-TRP}$
should mean "variable d-TRP"Edit: To have
\textit
scaled normally in sub- and super-script, you should load theamsmath
package. Thanks to David Carlisle for reminding me that, and for pointing my mistake about spacing around characters in\mathit
.