Closed ZodmanPerth closed 3 years ago
\
may be interpreted by Hexo as an escape character, so you need another \
to escape itself:
\textcolor{purple}{z}=(\textcolor{green}{c_1} \space choose \space \textcolor{teal}3)+(\textcolor{green}{c_2} \space choose \space \textcolor{teal}2)+(\textcolor{green}{c_3} \space choose \space \textcolor{teal}1)\\\\
\space\\\\
OR\\\\
\space\\\\
\textcolor{purple}{z}=\bigg(\vcenter{\textcolor{green}{c_1} \atop \textcolor{teal}3}\bigg)+\bigg(\vcenter{\textcolor{green}{c_2} \atop \textcolor{teal}2}\bigg)+\bigg(\vcenter{\textcolor{green}{c_3} \atop \textcolor{teal}1}\bigg)\\\\
No luck. I've also tried \newline
. All of them produce a single line result.
Have you tried to put it in the eqnarray
environment? It's working as expected on my website:
\begin{eqnarray\*}
\textcolor{purple}{z}=(\textcolor{green}{c_1} \space choose \space \textcolor{teal}3)+(\textcolor{green}{c_2} \space choose \space \textcolor{teal}2)+(\textcolor{green}{c_3} \space choose \space \textcolor{teal}1)\\\\
\space\\\\
OR\\\\
\space\\\\
\textcolor{purple}{z}=\bigg(\vcenter{\textcolor{green}{c_1} \atop \textcolor{teal}3}\bigg)+\bigg(\vcenter{\textcolor{green}{c_2} \atop \textcolor{teal}2}\bigg)+\bigg(\vcenter{\textcolor{green}{c_3} \atop \textcolor{teal}1}\bigg)\\\\
\end{eqnarray\*}
Well that's odd, this works. I believed I had tried this before, but this now works on my website as well. It's not the layout I want, but at least it appears the library is working properly.
I really want all lines to be centered horizontally, and can't find the right syntax. Looks like I'll have to go with two mathjax blocks separated by a div.
Thanks for your help.
Try this:
\begin{eqnarray\*}
&\textcolor{purple}{z}=(\textcolor{green}{c_1} \space choose \space \textcolor{teal}3)+(\textcolor{green}{c_2} \space choose \space \textcolor{teal}2)+(\textcolor{green}{c_3} \space choose \space \textcolor{teal}1)\\\\
&\space\\\\
&OR\\\\
&\space\\\\
&\textcolor{purple}{z}=\bigg(\vcenter{\textcolor{green}{c_1} \atop \textcolor{teal}3}\bigg)+\bigg(\vcenter{\textcolor{green}{c_2} \atop \textcolor{teal}2}\bigg)+\bigg(\vcenter{\textcolor{green}{c_3} \atop \textcolor{teal}1}\bigg)\\\\
\end{eqnarray\*}
See also https://tex.stackexchange.com/questions/114471/how-to-simply-center-equations-using-eqnarray
Yes, that works great! Thank you!
Thanks for the link; that helps me improve my google-fu when it comes to these sorts of things.
You're welcome :)
MathJax is compatible with most common LaTeX syntax, so you can find answers on this website: https://tex.stackexchange.com
I've been trying to output several different formulas on multiple lines, but am unable to get any linebreaks. I've tried pretty much all the methods I found in the KaTeX documentation but had no luck.
For example, using the editor at katex.org, the text
produces
but through hexo-filter-mathjax it produces
I am new to writing math with these TeX type libraries so hopefully I am just doing something wrong, but I can't spot it. Are linebreaks supported in this package?