Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Asked
Viewed 805 times
1

I am encountering problems combining the package multirow with the @-expressions. Basically, my table shall look like the one in the following picture:

enter image description here

Now I want to adjust all plusminus signs so they are straight below each other. Therefore, I use the $c@{ \pm }c$ statement behind the \begin{tabular} command. See:

\documentclass{scrbook}

\begin{table}[htbp]
\begin{minipage}{\textwidth}
    \renewcommand{\arraystretch}{1.3}
    \caption[...]{...}
    \label{...}

    \begin{tabular}{c | c@{ $\pm$ }c | c@{ $\pm$ }c }

    \multicolumn{1}{c|}{\bf{STATION}}   &  \multicolumn{2}{c}{\bf{SKEW VALUES}} \\ \hline
    & \bf{Single Traces [s]} & \bf{Stacked Traces [s]}  \\ \hline

    RUM41  &  1.089 & 12.337  &  0.888 & 1.278  \\ 
    RUM42  &  0.193 & 2.626  &  0.074 & 0.580  \\ 
    ...

    \end{tabular}
\end{minipage}
\end{table}

All I get, the @-expression interprets the multicolumn "&" as something to align (see table2). That makes sense but is not desired. Clearly, I would need a command which does an exception of the @-expression for a specific line I state, in this case the multicolumn line. I couldn't find it. Anyone having an idea?

enter image description here

Furthermore, is there a way of fixing the cell width in:

\begin{tabular}{c | c@{ $\pm$ }c | c@{ $\pm$ }c }

m{4cm} does not work for example.

2
  • You want r@{${}\pm{}$}l
    egreg
    –  egreg
    2014-07-11 17:33:22 +00:00
    Commented Jul 11, 2014 at 17:33
  • that didn't make it. Actually, it changed nothing. :(
    Johngoldenboy
    –  Johngoldenboy
    2014-07-11 17:37:40 +00:00
    Commented Jul 11, 2014 at 17:37

2 Answers 2

2

You may want to use dcolumn; playing with the values (here 6.8 and 6.7) is necessary because of the headers wide than the entries.

\documentclass{scrbook}
\usepackage{dcolumn}
\newcolumntype{P}[1]{D{+}{{}\pm{}}{#1}}

\begin{document}

\begin{table}[htbp]
\renewcommand{\arraystretch}{1.3}
\caption[...]{...}\label{...}

\begin{tabular}{c | P{6.8} | P{6.7} } % play with the values to get centering

\textbf{STATION} & \multicolumn{2}{c}{\textbf{SKEW VALUES}} \\
\hline
 & \multicolumn{1}{c|}{\textbf{Single Traces [s]}}
 & \multicolumn{1}{c}{\textbf{Stacked Traces [s]}} \\
\hline
RUM41 & 1.089 + 12.337 & 0.888 + 1.278  \\
RUM42 & 0.193 +  2.626 & 0.074 + 0.580  \\

\end{tabular}
\end{table}

\end{document}

enter image description here

Note that \bf has been obsolete for more than twenty years.

2
  • Thanks for your help. But again, this doesn't make it as your picutre shows as well. I want to have it like in the first picture.
    Johngoldenboy
    –  Johngoldenboy
    2014-07-11 17:51:30 +00:00
    Commented Jul 11, 2014 at 17:51
  • @johngoldenboy I just used your input. I'll fix it soon.
    egreg
    –  egreg
    2014-07-11 19:33:28 +00:00
    Commented Jul 11, 2014 at 19:33
0

I found it out myself using multirow and creating tables within single cells. I post the code and the result in the following:

\begin{table}[htbp]\centering
    \renewcommand{\arraystretch}{1.3}
    \caption[..]{..}
    \label{..}

    \begin{tabular}{c | c | c | c | c }

    \textbf{STATION}    &   \multicolumn{4}{c}{\textbf{SKEW VALUE}} \\ 
    \hline

                        &   \multicolumn{2}{c|}{\textbf{Single Traces [s]}} &  \multicolumn{2}{c}{\textbf{Stacked Traces [s]}}\\
    \hline

    \multicolumn{1}{c|}{  \begin{tabular}{c}                    
                        RUM41 \\
                        RUM42 \\
                        RUM43 \\
                        RUM44 \\
                        RUM45 \\
                        RUM46 \\
                        RUM48 \\
                        \end{tabular}}      &   \multicolumn{2}{c|}{  \begin{tabular}{r@{${}\pm{}$}l}
                                                1.089   &   12.337  \\
                                                0.193   &   2.626   \\
                                                -0.888  &   2.494   \\
                                                -1.441  &   0.873   \\
                                                -0.889  &   0.030   \\
                                                0.563   &   1.100   \\
                                                -1.142  &   0.287   \\
                                                \end{tabular}}          & \multicolumn{2}{c}{   \begin{tabular}{r@{${}\pm{}$}l}
                                                                                                0.888       &   1.278  \\ 
                                                                                                0.074       &   0.580  \\ 
                                                                                                -0.863      &   0.610  \\ 
                                                                                                -1.336      &   0.720  \\ 
                                                                                                -0.828      &   0.263  \\ 
                                                                                                0.601       &   0.189  \\ 
                                                                                                -0.992      &   0.418  \\
                                                                                                \end{tabular}
                                                                                                }\\

    \end{tabular}
 \end{table}

.

I used a lot of tabs to make clear what belongs where.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.