2

I have a problem writing the heat equation in latex. I would like to write it by starting with \begin{equation} and ending with \end{equation}. I tried doing the following:

\begin{equation}
\{$u_t(x,t)=u_{xx}(x,t)$} wherex $\epsilon$ ${\rm I\!R}$\  and $t>0$  
\end{equation}

The answer I got was this:

LaTeX Warning: You have requested package `',
               but the package provides `esdiff'.

and

! Display math should end with $$.
<to be read again> 
                   u
l.51 \{$u
         _t(x,t)=u_{xx}(x,t)$$} where x $\epsilon$ ${\rm I\!R}$\  and $t>0$
? 

Does anyone know how to write the heat equation in latex and have the text on the same line? David

  • I'll take a guess that the equation environment puts you into math mode. Take away the dollar signs, and use \text{}. – Jessica B Jan 29 '15 at 9:30
  • Thank you for your answer. I tried doing what you wrote, and it gave an "output", but not with u and subscript t (the derivative of u with respect to t). When I did this: [ u_{t}(x,t) = u_{xx}(x,t) ] I got the equation I wanted, but I would like to start with \begin{equation} so that it would be possible to have text on the same line. – David Jan 29 '15 at 9:42
5

Are you maybe looking for the following?

enter image description here

\documentclass{article}
\usepackage{amsmath}  % for \text macro
\usepackage{amssymb}  % for \mathbb macro
\begin{document}
\begin{equation}
\{ u_t(x,t)=u_{xx}(x,t)\}, \text{ where $\epsilon\in\mathbb{R}$ and $t>0$}
\end{equation}
\end{document}

Alternatively, might you be looking for the following?

enter image description here

\documentclass{article}
\usepackage{amsmath}  % for \text macro
\usepackage{amssymb}  % for \mathbb macro
\begin{document}
\begin{equation}
u_t(x,t)=u_{xx}(x,t), \text{ where $x\in\mathbb{R}$ and $t>0$}
\end{equation}
\end{document}
  • x \in \mathbb{R} I would guess:-) – David Carlisle Jan 29 '15 at 9:44
  • Yes, that is the way I would like to write the equation. It worked perfectly in my latex file. Thank you very much! – David Jan 29 '15 at 9:48
  • @DavidCarlisle - I get it now: the \epsilon was standing in for \in. I've added a second screenshot to raise this possibility. – Mico Jan 29 '15 at 9:54
5

Please always provide complete small documents that reproduce the error, not just fragments.

equation puts you in math mode so you should not use $ to re-start math mode inside that.

Do not use \rm in latex (it is just for compatibility with the previous version, LaTeX2.09, which has not been released since 1992)

Don't use I\!R for a double struck R use \mathbb{R} don't use \epsilon for set membership.

\begin{equation}
u_t(x,t)=u_{xx}(x,t) \text{ where } x \in \mathbb{R} \text{ and }  t>0  
\end{equation}

The package error I would guess you did

\input{esdiff.sty}

instead of

\usepackage{esdiff}
  • 1
    perhaps better semantically to use \qquad\text{where $x \in \mathbb{R}$ and $t>0$}. I've added a \qquad as well to separate them better. – daleif Jan 29 '15 at 9:52
0

Don't know if I got the equations right (your text was a bit confusing) but here is a working (and slightly corrected in terms of coding) version

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
u_{t}\left(x,t\right)=u_{xx}\left(x,t\right) \text{where}~\epsilon = \mathrm{I!R}~\text{and}~t>0
\end{equation}

\end{document}
  • 2
    There is no reason to add \left \right here. – David Carlisle Jan 29 '15 at 9:45
  • 2
    Also ~ is the wrong tool in math mode. – egreg Jan 29 '15 at 9:46

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.