When typing 'variable0' in a math mode, only the letters are italicised. How can I force the 0 to be italicised as well?
Asked
Active
Viewed 2,936 times
4
2 Answers
6
Usually numbers are not italicized, but it is possible, for example:
\documentclass{article}
\begin{document}
\[\mathit{01234567890}\]
\end{document}
Heiko Oberdiek
- 271,626
2
My suggestion would be to define a macro that handles the formatting of your "variable names", so you can have some consistent output in your document, regardless of where you use it:

\documentclass{article}
\usepackage[T1]{fontenc}
% http://tex.stackexchange.com/a/139980/5764
\newcommand{\var}[1]{\texttt{\detokenize{#1}}}
\begin{document}
\[
\var{variable}_0 \quad
\var{AbC}_{13} \quad
\var{some_thing}_i
\]
\end{document}
I've used \texttt, but you can use whatever text formatting you want to highlight a text-related variable.
Werner
- 603,163
-
-
@RandyCragun: Correct. I was more trying to suggest that one should define macros for consistency that you can change as needed. For example, if you're working with variables within you math environment(s), define a macro that formats these variables (say,
\var). Then you can change it to use\mathitor\texttt, depending on what you want it to be formatted as. – Werner Oct 12 '19 at 20:44

$ \mathit{variable0} $– barbara beeton Jun 10 '15 at 20:13