I want to change the function of some commands consisting of only one letter, such as \e or \i, and make them abide by MY rules. (Mouhahaha!) I have done this before with other commands like \in or \=, but it seems that one-letter commands are special for some mysterious reason.
In particular, I'd like to make a new command \i to use it in math-mode, but this produces an error.
Here is just a part of my document:
\documentclass[12pt]{article}
% % symbols
\let\i\undefined
\newcommand{\i}{\mathrm{i}}
% begin languages
\usepackage[LGR,T1]{fontenc}
\begin{document}
$\i$ $i$ i
\end{document}
I get the error
Command \i invalid in math mode
The .pdf file is, nevertheless, produced and \i appears as the greek letter beta. I tried other ways (which now I cannot recall) that had \i to appear as a dotless i instead of beta.
And why don't I get the same error with \e that also has a predefined meaning?
My problem is that I am not generally satisfied with the solution if I don't have completely understood the problem itself. By posting this question, I hoped to get an explanation about how one-letter commands really work and why it is so difficult to redefine them. The truth is I was not persuaded that I should not mess with them. So, here what I ask is "Why?".
– Jim Dec 12 '15 at 18:16\renewcommand{\i}{\iota}(say)? I don't have a problem with this... – Werner Dec 12 '15 at 18:39\c. – egreg Dec 12 '15 at 19:00\documentclassand have the minimal number of packages needed and then would have code that caused tex to give the error message. Without that you are asking us to debug unseen code. – David Carlisle Dec 12 '15 at 22:55fontencyou would not get the error that you show, since you never said before you were using fontenc it isn't surprising no one told you the exact cause of the error. – David Carlisle Dec 13 '15 at 00:24\iis an encoding-specific command. So it gets defined (again) when you define an encoding (T1 and LGR in your case) the fact that it is single letter is not relevant. – David Carlisle Dec 13 '15 at 00:30Why doesn't
\egive that same error?It seems to matter whether the package is before or after the new command! Is that how it is supposed to work?
Regardless, there is no
– Jim Dec 13 '15 at 01:02inor\iin greek. What is exactly the problem?