Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to know how to position two columns in the following table closer together. The table looks like this:

table

I have found I had a problem with spacing of tabular columns combined with \multicolumn. I found an inelegant solution. Perhaps someone knows of a better one? and Column padding in tables. Unfortunately, I still cannot get it to work. Consider the following code:

\begin{table}
\begin{mdframed}[style=schwarzelinie]
\begin{center}
\begin{threeparttable}
\caption{\textbf{Charakteristika 123}
\begin{tabular*}{1\columnwidth}{@{\extracolsep{\fill}}lS[table-alignment=center,table-column-width=0.02\columnwidth]S[table-alignment=center,input-symbols=(),table-column-width=0.02\columnwidth]}
\toprule 
 & \multicolumn{2}{c}{\textbf{Patienten: n(\%)}}\tabularnewline
\midrule
\midrule 
\textbf{Anzahl} & \multicolumn{2}{c}{59}\tabularnewline
\midrule 
\textbf{Dauer:} &  & \tabularnewline
- weniger als 1 Stunde & 8 & (13,6)\tabularnewline
- zwischen 1-3 Stunden & 23 & (39,0)\tabularnewline
- zwischen 4-72 Stunden & 26 & (44,1)\tabularnewline
- länger als 72 Stunden & 2 & (3,4)\tabularnewline
\midrule 
\textbf{Charakter:} &  & \tabularnewline
- ausschließlich anfallsartig & 45 & (76,3)\tabularnewline
- ausschließlich stetig & 12 & (22,0)\tabularnewline
- stetig und anfallsartig alternierend & 1 & (1,7)\tabularnewline
\end{tabular*}\begin{tablenotes}[para,flushleft]
\textbf{Erläuterungen:} Einige Erklaerungen. 
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{mdframed}
\end{table}
share|improve this question
4  
How does this differ from yesterday's quesion? –  Joseph Wright Dec 21 '11 at 10:47
    
It looks similar, I have to admit. I did use yesterday's suggestions. However it differs in so far as yesterday's table had 6 columns (with the image showing only an extract) which in total were narrower. With only three columns the extra (and thus not needed space) persists. Result: the table is too stretched. –  Jan Dec 21 '11 at 10:58
2  
It appears that the layout issues arise because the instruction \extracolsep{\fill}} inserts equal amounts of column whitespace between columns 2 and 3 as it does between columns 1 and 2 in order to increaee the table's total width to \columnwidth. Not knowing what other design parameters you have to satisfy, I'd say the easiest (though not most elegant!) solution is to widen the total width of column 1 artificially by inserting the code \phantom{einige unsichtbare Worte} after 72 Stunden. That way, there will be less space that needs to be filled by extracolsep{\fill}}... –  Mico Dec 21 '11 at 13:52
    
Hi Mico, thanks for your answer and the invisible words thing. Unfortunately it doesn't change a thing except the last line is hyphenated. I assume that I have to leave like it is... –  Jan Dec 21 '11 at 14:53
1  
Looks like your \caption is missing a closing brace… –  Seamus Dec 21 '11 at 15:06

1 Answer 1

up vote 5 down vote accepted

It appears that the layout issues arise because the instruction \extracolsep{\fill}} inserts equal amounts of column whitespace between columns 2 and 3 as it does between columns 1 and 2, in order to increase the table's total width to \columnwidth. Not knowing what other design parameters you have to satisfy, I'd say the easiest solution is to change the first column's type from l to p{0.65\texwidth}, as is done in the following MWE.

By the way, it would help if you posted full MWEs. They're not that much longer than the code you do post, and doing so would help save time for people potentially interested in helping you solve your issues, say by not making them go through a guessing game regarding the additional packages that must be loaded in order to get the code to compile.

\documentclass{article}
\usepackage{booktabs,mdframed,siunitx,threeparttable}
\sisetup{output-decimal-marker={,},
     table-alignment=center,
     input-symbols= () }
\begin{document}
\begin{table}
\begin{mdframed}[style=schwarzelinie]
\begin{threeparttable}
\caption{\textbf{Charakteristika 123}}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}p{0.65\columnwidth}
   SS}
\toprule 
 & \multicolumn{2}{c}{\textbf{Patienten: n(\%)}}\\
\midrule
\midrule 
\textbf{Anzahl} & \multicolumn{2}{c}{59}\\
\midrule 
\textbf{Dauer:}\\
- weniger als 1 Stunde    &  8 & (13,6)\\
- zwischen 1-3 Stunden    & 23 & (39,0)\\
- zwischen 4-72 Stunden   & 26 & (44,1)\\
- l\"anger als 72 Stunden &  2 &  (3,4)\\
\midrule 
\textbf{Charakter:}\\
- ausschlie\ss lich anfallsartig       & 45 & (76,3)\\
- ausschlie\ss lich stetig             & 12 & (22,0)\\
- stetig und anfallsartig alternierend &  1 &  (1,7)\\
\end{tabular*}
\begin{tablenotes}[para,flushleft]
\textbf{Erl\"auterungen:} Einige Erkl\"arungen. 
\end{tablenotes}
\end{threeparttable}
\end{mdframed}
\end{table}
\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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