Today I took over a client’s project containing lots of definitions like
1 2 3 |
\newcommand{\B}{\beta} \renewcommand{\c}{\cdot}% already defined in plain TeX |
etc. Don’t do this! It’s absolutely awful to maintain and in some month when you get back on your document you’ll probably have forgotten what all those shortcuts mean. On a first sight they save some time while typing but that is actually a task for autocompletion and a proper editor. Furthermore things probably get complicated if you redefine (\renewcommand
) macros that are already defined without knowing what you do and which other packages rely on the original definition …
It gets even worse if you share your documents with someone else and force them to learn you abbreviations, while e.g. \beta
is perfectly clear for everyone. Not to think about a case where two authors use different definitions/abbreviations like
1 2 3 4 |
\renewcommand{\c}{\cdot} % vs. \renewcommand{\c}{\centering} |
Thus: Don’t use shortcuts instead of the original macros and use “speaking” (meaningful) names for your macros.
Post updated according to Clemens’ and Moss’ comments.
Any discussion about good editors with good autocompletion (with good something \morei and good something \moreii and \so \on)?
@Leonid: I like TeXstudio … you can finde a (I guess) complete list on TeX.SX: http://tex.stackexchange.com/q/339/4918
\newcommand{\c}{...}
also should give an error message, anyway.You’re right … in the original file the author used
\renewcommand
. Probably without knowing what\c
was supposed to do and that it could be a problem to change its meaning …Ouch! No apostrophe in “gets”, please.
For your example code, “\newcommand{\c}{…}” will raise an error anyway, because “\c” is predefined in plain TeX and LaTeX.
Thank. I deleted the bad apostrophe and changed to
\renewcommand{\c}…
But in the case of plain TeX the cause of the error will be that \newcommand is not defined :p
A good solution for the kind of user you’re describing, is to define a macro:
\newcommand{\MathCharacterGreekBeta}{\beta}
and then to enable your lazy typing habits with:
\let\b\MathCharacterGreekBeta
This is bad advice:
\b
is (\c
,\d
,\k
) an existing accent command. Redefining those kind of commands can give rather unexpected errors. Run this with pdflatex for example:What is the advantage of your solution instead of
\let\b\beta
?However I don’t recommend this practice 😉