2

I ran into what I think is an anomaly. I was trying to add tags to my displayed math equations in a document, and I ran into the error message

Package amsmath Error: \tag not allowed here

which is the title of this question. That question was the first search engine hit to keywords amsmath and tag, which is why I am writing this.

Namely, unlike the asker of that question, my equation was in display math. Yet, I still get the same error message.

The answers to that related question were thus initially not helpful to me. Studying the examples as well as the AMSmath documentation didn't enlighten me either. They did leave me wondering whether the design goal was that only equations in specified environments can be tagged. That sounded somewhat strange.

Copy/pasting examples from the answers came with a surprise. The appearance of this error message apparently depends on exactly how the equation was put into display mode. Try the following snippet:

\documentclass{report}[12pt]
\usepackage{latexsym,epsf,amsthm}
\usepackage[finnish]{babel}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage[dvips]{graphicx}
\usepackage{float}
\usepackage{color}
\usepackage{psfrag}
\def\theenumii{\arabic{enumii}}
\begin{document}
Firs test
\[
\frac32n^2+\frac12n\le 936.\tag{1}
\]
Second test
$$
\frac32n^2+\frac12n\le 936.\tag{1}
$$
\end{document}

You will see that the error message is generated by the version with double dollars, but NOT when we use the \[ \] delimiters.

Thus I have solved my main problem. Posting this partly in case somebody else runs into the same problem (and linking it with the first hit). This does beg my title question

Why aren't the various display math delimiters interchangable in AMSmath?

I learned TeX when plainTeX was all we had, so if I have to unlearn using double-dollars I won't be too happy. For example MathJax still uses double dollars, and as an active user at Math.SE (a moderator even) I frequently use them.

Why is there a difference here?

In case it matters, here is my configuration:

  • laptop running on Windows 7
  • WinEdt version 7.0
  • MiKTeX version 2.9
  • You simply should never use $$ in LaTeX. It's a pity that Math.SE doesn't accept \[...\] – egreg Oct 25 '15 at 14:23
  • Thanks for the piece of advice (and the link) @egreg. My learning curve is not what it once was, and unlearning is particularly taxing, but ... Sorry about the dup :-( – Jyrki Lahtonen Oct 25 '15 at 14:33
  • Adding the following comment: Apparently ou can use \[...\] in Math.SE if you escape the backslash. – Jyrki Lahtonen Apr 1 '17 at 5:37

Browse other questions tagged or ask your own question.