Mastering LaTeX Equations: A Comprehensive Guide for Beginners on Physics Forums

  • LaTeX
  • Thread starter Redbelly98
  • Start date
In summary, LaTeX is a typesetting system used in physics forums. It is easy to type in, but there are some important bugs. The comprehensive list of formulas can be found at mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf.
  • #1
Redbelly98
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
12,175
182
[EDIT: https://www.physicsforums.com/showthread.php?p=3977517#post3977517" for the LaTeX FAQ that resulted from the following discussion.]

It would be good to replace https://www.physicsforums.com/showthread.php?t=386951" with something more up-to-date. I know Fredrik has thoughts on this. Sorry that I don't have time to come up with a first draft, but I am thinking the entry would:
  • Begin, in the first few lines, with the very basics. This is so complete novices can find out how to post very basic equations and symbols.
  • Then link to, or even explain in more detail, how to do more interesting stuff -- for example matrices, multiple-line code, etc.

The opening simple explanation could be what I wrote in Forum Feedback:
Redbelly98 said:
Members often ask how to make the nice looking math equations that they see in posts at Physics Forums. To do this, simply type equations or symbols between [itex] and [/itex]. For example, [itex] \lambda^2 [/itex] will result in [itex]\lambda^2[/itex].
... and right away it is clear how to make Greek letters and superscripts. (Well, lower-case Greek.)
 
Last edited by a moderator:
Physics news on Phys.org
  • #3


Ah, I found an earlier post by Fredrik that might be useful here. https://www.physicsforums.com/showthread.php?t=386951" refers to my Forum Feedback post; "Borek's post...should be deleted" has been deleted.
Fredrik said:
That thread could use some cleanup. Borek's post about the old preview bug should be deleted. It's weird to explain multiple lines by linking to page 19 of 49 of an old locked thread filled with lots of irrelevant information and broken LaTex code. (I would just link to a web page that explains the align environment). Those are just examples. I'm reluctant to link to this thread myself because of all the problems with it.

The thread should at least explain the difference between itex and tex tags (you could e.g. use my example below), link to the comprehensive LaTeX symbol list, mention the 50 character bug, mention the quick edit refresh bug, and mention that the best way to learn is to click on the quote button every time you see a post that makes you think "I wonder how he did that". (OK, I see now that the "how to latex" document actually does that last thing).

Example of itex vs tex: The function [itex]\sin:\mathbb R\rightarrow\mathbb R[/itex] is defined by [tex]\sin x=\sum_{n=0}^\infty \frac{(-1)^n}{(2n+1)!}x^{2n+1},[/tex] for all [itex]x\in\mathbb R[/itex]. Note that the comma must be placed inside the tex tags, and that you shouldn't type any line breaks.

The "how to latex" pdf should also be updated. It doesn't mention itex tags, fails to mention that \\ only works in specific environments (like align), falsely claims that tex tags are equivalent to "dollar sign, LaTeX code, dollar sign" in a LaTeX document. (This would give you a result equivalent to itex. You need two dollar signs before and after the code to get a result equivalent to tex). The pdf explains some things in awkward ways. For example matrices: [tex]\Lambda=\gamma\begin{pmatrix}1 & -v\\ -v & 1\end{pmatrix}[/tex] I also think people would prefer to use the cases environment instead of arrays: [tex]\chi_{\mathbb Q}(x)=\begin{cases}1 &\text{if }x\in\mathbb Q\\ 0 &\text{if }x\notin\mathbb Q.\end{cases}[/tex] The displaystyle command is explained badly. It's used to prevent LaTeX from formatting the math the way it normally would when the math image is to appear on a line that also includes text. Compare [itex]\sum_{k=0}^n x_k[/itex] to [itex]{\displaystyle \sum_{k=0}^n x_k}[/itex]. The latter code includes a "displaystyle". Note the positions of the curly brackets. They don't go where you'd normally put them. (Compare it with the source code for this image: [itex]\sqrt{x^2}[/itex]).
 
Last edited by a moderator:
  • #4


How do I work with LaTeX here?
Those fancy mathematical symbols are being made with something called LaTeX. Typing LaTeX-symbols in physicsforums is fairly easy. You just need to type the equations or symbols between [itеx] and [/itеx]. For example,
Code:
[itex] \lambda^2 [/itex]
will yield [itex]\lambda[/itex].

Alternatively, one can also type equations between [tеx] and [/tеx]. These tags do basically the same thing as itex, with the only example that they put everything on a separate line. So type
Code:
[tex] \lambda^2 [/tex]
yields [tex]\lambda^2[/tex]

For the ones already faamiliar with LaTeX: the [itеx] brackets are analohous to $, and the [tеx] brackets are $$.

The easiest way to learn LaTeX is to see what others have done. If you see a post with a nice equation in it, just click QUOTE (at the bottom of the post) to see what the auther did.​

Important bug:
LaTeX in this forum has a quite important bug: after each 50 typed characters, it will automatically insert a space. This can screw up some LaTeX formulas. So be sure to insert a space regularly.
[/INDENT]
A very short introduction to LaTeX

So far, we know how to type in LaTeX, but we do not know the specific formulas. We will now introduce some of the more common formulas. A comprehensive list of formulas can be found at mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

Sadly, not all symbols are being supported by mathjax. To see a full list of suppoerted symbols, see http://www.mathjax.org/docs/1.1/tex.html

Now, we will introduce some easy formulas:

Special characters The following characters have a special meaning in LaTeX: # $ % { } _ ^ \ ~
The first six can be printed by \# \$ \% \{ \} \_

Lines and text \\ starts a new line, \ includes a space, \text{...} included text.

Note: \\ only works in some environments, such as array, align,,...

fractions Fractions can be included by typing \frac{a}{b}. For example,

Code:
[itex]
\frac{2}{4}
[/itex]

This will yield [itex]\frac{2}{4}[/itex]

roots Square roots can be included by typing \sqrt. For example,

Code:
[itex]
\sqrt{16}
[/itex]

This will give [itex]\sqrt{16}[/itex]. Arbitrary n-th roots can be gived by \sqrt[n]. For example,

Code:
[itex]
\sqrt[4]{16}
[/itex]

This will give [itex]\sqrt[4]{16}[/itex]

Subscripts and superscript To type subscripts, just include _ For example
Code:
[itex]
x_y
[/itex]
will give [itex]x_y[/itex]. For superscripts, use ^ For example,
Code:
[itex]
x^y
[/itex]
will give [itex]x^y[/itex]

It might be necessary to include the brackets { }. For example,
Code:
[itex]
x^{x+y}
[/itex]
will give [itex]x^{x+y}[/itex]. Typing
Code:
[itex]
x^x+y
[/itex]
will give [itex]x^x+y[/itex].

Subscripts and superscripts work with integrals, limits, summations as well. For example,
Code:
[tex]
\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/tex]
will give us

[tex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/tex]

If you do the same thing in itex, then you get [itex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]. You notice that the subscrpt is written next to the limit instead of beneath it. To solve this, begin the text with \displaystyle. For example, typing
Code:
[itex]
\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/itex]
will give [itex]\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]

Delimiters The symbols ( ), [ ], \{ \} will give [itex](~),[~], \{~\}[/itex].
If you want larger delimiters, then you will have to include \left and \right. For example
Code:
[tex]
\left( \begin{array}{cc} a & b\\ c & d\end{array} \right)
[/tex]
will give

[tex]\left( \begin{array}{cc} a & b\\ c & d\end{array} \right)[/tex]

If you only want a left larger delimiter, then you need to include \left. or \right. For example
Code:
[tex]
\left. \begin{array}{cc} a & b\\ c & d\end{array} \right)
[/tex]
will give

[tex]\left. \begin{array}{cc} a & b\\ c & d\end{array} \right)[/tex]

Frequently used symbols A nice list of frequently used symbols can be found at http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols

Typing arrays and matrices An array can easily be typed by \bеgin{array} \еnd{array}. After \bеgin{array}, you have to specify the number of columns. An array with 5 columns would be typed as \bеgin{array}{ccccc} \еnd{array}.

Columns in the array are separated by &, and rows are separated by \\.

An example:
Code:
[tex]
\left(
\begin{array}{cccc}
1 & 2 & 2 & 4\\
5 & 6 & 7 & 8
\end{array}
\right)
[/tex]

will give

[tex]\left( \begin{array}{cccc} 1 & 2 & 2 & 4\\ 5 & 6 & 7 & 8\end{array} \right)[/tex]

We can also produce the following example:

Code:
[tex]
f(x) = 
\left\{
\bеgin{array}{rl}
-1 & x < 0\\
0 & x = 0\\
+1 & x > 0
\end{array}
\right.
[/tex]
This will give

[tex]f(x) =
\left\{
\begin{array}{rl}
-1 & x < 0\\
0 & x = 0\\
+1 & x > 0
\end{array}
\right.
[/tex]

Typing matrices can be significantly simplified using the pmatrix, bmatrix and vmatrix environments. See http://www.math-linux.com/spip.php?article132 for more information.

Sandbox:

If you wish to practice writing LATEX or test some code, a sandbox is available here: https://www.physicsforums.com/mathjax/test/preview.html
Please do not create threads in which to simply practice LATEX.
Additional information:

The Math & Science Software subforum, which often has active threads on LaTeX: https://www.physicsforums.com/forumdisplay.php?f=189

How to type multiple lines in a single LaTeX image: https://www.physicsforums.com/showthread.php?p=261329

You can get a drop-down menu of Latex while composing your post if you:

  • Are posting in one of the technical subforums
  • Are in Advanced Edit mode (click on "Go Advanced" to get there)
  • In Advanced Edit mode, click the icon

Simple non-LaTeX options:

Superscripts and subscripts can be entered using the and buttons while in Advanced Edit mode.

A quick-and-easy way to insert Greek letters and other math symbols in with normal text: https://www.physicsforums.com/blog.php?b=347 You just need to copy-and-paste the symbols.​

Acknowledgements

We are indebted to member and former admin chroot -- whose efforts brought LaTeX to Physics Forums in the first place -- and forum admin and owner Greg Bernhardt for updating to the currently-used MathJax processor. Numerous other members have provided valuable feedback and helped with the debugging process.​
 
Last edited by a moderator:
  • #5


The above is my proposal. It's not much original, it's more of a reworking of redbelly's post and some other sources.

Question; I have refrained from typing [tеx] and [tеx] everywhere. Do you think this is ok, or should I type it nevertheless?
 
  • #6


micromass said:
Important bug:
Physicsforums uses a LaTeX-software called mathjax. Mathjax has a quite important bug: after each 50 typed characters, it will automatically insert a space. This can screw up some LaTeX formula's. So be sure to insert a space regularly.

This is not a Mathjax bug - this is problem/feature of vBulletin. vBulletin divides long strings by inserting spaces, what Mathjax sees is already wrong.
 
  • #7


Borek said:
This is not a Mathjax bug - this is problem/feature of vBulletin. vBulletin divides long strings by inserting spaces, what Mathjax sees is already wrong.

Thanks! I edited it.
 
  • #8


The plural of formula is formulas. There's no apostrophe.

For matrices, most users will find it easier to use the pmatrix, bmatrix, and vmatrix environments. (There's another one, I think, but I can't remember the name.)
 
  • #9


vela said:
The plural of formula is formulas. There's no apostrophe.

Fixed. Thanks!

For matrices, most users will find it easier to use the pmatrix, bmatrix, and vmatrix environments. (There's another one, I think, but I can't remember the name.)

I did not include these on purpose. I want to make it clear that people can choose their own delimiters. With things like bmatrix, they cannot. It is my opinion, that if people understand the array environment, then they can do much more than just with the bmatrix environment.

I could introduce bmatrix (and dertivatives) separately. But I want to keep the number of new commands as low as possible. Any thoughts??
 
  • #10


I think most users won't care about how to build a matrix out of \left, \right, and \array. They'd rather just know they can use pmatrix or one of its variants. I'd include both methods. Tell them about pmatrix and its variants, and then point out if they want more flexibility, for example, for an augmented matrix, they can use array. The piecewise function is also a good example of that, I think.

I discovered the ITEX and TEX tags aren't parsed when they're inside CODE tags, so you don't need to use the funny E's in there.
 
  • #11


fyi, MathJax 2.0 should be out soon and they are claiming some SVG support which could be interesting.
 
  • #12


micromass, Borek, Greg, You guys rock. One can get educated just by reading post here.
 
  • #13


Very nice!

I've never been a fan of the array environment, and I almost never use it. I use the pmatrix environment, the cases environment, and the align environments instead. I would explain those (check out the link to the page that explains "align" and my examples of "pmatrix" and "cases" in the post that Redbelly98 quoted), and perhaps leave out the array environment entirely. But I certainly don't mind if you also explain array as well. If you do, it should inlude a comment like this: The c stands for "centered". You can also use "l" for "left" and "r" for right."


\lambda^2 yields [itex]\lambda[/itex]? Are you sure about that? :smile:

The part that mentions itex and tex tags, should use an example like this to illustrate the difference.

Code:
Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].
Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

I would like to see a comment like this: If you're using tex tags and you want a comma or a period after your formula, you should put it before the closing tex tag. If you're using itex tags, it doesn't really matter if you put it before or after the closing itex tag.

Also: When you use tex tags, the software will put a blank line before and after the formula. So you don't have to type any line breaks before the opening tex tag or after the closing tex tag.

You typed "subscrpt" instead of subscript in one place.

I think the part about subscripts and superscripts should include an example like \Lambda^\mu{}_\nu, [itex]\Lambda^\mu{}_\nu[/itex], where the horizontal positioning of the indices matter.

You said that "\\ only works in some environments, such as array, align,,..." which is fine (except for the extra comma), but I don't think a newbie understands what an "environment" is. So you should say something like this: An environment is a piece of code that begins and ends with \begin and \end statements, for example
Code:
\begin{align}\end{align}


I like the list of common symbols that you linked to, but perhaps we should also explain a few of the most common codes ourselves:

The symbol for the real numbers. Code: \mathbb R. Result: [itex]\mathbb R[/itex]. The \mathbb code works with other uppercase latin letters too (but not with lowercase letters or numbers).
Infinity. Code: \infty. Result: [itex]\infty[/itex]
Planck's constant divided by [itex]2\pi[/itex]. Code: \hbar. Result: [itex]\hbar[/itex].
Complex conjugation. Code: z^* or \overline z. Result: [itex]z^*,\ \overline z[/itex].
The adjoint of a linear operator. Code: A^* or A^\dagger. Result: [itex]A^*,\ A^\dagger[/itex].
Accents. Code: \hat x, \vec x, \tilde x. Result [itex]\hat x,\ \vec x,\ \tilde x[/itex].
Partial derivatives. Code: \frac{\partial f}{\partial x}. Result: [itex]\frac{\partial f}{\partial x}[/itex].
Set theory notation. Code: \forall, \exists, \cup, \cap, \bigcup, \bigcap. Result: [itex]\forall,\ \exists,\ \cup,\ \cap,\ \bigcup,\ \bigcap[/itex]
Dirac's bra-ket notation. Code: \langle\phi|\psi\rangle. Result: [itex]\langle\phi|\psi\rangle[/itex]
Arrows. Code: \rightarrow, \Rightarrow, \Leftrightarrow. Result: [itex]\rightarrow,\ \Rightarrow,\ \Leftrightarrow[/itex].
Relations. Code: \geq, \leq, \approx. Result: [itex]\geq,\ \leq,\ \approx[/itex].

This would look nicer as a table. Comment: For all of these, you have to use curly brackets if you want the command to apply to more than one symbol, or to a symbol that has a code that includes a space, for example \overline{z+w}, \hat{\mathcal A}, \int_{-\infty}^\infty f(x)dx. [itex]\overline{z+w}, \hat{\mathcal A}. [/itex], [itex]\int_{-\infty}^\infty f(x)dx[/itex].

I'm not sure I would even mention the \left. \right) trick, but I would explain how to choose the size of the delimiters manually. I rarely use \left and \right, because I feel that the result is often too big. So I use \bigg most of the time. I'd say something like this: If you want larger delimiters, then you can let LaTeX choose the sizes for you by using \left and \right, for example xe^x=x\left(\sum_{n=0}^\infty\frac{x^n}{n!}\right). [tex]xe^x=x\left(\sum_{n=0}^\infty\frac{x^n}{n!}\right)[/tex] If you do, you must type a \left for each \right, and vice versa. Otherwise, the code will not work. You can also choose the sizes manually using the commands \big, \Big, \bigg, and \Bigg.

We should explain some MathJax features (zoom, view source, "scale all math...") or link to a page that does.

The quick edit bug should also be mentioned. If you edit a post that contains LaTeX code without going to "advanced mode" first, the code will not be parsed when you view the thread immediately after saving the changes. The math looks fine to everyone else, but you will need to refresh the page (in your browser) to see the math again.

The part about simple non-latex options should mention the fancy new box of symbols we have to the right of the box where you type your posts. (By the way, I think the × symbol is a major omission from that list. The · symbol would have been nice too, but × is used much more often, e.g. in the phrase "m×n matrix", or as a Cartesian product f:X×Y→ℝ).
 
Last edited:
  • #14


I agree with all your points Freferik. I'll make the necessary edits tomorrow. I'll delete the discusion on the array environment and the \left \right thingies.

I'll also make a small text that uses all these LaTeX commands in action. Showing the code and the result should be very benificial for the users.
 
  • #16


micromass said:
How do I work with LaTeX here?
Those fancy mathematical symbols are being made with something called LaTeX. Typing LaTeX-symbols in physicsforums is fairly easy. You just need to type the equations or symbols between [itеx] and [/itеx]. For example,
Code:
[itex] \lambda^2 [/itex]
will yield [itex]\lambda[/itex].

Alternatively, one can also type equations between [tеx] and [/tеx]. These tags do basically the same thing as itex, with the only example that they put everything on a separate line. So type
Code:
[tex] \lambda^2 [/tex]
yields [tex]\lambda^2[/tex]​


I would change the second example to

Code:
[tex] \Lambda^2 [/tex]
yields [tex]\Lambda^2[/tex]

Anyone with half a brain will see the generalization :wink:
 
  • #17


I don't want to discriminate against members who don't have half a brain. You could perhaps use something like [itex]\lambda\ \Lambda[/itex] and [tex]\lambda\ \Lambda[/tex] as your examples.

Maybe we should say something about spacing. We could mention that spaces and blank lines that you type won't show up in the image. If you're feeling ambitious, you could explain commands like

\ (followed by one or more spaces)
~
\,
\!
\quad
\qquad
\hspace{30mm}.

Hm, there must be some web page that explains those things, so we might as well find one and link to it instead.
 
  • #18


How do I work with LaTeX here?
Those fancy mathematical symbols are being made with something called LaTeX. Typing LaTeX-symbols in physicsforums is fairly easy. You just need to type the equations or symbols between [itеx] and [/itеx]. For example,
Code:
[itex] \lambda^2 [/itex]
will yield [itex]\lambda^2[/itex].

Alternatively, one can also type equations between [tеx] and [/tеx]. These tags do basically the same thing as itex, with the only example that they put everything on a separate line. So type
Code:
[tex] \Lambda^2 [/tex]
yields [tex]\Lambda^2[/tex]

For the ones already familiar with LaTeX: the [itеx] brackets are analogous to $, and the [tеx] brackets are $$.

As another indication of the difference between [tеx] and [itеx], see the following example:

Code:
Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

It yields:

Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

Important note: If you're using tex tags and you want a comma or a period after your formula, you should put it before the closing tex tag. If you're using itex tags, it doesn't really matter if you put it before or after the closing itex tag.
Also, When you use tex tags, the software will put a blank line before and after the formula. So you don't have to type any line breaks before the opening tex tag or after the closing tex tag.

The easiest way to learn LaTeX is to see what others have done. If you see a post with a nice equation in it, just click QUOTE (at the bottom of the post) to see what the author did.

Important bug:
LaTeX in this forum has a quite important bug: after each 50 typed characters, it will automatically insert a space. This can screw up some LaTeX formulas. So be sure to insert a space regularly.

Another bug is that if you edit a post that contains LaTeX code without going to "advanced mode" first, the code will not be parsed when you view the thread immediately after saving the changes. The math looks fine to everyone else, but you will need to refresh the page (in your browser) to see the math again.
A very short introduction to LaTeX

So far, we know how to type in LaTeX, but we do not know the specific formulas. We will now introduce some of the more common formulas. A comprehensive list of formulas can be found at mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

Sadly, not all symbols are being supported by mathjax. To see a full list of suppoerted symbols, see http://www.mathjax.org/docs/1.1/tex.html

Now, we will introduce some easy formulas:

Special characters The following characters have a special meaning in LaTeX: # $ % { } _ ^ \ ~
The first six can be printed by \# \$ \% \{ \} \_

Lines and text \\ starts a new line, \ includes a space, \text{...} included text.

Note: \\ only works in some environments, such as array, align,... (an environment is a piece of code that begins with \bеgin and ends with \еnd statements, some important examples will follow later).

Spacing LaTeX does not care about space. For example

Code:
[tex]
x                                   y
[/tex]

will produce [tex]x y[/tex]

To insert spaces, you need to use symbols like ~ or \. For example

Code:
[tex]
x \ \ \ \ \ \ \ \ \ \ y
[/tex]

gives [tex]x \ \ \ \ \ \ \ \ \ \ y[/tex]

Subscripts and superscripts To type subscripts, just include _ For example
Code:
[itex]
x_y
[/itex]
will give [itex]x_y[/itex]. For superscripts, use ^ For example,
Code:
[itex]
x^y
[/itex]
will give [itex]x^y[/itex]

It might be necessary to include the brackets { }. For example,
Code:
[itex]
x^{x+y}
[/itex]
will give [itex]x^{x+y}[/itex]. Typing
Code:
[itex]
x^x+y
[/itex]
will give [itex]x^x+y[/itex].

To produce examples like [itex]\Lambda^\mu{}_\nu[/itex], you have to use the following idea:

Code:
[itex]\Lambda^\mu{}_\nu[/itex]

Subscripts and superscripts work with integrals, limits, summations as well. For example,
Code:
[tex]
\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/tex]
will give us [tex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/tex] If you do the same thing in itex, then you get [itex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]. You notice that the subscript is written next to the limit instead of beneath it. To solve this, begin the text with \displaystyle. For example, typing
Code:
[itex]
\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/itex]
will give [itex]\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]

Delimiters The symbols ( ), [ ], \{ \} will give [itex](~),[~], \{~\}[/itex].
If you want larger delimiters, then you have to use the \big, \Big, \bigg and \Bigg commands. For example

Code:
[tex]
xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)
[/tex]

will give [tex]xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)[/tex] You can also let LaTeX choose the size of your delimiters. This can be done by typing \left and \right in front of the delimiter. For example

Code:
[tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex]

will give [tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex] If you happen not to want a left or right delimiter, then you need to use \left. or \right. For example

Code:
[tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right.
[/tex]

will give [tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right.
[/tex]
Different fonts Sometimes we wish to type things in different font. For example the blackboard font [itex]\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R}, \mathbb{C}[/itex] is typed by

Code:
[itex]
\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R},\mathbb{C}
[/itex]

Caligraphic fonts like [itex]\mathcal{T},\mathcal{U},\mathcal{B}[/itex] are produced by

Code:
[itex]
\mathcal{T},\mathcal{U},\mathcal{B}
[/itex]

Note: these fonts only work with capital letters. Things like

Code:
[itex]
\mathcal{t}
[/itex]

will produce an error.

If you want to type something like [itex]f(x) \ \text{if} \ x>0[/itex], then you have to type it like

Code:
[itex]
f(x) \ \text{if} \ x>0
[/itex]

Just typing

Code:
[itex]
f(x) if x>0
[/itex]

will give something ugly: [itex]f(x) if x>0[/itex].
Frequently used symbols A nice list of frequently used symbols can be found at http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
Here we give a small sample of symbols you might want to use:

[tex]\begin{array}{|c|c|}
\hline
\text{\frac{1}{2}} & \frac{1}{2}\\
\hline
\text{\sqrt{16}} & \sqrt{16}\\
\hline
\text{\sqrt[4]{16}} & \sqrt[4]{16}\\
\hline
\text{\infty} & \infty\\
\hline
\text{\hbar} & \hbar\\
\hline
\text{z^*, \bar{z}, z^\dagger} & z^*, \bar{z}, z^\dagger\\
\hline
\text{\hat{z}, \vec{z}, \tilde{z}} & \hat{z}, \vec{z}, \tilde{z}\\
\hline
\text{\frac{ \partial f }{ \partial x }} & \frac{ \partial f }{ \partial x }\\
\hline
\text{\forall, \exists, \cup, \cap, \bigcup, \bigcap, \setminus, \in, \subseteq} & \forall, \exists, \cup, \cap, \bigcup, \bigcap, \setminus, \in, \subseteq\\
\hline
\text{\langle \phi | \psi \rangle} & \langle \phi | \psi \rangle\\
\hline
\text{\rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow} & \rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow\\
\hline
\text{\geq, \leq, \approx, \cong, \sim} & \geq, \leq, \approx, \cong, \sim\\
\hline
\text{ \binom{n}{k},{_nC_r}} & \binom{n}{k},{_nC_r}\\
\hline
\text{\sin(x), \cos(x), \log(x)} & \sin(x), \cos(x), \log(x)\\
\hline
\end{array}
[/tex]
A comprehensive list of LaTeX commands can be found at www.stat.berkeley.edu/~sourav/symbols-a4.pdf[/URL]
The list of all supported MathJax commands can be found at [PLAIN]http://www.mathjax.org/docs/1.1/tex.html

Typing multiple equations Multiple equations can be typed be the align environment. Such an environment must be started with \bеgin{align} and ended with \еnd{align}. Rows must be separated by \\, an alignment is given by & (followed by a symbol). So for example

Code:
[tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]

This yields [tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]
Typing matrices A matrix can easily by typed by the matrix, pmatrix, bmatrix and vmatrix environment. Such an environment must be started with \bеgin{pmatrix} and ended with \еnd{pmatrix}. Columns can be separated with & and ended with \\. Here is an example:

Code:
[tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]

This yields [tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]
The matrix, bmatrix and vmatrix environments produce the same results, but the delimiters are different. See http://www.math-linux.com/spip.php?article132 for more examples.

The cases environment Something like [tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex] Can be easily typed be the cases environment. Such an environment must be started with \bеgin{cases} and ended with \еnd{cases}. Rows must be separated with \\ and an invisible alignment is entered with &. The example above is produced by

Code:
[tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex]

Another example is

Code:
[tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1       & \text{if } x < 0
\end{cases}
[/tex]

which gives [tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1 & \text{if } x < 0
\end{cases}
[/tex] More information about such an environment is found in http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
Sandbox:

If you wish to practice writing LATEX or test some code, a sandbox is available here: https://www.physicsforums.com/mathjax/test/preview.html
Please do not create threads in which to simply practice LATEX.
Additional information:

The Math & Science Software subforum, which often has active threads on LaTeX: https://www.physicsforums.com/forumdisplay.php?f=189

You can get a drop-down menu of Latex while composing your post if you:

  • Are posting in one of the technical subforums
  • Are in Advanced Edit mode (click on "Go Advanced" to get there)
  • In Advanced Edit mode, click the icon

MathJax (the processor that physicsforums uses to produce LaTeX) also has a few view options. If you right click on a LaTeX symbol, then a menu will pop up with handy features. Here's what you can do:

  • Show Source: this shows original LaTeX code. This is handy if you want to see how something is typed.
  • Settings: Allows you to zoom in in equation. So it allows you to see some LaTex symbols bigger. In order for zoom to work, you need to set your zoom trigger. If you set it to "hover" (for example), then you zoom in every time you place your mouse over the LaTeX code.
  • MathJax Help: Has some additional help features for users. Check it out.
Simple non-LaTeX options:

Superscripts and subscripts can be entered using the and buttons while in Advanced Edit mode.

There also is a box of symbols right to the right of the box where you type the posts. Just click on a symbol and it appears in the post without LaTeX being necessary.

A quick-and-easy way to insert Greek letters and other math symbols in with normal text: https://www.physicsforums.com/blog.php?b=347 You just need to copy-and-paste the symbols.​

Acknowledgements

We are indebted to member and former admin chroot -- whose efforts brought LaTeX to Physics Forums in the first place -- and forum admin and owner Greg Bernhardt for updating to the currently-used MathJax processor. Numerous other members have provided valuable feedback and helped with the debugging process.​
 
Last edited by a moderator:
  • #19


The above includes changes suggested by vela, Borek and Frederik. Comments welcome!
 
  • #20


Nice work. These are a few observations:

"auther" should be "author"

Too many blank lines. You're not following the recommendation about not typing blank lines before and after tex tags. :smile: For best results, type
Code:
Sentence that includes an equation [tex]E=mc^2[/tex] and then more text.
I think the result looks best without a single newline character in the sentence (unless they're between the tex tags).

Not sure code tags are necessary around stuff like \hbar. Actually, I'm thinking that these symbols and their codes should appear in some sort of table. It would make the post significantly shorter and easier to read. I'll try to figure out a good way to do it in the morning if no one else has done it by then.

I would delete the sentence that links to the old thread about how to type multiple lines. It's an old thread and most of the math there looks bad, if it works at all.

I think "There also is a box of symbols right of the..." should be "There is also a box of symbols to the right of the..."
 
  • #21
Looking good!

In the second paragraph, separate is misspelled, and in the third, analogous has a typo.

For limits, I prefer to use \to to make the arrow, primarily because I'm lazy and it's much shorter to type than \rightarrow.
Code:
[tex]\lim_{x \to 0} \frac{\sin x}{x} = 1[/tex]
[tex]\lim_{x \to 0} \frac{\sin x}{x} = 1[/tex]
For conjugation, I think \bar looks better than \overline, which makes the bar too long: [itex]\bar z[/itex] vs. [itex]\overline z[/itex].

In the delimiters section, I wouldn't say that you have to use \big, etc., but that you can use them. Mention \left and \right can be used to let LaTeX automatically choose the size.

Since probability and combinatorics questions come up a lot, you might want to include
Code:
[tex]\binom{n}{k}[/tex]
[tex]\binom{n}{k}[/tex]and
Code:
[tex]{_nC_r}[/tex]
[tex]{_nC_r}[/tex]
In the fonts section, mention using \text to avoid mistakes like [itex]f(x) = x if x>0[/itex], which should be [itex]f(x) = x\text{ if }x>0[/itex].

I'd also point out the use of \ in front of the name of standard functions. A lot of posters don't know to do this so you see things like [itex]sin x[/itex] instead of [itex]\sin x[/itex].

Are there any other common mistakes people seem to make or common notation people want to use? I think those should be covered in the FAQ if possible.
 
  • #22


I have made all the changes. I think the table looks pretty :approve:

What do you guys think??
 
  • #23


Very nice. We're officially down to nitpicking minor details now.

It still says "If you want larger delimiters, then you have to use..." I agree with vela that it would be better to write "then you can use" rather than "then you have to use".

There are still a few unnecessary blank lines: After the \Lambda^2. After xy. After x y.

Also, there are some section titles have only one blank line before the section title, but two after it. Doesn't it look better with two before and one after? Look at the section titles: "A very short introduction to LaTeX", "Sandbox", and the other section titles after that.

The first two section titles and the last don't end with a colon, but the others do. Maybe we could be more consistent? Perhaps drop all those colons?

Very minor nitpick: "...the [itеx] brackets are analogous to $, and the [tеx] brackets are $$". I think the end of that should be "are analogous to $$", because otherwise it looks like tex is more similar to $$ than itex is to $.

Consider deleting the newline character in "...the closing itex tag.
Also, When you use tex tags..." An alternative is to type another one, to get a blank line between the paragraphs. Oh yeah, and the W should be lower case.

In the "important bug" section, I would rather not say that LaTeX in this forum has a bug. It's better than the original version, but it still (kind of) suggests that the bug is in MathJax. I would rather say this:

vBulletin (the forum software) has a feature that will sometimes break correct LaTeX code. If you type more than 50 characters without a space, vBulletin will insert one for you after the 50th character. This will break the code unless you're lucky enough to have the space end up before a LaTeX command rather than in the middle of it. To prevent this from happening, you will have to make sure that your code contains a space at least once every 50 characters. If you often write long pieces of LaTeX code, you may want to start to routinely type extra spaces that will be ignored by the LaTeX processor, for example before equality signs and LaTeX commands that aren't arguments of other LaTeX commands.

(I don't mind using the word "bug" in the section title, because even though both pieces of software are doing exactly what they're supposed to, there's still a problem when we combine them.)

\subseteq but no \subset? (I'm one of those who only uses the latter). Oh yeah, I remember that you don't like the \mapsto arrow, but I do. So how about including that with the other arrows? Nice table by the way. :smile:

Edit: The paragraph that starts with "The easiest way to learn LaTeX is to see what others have done." is good, but should perhaps be in a different place. In the opening paragraph perhaps, or right after the first simple examples.

I suggest one more line in the table: \vec x\cdot\vec y, f\circ g, X\times Y.
 
Last edited:
  • #24


A few more nitpicks:

\sin \cos \log in the table: add something like "and many other common math functions"

"It might be necessary to include the brackets { }"

I would prefer a this under its own heading, because it's essential to know about it. e.g.

Grouping:
By default, LaTeX operations only act on the next single 'token' (a single character, or something starting with a '\' ) in what you type. To make them act on a longer pieces of input, use curly brackets { }.

Examples: x^{10}+y^{10} giives [itex]x^{10}+y^{10}[/itex].
x^10+y^10 would produce [itex]x^10+y^10[/itex] .

Sometimes it's useful to attach something to an empty pair of brackets, {}. For example A^i_j and A_j^i both give [itex] A^i_j [/itex], but A^i{}_j gives [itex] A^i{}_j [/itex] and A_j{}^i gives [itex] A_j{}^i [/itex].

You can nest brackets within brackets as deeply as you want, to build up a complicated expression. For example \sqrt{1 + \sqrt{1 + \sqrt{1 + x}}} gives
[tex]\sqrt{1 + \sqrt{1 + \sqrt{1 + x}}}[/tex]
 
  • #25


How do I work with LaTeX here?
Those fancy mathematical symbols are being made with something called LaTeX. Typing LaTeX-symbols in physicsforums is fairly easy. You just need to type the equations or symbols between [itеx] and [/itеx]. For example,
Code:
[itex] \lambda^2 [/itex]
will yield [itex]\lambda^2[/itex].

Alternatively, one can also type equations between [tеx] and [/tеx]. These tags do basically the same thing as itex, with the only example that they put everything on a separate line. So type
Code:
[tex] \Lambda^2 [/tex]
yields [tex]\Lambda^2[/tex]
For the ones already familiar with LaTeX: the [itеx] brackets are analogous to $, and the [tеx] brackets are analogous to $$.

The easiest way to learn LaTeX is to see what others have done. If you see a post with a nice equation in it, just click QUOTE (at the bottom of the post) to see what the author did.

As another indication of the difference between [tеx] and [itеx], see the following example:

Code:
Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

It yields:

Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

Important note If you're using tex tags and you want a comma or a period after your formula, you should put it before the closing tex tag. If you're using itex tags, it doesn't really matter if you put it before or after the closing itex tag. Also, when you use tex tags, the software will put a blank line before and after the formula. So you don't have to type any line breaks before the opening tex tag or after the closing tex tag.

Important bug
vBulletin (the forum software) has a feature that will sometimes break correct LaTeX code. If you type more than 50 characters without a space, vBulletin will insert one for you after the 50th character. This will break the code unless you're lucky enough to have the space end up before a LaTeX command rather than in the middle of it. To prevent this from happening, you will have to make sure that your code contains a space at least once every 50 characters. If you often write long pieces of LaTeX code, you may want to start to routinely type extra spaces that will be ignored by the LaTeX processor, for example before equality signs and LaTeX commands that aren't arguments of other LaTeX commands.

Another bug is that if you edit a post that contains LaTeX code without going to "advanced mode" first, the code will not be parsed when you view the thread immediately after saving the changes. The math looks fine to everyone else, but you will need to refresh the page (in your browser) to see the math again.​
A very short introduction to LaTeX
So far, we know how to type in LaTeX, but we do not know the specific formulas. We will now introduce some of the more common formulas. A comprehensive list of formulas can be found at mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

Sadly, not all symbols are being supported by mathjax. To see a full list of supported symbols, see http://www.mathjax.org/docs/1.1/tex.html

Now, we will introduce some easy formulas:

Special characters The following characters have a special meaning in LaTeX: # $ % { } _ ^ \ ~
The first six can be printed by \# \$ \% \{ \} \_

Lines and text \\ starts a new line, \ includes a space, \text{...} included text.

Note: \\ only works in some environments, such as array, align,... (an environment is a piece of code that begins with \bеgin and ends with \еnd statements, some important examples will follow later).

Spacing LaTeX does not care about space. For example

Code:
[tex]
x                                   y
[/tex]

will produce [tex]x y[/tex]
To insert spaces, you need to use symbols like ~ or \. For example

Code:
[tex]
x \ \ \ \ \ \ \ \ \ \ y
[/tex]

gives [tex]x \ \ \ \ \ \ \ \ \ \ y[/tex]
Subscripts and superscripts To type subscripts, just include _ For example
Code:
[itex]
x_y
[/itex]
will give [itex]x_y[/itex]. For superscripts, use ^ For example,
Code:
[itex]
x^y
[/itex]
will give [itex]x^y[/itex]

Subscripts and superscripts work with integrals, limits, summations as well. For example,
Code:
[tex]
\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/tex]
will give us [tex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/tex] If you do the same thing in itex, then you get [itex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]. You notice that the subscript is written next to the limit instead of beneath it. To solve this, begin the text with \displaystyle. For example, typing
Code:
[itex]
\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/itex]
will give [itex]\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]

Grouping By default, LaTeX operations only act on a single character in what you type. To make them act on longer pieces of input, use curly brackets { }. For example

Code:
[itex]
x^{10}+x^10
[/itex]

gives [itex]x^{10}+x^10[/itex].

Sometimes it's useful to attack something to an empty pair of brackets, {}. See for example the difference in the following:

Code:
[itex]
\Lambda_\mu^\nu, \Lambda^\nu_\mu, \Lambda_\mu{}^\nu, \Lambda^\nu{}_\mu
[/itex]

gives [itex]
\Lambda_\mu^\nu, \Lambda^\nu_\mu, \Lambda_\mu{}^\nu, \Lambda^\nu{}_\mu
[/itex].

You can nest brackets within brackets as deeply as you want to build up a complicated experssion. For example

Code:
[itex]
\sqrt{1+\sqrt{1+\sqrt{1+x}}}
[/itex]

gives [itex]
\sqrt{1+\sqrt{1+\sqrt{1+x}}}
[/itex].

Delimiters The symbols ( ), [ ], \{ \} will give [itex](~),[~], \{~\}[/itex].
If you want larger delimiters, then you can use the \big, \Big, \bigg and \Bigg commands. For example

Code:
[tex]
xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)
[/tex]

will give [tex]xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)[/tex] You can also let LaTeX choose the size of your delimiters. This can be done by typing \left and \right in front of the delimiter. For example

Code:
[tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex]

will give [tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex] If you happen not to want a left or right delimiter, then you need to use \left. or \right. For example

Code:
[tex]
\left\{ \int_1^{12}{x^3dx} \right.
[/tex]

will give [tex]
\left\{ \int_1^{12}{x^3dx} \right.
[/tex]
Different fonts Sometimes we wish to type things in different font. For example the blackboard font [itex]\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R}, \mathbb{C}[/itex] is typed by

Code:
[itex]
\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R},\mathbb{C}
[/itex]

Caligraphic fonts like [itex]\mathcal{T},\mathcal{U},\mathcal{B}[/itex] are produced by

Code:
[itex]
\mathcal{T},\mathcal{U},\mathcal{B}
[/itex]

Note: these fonts only work with capital letters. Things like

Code:
[itex]
\mathcal{t}
[/itex]

will produce an error.

If you want to type something like [itex]f(x) \ \text{if} \ x>0[/itex], then you have to type it like

Code:
[itex]
f(x) \ \text{if} \ x>0
[/itex]

Just typing

Code:
[itex]
f(x) if x>0
[/itex]

will give something ugly: [itex]f(x) if x>0[/itex].

Frequently used symbols A nice list of frequently used symbols can be found at http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
Here we give a small sample of symbols you might want to use:

[tex]\begin{array}{|c|c|}
\hline
\text{\frac{1}{2}} & \frac{1}{2}\\
\hline
\text{\sqrt{16}} & \sqrt{16}\\
\hline
\text{\sqrt[4]{16}} & \sqrt[4]{16}\\
\hline
\text{\infty} & \infty\\
\hline
\text{\hbar} & \hbar\\
\hline
\text{z^*, \bar{z}, z^\dagger} & z^*, \bar{z}, z^\dagger\\
\hline
\text{\hat{z}, \vec{z}, \tilde{z}, \dot{z}, \ddot{z}} & \hat{z}, \vec{z}, \tilde{z}, \dot{z}, \ddot{z}\\
\hline
\text{\frac{ \partial f }{ \partial x }} & \frac{ \partial f }{ \partial x }\\
\hline
\text{\forall, \exists, \cup, \cap, \bigcup, \bigcap, \setminus, \in, \subseteq, \subset} & \forall, \exists, \cup, \cap, \bigcup, \bigcap, \setminus, \in, \subseteq, \subset\\
\hline
\text{\langle \phi | \psi \rangle} & \langle \phi | \psi \rangle\\
\hline
\text{\rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow, \mapsto} & \rightarrow, \leftarrow, \Rightarrow, \Leftrightarrow, \mapsto\\
\hline
\text{\geq, \leq, \approx, \cong, \sim} & \geq, \leq, \approx, \cong, \sim\\
\hline
\text{\oplus, \otimes, \ne, \pm, \mp} & \oplus, \otimes, \ne, \pm, \mp\\
\hline
\text{ \binom{n}{k},{_nC_r}} & \binom{n}{k},{_nC_r}\\
\hline
\text{\sin(x), \cos(x), \log(x),...} & \sin(x), \cos(x), \log(x),...\\
\hline
\text{A\cdot B, A\times B, f\circ g} & A\cdot B, A\times B, f\circ g\\
\hline
\text{\int, \iint, \iiint, \oint} & \int, \iint, \iiint, \oint\\
\hline
\text{\cdots, \vdots, \ddots, \dots} & \cdots, \vdots, \ddots, \dots\\
\hline
\end{array}
[/tex]
A comprehensive list of LaTeX commands can be found at www.stat.berkeley.edu/~sourav/symbols-a4.pdf[/URL]
The list of all supported MathJax commands can be found at [PLAIN]http://www.mathjax.org/docs/1.1/tex.html

Typing multiple equations Multiple equations can be typed be the align environment. Such an environment must be started with \bеgin{align} and ended with \еnd{align}. Rows must be separated by \\, an alignment is given by & (followed by a symbol). So for example

Code:
[tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]

This yields [tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]
Typing matrices A matrix can easily by typed by the matrix, pmatrix, bmatrix and vmatrix environment. Such an environment must be started with \bеgin{pmatrix} and ended with \еnd{pmatrix}. Columns can be separated with & and ended with \\. Here is an example:

Code:
[tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]

This yields [tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]
The matrix, bmatrix and vmatrix environments produce the same results, but the delimiters are different. See http://www.math-linux.com/spip.php?article132 for more examples.

The cases environment Something like [tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex] Can be easily typed be the cases environment. Such an environment must be started with \bеgin{cases} and ended with \еnd{cases}. Rows must be separated with \\ and an invisible alignment is entered with &. The example above is produced by

Code:
[tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex]

Another example is

Code:
[tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1       & \text{if } x < 0
\end{cases}
[/tex]

which gives [tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1 & \text{if } x < 0
\end{cases}
[/tex] More information about such an environment is found in http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
Sandbox
If you wish to practice writing LATEX or test some code, a sandbox is available here: https://www.physicsforums.com/mathjax/test/preview.html
Please do not create threads in which to simply practice LATEX.​
Additional information
The Math & Science Software subforum, which often has active threads on LaTeX: https://www.physicsforums.com/forumdisplay.php?f=189

You can get a drop-down menu of Latex while composing your post if you:

  • Are posting in one of the technical subforums
  • Are in Advanced Edit mode (click on "Go Advanced" to get there)
  • In Advanced Edit mode, click the icon

MathJax (the processor that physicsforums uses to produce LaTeX) also has a few view options. If you right click on a LaTeX symbol, then a menu will pop up with handy features. Here's what you can do:

  • Show Source: this shows original LaTeX code. This is handy if you want to see how something is typed.
  • Settings: Allows you to zoom in in equation. So it allows you to see some LaTex symbols bigger. In order for zoom to work, you need to set your zoom trigger. If you set it to "hover" (for example), then you zoom in every time you place your mouse over the LaTeX code.
  • MathJax Help: Has some additional help features for users. Check it out.
Simple non-LaTeX options
Superscripts and subscripts can be entered using the and buttons while in Advanced Edit mode.

There also is a box of symbols right to the right of the box where you type the posts. Just click on a symbol and it appears in the post without LaTeX being necessary.

A quick-and-easy way to insert Greek letters and other math symbols in with normal text: https://www.physicsforums.com/blog.php?b=347 You just need to copy-and-paste the symbols.​
Acknowledgements
We are indebted to member and former admin chroot -- whose efforts brought LaTeX to Physics Forums in the first place -- and forum admin and owner Greg Bernhardt for updating to the currently-used MathJax processor. Numerous other members have provided valuable feedback and helped with the debugging process.​
 
Last edited by a moderator:
  • #26


To the table, I suggest adding:

Integral symbols: \int, \iint, \iiint, \oint
Ellipses: \cdots, \vdots, \ddots, \dots
Dots: \dot{x}, \ddot{x}
Miscellaneous: \oplus, \otimes, \ne, \pm, \mp

Also, it might be worth having an example of a definite integral somewhere in the FAQ, perhaps in the delimiters section since you need big stuff in there anyway.
 
  • #27


vela said:
Also, it might be worth having an example of a definite integral somewhere in the FAQ

...and that would be a good place to mention that \, makes a small space, as in \int x\,dx = [itex]\int x\,dx[/itex]
 
  • #29


I think the FAQ is too long. I propose posting it in 3 posts:

- 1 post with everything except the introduction to LaTeX
- the introduction to LaTeX
- an example text.
 
  • #30


I thought of a few more suggestions for the table. Rather than inundate you with a stream of posts, I decided to try tweak the table on my own, and I got a bit carried away. This could be its own post, with links to and from the FAQ.

\begin{array}{l|c|c}
\hline
\text{Infinity} & \text{\infty} & \infty \\
\text{Reduced Planck's Constant} & \text{\hbar} & \hbar \\
\text{Plus-minus} & \text{\pm, \mp} & \pm, \mp \\
\text{Parallel} & \text{\parallel} & \parallel \\
\text{Perpendicular} & \text{\perp} & \perp \\
\text{For all} & \text{\forall} & \forall \\
\text{There exists} & \text{\exists} & \exists \\
\text{Ellipsis} & \text{\cdots, \vdots, \ddots, \dots} & \cdots, \vdots, \ddots, \dots \\
\hline
\text{Arrows} & \text{\rightarrow, \leftarrow} & \rightarrow, \leftarrow, \leftrightarrow \\
& \text{\Rightarrow, \Leftarrow, \Leftrightarrow} & \Rightarrow, \Leftarrow, \Leftrightarrow \\
& \text{\mapsto, \to} & \mapsto, \to \\
& \text{\uparrow, \downarrow} & \uparrow, \downarrow \\
\hline
\text{Relations} & \text{\geq, \leq, \neq} & \geq, \leq, \neq \\
& \text{\gg, \ll, \equiv} & \gg, \ll, \equiv \\
& \text{\approx, \cong, \sim} & \approx, \cong, \sim \\
\hline
\text{Superscript} & \text{x^n} & x^n \\
\text{Subscript} & \text{x_i} & x_i \\
\text{Tensor indices} & \text{R_{ab}{}^{cd}} & R_{ab}{}^{cd} \\
\text{Fraction} & \text{\frac{1}{2}} & \frac{1}{2} \\
\text{Square root} & \text{\sqrt{16}} & \sqrt{16} \\
\text{Nth root} & \text{\sqrt[4]{16}} & \sqrt[4]{16} \\
\text{Absolute value} & \text{|x|} & |x| \\
\text{Norm} & \text{\|\vec{x}\|} & \|\vec{x}\| \\
\text{Accents} & \text{\hat{p}, \vec{r}, \tilde{z}} & \hat{p}, \vec{r}, \tilde{z} \\
\text{Complex conjugate} & \text{z^*, \bar{z}, z^\dagger} & z^*, \bar{z}, z^\dagger \\
\text{Dirac notation} & \text{\langle \phi | \psi \rangle} & \langle \phi | \psi \rangle \\
\text{Multiplication} & \text{A \cdot B, A \times B} & A\cdot B, A\times B \\
\text{Direct Sum} & \text{V \oplus W} & V \oplus W \\
\text{Tensor Product} & \text{S \otimes T} & S \otimes T \\
\text{Function composition} & \text{f \circ g} & f\circ g \\
\text{Element of} & \text{x \in A} & x \in A \\
\text{Not in} & \text{x \not\in A} & x \not\in A \\
\text{Subset} & \text{A \subset B, B \subseteq C} & A \subset B, B \subseteq C \\
\text{Set Union} & \text{A \cup B} & A \cup B \\
\text{Set Intersection} & \text{A \cap B} & A \cap B \\
\text{Set Subtraction} & \text{A \setminus B} & A \setminus B \\
\hline
\text{Binomial coefficient} & \text{\binom{n}{k}, {_nC_r}} & \binom{n}{k}, {_nC_r} \\
\hline
\text{Big stuff} & \text{\bigcup_i A_i} & \bigcup_i A_i \\
& \text{\bigcap_i A_i} & \bigcap_i A_i \\
& \text{\sum_{n=0}^\infty a_n x^n} & \sum_{n=0}^\infty a_n x^n \\
& \text{\prod_{n=0}^\infty a_n} & \prod_{n=0}^\infty a_n \\
\hline
\text{Derivatives} & \text{y', y'', y^{(n)}} & y', y'', y^{(n)} \\
& \text{\dot{x}, \ddot{x}} & \dot{x}, \ddot{x} \\
& \text{\frac{\partial f}{\partial x}} & \frac{\partial f}{\partial x} \\
& \text{\nabla f} & \nabla f\\
& \text{\Box^2 \phi} & \Box^2 \phi \\
\hline
\text{Integrals} & \text{\int e^x\,dx} & \int e^x\,dx \\
& \text{\oint \vec{E}\cdot d\vec{A}} & \oint \vec{E}\cdot d\vec{A} \\
& \text{\iint, \iiint} & \iint, \iiint \\
\hline
\text{Elementary Functions} & \text{\sin x, \cos x, \log (x+y), ...} & \sin x, \cos x, \log(x+y), \dots \\
\hline
\end{array}
 
Last edited:
  • #31


"Sometimes it's useful to attack something..." Change attack to attach.

"The matrix, bmatrix and vmatrix environments produce the same results, but the delimiters are different". I think "the same" is too strong. I would change this to "The matrix, bmatrix and vmatrix environments produce similar results. Only the delimiters are different."

The bullet points under "You can get a drop-down menu of Latex while composing your post if you:" are a bit weird. I hope someone will correct me if what I'm saying is wrong, but I think that if each item is a different way to end the sentence you started before the list began, then there should be no colon after "if you", and each item should start with a lowercase character. The third one should probably say "are in Advanced Edit mode and click the Σ button." An alternative is to change the text before the list to a complete sentence, and then make each item in the list a complete sentence.

The first sentence under "Additional information". I would change it to this: If you have questions, you can ask them in the The Math & Science Software subforum.



I suggest that you replace the content of the "Simple non-LaTeX options" section with this:

If you just want a subscript or a superscript, you can use vBulletin's sub and sup tags. For example, [noparse]x1[/noparse] yields x1, and [noparse]x2[/noparse] yields x2. If you don't want to type these tags, you can use the X2 and X2 buttons above the input field when you're in Advanced Edit mode.

If you just want to insert a Greek letter or a mathematical symbol in your post, the easiest way is to just click on the symbol you want in the box of symbols to the right of the input field when you're in Advanced Edit mode. If you need a symbol that you don't see in that box, you can try to find it in https://www.physicsforums.com/blog.php?b=347 at the website of the Pennsylvania State University.

Do not use these symbols, the sub/sup tags, or any other vBulletin tags in LaTeX mode (i.e. between tex or itex tags).


I like vela's table. It should perhaps be in a separate post on the same page. In the main text, where your table is now, you can just mention that there's a table of common symbols and their LaTeX code in a separate post below. How about adding \uparrow and \downarrow? They are sometimes used when discussing spin-1/2 systems. [itex]\left|\uparrow\right\rangle[/itex]
 
Last edited by a moderator:
  • #32


How do I work with LaTeX here?
Those fancy mathematical symbols are being made with something called LaTeX. Typing LaTeX-symbols in physicsforums is fairly easy. You just need to type the equations or symbols between [itеx] and [/itеx]. For example,
Code:
[itex] \lambda^2 [/itex]
will yield [itex]\lambda^2[/itex].

Alternatively, one can also type equations between [tеx] and [/tеx]. These tags do basically the same thing as itex, with the only example that they put everything on a separate line. So type
Code:
[tex] \Lambda^2 [/tex]
yields [tex]\Lambda^2[/tex]
For the ones already familiar with LaTeX: the [itеx] brackets are analogous to $, and the [tеx] brackets are analogous to $$.

The easiest way to learn LaTeX is to see what others have done. If you see a post with a nice equation in it, just click QUOTE (at the bottom of the post) to see what the author did.

As another indication of the difference between [tеx] and [itеx], see the following example:

Code:
Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

It yields:

Let [itex]f:\mathbb R\rightarrow\mathbb R[/itex] be the function defined by [tex]f(x)=x^2,[/tex] for all [itex]x\in\mathbb R[/itex].

Important note If you're using tex tags and you want a comma or a period after your formula, you should put it before the closing tex tag. If you're using itex tags, it doesn't really matter if you put it before or after the closing itex tag. Also, when you use tex tags, the software will put a blank line before and after the formula. So you don't have to type any line breaks before the opening tex tag or after the closing tex tag.

Important bug
vBulletin (the forum software) has a feature that will sometimes break correct LaTeX code. If you type more than 50 characters without a space, vBulletin will insert one for you after the 50th character. This will break the code unless you're lucky enough to have the space end up before a LaTeX command rather than in the middle of it. To prevent this from happening, you will have to make sure that your code contains a space at least once every 50 characters. If you often write long pieces of LaTeX code, you may want to start to routinely type extra spaces that will be ignored by the LaTeX processor, for example before equality signs and LaTeX commands that aren't arguments of other LaTeX commands.

Another bug is that if you edit a post that contains LaTeX code without going to "advanced mode" first, the code will not be parsed when you view the thread immediately after saving the changes. The math looks fine to everyone else, but you will need to refresh the page (in your browser) to see the math again.​
A very short introduction to LaTeX
So far, we know how to type in LaTeX, but we do not know the specific formulas. We will now introduce some of the more common formulas. A comprehensive list of formulas can be found at mirror.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

Sadly, not all symbols are being supported by mathjax. To see a full list of supported symbols, see http://www.mathjax.org/docs/1.1/tex.html

Now, we will introduce some easy formulas:

Special characters The following characters have a special meaning in LaTeX: # $ % { } _ ^ \ ~
The first six can be printed by \# \$ \% \{ \} \_

Lines and text \\ starts a new line, \ includes a space, \text{...} included text.

Note: \\ only works in some environments, such as array, align,... (an environment is a piece of code that begins with \bеgin and ends with \еnd statements, some important examples will follow later).

Spacing LaTeX does not care about space. For example

Code:
[tex]
x                                   y
[/tex]

will produce [tex]x y[/tex]
To insert spaces, you need to use symbols like ~ or \. For example

Code:
[tex]
x \ \ \ \ \ \ \ \ \ \ y
[/tex]

gives [tex]x \ \ \ \ \ \ \ \ \ \ y[/tex]
Subscripts and superscripts To type subscripts, just include _ For example
Code:
[itex]
x_y
[/itex]
will give [itex]x_y[/itex]. For superscripts, use ^ For example,
Code:
[itex]
x^y
[/itex]
will give [itex]x^y[/itex]

Subscripts and superscripts work with integrals, limits, summations as well. For example,
Code:
[tex]
\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/tex]
will give us [tex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/tex] If you do the same thing in itex, then you get [itex]\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]. You notice that the subscript is written next to the limit instead of beneath it. To solve this, begin the text with \displaystyle. For example, typing
Code:
[itex]
\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}
[/itex]
will give [itex]\displaystyle\lim_{n\rightarrow +\infty} {\frac{\sin(x)}{x}}[/itex]

Grouping By default, LaTeX operations only act on a single character in what you type. To make them act on longer pieces of input, use curly brackets { }. For example

Code:
[itex]
x^{10}+x^10
[/itex]

gives [itex]x^{10}+x^10[/itex].

Sometimes it's useful to attach something to an empty pair of brackets, {}. See for example the difference in the following:

Code:
[itex]
\Lambda_\mu^\nu, \Lambda^\nu_\mu, \Lambda_\mu{}^\nu, \Lambda^\nu{}_\mu
[/itex]

gives [itex]
\Lambda_\mu^\nu, \Lambda^\nu_\mu, \Lambda_\mu{}^\nu, \Lambda^\nu{}_\mu
[/itex].

You can nest brackets within brackets as deeply as you want to build up a complicated experssion. For example

Code:
[itex]
\sqrt{1+\sqrt{1+\sqrt{1+x}}}
[/itex]

gives [itex]
\sqrt{1+\sqrt{1+\sqrt{1+x}}}
[/itex].

Delimiters The symbols ( ), [ ], \{ \} will give [itex](~),[~], \{~\}[/itex].
If you want larger delimiters, then you can use the \big, \Big, \bigg and \Bigg commands. For example

Code:
[tex]
xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)
[/tex]

will give [tex]xe^x = x \Big( \sum_{n=0}^\infty\frac{x^n}{n!} \Big)[/tex] You can also let LaTeX choose the size of your delimiters. This can be done by typing \left and \right in front of the delimiter. For example

Code:
[tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex]

will give [tex]
xe^x = x \left( \sum_{n=0}^\infty\frac{x^n}{n!} \right)
[/tex] If you happen not to want a left or right delimiter, then you need to use \left. or \right. For example

Code:
[tex]
\left\{ \int_1^{12}{x^3dx} \right.
[/tex]

will give [tex]
\left\{ \int_1^{12}{x^3dx} \right.
[/tex]
Different fonts Sometimes we wish to type things in different font. For example the blackboard font [itex]\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R}, \mathbb{C}[/itex] is typed by

Code:
[itex]
\mathbb{N},\mathbb{Z},\mathbb{Q},\mathbb{R},\mathbb{C}
[/itex]

Caligraphic fonts like [itex]\mathcal{T},\mathcal{U},\mathcal{B}[/itex] are produced by

Code:
[itex]
\mathcal{T},\mathcal{U},\mathcal{B}
[/itex]

Note: these fonts only work with capital letters. Things like

Code:
[itex]
\mathcal{t}
[/itex]

will produce an error.

If you want to type something like [itex]f(x) \ \text{if} \ x>0[/itex], then you have to type it like

Code:
[itex]
f(x) \ \text{if} \ x>0
[/itex]

Just typing

Code:
[itex]
f(x) if x>0
[/itex]

will give something ugly: [itex]f(x) if x>0[/itex].

Frequently used symbols A nice list of frequently used symbols can be found at http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
Here we give a small sample of symbols you might want to use:
[tex]
\begin{array}{l|c|c}
\hline
\text{Infinity} & \text{\infty} & \infty \\
\text{Reduced Planck's Constant} & \text{\hbar} & \hbar \\
\text{Plus-minus} & \text{\pm, \mp} & \pm, \mp \\
\text{Parallel} & \text{\parallel} & \parallel \\
\text{Perpendicular} & \text{\perp} & \perp \\
\text{For all} & \text{\forall} & \forall \\
\text{There exists} & \text{\exists} & \exists \\
\text{Ellipsis} & \text{\cdots, \vdots, \ddots, \dots} & \cdots, \vdots, \ddots, \dots \\
\hline
\text{Arrows} & \text{\rightarrow, \leftarrow} & \rightarrow, \leftarrow, \leftrightarrow \\
& \text{\Rightarrow, \Leftarrow, \Leftrightarrow} & \Rightarrow, \Leftarrow, \Leftrightarrow \\
& \text{\mapsto, \to} & \mapsto, \to \\
& \text{\uparrow, \downarrow} & \uparrow, \downarrow \\
\hline
\text{Relations} & \text{\geq, \leq, \neq} & \geq, \leq, \neq \\
& \text{\gg, \ll, \equiv} & \gg, \ll, \equiv \\
& \text{\approx, \cong, \sim} & \approx, \cong, \sim \\
\hline
\text{Superscript} & \text{x^n} & x^n \\
\text{Subscript} & \text{x_i} & x_i \\
\text{Tensor indices} & \text{R_{ab}{}^{cd}} & R_{ab}{}^{cd} \\
\text{Fraction} & \text{\frac{1}{2}} & \frac{1}{2} \\
\text{Square root} & \text{\sqrt{16}} & \sqrt{16} \\
\text{Nth root} & \text{\sqrt[4]{16}} & \sqrt[4]{16} \\
\text{Absolute value} & \text{|x|} & |x| \\
\text{Norm} & \text{\|\vec{x}\|} & \|\vec{x}\| \\
\text{Accents} & \text{\hat{p}, \vec{r}, \tilde{z}} & \hat{p}, \vec{r}, \tilde{z} \\
\text{Complex conjugate} & \text{z^*, \bar{z}, z^\dagger} & z^*, \bar{z}, z^\dagger \\
\text{Dirac notation} & \text{\langle \phi | \psi \rangle} & \langle \phi | \psi \rangle \\
\text{Multiplication} & \text{A \cdot B, A \times B} & A\cdot B, A\times B \\
\text{Direct Sum} & \text{V \oplus W} & V \oplus W \\
\text{Tensor Product} & \text{S \otimes T} & S \otimes T \\
\text{Function composition} & \text{f \circ g} & f\circ g \\
\text{Element of} & \text{x \in A} & x \in A \\
\text{Not in} & \text{x \not\in A} & x \not\in A \\
\text{Subset} & \text{A \subset B, B \subseteq C} & A \subset B, B \subseteq C \\
\text{Set Union} & \text{A \cup B} & A \cup B \\
\text{Set Intersection} & \text{A \cap B} & A \cap B \\
\text{Set Subtraction} & \text{A \setminus B} & A \setminus B \\
\hline
\text{Binomial coefficient} & \text{\binom{n}{k}, {_nC_r}} & \binom{n}{k}, {_nC_r} \\
\hline
\text{Big stuff} & \text{\bigcup_i A_i} & \bigcup_i A_i \\
& \text{\bigcap_i A_i} & \bigcap_i A_i \\
& \text{\sum_{n=0}^\infty a_n x^n} & \sum_{n=0}^\infty a_n x^n \\
& \text{\prod_{n=0}^\infty a_n} & \prod_{n=0}^\infty a_n \\
\hline
\text{Derivatives} & \text{y', y'', y^{(n)}} & y', y'', y^{(n)} \\
& \text{\dot{x}, \ddot{x}} & \dot{x}, \ddot{x} \\
& \text{\frac{\partial f}{\partial x}} & \frac{\partial f}{\partial x} \\
& \text{\nabla f} & \nabla f\\
& \text{\Box^2 \phi} & \Box^2 \phi \\
\hline
\text{Integrals} & \text{\int e^x\,dx} & \int e^x\,dx \\
& \text{\oint \vec{E}\cdot d\vec{A}} & \oint \vec{E}\cdot d\vec{A} \\
& \text{\iint, \iiint} & \iint, \iiint \\
\hline
\text{Elementary Functions} & \text{\sin x, \cos x, \log (x+y), ...} & \sin x, \cos x, \log(x+y), \dots \\
\hline
\end{array}
[/tex]
A comprehensive list of LaTeX commands can be found at www.stat.berkeley.edu/~sourav/symbols-a4.pdf[/URL]
The list of all supported MathJax commands can be found at [PLAIN]http://www.mathjax.org/docs/1.1/tex.html

Typing multiple equations Multiple equations can be typed be the align environment. Such an environment must be started with \bеgin{align} and ended with \еnd{align}. Rows must be separated by \\, an alignment is given by & (followed by a symbol). So for example

Code:
[tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]

This yields [tex]
\begin{align}
(1+x)^n &\geq 1+nx\\
&= \sqrt{(1+nx)^2}\\
&= \sqrt{1+2nx+n^2x^2}
\end{align}
[/tex]
Typing matrices A matrix can easily by typed by the matrix, pmatrix, bmatrix and vmatrix environment. Such an environment must be started with \bеgin{pmatrix} and ended with \еnd{pmatrix}. Columns can be separated with & and ended with \\. Here is an example:

Code:
[tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]

This yields [tex]
\begin{pmatrix}
1 & 2 & 3 & 4\\
a & b & c & d\\
x & y & z & w
\end{pmatrix}
[/tex]
The matrix, bmatrix and vmatrix environments produce similar results. Only the delimiters are different. See http://www.math-linux.com/spip.php?article132 for more examples.

The cases environment Something like [tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex] Can be easily typed be the cases environment. Such an environment must be started with \bеgin{cases} and ended with \еnd{cases}. Rows must be separated with \\ and an invisible alignment is entered with &. The example above is produced by

Code:
[tex]
\begin{cases}
2x+y+z & = 0\\
3x+4y+5z & = 0\\
x+2y+8z & = 0
\end{cases}
[/tex]

Another example is

Code:
[tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1       & \text{if } x < 0
\end{cases}
[/tex]

which gives [tex]
u(x) =
\begin{cases}
\exp{x} & \text{if } x \geq 0 \\
1 & \text{if } x < 0
\end{cases}
[/tex] More information about such an environment is found in http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics
Sandbox
If you wish to practice writing LATEX or test some code, a sandbox is available here: https://www.physicsforums.com/mathjax/test/preview.html
Please do not create threads in which to simply practice LATEX.​
Additional information
If you have questions, you can ask them in The Math & Science Software subforum: https://www.physicsforums.com/forumdisplay.php?f=189

You can get a drop-down menu of Latex while composing your post if you

  • are posting in one of the technical subforums
  • are in Advanced Edit mode (click on "Go Advanced" to get there)
  • in Advanced Edit mode, click the Σ button.

MathJax (the processor that physicsforums uses to produce LaTeX) also has a few view options. If you right click on a LaTeX symbol, then a menu will pop up with handy features. Here's what you can do:

  • Show Source: this shows original LaTeX code. This is handy if you want to see how something is typed.
  • Settings: Allows you to zoom in in equation. So it allows you to see some LaTex symbols bigger. In order for zoom to work, you need to set your zoom trigger. If you set it to "hover" (for example), then you zoom in every time you place your mouse over the LaTeX code.
  • MathJax Help: Has some additional help features for users. Check it out.
Simple non-LaTeX options
If you just want a subscript or a superscript, you can use vBulletin's sub and sup tags. For example, x1 yields x1, and x2 yields x2. If you don't want to type these tags, you can use the X2 and X2 buttons above the input field when you're in Advanced Edit mode.

If you just want to insert a Greek letter or a mathematical symbol in your post, the easiest way is to just click on the symbol you want in the box of symbols to the right of the input field when you're in Advanced Edit mode. If you need a symbol that you don't see in that box, you can try to find it in https://www.physicsforums.com/blog.php?b=347 at the website of the Pennsylvania State University.

Do not use these symbols, the sub/sup tags, or any other vBulletin tags in LaTeX mode (i.e. between tex or itex tags).​
Acknowledgements
We are indebted to member and former admin chroot -- whose efforts brought LaTeX to Physics Forums in the first place -- and forum admin and owner Greg Bernhardt for updating to the currently-used MathJax processor. Numerous other members have provided valuable feedback and helped with the debugging process.​
 
Last edited by a moderator:
  • #33


Are there any more remarks?? I think this is very close to being postable.
 
  • #34


Sounds good. I haven't followed this discussion very closely, so at this point is it just Post #32 that is to be the FAQ entry?

If nobody objects then I'll go ahead and post it Wednesday afternoon, Eastern USA time. Feel free to remind me via PM if I don't get to it for some reason.
 

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
280
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
13
Views
222
  • Sticky
  • Quantum Physics
Replies
1
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Feedback and Announcements
Replies
11
Views
143K
  • Feedback and Announcements
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • Feedback and Announcements
Replies
3
Views
1K
Back
Top