LaTeX LaTeX how do I write an equation

  • Thread starter Thread starter Nusc
  • Start date Start date
  • Tags Tags
    Latex
AI Thread Summary
To write a centered and numbered equation in LaTeX without garbled text, the \text macro is recommended for inserting text within math environments. An example provided shows how to use \text effectively alongside the equation. Users noted that the \text command is part of the AMS math package and other packages, which may not be recognized in all versions of LaTeX, such as MikTeX 2.8. Concerns were raised about relying on autogenerated LaTeX code from tools like Mathematica, which may not follow best practices. Proper package inclusion and manual adjustments are essential for optimal formatting in LaTeX.
Nusc
Messages
752
Reaction score
2
Hey, how do I write an equation without the text looking all garbled up:

\begin{equation}
\frac{\partial u}{\partial x} + \frac{\partial w}{\partial z} = 0 with u = v_{x} and w = v_z
\end{equation}

I don't want to use $ $ since I want this eqn centered and numbered but with text immediately following the major expression.
 
Last edited by a moderator:
Physics news on Phys.org


possible solutions:
Code:
\begin{equation}
\begin{array}{ccccc}
\frac{\partial u}{\partial x} + \frac{\partial w}{\partial z} = 0 & with & u = v_{x} & and & w = v_z
\end{array}
\end{equation}
Code:
\begin{eqnarray}
\begin{array}{rlcll}
&&\frac{\partial u}{\partial x} + \frac{\partial w}{\partial z} = 0&& \\ \mathrm{with:} & u = v_{x} & \mathrm{and} & w = v_z&
\end{array}
\end{eqnarray}

its the \mathrm{} that changes font in the mathtype and the arrays that let you space things correctly.
 


Use the \text macro. It is designed specifically for this problem, inserting short amounts of text within math.

\begin{equation}
\frac{\partial u}{\partial x} + \frac{\partial w}{\partial z} = 0
\ \text{with}\ u = v_{x} \ \text{and}\ w = v_z
\end{equation}

<br /> \frac{\partial u}{\partial x} + \frac{\partial w}{\partial z} = 0<br /> \ \text{with}\ u = v_{x} \ \text{and}\ w = v_z<br />
 


what is that a part of? Because mathematica always puts that in its LaTeX output, but my version of LEd with MikTeX 2.8 doesn't recognize "\text"
 


Thanks for the input guys.
 


Hepth said:
what is that a part of?
\text is provided by the AMS math package, the ReVTeX package, and others.

Because mathematica always puts that in its LaTeX output, but my version of LEd with MikTeX 2.8 doesn't recognize "\text"
As a general rule, always treat autogenerated code as suspect. That autogenerated junk rarely is a good pattern to follow. From the appearance, it looks like mathematica's generated LaTeX code fits that rule quite nicely.
 

Similar threads

Replies
8
Views
3K
Replies
8
Views
3K
Replies
5
Views
2K
Replies
3
Views
8K
Replies
11
Views
5K
Replies
8
Views
3K
Replies
2
Views
2K
Back
Top