## How to include formulas (LaTeX) and code blocks in WordPress posts and replies

It’s possible to include LaTeX formulas like $\int e^x \, \mathrm{d}x$. I entered it as $latex \int e^x \, \mathrm{d}x$.

You can also generate code blocks like this

for (n in 1:N)
y[n] ~ normal(0, 1);


The way to format them is to use <pre> to open the code block and </pre> to close it.

You can create links using the anchor (a) tag.

You can also quote someone else, like our friend lorem ipsum,

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

You open with <blockquote> and close with </blockquote>.

You can add bold (tag inside angle brackets is b), italics (tag is i) and typewriter text (tag is tt), but our idiotic style makes typewriter text smaller, so you need to wrap it in a big for it to render the same size as surrounding text.

The full set of tags allowed is:

address, a, abbr, acronym, area, article, aside, b, big,
blockquote, br, caption, cite, class, code, col, del,
details, dd, div, dl, dt, em, figure, figcaption, footer,
font, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i,
img, ins, kbd, li, map, ol, p, pre, q, s, section, small,
span, strike, strong, sub, summary, sup, table, tbody,
td, tfoot, th, thead, tr, tt, u, ul, var


For more details, see: https://en.support.wordpress.com/code/

Too bad there’s no way for users without admin privileges to edit their work. It’s fiddly getting LaTeX or HTML right on the first try.

After some heavy escaping, you deserve some comic relief; it’ll give you some hint at what I had to do to show what I entered to you without it rendering.

1. anon says:

Let’s test this

$p = \Pr (H) <=0.05$

2. Anon2 says:

Testing 1-2-3

Inline math: $\frac{f(x)}{g(x)}$ and

$$\int_a^b f(x) dx$$

bold done

3. Anon2 says:

Table test:

exp
out
Age

$\frac{x}{y}$
Smith
50

Eve
Jackson
94

4. Anon2 says:

Table test 2:

ROW1 COL1 CONTENTROW1 COL2 CONTENTROW1 COL3 CONTENT
ROW2 COL1 CONTENTROW2 COL2 CONTENTROW2 COL3 CONTENT
ROW3 COL1 CONTENTROW3 COL2 CONTENTROW3 COL3 CONTENT

5. As you can see, it’s not markdown. Just a little light HTML with a specialized MathJAX-powered LaTeX option. I updated the post.

6. mess? says:

$\newcommand{\ffrac}[2]{\ensuremath{\frac{\displaystyle #1}{\displaystyle #2}}}$

One
$latex Pr(A|B)=\frac{Pr(A)Pr(B|A)}{Pr(B)}$

Two
$latex Pr(H_{0}|O) = \frac{ Pr(H_{0})Pr(O|H_{0}) }{ \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Three
$latex Pr(H_{0}|O) = \ffrac{ Pr(H_{0})Pr(O|H_{0}) }{ \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Four
$latex Pr(H_{0}|O) = \frac{ \displaystyle Pr(H_{0})Pr(O|H_{0}) }{ \displaystyle \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Wow!!!1

Wow!!!2

Code:

a = 0
b = NULL
for(i in 1:100){
a = a + i
b = c(b, ‘if'(a %% 10 == 0, i, 0))
}

Results:

> a
[1] 5050
> b
[1] 0 0 0 4 0 0 0 0 0 0 0 0 0 0 15 0 0 0
[19] 19 20 0 0 0 24 0 0 0 0 0 0 0 0 0 0 35 0
[37] 0 0 39 40 0 0 0 44 0 0 0 0 0 0 0 0 0 0
[55] 55 0 0 0 59 60 0 0 0 64 0 0 0 0 0 0 0 0
[73] 0 0 75 0 0 0 79 80 0 0 0 84 0 0 0 0 0 0
[91] 0 0 0 0 95 0 0 0 99 100

7. trying again says:

$\newcommand{\ffrac}[2]{\ensuremath{\frac{\displaystyle #1}{\displaystyle #2}}}$

One
$latex Pr(A|B)=\frac{Pr(A)Pr(B|A)}{Pr(B)}$

Two
$latex Pr(H_{0}|O) = \frac{ Pr(H_{0})Pr(O|H_{0}) }{ \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Three
$latex Pr(H_{0}|O) = \ffrac{ Pr(H_{0})Pr(O|H_{0}) }{ \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Four
$latex Pr(H_{0}|O) = \frac{ \displaystyle Pr(H_{0})Pr(O|H_{0}) }{ \displaystyle \sum_{i = 0}^{n} Pr(H_{i})Pr(O|H_{i}) }$

Wow!!!1

Wow!!!2

Code:

a = 0
b = NULL
for(i in 1:100){
a = a + i
b = c(b, ‘if'(a %% 10 == 0, i, 0))
}

Results:

> a
[1] 5050
> b
[1] 0 0 0 4 0 0 0 0 0 0 0 0 0 0 15 0 0 0
[19] 19 20 0 0 0 24 0 0 0 0 0 0 0 0 0 0 35 0
[37] 0 0 39 40 0 0 0 44 0 0 0 0 0 0 0 0 0 0
[55] 55 0 0 0 59 60 0 0 0 64 0 0 0 0 0 0 0 0
[73] 0 0 75 0 0 0 79 80 0 0 0 84 0 0 0 0 0 0
[91] 0 0 0 0 95 0 0 0 99 100

8. numeric says:

$\int e^x \, \mathrm{d}x$

a test

9. Alex says:

$(\theta^{(k)}, y^{(k)})$

I don’t find the

Code options

(with pre option) to work correctly.

Using  [/code]