4

I'm using LaTeX to write my paper and every equation needs to be numbered, so I use the equation environment. However, it fails to compile.

\documentclass[UTF8]{ctexart}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\begin{equation}
\[
\begin{bmatrix}
    L_{a1} & 0 \\
    0 & L_{a2} 
\end{bmatrix}
 \begin{bmatrix}
    I_{a1}  \\
    I_{a2}
\end{bmatrix}
+
 \begin{bmatrix}
    R_{a1} & 0 \\
    0 & R_{a2} 
\end{bmatrix}
 \begin{bmatrix}
    I_{a1}  \\
    I_{a2}
\end{bmatrix}
+
 \begin{bmatrix}
    K_{e1} & 0 \\
    0 & K_{e2} 
\end{bmatrix}
 \begin{bmatrix}
    $theta_1$ \\
    $theta_2$
\end{bmatrix}
=
 \begin{bmatrix}
    V_{a1} \\
    V_{a2} 
\end{bmatrix}
\]
\end{equation}
\end{document}

So my question is: how to revise it? In addtion, I would like to know why the math expression that follows is wrong:

$$ B = \frac{J_2}{N_1 N_2}+\frac{m_2 r_2^2}{4 N_1 N_2}+\frac{m_2 r_1 r_2}{2 N_1 N_2} cos(\frac{\theat_{m2}}{N_2}) $$
$$ C = \frac{-m_2 r_1 r_2}{N_1 N_2}(\frac{\theat_{m1} \theat_{m2}}{N_1}+\frac{\theat_{m2}^2}{2 N_2}) sin\frac{\theat_{m2}}{N_2} $$
$$ D = J_{m1} +\frac{J_2}{N_2^2}+\frac{m_2 r_2^2}{4 N_2^2} $$
$$ E = \frac{J_2}{N_1 N_2}+\frac{m_2 r_2^2}{4 N_1 N_2}+\frac{m_2 r_1 r_2}{2 N_1 N_2} cos(\frac{\theat_{m2}}{N_2}) $$

LaTeX gives the information:

Undefined control sequence. [..._2}{2 N_1 N_2} cos(\frac{\theat_{m2}}{N_2}]
4
  • 6
    \theta not \theat. Also you don't need \[ \] inside equation environment.
    – Sigur
    Jan 7, 2014 at 15:44
  • 5
    And for the last bit, don't use $$ ... $$. See e.g. Why is \[ … \] preferable to $$? Jan 7, 2014 at 15:47
  • 3
    Also remove $ from inside bmatrix (you are already in math mode). Also you probably want \theta and not theta Jan 7, 2014 at 15:48
  • 1
    Since you're just starting to learn LaTeX I recommend that you write your math just a little bit at a time, compiling often. That way your mistakes will show up just one at a time and will be easier to find and fix. When you're stuck after trying, ask here, one question at a time. Jan 7, 2014 at 16:21

1 Answer 1

5

The following code should work. Changes:

  • deleted \[ in line 8
  • deleted \] in line 40
  • deleted $ in lines 32 and 33 -> you're already in a math environment, so you don't need to mark this as a math environment by using $ .. $
  • added \ in front of theta in lines 32 and 33

    \documentclass[UTF8]{ctexart}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage{graphicx}
    \usepackage{epstopdf}
    \begin{document}
    \begin{equation}
    \begin{bmatrix}
        L_{a1} & 0 \\
        0 & L_{a2} 
    \end{bmatrix}
     \begin{bmatrix}
        I_{a1}  \\
        I_{a2}
    \end{bmatrix}
    +
     \begin{bmatrix}
        R_{a1} & 0 \\
        0 & R_{a2} 
    \end{bmatrix}
     \begin{bmatrix}
       I_{a1}  \\
        I_{a2}
    \end{bmatrix}
    +
     \begin{bmatrix}
        K_{e1} & 0 \\
        0 & K_{e2} 
    \end{bmatrix}
     \begin{bmatrix}
        \theta_1 \\
        \theta_2
    \end{bmatrix}
    =
     \begin{bmatrix}
       V_{a1} \\
        V_{a2} 
    \end{bmatrix}
    \end{equation}
    \end{document}
    

Regarding your equations: You wrote theat instead of theta -> changing that should do it:

    $$ B = \frac{J_2}{N_1 N_2}+\frac{m_2 r_2^2}{4 N_1 N_2}+\frac{m_2 r_1 r_2}{2 N_1 N_2} cos(\frac{\theta_{m2}}{N_2}) $$
    $$ C = \frac{-m_2 r_1 r_2}{N_1 N_2}(\frac{\theta_{m1} \theta_{m2}}{N_1}+\frac{\theta_{m2}^2}{2 N_2}) sin\frac{\theta_{m2}}{N_2} $$
    $$ D = J_{m1} +\frac{J_2}{N_2^2}+\frac{m_2 r_2^2}{4 N_2^2} $$
    $$ E = \frac{J_2}{N_1 N_2}+\frac{m_2 r_2^2}{4 N_1 N_2}+\frac{m_2 r_1 r_2}{2 N_1 N_2} cos(\frac{\theta_{m2}}{N_2}) $$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .