LaTeX how do I write an equation

  • Context: LaTeX 
  • Thread starter Thread starter Nusc
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion focuses on how to properly format equations in LaTeX, specifically how to include text alongside mathematical expressions without compromising the layout. Participants explore various methods for achieving centered and numbered equations with accompanying text.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant asks how to write an equation in LaTeX without the text appearing garbled, expressing a desire for a centered and numbered format with text immediately following the equation.
  • Another participant suggests using an array environment to format the equation and accompanying text, highlighting the use of \mathrm{} for font changes and spacing.
  • A different participant recommends using the \text macro, which is designed for inserting text within math environments, providing an example of its application.
  • One participant questions the compatibility of the \text macro with their version of LaTeX, noting that it is included in certain packages like AMS math and ReVTeX.
  • Another participant comments on the reliability of autogenerated LaTeX code from Mathematica, suggesting that it may not always be a good practice to follow.

Areas of Agreement / Disagreement

Participants express differing views on the best approach to formatting equations with text in LaTeX, and there is no consensus on which method is superior or universally applicable.

Contextual Notes

Some participants mention specific LaTeX packages that provide the \text macro, indicating potential limitations based on the user's LaTeX distribution and version.

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}

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


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 ·
Replies
8
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
5K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
9K
  • · Replies 11 ·
Replies
11
Views
9K
  • · Replies 11 ·
Replies
11
Views
6K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K