# [SOLVED]Align spacing on the forum

#### Jameson

Staff member
Re: align spacing on the forum

Can you copy the $\LaTeX$ code? I'm going to test it out on another forum that uses Mathjax. I am very sure that this is due to MJ and not MHB.

#### dwsmith

##### Well-known member
Re: align spacing on the forum

Can you copy the $\LaTeX$ code? I'm going to test it out on another forum that uses Mathjax. I am very sure that this is due to MJ and not MHB.
Latex Code:

\begin{alignat*}{2}
T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\
A_0 &= \frac{1}{2\pi}\int_{-\pi}^{\pi}f(\theta)d\theta \\
A_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\
B_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta
\end
{alignat*
}

#### Jameson

Staff member
Re: align spacing on the forum

Thank you. Why don't you use the latex bbcode we have enabled? Does this still not look good for you?

[latexs]\begin{alignat*}{2}
T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\
A_0 &= \frac{1}{2\pi}\int_{-\pi}^{\pi}f(\theta)d\theta \\
A_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\
B_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta
\end{alignat*}[/latexs] For me it looks perfect and there's no need to do all of the custom coloring.

EDIT: Ok I just tested this at PF and it's the same story so it's not us, it's Mathjax. #### dwsmith

##### Well-known member
Re: align spacing on the forum

Thank you. Why don't you use the latex bbcode we have enabled? Does this still not look good for you?

Latex Code:

\begin{alignat*}{2} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\ A_0 &= \frac{1}{2\pi}\int_{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int_{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{alignat*}

For me it looks perfect and there's no need to do all of the custom coloring.

EDIT: Ok I just tested this at PF and it's the same story so it's not us, it's Mathjax.

View attachment 1351
I use the tags LATEXS when I entered the code is that what you mean?

#### Jameson

Staff member
Re: align spacing on the forum

I use the tags LATEXS when I entered the code is that what you mean?
Yes. Strange, it had the same output in terms of color but it doesn't have the box that my post has. Do my post and your post look the same in terms of the code? Are you posting from you Linux desktop?

When I quote your post with the code, this is what I see:

Code:
 [PLAIN][COLOR=#C00000]\begin[/COLOR][COLOR=#E02020]{[/COLOR][COLOR=#2020C0][COLOR=#0000D0]alignat*[/COLOR][COLOR=#E02020]}{[/COLOR]2[COLOR=#E02020]}[/COLOR]
T(a, [COLOR=#800000]\theta[/COLOR]) [COLOR=#E02020]&[/COLOR]= A_0 + [COLOR=#E02020]\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Csum"][COLOR=#800000]sum[/COLOR][/URL]_[COLOR=#E02020]{[/COLOR]n = 1[COLOR=#E02020]}[/COLOR]^[COLOR=#E02020]{\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cinfty"][COLOR=#800000]infty[/COLOR][/URL][COLOR=#E02020]}\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cfrac"][COLOR=#800000]frac[/COLOR][/URL][COLOR=#E02020]{[/COLOR]A_n[COLOR=#E02020]}{[/COLOR]a^n[COLOR=#E02020]}[/COLOR][COLOR=#800000]\cos[/COLOR](n[COLOR=#800000]\theta[/COLOR])             + [COLOR=#E02020]\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cfrac"][COLOR=#800000]frac[/COLOR][/URL][COLOR=#E02020]{[/COLOR]B_n[COLOR=#E02020]}{[/COLOR]a^n[COLOR=#E02020]}[/COLOR][COLOR=#800000]\sin[/COLOR](n[COLOR=#800000]\theta[/COLOR]) [COLOR=#E02020]&&{}[/COLOR] =f([COLOR=#800000]\theta[/COLOR])[COLOR=#E02020]\\[/COLOR]
A_0 [COLOR=#E02020]&[/COLOR]= [COLOR=#E02020]\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cfrac"][COLOR=#800000]frac[/COLOR][/URL][COLOR=#E02020]{[/COLOR]1[COLOR=#E02020]}{[/COLOR]2[COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cint"][COLOR=#800000]int[/COLOR][/URL]_[COLOR=#E02020]{[/COLOR]-[COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]^[COLOR=#E02020]{[/COLOR][COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]f([COLOR=#800000]\theta[/COLOR])d[COLOR=#800000]\theta[/COLOR]                              [COLOR=#E02020]\\[/COLOR]
A_n [COLOR=#E02020]&[/COLOR]= [COLOR=#E02020]\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cfrac"][COLOR=#800000]frac[/COLOR][/URL][COLOR=#E02020]{[/COLOR]a_n[COLOR=#E02020]}{[/COLOR][COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cint"][COLOR=#800000]int[/COLOR][/URL]_[COLOR=#E02020]{[/COLOR]-[COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]^[COLOR=#E02020]{[/COLOR][COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]f([COLOR=#800000]\theta[/COLOR])[COLOR=#800000]\cos[/COLOR](n[COLOR=#800000]\theta[/COLOR])d[COLOR=#800000]\theta[/COLOR]                [COLOR=#E02020]\\[/COLOR]
B_n [COLOR=#E02020]&[/COLOR]= [COLOR=#E02020]\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cfrac"][COLOR=#800000]frac[/COLOR][/URL][COLOR=#E02020]{[/COLOR]a_n[COLOR=#E02020]}{[/COLOR][COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}\[/COLOR][URL="http://www.golatex.de/wiki/index.php?title=%5Cint"][COLOR=#800000]int[/COLOR][/URL]_[COLOR=#E02020]{[/COLOR]-[COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]^[COLOR=#E02020]{[/COLOR][COLOR=#800000]\pi[/COLOR][COLOR=#E02020]}[/COLOR]f([COLOR=#800000]\theta[/COLOR])[COLOR=#800000]\sin[/COLOR](n[COLOR=#800000]\theta[/COLOR])d[COLOR=#800000]\theta[/COLOR]                                                                  [COLOR=#C00000]
\end[/COLOR][COLOR=#E02020]{[/COLOR][COLOR=#0000D0]alignat*[/COLOR][/COLOR][COLOR=#E02020]}[/COLOR][/PLAIN]

#### dwsmith

##### Well-known member
Re: align spacing on the forum

Yes. Strange, it had the same output in terms of color but it doesn't have the box that my post has. Do my post and your post look the same in terms of the code? Are you posting from you Linux desktop?
Here is exactly what I see: Maybe you can force see below in the align environments:

Latex Code:

{} &{} =

I mentioned weird stuff about it when it first came out but no one else had a problem then, remember?

#### Jameson

Staff member
Re: align spacing on the forum

That's what I see as well. Your post with the code has the same code but it's not wrapped in a code box and when I quote it I get a whole mess. When I quote mine I see the latexs bbcode. I really am starting to think that this is related to Linux because others have written that this particular bbcode works fine. I will ask a coder that works with us sometimes if he can see any problems.

#### Opalg

##### MHB Oldtimer
Staff member
Re: align spacing on the forum

I find that the aligned environment produces better results than alignat*. Compare this
Code:
\begin{alignat*}{2} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{alignat*}
\begin{alignat*}{2} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{alignat*}

with this
Code:
\begin{aligned} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) =f(\theta) \\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{aligned}
\begin{aligned} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) =f(\theta) \\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{aligned}
Notice how the equals signs have equal spacing on both sides in the second example.

#### dwsmith

##### Well-known member
Re: align spacing on the forum

I find that the aligned environment produces better results than alignat*. Compare this
Code:
\begin{alignat*}{2} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{alignat*}
\begin{alignat*}{2} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) &&{} =f(\theta)\\A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{alignat*}

with this
Code:
\begin{aligned} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) =f(\theta) \\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{aligned}
\begin{aligned} T(a, \theta) &= A_0 + \sum_{n = 1}^{\infty}\frac{A_n}{a^n}\cos(n\theta) + \frac{B_n}{a^n}\sin(n\theta) =f(\theta) \\ A_0 &= \frac{1}{2\pi}\int{-\pi}^{\pi}f(\theta)d\theta \\ A_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\cos(n\theta)d\theta \\ B_n &= \frac{a_n}{\pi}\int{-\pi}^{\pi}f(\theta)\sin(n\theta)d\theta \end{aligned}
Notice how the equals signs have equal spacing on both sides in the second example.
I see your point but alignat shouldn't work the way it is in latex on the forum.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I'm kind of surprised all symbols would be upright in the pdf.
As far as I know all symbols should be italic as opposed to operators that are supposed to be upright.

#### dwsmith

##### Well-known member
I'm kind of surprised all symbols would be upright in the pdf.