PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Tabellenkopf ausrichten



Gonse
27-04-2010, 11:35
Hallo zusammen,

ich habe Probleme den Tabellenkopf 'Computational time [ms]' zentriert darzustellen. Anbei das Minimalbeispiel. Hat jemand eine helfende Hand frei?

Gruß,
Stefan




\documentclass{scrartcl}% Klassen: scrartcl, scrreprt, scrbook
\usepackage{booktabs}
\begin{document}
\begin{table}[tb]
\centering
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\begin{tabular}{@{}ccccc@{}}
\toprule
\multicolumn{1}{p{1.75cm}}{\centering \# of \textsc{Hildreth} iterations} & \multicolumn{3}{p{2cm}}{\centering Computational time [ms]} & \multicolumn{1}{p{1.75cm}}{\centering \# of active set iterations} \\
\cmidrule(lr){2-4}
& min & max & sum \\
\midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}

Legion
27-04-2010, 11:47
Hallo zusammen,

ich habe Probleme den Tabellenkopf 'Computational time [ms]' zentriert darzustellen. Anbei das Minimalbeispiel. Hat jemand eine helfende Hand frei?

Gruß,
Stefan




\documentclass{scrartcl}% Klassen: scrartcl, scrreprt, scrbook
\usepackage{booktabs}
\begin{document}
\begin{table}[tb]
\centering
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\begin{tabular}{@{}ccccc@{}}
\toprule
\multicolumn{1}{p{1.75cm}}{\centering \# of \textsc{Hildreth} iterations} & \multicolumn{3}{p{3cm}}{\centering Computational time [ms]} & \multicolumn{1}{p{1.75cm}}{\centering \# of active set iterations} \\
\cmidrule(lr){2-4}
& min & max & sum \\
\midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


einfach die Spalte größer machen

localghost
27-04-2010, 12:01
Ich würde es anders angehen.

\begin{table}[!ht]
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\centering
\begin{tabular}{@{}ccccc@{}} \toprule
\# of & \multicolumn{3}{c}{Computational} & \multicolumn{1}{c}{\# of} \\
\textsc{Hildreth} & \multicolumn{3}{c}{time [ms]} & \multicolumn{1}{c}{active set} \\
iterations & & & & \multicolumn{1}{c}{iterations} \\ \cmidrule(lr){2-4}
& min & max & sum \\ \midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\ \bottomrule
\end{tabular}
\end{table}


MfG
Thorsten

Gonse
27-04-2010, 12:09
@Legion
Dann passt es nicht im zweispaltigen Satz in den Artikel.

@localghost
Das war die Idee. Danke

Xenara
27-04-2010, 12:14
Von mir gibts auch nen Vorschlag (etwas spät, hab zu lang zum Basteln gebraucht :D),
dafür bei der Gelegenheit gleich alle drei Varianten (deine originale, die von Localghost und von mir) ins MB eingebaut.
Ich hab versucht, mit weniger multicolumns auszukommen und den Code dadurch etwas eleganter zu machen.




\documentclass{scrartcl}% Klassen: scrartcl, scrreprt, scrbook
\usepackage{booktabs}
\usepackage{array}
\usepackage{calc}

\begin{document}

\begin{table}[!ht]
Original
\centering
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\begin{tabular}{@{}ccccc@{}}
\toprule
\multicolumn{1}{p{1.75cm}}{\centering \# of \textsc{Hildreth} iterations} & \multicolumn{3}{p{2cm}}{\centering Computational time [ms]} & \multicolumn{1}{p{1.75cm}}{\centering \# of active set iterations} \\
\cmidrule(lr){2-4}
& min & max & sum \\
\midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\
\bottomrule
\end{tabular}
\end{table}


\begin{table}[!ht]
Localghost
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\centering
\begin{tabular}{@{}ccccc@{}} \toprule
\# of & \multicolumn{3}{c}{Computational} & \multicolumn{1}{c}{\# of} \\
\textsc{Hildreth} & \multicolumn{3}{c}{time [ms]} & \multicolumn{1}{c}{active set} \\
iterations & & & & \multicolumn{1}{c}{iterations} \\ \cmidrule(lr){2-4}
& min & max & sum \\ \midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\ \bottomrule
\end{tabular}
\end{table}



\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{table}[!ht]
Xenara
\caption{Benchmark data for parallel implementation with the initialisation by \textsc{Hildreth}s procedure}\label{tab:ct-par-hildreth}
\centering
\begin{tabular}{@{}C{1.75cm}*{3}{C{0.8cm}}C{1.75cm }@{}}
\toprule
\# of \textsc{Hildreth} iterations & \multicolumn{3}{C{0.8cm*\real{3}+4\tabcolsep}}{Com putational time [ms]} & \# of \par active set \par iterations \\
\cmidrule(lr){2-4}
& min & max & sum \\
\midrule
1 & 0.41 & 7.42 & 1260 & 2714 \\
3 & 0.46 & 7.04 & 1303 & 1847 \\
5 & 0.41 & 7.33 & 1265 & 1717 \\
\bottomrule
\end{tabular}
\end{table}

\end{document}

Legion
27-04-2010, 12:55
@Legion
Dann passt es nicht im zweispaltigen Satz in den Artikel.

Von zweispaltig war überhaupt nicht die Rede. Hast du das mal probiert? Wenn ich dein Beispiel zweispaltig setzte ist die Tabelle von sich aus schon zu breit. Außerdem ändert mein Vorschlag mitnichten die Breite deiner Tabelle.