# Can I make this little table of diagrams better than ASCII graphics?

In my question How can one recognize when two Coxeter diagrams represent the same uniform polytope?, I have a simple table into which I want to put three little Coxeter diagrams. Here are the three little diagrams, which I created in SVG and converted to PNG to show here:

If I were writing this in HTML, I'd now just make a <table> element and put the <svg> elements inside it. But, according to the "What HTML tags are allowed on StackExchange sites" post:

We do not (and will not) allow <table> tags. Sorry. This is intentional and by design. If you need a quick and dirty "table", use <pre> and ASCII layout.

So I followed that suggestion, and made a quick and dirty "table", using <pre> and ASCII graphics instead of my nice SVGs, and, sadly, that's what's currently in my post. It's small, so I'll include it here:

 Case             Coxeter diagram  Vertex configuration
+----------------+----------------+--------------------+
|                |       r        |                    |
| 1 ringed node  |     *---*      |     (p.q)r          |
|                |     p\ /q      |                    |
|                |      (*)       |                    |
+----------------+----------------+--------------------+
|                |       r        |                    |
| 2 ringed nodes |    (*)-(*)     |     p.2r.q.2r      |
|                |     p\ /q      |                    |
|                |       *        |                    |
+----------------+----------------+--------------------+
|                |       r        |                    |
| 3 ringed nodes |    (*)-(*)     |     2p.2q.2r       |
|                |     p\ /q      |                    |
|                |      (*)       |                    |
+----------------+----------------+--------------------+


Is that as good as it gets? I'd sure like it to look more polished.

Here are some pieces that could be useful building blocks, but unfortunately each of these are either non-robust or incompatible with each other, so I still don't see a good solution.

• I know I can draw a nice table in MathJax using {array}. But I can't put my SVGs, nor images, inside that.

• I would be happy to recreate my three little diagrams in MathJax instead of SVG, if I knew how. The most promising example I could find is this answer. But unfortunately the comments there reveal that that method gives poor results in some browsers.

• I could certainly render an HTML <svg>s-in-a-<table> in a browser and take a screenshot, and include that as an image in my post, but that would hurt accessibility.

Is there any good way to polish my post? Or is <pre> and ASCII the pinnacle of the technology available for this?

• Looking at this past thread, I notice that the diagrams in the answer either all have vertical/horizontal lines or they have been included as images: How do you typeset Dynkin-like diagrams with MathJax? Sep 12 '20 at 5:40
• To put the pictures into the table, maybe you could try the approach using \require{HTML} as suggested in this answer: How to Post Pictures in an Array/Table, on MSE, with MathJax. (Although the answerer warns there that the result might be browser-dependent.) Sep 12 '20 at 6:14
• Please ask this question again on Tex Stack Exchange, and link back to Mathematics S.E. and this question. I could see myself Googling the same question, but I may be unable to find it due to where it has been posted (I would type Tex stack exchange. at the end of my search.) (1 of 2) Sep 13 '20 at 3:52
• You could self answer it, or ask @TheSimpliFire to re-answer it, if they happen to have an account there. (2 of 2) Sep 13 '20 at 3:52
• @user400188 I don't necessarily object, but is tex.stackexchange.com really the right place for it? I don't see this as a "how can I make tex do this thing" question, but rather a "how do I make a table with a diagram in it in a stackexchange post" question, whose answer(s) might or might not involve tex. That said, it is more general than math.stackexchange; ideally it would be discoverable by someone just as they reach the apparent dead end "We do not (and will not) allow table tags" here: meta.stackexchange.com/questions/1777/… Sep 13 '20 at 16:56

## 2 Answers

In your special case we can get away with the built-in \triangledown to represent the lines connecting each vertex. We can also make use of \odot to represent each ringed node:

$$\begin{array}{ccc}\hline\text{Case}&\text{Coxeter diagram}&\text{Vertex configuration}\\\hline\text{1 ringed node}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\boldsymbol{\Large\odot}}^{\hspace{-0.85cm}\bullet\,^{\\[2pt]\,\Large\boldsymbol r}\hspace{0.1cm}\bullet}\hspace{-0.2cm}^{\boldsymbol q}&(p\cdot q)^r\\\\\text{2 ringed nodes}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\bullet}^{\hspace{-0.9cm}\boldsymbol{\Large\odot}^{\Large\boldsymbol r}\boldsymbol{\Large\odot}}\hspace{-0.3cm}^{\boldsymbol q}&p\cdot2r\cdot q\cdot2r\\\\\text{3 ringed nodes}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\boldsymbol{\Large\odot}}^{\hspace{-0.9cm}\boldsymbol{\Large\odot}^{\Large\boldsymbol r}\boldsymbol{\Large\odot}}\hspace{-0.3cm}^{\boldsymbol q}&2p\cdot2q\cdot2r\\\hline\end{array}\\\text{Table 1: Coxeter diagrams using} \,\texttt{hspace}\,\text{magic}$$

The code is very far from neat as I had to use \hspace to format the nodes and the positions of $$p,q,r$$, but this should be somewhat expected as MathJax hasn't really been built for this. Hence I suspect this method will also affect display on mobile browsers. FWIW I’ve just tried viewing this on iOS and the table looks okay, though some of the nodes are misaligned slightly.

An easier and more user-friendly way, as per Martin's suggestion in the comments, is to directly insert the images in a table in MathJax: $$\require{HTML}\newcommand{\mypic}[4][]{\style{display: inline-block;background: url(http://i.stack.imgur.com/#4) no-repeat center;#1}{\phantom{\Rule{#2}{#3}{0px}}}}\begin{array}{ccc}\hline\text{Case}&\text{Coxeter diagram}&\text{Vertex configuration}\\\hline\text{1 ringed node}&\mypic{40px}{40px}{hVoci.jpg}&(p\cdot q)^r\\\text{2 ringed nodes}&\mypic{40px}{40px}{nDAmp.jpg}&p\cdot2r\cdot q\cdot2r\\\text{3 ringed nodes}&\mypic{40px}{40px}{k26a3.jpg}&2p\cdot2q\cdot2r\\\hline\end{array}\\\text{Table 2: Coxeter diagrams using images}$$

MathJax used in Table 1 is as follows:

$$\begin{array}{ccc}\hline \text{Case}&\text{Coxeter diagram}&\text{Vertex configuration}\\\hline \text{1 ringed node}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\boldsymbol{\Large\odot}}^{\hspace{-0.85cm}\bullet\,^{\\[2pt]\,\Large\boldsymbol r}\hspace{0.1cm}\bullet}\hspace{-0.2cm}^{\boldsymbol q}&(p\cdot q)^r\\\\ \text{2 ringed nodes}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\bullet}^{\hspace{-0.9cm}\boldsymbol{\Large\odot}^{\Large\boldsymbol r}\boldsymbol{\Large\odot}}\hspace{-0.3cm}^{\boldsymbol q}&p\cdot2r\cdot q\cdot2r\\\\ \text{3 ringed nodes}&{}^{\boldsymbol p}\hspace{-0.15cm}{\Huge\triangledown}_{\hspace{-0.81cm}\boldsymbol{\Large\odot}}^{\hspace{-0.9cm}\boldsymbol{\Large\odot}^{\Large\boldsymbol r}\boldsymbol{\Large\odot}}\hspace{-0.3cm}^{\boldsymbol q}&2p\cdot2q\cdot2r\\\hline\end{array}\\ \text{Table 1: Coxeter diagrams using} \,\texttt{hspace}\,\text{magic}$$


MathJax used in Table 2 is as follows:

$$\require{HTML}\newcommand{\mypic}[4][]{\style{display: inline-block;background: url(http://i.stack.imgur.com/#4) no-repeat center;#1}{\phantom{\Rule{#2}{#3}{0px}}}} \begin{array}{ccc}\hline\text{Case}&\text{Coxeter diagram}&\text{Vertex configuration}\\\hline \text{1 ringed node}&\mypic{40px}{40px}{hVoci.jpg}&(p\cdot q)^r\\ \text{2 ringed nodes}&\mypic{40px}{40px}{nDAmp.jpg}&p\cdot2r\cdot q\cdot2r\\ \text{3 ringed nodes}&\mypic{40px}{40px}{k26a3.jpg}&2p\cdot2q\cdot2r\\\hline\end{array}\\ \text{Table 2: Coxeter diagrams using images}$$


Addendum (as per OP's request): The method of inserting the images was taken from the answer to How to Post Pictures in an Array/Table, on MSE, with MathJax. One caveat is that it may not be completely portable in that some browsers may not provide the intended display.

• @DonHatch: Please don't use the first method, as it displays badly on some browsers. Also, if you want quick ASCII art I don't see why you wouldn't use (•) instead of (*). Sep 15 '20 at 16:32
• @user21820 the pedantic answer to why not use (•) is that it's not ascii :-) But I see your point. Anyway, I replaced all the ascii with images in my original question, and I re-did my table using Example 2. Unfortunately I just found out that, when Example 2 is viewed in the StackExchange app on my android phone, the images come out all-black :-( Sep 15 '20 at 19:02
• @DonHatch: Haha in some variants it was the graphical symbol for ASCII character 7. Sep 16 '20 at 11:59
• For reference, on a mac, Option 1 looks best using the HTML-CSS math renderer but I suspect not the same as what you see. The other math renderers like SVG do not give nice output Sep 17 '20 at 7:44
• The second option works worse when using dark theme, e.g. with Dark Reader extension for Chromium: screenshot. The first though has the dots misplaced a bit. Sep 23 '20 at 10:02

Instead of using MathJax you can create your table in TeX and then export it as an image to insert into your post. It will display faster and uniformly in all browsers but won't scale since it is a raster image. See https://tex.stackexchange.com/questions/11866/compile-a-latex-document-into-a-png-image-thats-as-short-as-possible for exporting a document as PNG.