[Tex/LaTex] Centering equation on a line

equationsmath-mode

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.

Best Answer

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

Related Question