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:
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:
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:
\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?
\texttt{++----++}
– Seamus Mar 30 '11 at 13:39