4

When I use double dollar signs $$ or \[ and \] to begin and end math mode I have no problem compiling the file. When I substitute them with \begin{equation} and \end{equation} correspondingly I get an error.

For example:

\[
\label{eq:stress_strain_eq}
\left\{\begin{array}{c}
\sigma_x \\
\sigma_y \\
\tau_{xy}
\end{array}\right\}
=
\begin{bmatrix}
\overline{Q}_{11}   & \overline{Q}_{12}  & \overline{Q}_{16}    \\[0.3em]
\overline{Q}_{12}   & \overline{Q}_{22}  & \overline{Q}_{26}    \\[0.3em]
\overline{Q}_{16}   & \overline{Q}_{26}  & \overline{Q}_{66}
\end{bmatrix}
\cdot
\left\{\begin{array}{c}
\epsilon_x \\
\epsilon_y \\
\gamma_{xy}
\end{array}\right\}
\]

produces the right result but I cannot reference it. I thought that the three options were interchangeable.

migrated from stackoverflow.com Mar 26 '14 at 4:41

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

  • What error exactly? – herohuyongtao Mar 24 '14 at 15:35
  • They should be interchangeable, yes. So, if you use \begin{equation}, don't include \[ or $$. Also see Why is \[\] preferable to $$? – Werner Mar 24 '14 at 17:35
  • I read somewhere that $$ was the old syntax which has now been superseded by \[. The problem is now solved by moving the \label{} at the end of the block just before \end{equation} – Kounis Evangelos Mar 25 '14 at 7:28
  • Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Mar 26 '14 at 5:50
7

The environments

\begin{equation}
 ...
\end{equation}

and

\[ ... \]

are not interchangeable, as the first will produce an equation number, while the latter will not. A \label{...} command in the latter will not produce an error, but it has no effect since there is no counter it may refer to.

The equivalent to the latter would be the starred version of the equation environment, which is provided by the amsmath package:

\begin{equation*}
 ...
\end{equation*}

Your Answer

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