Define every symbol as a command in LaTeX

code-formatting, latex

Solution

I have been doing this for anything that has a specific meaning and is longer than a single symbol, mostly to save typing:

\newcommand{\objId}{\mbox{$\mathit{objId}$}\xspace} 
\newcommand{\insOp}[1]{#1\mbox{$^+$}\xspace} 
\newcommand{\delOp}[1]{#1\mbox{$^-$}\xspace}

However then I noticed that I stopped making inconsistency errors (objId vs ObjId vs ObjID), so I agree that it is a nice idea.

However I am not sure if it is a good idea in case symbols in the output are, well, single Latin symbols, as in:

\newcommand{\numOfObjs}{$n$}

It is too easy to type a single symbol and forget about it even though a command was defined for it.

EDIT: using your example IMHO it'd be a good idea to define `\permeability` because it is more than a single P that you have to type in without the command. But it's a close call.

Problem

I'm working on a large project involving multiple documents typeset in LaTeX. I want to be consistent in my use of symbols, so it might be a nice idea to define a command for every symbol that has a specific meaning throughout the project. Does anyone have any experience with this? Are there issues I should pay attention to? A little more specific. Say that, throughout the document I would denote something called permability by a script P, would it be an idea to define ``` \providecommand{\permeability}{\mathscr{P}} ``` or would this be more like the case "defining a command for $n$"?

Original source