5

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...

  • Welcome to TeX.SX!. Are you asking us to do that for you or you have some code that shows how you did it? – karlkoeller Sep 5 '13 at 19:00
  • @karlkoeller: Thank you! I've edited my post. – Salech Rubenstein Sep 5 '13 at 19:03
  • 3
    Does adding \hline after your \\ 's do what you want? – Scott H. Sep 5 '13 at 19:05
  • 2
    Maybe a low rep user could compile all this info into an answer including the centering information, the horizontal lines and the automatic mathmode setup. – Scott H. Sep 5 '13 at 19:20
  • 1
    ...and a link to one of the very many great pieces of online documentation where this information can be found. – Mariano Suárez-Álvarez Sep 5 '13 at 19:21
7
\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.

  • Recommending chapter 20 to someone who is asking about how to center a table is very, very close to sadism :-) – Mariano Suárez-Álvarez Sep 5 '13 at 21:00
  • Reading anything by DEK is pure pleasure! :-) – Thruston Sep 5 '13 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.