Introducing LaTeX Math Typesetting

Click For Summary

Discussion Overview

The discussion centers around the introduction of LaTeX mathematical typesetting on Physics Forums, focusing on its implementation, usage, and examples. Participants explore how to effectively use LaTeX for mathematical expressions and share examples of LaTeX code.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • Warren introduces LaTeX typesetting, explaining its markup style and how to include LaTeX graphics in posts.
  • Some participants share additional examples of LaTeX code, demonstrating various mathematical expressions.
  • Warren invites suggestions for LaTeX packages to include, expressing concern about performance impacts from too many packages.
  • One participant inquires about using the LaTeX generator for personal web pages, prompting a discussion about server load and intended use.
  • Another participant expresses enthusiasm for practicing LaTeX by writing equations related to particle interactions.
  • A question arises about formatting subscripts in LaTeX, specifically how to create multi-line subscripts.
  • Participants provide tips on learning LaTeX, including quoting existing code to see how it is written and encouraging practice.
  • Warren reminds participants that clicking on LaTeX images reveals the source code, which can aid in learning.

Areas of Agreement / Disagreement

Participants generally agree on the usefulness of LaTeX for typesetting mathematics, but there are differing views on its application for personal use outside the forum, with some cautioning against it due to resource concerns.

Contextual Notes

Some participants express uncertainty about specific LaTeX formatting techniques and the potential performance implications of adding more packages to the forum's LaTeX capabilities.

  • #391
how do I set up a case-by-case function definition, i.e.
...{ a if y<1
x = { b if 1&le;y<2
...{ c otherwise

The \cases command doesn't seem to work here.
 
Physics news on Phys.org
  • #392
x =\left\{\begin{array}{ccc}a&amp;\mbox{ if }<br /> x&lt;1\\b &amp;\mbox{ if }1\leq y &lt;2 \\c&amp;\mbox{ otherwise}\end{array}\right
 
  • #393
Thanks. Any way to get the "ifs" aligned?

edit: nm; I seem to have gotten it.
 
Last edited:
  • #394
Yes, I couldn't work it out at first (for info here it is:)
x =\left\{\begin{array}{lll}a&amp;\mbox{ if }<br /> x&lt;1\\b&amp;\mbox{ if }1\leq y &lt;2 \\c&amp;\mbox{ otherwise }\end{array}\right
 
  • #395
TexAide

This is copied (and edited) from TeXaide (which works exactly like Microsoft Equation Editor)

<br /> x\sum\limits_{i = 0}^\infty {\left( {\begin{array}{*{20}c}<br /> a &amp; b &amp; c \\<br /> {a \times a} &amp; {b \otimes b} &amp; {c\langle c^c \rangle } \\<br /> {a_{\aleph _0 } } &amp; {\wp \left( b \right)} &amp; {\bigcap\limits_c {\Re ^c } } \\<br /> \end{array}} \right)} \frac{\partial }{{\partial x}}\mathop \oplus \limits_x \bigcup + 6\mathop{\left){\vphantom{1{12}}}\right.<br /> \!\!\!\!\overline{\,\,\,\vphantom 1{{12}}}}<br /> \limits^{\displaystyle\hfill\,\,\, 2}<br /> \

Can't seem to figure out where that last "]" comes from at the end, but alas - it worked like a charm. Shame that all means nothing!
 
Last edited:
  • #396
\textrm{pwnz0rz}= \frac {-1337 \textrm{search engine}\pm \sqrt{(1337 \textrm{search engine})^2-4(1)(\textrm{gmail})}}{2}


Hmm, so you can mix words with numbers and pretty print in latex with \textrm.


...dont ask
 
  • #397
Testing
<br /> \begin{array}{ccccc}1&amp;2\\1&amp;2\\3&amp;2\\2&amp;4\\2&amp;5\\\end{array}<br />
<br /> \begin{array}{|c|c|c|c|c|}1&amp;2\\1&amp;2\\3&amp;2\\2&amp;4\\2&amp;5\\\end{array}<br />
<br /> \begin{array}{|c|c|c|c|c|}\hline1&amp;2\\\hline\hline1&amp;2\\\hline\hline3&amp;2\\\hline\<br /> \hline2&amp;4\\\hline\hline2&amp;5\\\hline\end{array}<br />
 
  • #398
bored and late

FBox[x_List] := StringJoin@ToString @@@ Flatten[
{
"\begin{array}\n",
"{", "|", Table["
c|", {n, 1, Length[x]}], "}", "\hline", Table[{Table[{ToString[x[[n1,
n2]]], If[n2 ≠ Dimensions[
x][[2]], "&", ""]}, {n2, 1, Dimensions[x][[2]]}], "\\\\", "\hline
"}, {n1, 1, Dimensions[x][[1]]}], "\n \end{array}"
}
]

FBox[{{1, 2}, {1, 2}, {3, 2}, {2, 4}, {2, 5}}]:
<br /> \begin{array}<br /> {|c|c|c|c|c|}\hline1&amp;2\\\hline1&amp;2\\\hline3&amp;2\\\hline2&amp;4\\\hline2&amp;5\\\hline<br /> \end{array}<br />
 
  • #399
F2[x_List] := StringJoin @@ ToString @@@ Flatten[
{
"\begin{array}",
"{", Table["c", {n, 1, Length[x]}], "}",
Table[
{Table[{ToString[x[[n1, n2]]], If[n2
≠ Dimensions[x][[2]], "&", ""]}, {n2, 1, Dimensions[x][[2]]}],
"\\\\"},
{n1, 1, Dimensions[x][[1]]}
],
"\end{array}"
}
]
F2[{{1, 2}, {1, 2}, {3, 2}, {2, 4}, {2, 5}}]:
<br /> \begin{array}{ccccc}1&amp;2\\1&amp;2\\3&amp;2\\2&amp;4\\2&amp;5\\\end{array}<br />
 
  • #400
The above code is for mathematica
 
  • #401
Why doesn't this work? All I'm trying to do is get 2 left-aligned columns. First I was trying to do it using {array}{cc} formatting similar to the conditional equations up above. That didn't work so I tried this {equation*} layout which is also going haywire. When I was testing a little while ago, I'm pretty sure the same code (but with a smaller amount of content) worked almost correctly; only the first column was right- instead of left-aligned. Now it doesn't work at all.

To accomplish this, the formula will be built up from 3 types of variables, specifically:
\begin{equation*}\begin{split}\mbox{Variable} \quad &amp;\mbox{Meaning}\\<br /> Q[i,k] \quad &amp;\mbox{At time i, M is in state q_k}\\<br /> H[i,j] \quad &amp;\mbox{At time i, the read-write head}\\<br /> &amp;\mbox{ is scanning tape square j}\\<br /> S[i,j,k] \quad &amp;\mbox{At time i, the contents of}\\<br /> &amp;\mbox{tape square j is symbol s_k}\end{split}\end{equation*}


OK this is really crazy; sometimes this works, and sometimes it doesn't, yet it's the same code structure as above:
\begin{equation*}\begin{split}\mbox{Variable} \quad &amp;\mbox{Meaning}\\<br /> Q[i,k] \quad &amp;\mbox{At time i the read-write head blah blah blah}\\<br /> &amp;\mbox{blah blah blah}\\<br /> H[i,j] \quad &amp;\mbox{At time i}\end{split}\end{equation*}
 
Last edited:
  • #402
try {ll} instead {cc}, (that's how I managed to get the conditonal equation aligned).
 
  • #403
Nope. It seems to make no difference whether I format it using {array}{cc} or {array}{11} or {equation*}{split}, \mbox{...} or \text{...]. For example:

To accomplish this, the formula will be built up from 3 types of variables, specifically:
\begin{array}{11}\mbox{Variable} &amp; \mbox{Meaning}\\<br /> Q[i,k] &amp;\mbox{At time i, M is in state q_k}\\<br /> H[i,j] &amp;\mbox{At time i, the read-write head}\\<br /> &amp;\mbox{ is scanning tape square j}\\<br /> S[i,j,k] &amp;\mbox{At time i, the contents of}\\<br /> &amp;\mbox{tape square j is symbol s_k}\end{array}
 
  • #404
It's not a 1 it's an 'l' and you need one for each row:

edited to add: hmm I can't see anything wrong with this perhaps it's just too big.
 
Last edited:
  • #405
(I think it's just any series of characters {xxx}, {111}, {iii}, whatever, not some particular one; and isn't it one for each COLUMN, not row?)


Edited to remove my witty(?) remark about the part of your post that you deleted. :wink:
 
Last edited:
  • #406
No, it's one for each row and 'c' is for centre 'l' is for left I guess.

edited to add: actually you're right but {ll}, {cc} or {rr} is the justifcation.
 
Last edited:
  • #407
This one works and it's simlair:

\begin{array}{lr}\mbox{yoink}&amp;\mbox{double-yoink}\\G[i,j]&amp;\mbox{yes}\\H[k,l] &amp;\mbox{no}\\&amp;\mbox{what?}\end{array}

I reckon then it must be thta it's just too big as there's a limit to the size of the code.
 
  • #408
Good find!

That should be helpful.
 
  • #409
That's it!

\begin{array}{ll}\mbox{Variable} &amp; \mbox{Meaning}\\<br /> Q[i,k] &amp;\mbox{At time i, M is in state}\, q_k\\<br /> H[i,j] &amp;\mbox{At time i, the read-write head}\\<br /> &amp;\mbox{is scanning tape square j}\\<br /> S[i,j,k] &amp;\mbox{At time i, the contents of}\\<br /> &amp;\mbox{tape square j is symbol}\, s_k\end{array}


\mbox{testing another sub_sc_rip_t}

Building on jcsd's find:
the charaters in the brackets after {array} must be
{lll} (that lower-case L's) to left-align
{rrr} to right-align
{"any characters"} to center the text in each column (one char for each column)

Also: apparently subscript like q_k can't be used in \mbox in an array, although it can be used in \mbox when it's not part of an array.

Now I can get back to my "real" post.

Thanks.
:smile: :smile: :smile:
 
  • #410
Wick Contraction in LaTeX

Wick Contraction-

http://www.fzu.cz/~kolorenc/tex.php

This website has 2 or 3 possible implementations for Wick Contractions in QFT. I have not tried any, but will let you know how they work!
 
  • #411
Simple question.

Hi everybody,
Does anyone know how do I write a vector quantity, such as an F with an arrow up? I'm not so skilled in Latex.
Thanks
 
  • #412
\vec{F}

\vec{F}
 
  • #413
OK, let me try once.

<br /> \sum\vec{F}_e_x_t = M\vec{a}_c_m<br />
 
  • #414
Thanks jcsd!
 
  • #415
How do I create the 'inverse' symbol?
 
  • #416
Like cos\theta^{-1}?
 
  • #417
inverse is just ^{-1}, so the (muplicative) inverse of a is a^{-1}, for an inverse function like cos you want \cos^{-1}\theta
 
  • #418
\begin{array}P=A(1+\frac{r}{100})^n<br /> \\<br /> \sqrt[n]{\frac{P}{A}}=\frac{r+100}{100}<br /> \\<br /> r=100\sqrt[n]{\frac{P}{A}}-100\end{array}
 
  • #419
Norman said:
Wick Contraction-

http://www.fzu.cz/~kolorenc/tex.php

This website has 2 or 3 possible implementations for Wick Contractions in QFT. I have not tried any, but will let you know how they work!

The simple_wick.tex file works very well. I could not get the other one to work. I also did not have any of the problems the author gives for simple_wick.tex.

Cheers
 
  • #420
expired post...
 
Last edited:

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
6K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K