[Tex/LaTex] How to disable the TeX primitive $$

macrostex-core

I would like to disable the LaTeX$$ command (since I wrote things like $equation1$$equation2$ for some reasons and I cannot merge the two equations)

Is it feasible? Is there a command to "remove" a specific command so that when latex run , it will no more consider $$ as a command?


I get from the lateX compiler :

Display math should end with $$.
<to be read again> \endgroup 
The `$' that I just saw supposedly matches a previous `$$'. So I shall assume 
that you typed `$$' both times.

This is an error from the compiler . OK Latex is maybe clever enough ( apparently not ) to understand that this is a block of two equations $equation1$$equation2$ but I want to remove ALL errors and Warning before submitting my paper .

However the idea to substitute ${}$ to $$ is very simple and efficient since I never use $$ for math environement in my latex source .

Nervertheless the questions remains to know if some lateX commands or primitives could be disabled ?

Best Answer

This is not really recommended. Anyway, here a technical solution: In this specific case you could change $ to be an active character (i.e. like a macro) which holds an old normal $. Then two $s in a row would not be combined:

\def\mathdollar{$}
\catcode`\$=\active
\let$\mathdollar

All $$ inside previously defined math environments are still OK because they hold the dollars in their original category code.

However, I would recommend the following solution instead: To write your two equations simply write $equation1${}$equation2$ or $equation1 equation2$. If you don't use $$ in your apparently automatically generated code then it should be safe to search&replace all $$ with ${}$.

Related Question