# Bizarre spacing of \cdot when trying to typeset a permutation type

I was just trying to write some cycle types in a permutation group, like so:

The conjugacy classes of the symmetric group are simply given by the
cycle types, so there are five in $S_4$: $Id$, $(\cdot \cdot)$,
$(\cdot \cdot)(\cdot \cdot)$, $(\cdot \cdot \cdot)$, and $(\cdot \cdot \cdot \cdot)$.


But I get rather odd results:

I guess the weird spacing is the result of LaTeX interpreting the \cdot as an operator and trying to space things out so that they fit on the line nicely, but the non-uniformity is disturbing. What's the correct way to do what I'm trying to do here?

UPDATE: Changing the spaces to ~'s helps, but the spacing is still a bit uneven.

-
David and Werner have of course given the answer(s) to your problem but there is another small thing: The identity operator (I assume $Id$ means that) should be declared using \DeclareMathOperator{\Id}{Id} in the preamble. – Svend Tveskæg Feb 25 '13 at 23:10

\cdot is a binary operator so gets spacing either side, but if it is used in a non-infix position it loses its spacing and turns into a mathord so two \cdot are two mathord, but three \cdot the end ones become mathord but the middle one stays as a \mathbin. If you make them all \mathord you get:

The conjugacy classes of the symmetric group are simply given by the cycle types,
so there are five in
$S_4$: $Id$, $({\cdot} {\cdot})$,
$({\cdot} {\cdot})({\cdot} {\cdot})$,
$({\cdot} {\cdot} {\cdot})$, and
$({\cdot} {\cdot} {\cdot} {\cdot})$

\bye

-

You can experiment with \dotspacing in the following code, so you can define what spacing pleases you more:

\documentclass{article}
\usepackage{xparse}

\newcommand{\dotspacing}{1mu}
\ExplSyntaxOn
\NewDocumentCommand{\bcdot}{O{1}}
{
{ \prg_replicate:nn { #1 } { {\cdot}\mkern\dotspacing } \mkern-\dotspacing }
}

\ExplSyntaxOff

\begin{document}
\newcommand{\test}{$\mathit{Id}$, $(\bcdot)$,
$(\bcdot[2])$, $(\bcdot[3])$,
$(\bcdot[4])$, $(\bcdot[5])$.}

\test

\renewcommand{\dotspacing}{1.5mu}\test

\renewcommand{\dotspacing}{2mu}\test

\renewcommand{\dotspacing}{2.5mu}\test

\renewcommand{\dotspacing}{3mu}\test

\end{document}


Note the use of $\mathit{Id}$, rather than $Id$, that gives a better rendering.

-

An alternative suggestion in terms of the output is given in the last example below:

\documentclass{article}
\usepackage{amsmath,multido}% http://ctan.org/pkg/{amsmath,multido}
\newcommand{\conjclass}[1]{%
\def\conjclasssep{\def\conjclasssep{\,}}%
\ifnum#1>0\relax
\multido{\i=1+1}{#1}{\conjclasssep{\cdot}}
\fi%
}
\begin{document}
The conjugacy classes of the symmetric group are simply given by
the cycle types, so there are five in $S_4$: $Id$, $(\cdot \cdot)$,
$(\cdot \cdot)(\cdot \cdot)$, $(\cdot \cdot \cdot)$, and $(\cdot \cdot \cdot \cdot)$.

The conjugacy classes of the symmetric group are simply given by
the cycle types, so there are five in $S_4$: $\text{Id}$, $(\cdot{}\cdot)$,
$(\cdot{}\cdot)(\cdot{}\cdot)$, $(\cdot{}\cdot{}\cdot)$, and
$(\cdot{}\cdot{}\cdot{}\cdot)$.

The conjugacy classes of the symmetric group are simply given by
the cycle types, so there are five in $S_4$: $\text{Id}$, $({\cdot}{\cdot})$,
$({\cdot}{\cdot})({\cdot}{\cdot})$, $({\cdot}{\cdot}{\cdot})$, and
$({\cdot}{\cdot}{\cdot}{\cdot})$.

The conjugacy classes of the symmetric group are simply given by
the cycle types, so there are five in $S_4$: $\text{Id}$, $(\conjclass{2})$,
$(\conjclass{2})(\conjclass{2})$, $(\conjclass{3})$, and $(\conjclass{4})$.
\end{document}


The last example provides \conjclass{<num>} which sets \cdot as a "\mathord" (using {\cdot}), but also prints <num> with a predefined spacing \, between each element. Depending on your usage (quantity), it promotes consistency when defining a macro (see Consistent typography).

The technique used to delay the initial space is from Cunning (La)TeX tricks.

As a side-note: See the use of $\text{Id}$ instead of $Id$. It looks better...

-