for typesetting tables with design of experiments, I have to typeset strings like "+ - + +", - - - +", etc. in a column of a table to represent the so called pattern of the experimental run (sometimes they also contain "a", "A" and "0" (zero)).

However, the width of the "+" and "-" sign are very different in the used font (standard font in KOMA script class scrreprt) and a sequence of 2 or 3 dashes creates one long or very long dash....

So I'm searching for a way to easily typeset e. g. "+ - - - + -" with a little spacing between the characters and (if possible) that several different strings composed of the same number of characters ("+" or "-", "a", "A" and "0") would be aligned with each other, when they are in the same column of a table.

I hope I could make clear what I need, some examples how it shall NOT look are found here:  

![bad example](https://i.stack.imgur.com/YZkQH.png)
in line 9 it should be "+ - -" and in 10 "- - +", line 5 should be "- - -"

It looks a little better, if I insert `\,` between the characters, but as the widths are different, it is still not aligned:  

![enter image description here](https://i.stack.imgur.com/dC5x3.png)

Sure, I could split it up in centered columns like `- & + & - & - & ...`, but the tables are already complicated enough and I do not want to add 3 to 7 columns...

Does anybody have an idea how to solve that?
Maybe a command that parses the string like --+--++ and typesets it with a "constant spacing"?

------- edit:

added math mode for "+" and "-", looks better now, but not perfect:
![math mode for plus and minus](https://i.stack.imgur.com/D3hFt.png)

```
    \documentclass[11pt, a4paper%,  halfparskip
    ]{scrreprt}

    \usepackage{booktabs}

    \begin{document}

\begin{tabular}{cccccccc}
\midrule
         1 &        $+$$+$$-$           \\
         2 &        $+$$-$$+$           \\
         3 &        $-$$+$$+$           \\
         4 &        000                 \\
         5 &        $-$$-$$-$           \\
         6 &        000                 \\
\midrule
         7 &        $-$$+$$-$           \\
         8 &        000                 \\
         9 &        $+$$-$$-$           \\
        10 &        $-$$-$$+$           \\
        11 &        $+$$+$$+$           \\
        12 &        000                 \\ 
\midrule
        13 &        000                 \\
        14 &        00a                 \\
        15 &        00A                 \\
        16 &        0A0                 \\
        17 &        A00                 \\
        18 &        0a0                 \\
        19 &        a00                 \\
        20 &        000                 \\
\toprule
\end{tabular}  

\end{document}

```

---

example and further question about side-effects:

I used the solution of Michel and it looks good, but there is one thing I'm not sure about:
Is it possible that it changes the free space between columns?
I have the impression that the first 3 columns are closer together than the rest...
How can I fix that?

![solution with side effects?!](https://i.stack.imgur.com/25OVA.png)
['https://tex.stackexchange.com/questions/14576', 'https://tex.stackexchange.com', 'https://tex.stackexchange.com/users/4009/']
```
\documentclass{minimal}
\begin{document}
\setlength{\parindent}{0pt}
\newlength{\stretchlen}\setlength{\stretchlen}{1em}
\def\splitterm{\_}
\newcommand{\stretchit}[1]{\leavevmode\realstretch#1\_}
\def\realstretch#1{%
    \def\temp{#1}%
    \ifx\temp\splitterm
    \else
    \hbox to \stretchlen{\hss#1\hss}\expandafter\realstretch
\fi}
\stretchit{abcd}\par
\stretchit{----}\par
\stretchit{++++}\par
\stretchit{-+-+}\par
\stretchit{0aA+}\par
\end{document}

```

`\stretchit` appends an underscore to its argument and passes it to `\realstretch`, which recursively 'eats' one letter at a time, and typesets it centered in an `\hbox` stretched to `\stretchlen`. All letters are thus equally wide, and since they are centered, aligned nicely.

--- **solution for the question:** 

```
\documentclass[10pt, a4paper    ]{scrreprt}

\usepackage{booktabs}
\usepackage{collcell}
\usepackage{array}
\begin{document}

\setlength{\parindent}{0pt}
\newlength{\stretchlen}\setlength{\stretchlen}{1em}
\def\splitterm{\_}
\newcommand{\stretchit}[1]{\leavevmode\realstretch#1\_}
\def\realstretch#1{%
    \def\temp{#1}%
    \ifx\temp\splitterm
    \else
    \hbox to \stretchlen{\hss#1\hss}\expandafter\realstretch
\fi}

without the stretchit command

\begin{tabular}{cccccccc}
\midrule
         1 &        ++-             \\
         2 &        +-+             \\
         3 &        -++             \\
         4 &        000                  \\
         5 &        ---                 \\
         6 &       000               \\
\midrule
         7 &        -+-                 \\
         8 &       000                \\
         9 &        +--                 \\
        10 &        --+             \\
        11 &        +++             \\
        12 &        000             \\ 
\midrule
        13 &        000                  \\
        14 &        00a                   \\
        15 &        00A                   \\
        16 &        0A0                 \\
        17 &        A00                   \\
        18 &        0a0                  \\
        19 &        a00                  \\
        20 &        000                  \\
\toprule
\end{tabular}  

\medskip

\emph{with} the stretchit command

\begin{tabular}{c>{\collectcell\stretchit}c<{\endcollectcell}ccccccc}
\midrule
         1 &        ++-             \\
         2 &        +-+             \\
         3 &        -++             \\
         4 &        000                  \\
         5 &        ---                 \\
         6 &       000               \\
\midrule
         7 &        -+-                 \\
         8 &       000                \\
         9 &        +--                 \\
        10 &        --+             \\
        11 &        +++             \\
        12 &        000             \\ 
\midrule
        13 &        000                  \\
        14 &        00a                   \\
        15 &        00A                   \\
        16 &        0A0                 \\
        17 &        A00                   \\
        18 &        0a0                  \\
        19 &        a00                  \\
        20 &        000                  \\
\toprule
\end{tabular}  

\end{document}

```
Make sure you typeset them it **math-mode**, i.e. `$-$` and `$+$`.

Be aware that it makes a difference if you use a single math-mode or separate ones for them. The last sign has different spacing in the first case because it 
is taken as an unary sign but the others are operators.

Compare the following:

```
\documentclass{article}

\begin{document}

$-$$-$$-$$+$$+$$+$

$+$$+$$+$$+$$+$$+$

$-$$-$$-$$-$$-$$-$

$---+++$

$++++++$

$------$

\end{document}

```

### Result:

![Result](https://i.stack.imgur.com/8AnbD.png)

---

For the alignment with the other signs `a`, `A` and `0` I would recommend that you make macros for all and set the width manually the one of the widest (should be `$+$`).

This can be done either with `\hbox to <length>{\hss <sign>\hss}` (TeX) or using `\makebox[<length>][c]{<sign>}` (LaTeX). The width is provided by `\settowidth{<length register>}{<content>}`.

```
\documentclass[11pt, a4paper]{scrreprt}

\usepackage{booktabs}

\newlength{\slength}
\settowidth{\slength}{$+$}
\newcommand*{\Sz}{\makebox[\slength][c]{0}}
\newcommand*{\SA}{\makebox[\slength][c]{A}}
\newcommand*{\Sa}{\makebox[\slength][c]{a}}
\newcommand*{\Sp}{\makebox[\slength][c]{$+$}}
\newcommand*{\Sm}{\makebox[\slength][c]{$-$}}

\begin{document}

\begin{tabular}{cc}
\toprule
         1 &  \Sp\Sp\Sm  \\
         2 &  \Sp\Sm\Sp  \\
         3 &  \Sm\Sp\Sp  \\
         4 &  \Sz\Sz\Sz  \\
         5 &  \Sm\Sm\Sm  \\
         6 &  \Sz\Sz\Sz  \\
\midrule
         7 &  \Sm\Sp\Sm  \\
         8 &  \Sz\Sz\Sz  \\
         9 &  \Sp\Sm\Sm  \\
        10 &  \Sm\Sm\Sp  \\
        11 &  \Sp\Sp\Sp  \\
        12 &  \Sz\Sz\Sz  \\
\midrule
        13 &  \Sz\Sz\Sz  \\
        14 &  \Sz\Sz\Sa  \\
        15 &  \Sz\Sz\SA  \\
        16 &  \Sz\SA\Sz  \\
        17 &  \SA\Sz\Sz  \\
        18 &  \Sz\Sa\Sz  \\
        19 &  \Sa\Sz\Sz  \\
        20 &  \Sz\Sz\Sz  \\
\bottomrule
\end{tabular}

\end{document}

```

### Result:

![Result 2](https://i.stack.imgur.com/1d879.png)