[Tex/LaTex] Creating multiplication table of symmetric group S_3

math-modetables

How one can create multiplication table of symmetric group S_3?

(In that table 6 columns and 6 rows)

Edit:

here some progress:

\begin{table}
    \begin{tabular}{l|llllll}
    ~   & e   & a   & a^2 & b   & c   & d   \\
    e   & e   & a   & a^2 & b   & c   & d   \\
    a   & a   & a^2 & e   & c   & d   & b   \\
    a^2 & a^2 & e   & a   & d   & b   & c   \\
    b   & b   & d   & c   & e   & a^2 & a   \\
    c   & c   & b   & d   & a   & e   & a^2 \\
    d   & d   & c   & b   & a^2 & a   & e   \\
    \end{tabular} \end{table}

But now I can't figure how making the horizontal line…

Best Answer

\documentclass{article}
\usepackage{array}
\usepackage{lipsum}
\begin{document}

\lipsum[2]
\[
    \begin{tabular}{>{$}l<{$}|*{6}{>{$}l<{$}}}
    ~   & e   & a   & a^2 & b   & c   & d   \\
    \hline\vrule height 12pt width 0pt
    e   & e   & a   & a^2 & b   & c   & d   \\
    a   & a   & a^2 & e   & c   & d   & b   \\
    a^2 & a^2 & e   & a   & d   & b   & c   \\
    b   & b   & d   & c   & e   & a^2 & a   \\
    c   & c   & b   & d   & a   & e   & a^2 \\
    d   & d   & c   & b   & a^2 & a   & e   \\
    \end{tabular} 
\]
\lipsum[2]
\end{document}

Note the "invisible" \vrule to keep the rule clear of the superscript 2.

Here I have presented the table in a math display. If you really want it in a floating table, then replace \[ with \begin{table}\centering and \] with \end{table}. Your display will then float to the top of the next page.

There's a good introduction to tables in Latex on Wikibooks.

And for the curious and/or the diehards, you can do it the plain TeX way too.

$$\vbox{\tabskip0.5em\offinterlineskip
    \halign{\strut$#$\hfil\ \tabskip1em\vrule&&$#$\hfil\cr
    ~   & e   & a   & a^2 & b   & c   & d   \cr
    \noalign{\hrule}\vrule height 12pt width 0pt
    e   & e   & a   & a^2 & b   & c   & d   \cr
    a   & a   & a^2 & e   & c   & d   & b   \cr
    a^2 & a^2 & e   & a   & d   & b   & c   \cr
    b   & b   & d   & c   & e   & a^2 & a   \cr
    c   & c   & b   & d   & a   & e   & a^2 \cr
    d   & d   & c   & b   & a^2 & a   & e   \cr
}}$$

Most of the "difficulty" here is to do with having the vertical rule. If you remove that (or replace it with some white space) you can dispense with the \struts and the \offinterlineskip.

Here is what they look like. The "plain" version is the lower one. enter image description here

If you are just starting out you should probably stick with tabular, but if you want to really understand TeX I recommend reading the TeXbook thoroughly. Chapter 22 covers alignments.

Related Question