LaTeX how do I write an equation

  • LaTeX
  • Thread starter Nusc
  • Start date
  • Tags
    Latex
In summary, there are various ways to write an equation without the text looking garbled up. Some possible solutions include using an array or the \mathrm{} command, but the recommended method is to use the \text macro, which is designed specifically for inserting short amounts of text within math equations. However, it is important to be cautious when using autogenerated code, as it may not always be a good pattern to follow.
  • #1
Nusc
760
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
  • #2


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.
 
  • #3


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
\ \text{with}\ u = v_{x} \ \text{and}\ w = v_z
[/tex]
 
  • #4


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"
 
  • #5


Thanks for the input guys.
 
  • #6


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.
 

1. How do I write an equation in LaTeX?

To write an equation in LaTeX, you will need to use the equation environment. Within this environment, you can use various commands and symbols to create your desired equation. For example, you can use the command \frac{numerator}{denominator} to create a fraction or the command \sqrt{value} to create a square root.

2. Can I add labels to my equations in LaTeX?

Yes, you can add labels to your equations in LaTeX by using the \label{label_name} command. This will assign a label to your equation, which you can then refer to in your document using the \ref{label_name} command. This can be helpful for referencing equations in your text or for creating a list of equations.

3. How do I write multiple equations in one line in LaTeX?

To write multiple equations in one line in LaTeX, you can use the align environment. Within this environment, you can use the & symbol to indicate where you want the equations to be aligned. For example, you can use the command \begin{align} x^2 + y^2 &= 1 \\ x + y &= 2 \end{align} to write two equations on the same line with the equal signs aligned.

4. Can I use Greek letters in my equations in LaTeX?

Yes, you can use Greek letters in your equations in LaTeX by using the corresponding command. For example, you can use \alpha for α, \beta for β, and \gamma for γ. You can also use uppercase versions of these commands for the corresponding uppercase Greek letters.

5. How do I add special symbols or operators in my equations in LaTeX?

To add special symbols or operators in your equations in LaTeX, you can use the corresponding command. For example, you can use \pi for π, \infty for ∞, and \int for ∫. If you are unsure of the command for a specific symbol, you can use the Detexify tool to draw the symbol and find the corresponding command.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
954
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
6K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
275
Replies
3
Views
543
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
911
Back
Top