LaTeX Introducing LaTeX Math Typesetting

Click For Summary
Physics Forums has integrated LaTeX mathematical typesetting into its platform, allowing users to create visually appealing mathematical expressions using markup similar to HTML. Users can include LaTeX graphics in posts by wrapping their code in [tex] or [itex] tags for display or inline formatting, respectively. A PDF guide with essential LaTeX commands and symbols is available, along with links to additional resources. The community is encouraged to experiment with the system and share examples, while also being mindful of server load when generating graphics. This addition aims to enhance the clarity and professionalism of mathematical discussions on the forum.
  • #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
[tex]x =\left\{\begin{array}{ccc}a&\mbox{ if }
x<1\\b &\mbox{ if }1\leq y <2 \\c&\mbox{ otherwise}\end{array}\right[/tex]
 
  • #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:)
[tex]x =\left\{\begin{array}{lll}a&\mbox{ if }
x<1\\b&\mbox{ if }1\leq y <2 \\c&\mbox{ otherwise }\end{array}\right[/tex]
 
  • #395
TexAide

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

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

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
[tex]\textrm{pwnz0rz}= \frac {-1337 \textrm{search engine}\pm \sqrt{(1337 \textrm{search engine})^2-4(1)(\textrm{gmail})}}{2}[/tex]


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


...dont ask
 
  • #397
Testing
[tex]
\begin{array}{ccccc}1&2\\1&2\\3&2\\2&4\\2&5\\\end{array}
[/tex]
[tex]
\begin{array}{|c|c|c|c|c|}1&2\\1&2\\3&2\\2&4\\2&5\\\end{array}
[/tex]
[tex]
\begin{array}{|c|c|c|c|c|}\hline1&2\\\hline\hline1&2\\\hline\hline3&2\\\hline\
\hline2&4\\\hline\hline2&5\\\hline\end{array}
[/tex]
 
  • #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}}]:
[tex]
\begin{array}
{|c|c|c|c|c|}\hline1&2\\\hline1&2\\\hline3&2\\\hline2&4\\\hline2&5\\\hline
\end{array}
[/tex]
 
  • #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}}]:
[tex]
\begin{array}{ccccc}1&2\\1&2\\3&2\\2&4\\2&5\\\end{array}
[/tex]
 
  • #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:
[tex]\begin{equation*}\begin{split}\mbox{Variable} \quad &\mbox{Meaning}\\
Q[i,k] \quad &\mbox{At time i, M is in state q_k}\\
H[i,j] \quad &\mbox{At time i, the read-write head}\\
&\mbox{ is scanning tape square j}\\
S[i,j,k] \quad &\mbox{At time i, the contents of}\\
&\mbox{tape square j is symbol s_k}\end{split}\end{equation*}[/tex]


OK this is really crazy; sometimes this works, and sometimes it doesn't, yet it's the same code structure as above:
[tex]\begin{equation*}\begin{split}\mbox{Variable} \quad &\mbox{Meaning}\\
Q[i,k] \quad &\mbox{At time i the read-write head blah blah blah}\\
&\mbox{blah blah blah}\\
H[i,j] \quad &\mbox{At time i}\end{split}\end{equation*}[/tex]
 
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:
[tex]\begin{array}{11}\mbox{Variable} & \mbox{Meaning}\\
Q[i,k] &\mbox{At time i, M is in state q_k}\\
H[i,j] &\mbox{At time i, the read-write head}\\
&\mbox{ is scanning tape square j}\\
S[i,j,k] &\mbox{At time i, the contents of}\\
&\mbox{tape square j is symbol s_k}\end{array}[/tex]
 
  • #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:

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

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!

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


[tex]\mbox{testing another sub_sc_rip_t}[/tex]

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}

[tex]\vec{F}[/tex]
 
  • #413
OK, let me try once.

[tex]
\sum\vec{F}_e_x_t = M\vec{a}_c_m
[/tex]
 
  • #414
Thanks jcsd!
 
  • #415
How do I create the 'inverse' symbol?
 
  • #416
Like [tex]cos\theta^{-1}[/tex]?
 
  • #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
[tex]\begin{array}P=A(1+\frac{r}{100})^n
\\
\sqrt[n]{\frac{P}{A}}=\frac{r+100}{100}
\\
r=100\sqrt[n]{\frac{P}{A}}-100\end{array}[/tex]
 
  • #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
5K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K