I'm trying to figure out how best to define an alias. I have some moderately complicated variable names, such as $p^{i,j}_{t}$
, and having to type them over and over again is a pain. More importantly, if I decide later to change my naming convention, I'd have to go back and search replace in my whole document, which seems ridiculous. I've tried to use this method:
\newcommand{\varn}{$p^{i,j}_{t}$}
but this method is not powerful enough. First of all, I cannot use it in Math mode, and would have to define another command
\newcommand{\mathvarn}{p^{i,j}_{t}}
which seems redundant.
Second of all, latex doesn't know that it's supposed to insert a whitespace after I use the command in a text environment. If I force a whitespace in the command, I cannot use the command just before punctuation like full stop, or comma.
Any suggestions? Thank you!
`
to mark your inline code as I did in my edit.