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 ?

migrated from stackoverflow.com Jul 3 '11 at 14:30

This question came from our site for professional and enthusiast programmers.

  • 7
    use \(equation\) instead of $equation$. texblog.net/latex-archive/maths/inline-math-mode – Dan D. Jul 3 '11 at 13:37
  • 2
    $$ is essentially a tex primitive. disabling it is not a good idea. – barbara beeton Jul 3 '11 at 14:39
  • 1
    As you asked the question, you will be able to comment if the system recognises you. To do that, you'll need to be registered both on TeX.SX and on StackExchange, as I said using the same OpenID. – Joseph Wright Jul 4 '11 at 8:54
  • 2
    I don't get that with a minimal example. My guess is that there is an extra dollar somewhere sneaking in. When you've registered, if you could post some example code demonstrating the error, that might help us track it down. – Loop Space Jul 4 '11 at 12:11
  • 2
    @Andrew Indeed TeX looks for a second $ only when entering math mode and when closing display math mode. So the error is surely related to a dangling $ before the "double formula". On the other hand, writing ${eq1}{eq2}$ is equivalent to $eq1$$eq2$, under normal conditions (no \everymath). – egreg Jul 4 '11 at 22:59

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:


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 ${}$.

  • Is there an actual problem here? I just tried it and $x=y$$a=b$ worked as I would expect it to: two maths groups. – Loop Space Jul 4 '11 at 7:58
  • @Andrew: Indeed. I wasn't testing the starting scenario, just if my solution works. I just took the OP word for it. Could you use some package which causes this to stop working? – Martin Scharrer Jul 4 '11 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy