Welcome to our community

Be a part of something great, join today!

[SOLVED] Align spacing on the forum

dwsmith

Well-known member
Feb 1, 2012
1,673

Jameson

Administrator
Staff member
Jan 26, 2012
4,043
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
Feb 1, 2012
1,673
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

Administrator
Staff member
Jan 26, 2012
4,043
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.

Screen Shot 2013-09-21 at 11.37.18 PM.png
 

dwsmith

Well-known member
Feb 1, 2012
1,673
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

Administrator
Staff member
Jan 26, 2012
4,043
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
Feb 1, 2012
1,673
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

Administrator
Staff member
Jan 26, 2012
4,043
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
Feb 7, 2012
2,707
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
Feb 1, 2012
1,673
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
Mar 5, 2012
8,780
I'm kind of surprised all symbols would be upright in the pdf.
Was this overruled in the pdf somehow?
As far as I know all symbols should be italic as opposed to operators that are supposed to be upright.
 

dwsmith

Well-known member
Feb 1, 2012
1,673
I'm kind of surprised all symbols would be upright in the pdf.
Was this overruled in the pdf somehow?
As far as I know all symbols should be italic as opposed to operators that are supposed to be upright.
I have mathrm global set for math.
 

Jameson

Administrator
Staff member
Jan 26, 2012
4,043
I have spent a while now trying to go over the \alignat command and see if something can be edited to fix any issues, but I have reached the extent of my expertise here. All example code with this alignment command produced the same spacing issue with the equals sign. I thought maybe the AMS packaged weren't loading like they were supposed to, so explicitly added them to our extensions - but still nothing.

If someone else wants to research this and suggest some possible fixes then I'm all game, otherwise we have a workaround that Opalg pointed out so we're still ok. Marking this thread [SOLVED] for now.