# Test the new LaTeX markdown in this Sandbox question!

## Purpose of question

We now have $\LaTeX$ support through MathJax! Now, instead of writing equations like this:

w0 = 1 / sqrt(L * C)


we can write:

$\displaystyle \omega_0 = \frac{1}{\sqrt{LC}}$

Beautiful! However, TeX has a steep learning curve, and it will take some time to figure out how to use this feature. This question is a sandbox in which to practice its use.

## Documentation

You'll see in the right sidebar, when writing a question, the line:

MathJaX[sic] equations $sin^2\theta$

and a link to generic TeX help. I find that the math mode section is most helpful. The special symbols article is particularly useful:

 \alpha \beta \mu \Omega \omega \theta 

Note that not all of TeX is included; you'll get this message if you try to include a module that's not in MathJax, such as Tabular:

$\begin{tabular}1 & 2\\3 & 4\end{tabular}$

## How did they do that?

You can always get at the source by right-clicking an equation. A MathJax context menu will come up, like the following:

and "Show Source" will bring up a window with the source for the equations. Just drop the text contained $between a pair of escaped dollar signs!$ Or, you can $$surround it with two dollar signs for centering.$$

This question should be community wiki (No one should get rep from it, and it should be easy to edit), so you can also see the source that way.

## Begin $\LaTeX$ Sandbox

The markdown for a question should be identical to what you get from an answer, but I'll leave the rest of this question for testing more TeX in case that assumption is mistaken.

• It also works in comments: $\Rightarrow \LaTeX$ $\Rightarrow \LaTeX$ – Kevin Vermeer Mar 8 '11 at 22:20
• By the way, it will take a second to render in preview while editing and in normal view, especially once this page starts filling up. Give it time. – Kevin Vermeer Mar 8 '11 at 22:23
• What is meant by "module" in TeX context? I don't think there is such a thing in TeX anyway. – AndreKR Mar 9 '11 at 2:07
• This kinda sucks having a meta question on the main site, but TeX isn't enabled on meta, so not sure what to do. – Nick T Mar 9 '11 at 3:18
• and now it's moved to meta, so it doesn't work :( – Martin Thompson Mar 9 '11 at 16:04
• @Martin - I tried to rectify that problem with this question – Kevin Vermeer Mar 9 '11 at 16:20
• $100 test$60... – Earlz Mar 13 '11 at 17:28
• It says "misplaced on the main site" – Brian Carlton Mar 17 '11 at 14:39
• Well, MathJax server responds really slow and prevents the page from starting to load. I am guessing that this problem can be solved by putting the MathJax requests at the bottom of the html body? – abdullah kahraman Jun 12 '12 at 13:35
• @abdullahkahraman - It is. First, the raw text loads, then the MathJax requests fire. What do you see? – Kevin Vermeer Jun 12 '12 at 15:27
• @KevinVermeer well, I see nothing on the page while "MathJax server loading bla bla" on the status bar, then it finishes loading and then page loads up instantly. In other words, it hangs the load of the page. – abdullah kahraman Jun 12 '12 at 17:02
• It works in chat too! – jippie May 24 '13 at 16:37
• Apologies for bumping this question, but there's an ongoing meta discussion on codegolf.se regarding mathjax, which we don't currently have support for. – Riker Jan 12 '18 at 22:13
• Woo hoo! I'm using $$\style{color:red;font-size:150%}{\text{This style of font in every latex answer from now on}}$$ JK – Voltage Spike Jan 18 '18 at 16:35

Yes, I've been shopping around in various (upvoted) answers, but how about a ...

# CHEAT SHEET

11 & 12 & 13\\
21 & 22 & 23
11 & 12 & 13\\
21 & 22 & 23
\end{bmatrix}$$\begin{bmatrix} 11 & 12 & 13\\ 21 & 22 & 23 \end{bmatrix}$### Some Other Matrix Notations $\begin{pmatrix}
11 & 12 & 13\\
21 & 22 & 23
\end{pmatrix}$$\begin{pmatrix} 11 & 12 & 13\\ 21 & 22 & 23 \end{pmatrix}$$\begin{Bmatrix}
11 & 12 & 13\\
21 & 22 & 23
11 & 12 & 13\\
21 & 22 & 23
\end{Vmatrix}$$\begin{Vmatrix} 11 & 12 & 13\\ 21 & 22 & 23 \end{Vmatrix}$### Partial Expressions $f(x) =
\left\{\begin{matrix}
x; & x \leq 0\\
0; & otherwise
\end{matrix}\right.$$f(x) =  \left\{\begin{matrix} x; & x \leq 0\\  0; & otherwise \end{matrix}\right.$### Multiple Line Alignment $\begin{align}
f(x, y, z) = &   & x^3  & + & 2x^2 & + & x  & + & 3 \\
& + & 4y^3 &   &      & + & 5x & - & 1 \\
&   &      & - &  z^2 & - & 2z & + & 2
\end{align}$$\begin{align} f(x, y, z) = & & x^3 & + & 2x^2 & + & x & + & 3 \\ & + & 4y^3 & & & + & 5x & - & 1 \\ & & & - & z^2 & - & 2z & + & 2 \end{align}$# Usage of Matrices and Alignment in Practice  H(s) = \frac{\sum_{i=0}^{n-1} b_is^i}{s^n + \sum_{i=0}^{n-1} a_is^i} = \frac{b_{n-1}s^{n-1} + b_{n-2}s^{n-2} + b_{n-3}s^{n-3} + \dots + b_0} {s^n + a_{n-1}s^{n-1} + a_{n-2}s^{n-2} + \dots + a_0}\\ \ \\ \begin{matrix} \mathbf{\dot{x}} & = & A\mathbf{x} + Bu(t)\\ y(t) & = & C\mathbf{x} + Du(t) \end{matrix}\\ \ \\ \begin{matrix} \begin{bmatrix} \dot{x}_1\\ \dot{x}_2\\ \dot{x}_3\\ \vdots \\ \dot{x}_n \end{bmatrix} & = & \begin{bmatrix} -b_{n-1} & -b_{n-2} & -b_{n-3} & -b_{n-4} & \cdots & -b_0 \\ 1 & 0 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \vdots & \cdots & 0 \\ 0 & 0 & 1 & 0 & \cdots & 0 \\ \vdots & \vdots & 0 & \ddots & 0 & \vdots\\ 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \vdots \\ x_n \end{bmatrix} + \begin{bmatrix} 1\\ 0\\ 0\\ \vdots \\ 0 \end{bmatrix} u(t) \\ y(t) & = & \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \vdots \\ x_n \end{bmatrix} \end{matrix}  Notice that I used nested matrices. H(s) = \frac{\sum_{i=0}^{n-1} b_is^i}{s^n + \sum_{i=0}^{n-1} a_is^i} = \frac{b_{n-1}s^{n-1} + b_{n-2}s^{n-2} + b_{n-3}s^{n-3} + \dots + b_0} {s^n + a_{n-1}s^{n-1} + a_{n-2}s^{n-2} + \dots + a_0}\\ \ \\ \begin{matrix} \mathbf{\dot{x}} & = & A\mathbf{x} + Bu(t)\\ y(t) & = & C\mathbf{x} + Du(t) \end{matrix}\\ \ \\ \begin{matrix} \begin{bmatrix} \dot{x}_1\\ \dot{x}_2\\ \dot{x}_3\\ \vdots \\ \dot{x}_n \end{bmatrix} & = & \begin{bmatrix} -b_{n-1} & -b_{n-2} & -b_{n-3} & -b_{n-4} & \cdots & -b_0 \\ 1 & 0 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \vdots & \cdots & 0 \\ 0 & 0 & 1 & 0 & \cdots & 0 \\ \vdots & \vdots & 0 & \ddots & 0 & \vdots\\ 0 & 0 & 0 & 0 & 1 & 0 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \vdots \\ x_n \end{bmatrix} + \begin{bmatrix} 1\\ 0\\ 0\\ \vdots \\ 0 \end{bmatrix} u(t) \\ y(t) & = & \begin{bmatrix} 1 & 0 & 0 & \cdots & 0 \end{bmatrix} \begin{bmatrix} x_1\\ x_2\\ x_3\\ \vdots \\ x_n \end{bmatrix} \end{matrix} It crashes if you play with big expressions too much! It crashed several times until I finish my post. (My browser: Google Chrome 19.0.1084.56 m) However, the good thing is, Stack Exchange fully and successfully recovers the lost message after every crash. • OK, you got me there! I tried to pinch your matrix to add it to 'my' Cheat Sheet, but I cant get the formatting correct in the right column. +1 – jippie Jun 19 '12 at 21:13 Need a new sandbox -- one without cat poop. (Testing comments w/o bugging authors.) Does this work? Testingtestingtesting$\infty \delta_s = \frac{1}{Re\{j\omega \sqrt{\mu \epsilon}\}} $•$ Al^{2+}_{0} $– tyblu Dec 18 '11 at 21:42 •$ \frac{1}{2} $– tyblu Dec 18 '11 at 21:46 •$ L = \frac{area R_s}{\Delta V}$– tyblu Dec 18 '11 at 21:53 •$V_{inductor} = L \frac{dI}{dt}$– tyblu Dec 18 '11 at 21:53 •$\infty$5 more to go... – tyblu Mar 4 '12 at 1:22 •$f=\frac{c}{2mm}=150\text{GHz}$– rdtsc Nov 10 '16 at 12:59 How many subscripts can we have? Let's find out.$W_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E_{E}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}$So two things happened: It looks like my answer has left the boundaries of the answer box. It also looks like I make a horizontal scroll bar for this webpage.$\LaTeX$is superset of$\TeX$This chip costs$$1.21$, but an alternative is only$$0.88$. One complaint about using dollar signs is that prices are used too often in electronics questions. Can we at least change it to double-dollar on each end? Using normal  signs is no longer a problem. The above sentence looked like this when we used  ..  as the delimiters: This chip costs$1.21, but an alternative is only $0.88. but this has been fixed. Just use normal dollar signs: This chip costs 1.21, but an alternative is only 0.88. If something funny happens to your prose, you've probably got an unmatched delimiter in your equations somewhere. Make sure that $ only appears around equations.

• See this question and the MathJax documentation for more about this issue. – Kevin Vermeer May 16 '11 at 12:41
• Other SE sites, like Math and TeX, use the single dollar signs. Jeff has said "we don't want different basic usage of MathJax across the network; that would be like Markdown changing essentials like "how to bold" on a site by side basis." Therefore, it's essentially a closed issue. Use $ for now. – Kevin Vermeer May 16 '11 at 12:43 And if you want to draft/sandbox your MathJax equations on your own PC, Julian Bucknall has a blog post here on how to create an HTML page to do this. It works a treat. Just remember you don't need the$ delimiters. $\style{font-size:700%}\Theta_\style{font-size:700%}\alpha\style{font-size:700%}(\style{font-size:700%}z\style{font-size:700%}) \style{font-size:700%}= \style{font-size:700%}\sum\limits_{n=0,1,2..m}^\infty what\space ? \space \style{color:green;font-size:400%}W? ...$profit! • $sin^2*\sqrt(5)$ – user924 Jun 10 '12 at 3:03 Equation numbers ($$, $$) not supported $$$y=x$$$ I see no number Can't make equations in bold by surrounding with asterixes:- $Y_{bold}\neq X_{bold}$ Aha! use \boldsymbol instead $\boldsymbol{Y_{bold} = X_{bold}}$ • Mike, do you have a workaround for the equation numbering? – stevenvh Oct 16 '12 at 11:20 • @stevenvh I realize this is like a way old comment, but in case anyone else sees this: use the \tag{1} to label an equation as equation 1. – apnorton May 29 '13 at 1:31 Wikipedia has a nice summary for displaying a formula Including a truth table: \begin{array}{|c|c||c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}  \begin{array}{|c|c||c|} a & b & S \\ \hline 0&0&1\\ 0&1&1\\ 1&0&1\\ 1&1&0\\ \end{array}  And I figured out how to align and number formula's: \begin{align} I&=\frac{U}{R}&(1)\\ P & = U×I&(2)\\ & = U × \frac{U}{R}&(3)\\ & = \frac{U^2}{R}&(4) \end{align}  \begin{align} I&=\frac{U}{R}&(1)\\ P & = U×I&(2)\\ & = U × \frac{U}{R}&(3)\\ & = \frac{U^2}{R}&(4) \end{align}  A simpler way is $$P=U×I \tag{1}$$ $$P=U×I \tag{1}$$  Here's my try:$50 \mbox{ }\Omega$. But that was too short.100 <- Testing dollar

Your transformer will convert 120$V_{ac}$ to 12$V_{ac}$. So you'll need to regulate it to 5$V_{dc}$.

• $I_{ce}$ = $I_{be}$ * HFE

• $V_{ceo}$ $I_{c}MAX$

• ASCII:
16 - log((5 - 0)/(5 - 4))/log(2) = 13.68

• TeX:
$16 - \frac{log\frac{(5 - 0)}{(5 - 4)}}{log 2} = 13.68$

• $I_{F_{max}} = 30mA$

• $V_{F_{typ}} = 1.7V$
• $V_{F_{max}} = 2.1V$
• $V_{R_{max}} = 5V$
• These are all things that being able to get the source from would be valuable. – Kortuk May 10 '11 at 3:32
• @Kortuk - Just right-click the equation and MathJax will populate your context menu with a "Show Source" option. Or, this is CW and it's been edited, so anyone can view the post source. – Kevin Vermeer Sep 27 '11 at 12:35

Nested dfracs: $\dfrac{ \dfrac{\alpha \beta ^{j2 \pi f t}}{j \omega} }{ \dfrac{\gamma \delta}{\Omega \Phi} }$ these are meant to create inline equations without resizing them to the size of a single line of text. The line is in effect streched to contain the full equation becoming much higher :)

And you can use Unicode when typing your maths:

$$A = πr^2$$

A better way of doing what he did:

$$P_{max} = \frac{V_{max}{}^2}{4R_{sink}} = \frac{(150 \text{ volts})^2}{4 \times 10\text{ kΩ}} = 9/16 \text{ watts}$$

$$P_{max} = \frac{V_{max}{}^2}{4R_{sink}} = \frac{(150 \text{ volts})^2}{4 \times 10\text{ kΩ}} = 9/16 \text{ watts}$$

• Yeah, but that requires to insert the Omega character, not really handy – clabacchio Mar 17 '12 at 9:43
• Unless you use AutoKey or something similar. :) – Andres Riofrio Mar 17 '12 at 21:46

This is a test for a bug over on PPCG.

$foo$bar
$baz  $foo$bar $baz  $foobarbaz$  foo bar baz  $ foo bar baz $$ foo bar baz $$ foo bar baz $ $ foo bar baz $ # Perl, 93 bytes _=bpi=;printf'()'x6x!.' %12s',F.ee x!\--^substr"\32::\$&|",-12while/.{$\}/g


Requires the command line option -l71Mbignum=bpi, counted as 14. The \32 should be replaced by a literal character 26.

Sample Usage

$perl -l71Mbignum=bpi pi-slice.pl ()()()()()() |\3.1415926| |:\53589793| \::\2384626| \::\433832| \::\79502| \::\8841| \::\971| \::\69| \::\3| \__\|  ### Perl, 111 bytes $_=bpi$_*($l=($.=$_)-3);printf'()'x($./2)x!$."
%$.s",F.ee x!$l--^substr"\32::\\$&|",-$.while/.{$l}/g  Parameterized version. Requires the command line option -nMbignum=bpi, counted as 12. Sample Usage $ echo 10 | perl -nMbignum=bpi pi-slice.pl
()()()()()
|\3.14159|
|:\265358|
\::\97932|
\::\3846|
\::\264|
\::\33|
\::\8|
\__\|

\$ echo 20 | perl -nMbignum=bpi pi-slice.pl
()()()()()()()()()()
|\3.141592653589793|
|:\2384626433832795|
\::\028841971693993|
\::\75105820974944|
\::\5923078164062|
\::\862089986280|
\::\34825342117|
\::\0679821480|
\::\865132823|
\::\06647093|
\::\8446095|
\::\505822|
\::\31725|
\::\3594|
\::\081|
\::\28|
\::\4|
\__\|