# Conventions for writing MathJax code

I am new to MathJax. I copied some the code from the MathJax basic tutorial and quick reference

\begin{array}{ccc|c}
a&0&b&2\\
a&a&4&4\\
\end{array}


Then I edited it to get more rows for the matrix

\begin{array}{ccc|cc}
a&0&b&2\\
a&a&4&4\\
4&2&3&2\\
\end{array}


Whilst my code got the job done, it is messier than the code I started with. Is any resource which outlines conventions or provides advice for typing MathJax formulas neatly? I am far more familiar with mathematical conventions than programming conventions!

• What do you mean it is messier? (also, I think the $signs are a typo) – AnalysisStudent0414 Dec 11 '15 at 12:04 • You might find the \begin{bmatrix}...\end{bmatrix (for square brackets) and \begin{pmatrix}...\end{pmatrix} (for round brackets) environments simpler to use for actual matrices (rather than for tables/arrays). If it's an augmented matrix you wanted, you can create vertical separator entries in the matrix with \mid or simply |. – hardmath Dec 11 '15 at 16:22 • @hardmath Thanks for that. – Bernard W Dec 13 '15 at 11:53 • @AnalysisStudent0414 Yes, the$ were a typo. I mean it is messier in that the first code is nicely formatted (with indentations and so forth) wheras when I input matrices, I can't get the same formatting. – Bernard W Dec 13 '15 at 11:55
• @BernardWojcik, just add some spaces in front of the line you added. – Antonio Vargas Dec 13 '15 at 12:24
• @AntonioVargas hmmm I could swear I tried that and it didn't work before-which is why I got confused and asked this question! Maybe it was all an illusion... – Bernard W Dec 13 '15 at 12:43
• Also, I am not sure why this was downvoted? Not to say that it shouldn't be. There seems to be many conventions on this site, so why not conventions regarding the formatting of code? It seems like a legitimate question, even if no is the answer. – Bernard W Dec 13 '15 at 12:44
• I'm not a downvoter, but down voting on Meta has different connotations from how things work on Main. For one thing down voting has no effect on reputation (nor does up voting for that matter). Rather down voting is often a measure of agreement/disagreement with proposed ideas, and some may have taken your Question to essay that there should be conventions for MathJax (code) formatting and wanted to indicate disagreement with that idea. – hardmath Dec 13 '15 at 17:31
• I think not few found your question simply unclear. I will try to write an answer. – quid Dec 13 '15 at 18:09

• Use space. This is not really done in the example. Yet I'd find a & 0 & b & 2 easier to parse. It would also emphasize that the entries are in a way 'separated' by the ampersand.