2

I am trying to center my equation on the line using this code:

\[

\ l_{12} =  \frac {m_{c} c_{c} \frac {dT_{c}}{dt} + m_{s} c_{s} \frac {dT_{s}}{dt}}{m_{s}} Delta t 

\]

but I keep getting this error: Missing $ inserted. I tried adding $ but it's still not working.

  • 2
    Welcome to TeX.sx! Are there empty lines in your source, too? (Comment those lines out (%) or remove them. This applies to every math mode (plain, LaTeX or amsmaths environment).) – Qrrbrbirlbel Nov 11 '12 at 1:44
  • 1
    I can confirm that it works when removing empty lines. – mkc Nov 11 '12 at 1:46
  • I removed the empty lines but I am getting the same error. Is there a specific package I need to use? I have now {amsmath} and {amssymb} – Lynn Nov 11 '12 at 1:49
  • 1
    @Lynn Can you post a minimal working example (MWE) starting with \documentclass and ending with \end{document}? A tip: If you indent lines by 4 spaces, they'll be marked as a code sample. You can also highlight the code and click the "code" button (with "{}" on it). – Qrrbrbirlbel Nov 11 '12 at 1:50
  • 1
    Yep, as the others said you have a blank line issue. Also, there is a leading backslash that I think was meant for \Delta instead which is missing the backslash. The four space indenting is only for posting here so that the code gets displayed as code rather than text. – Peter Grill Nov 11 '12 at 2:08
1

As already said in my comment. Empty lines in math mode are not allowed.

Comment them out with % or remove them entirely.

If you load amsmath you have the benefit of using its very helpful math environments. In this case you probably want the equation or (unnumbered) the equation* environment.

(I also removed the preceding backslash \ and moved it in front of Delta.)

Code

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
%
l_{12} =  \frac {m_{c} c_{c} \frac {dT_{c}}{dt} + m_{s} c_{s} \frac {dT_{s}}{dt}}{m_{s}} \Delta t 
%
\]

\[
l_{12} =  \frac {m_{c} c_{c} \frac {dT_{c}}{dt} + m_{s} c_{s} \frac {dT_{s}}{dt}}{m_{s}} \Delta t 
\]

\begin{equation}
l_{12} =  \frac {m_{c} c_{c} \frac {dT_{c}}{dt} + m_{s} c_{s} \frac {dT_{s}}{dt}}{m_{s}} \Delta t 
\end{equation}

\begin{equation*}
l_{12} =  \frac {m_{c} c_{c} \frac {dT_{c}}{dt} + m_{s} c_{s} \frac {dT_{s}}{dt}}{m_{s}} \Delta t 
\end{equation*}
\end{document}

Output

Output

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.