PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : sowas wie cmidrule aber vertikal



don_shifty
28-07-2010, 08:54
hallo allwissendes forum

nachdem ich schon mehrmals danach gesucht habe und nicht fündig wurde mal hier noch die frage:
gibt es sowas wie \cmidrule aber vertikal? also quasi ein \vmidrule? - etwas, das geteilte vertikale striche macht, resp nur gewisse zellen mit vertikalen strichen teilt?

und: ja ich wiess, vertikale striche sind böse (man siehe booktabs-paketbeschrieb). aber, ich bin nun mal kein freund von information über mehrere tabellen verteilen, und daher hätte ich meine (grossen) tabellen gerne so übersichtlich wie möglich...

hat das mal jemand mit irgendeinem schlauen kniff hingekriegt, oder gibts ein paket, das ich noch nicht gefunden habe?

danke im voraus für die antworten

mfg shifty

u_fischer
28-07-2010, 10:06
Nun, du kannst natürlich \multicolumn (für Striche zwischen Zellen) oder \vline (Striche in Zellen) benutzen. Aber beide bekommen Löcher, wenn du \midrule benutzt.

Ansonsten kann man mit ein bisschen rechnen, beliebige Striche durch eine Tabelle ziehen. Mit pstricks, tikz oder einfach mit \raisebox+\rule:


\documentclass{article}
\usepackage{booktabs,color}
\begin{document}

\begin{tabular}{lll|}
\multicolumn{1}{|l}{a}& b \vline & c\\\midrule
\multicolumn{1}{|l}{a
\raisebox{-\dp\strutbox}[0pt][0pt]{\color{red}\rule{0.4pt}{\dimexpr
2\ht\strutbox+2\dp\strutbox+\the\lightrulewidth+\t he\aboverulesep+\the\belowrulesep}}}&
b \vline & c\\
a& b & c\\
\end{tabular}

don_shifty
28-07-2010, 11:06
danke erst mal für die antwort!

ich wusste nicht, dass man in multicolumn auch linien neben der ausrichtung angeben kann! - das könnte schon helfen...

momentan hab ich noch ein problem, das wahrscheinlich auf einen pakete-mix zurückzuführen ist... verschiedene pakete, die sich gegenseitig übersteuern oder sowas...
wenn ich folgenden code in einem separaten file kompiliere siehts in ordnung aus (vertikale linien sind wo sie sein sollten), wenn ich ihn hingegen in meinem template kompiliere siehts schlecht aus (vertikale linien beginnen und enden nicht an den richtigen orten in zellen, man sehe die posts...)


\documentclass{article}
\usepackage{booktabs,color,amsmath,amssymb}
\begin{document}

\begin{table}[h]
\begin{center}
\begin{tabular}{p{1.5cm} p{2.5cm}p{2.5cm} p{2.5cm}p{2.5cm}}
& \multicolumn{2}{c}{\textbf{279 kN}} & \multicolumn{2}{c}{\textbf{310 kN}} \\
\midrule
\multicolumn{1}{l|}{\textbf{number of strands}} & \textbf{calculated deflection [mm]} & \textbf{calculated stress [MPa]} & \textbf{calculated deflection [mm]} & \textbf{calculated stress [MPa]} \\
\midrule
\multicolumn{1}{l|}{1} & 0.0000 & 2.16 & 0.0000 & 2.40 \\
\multicolumn{1}{l|}{2} & 0.0156 & 198.58 & 0.0173 & 220.64 \\
\multicolumn{1}{l|}{3} & 0.0449 & 371.20 & 0.0499 & 412.45 \\
\multicolumn{1}{l|}{4} & 0.0265 & 257.49 & 0.0294 & 286.10 \\
\multicolumn{1}{l|}{7} & 0.1054 & 487.30 & 0.1171 & 541.44 \\
\multicolumn{1}{l|}{12} & 0.1820 & 503.36 & 0.2022 & 559.29 \\
\multicolumn{1}{l|}{15} & 0.1462 & 387.26 & 0.1625 & 430.28 \\
\multicolumn{1}{l|}{19} & 0.2680 & 501.08 & 0.2978 & 556.75 \\
\multicolumn{1}{l|}{22} & 0.2901 & 476.03 & 0.3224 & 528.93 \\
\multicolumn{1}{l|}{27} & 0.3907 & 513.56 & 0.4341 & 570.62 \\
\multicolumn{1}{l|}{31} & 0.2894 & 444.10 & 0.3216 & 493.45 \\
\multicolumn{1}{l|}{37} & 0.4655 & 481.98 & 0.5172 & 535.54 \\
\multicolumn{1}{l|}{43} & 0.3276 & 384.98 & 0.3640 & 427.76 \\
\multicolumn{1}{l|}{55} & 0.5375 & 466.38 & 0.5972 & 518.20 \\
\midrule \midrule \multicolumn{2}{l}{\textbf{VSL specification MS-1-1-1}} & \textbf{$\varnothing$ 16-100 [mm]}&\textbf{$\varnothing$ 101-250 [mm]} & \textbf{$\varnothing$ $\>$ 250 [mm]}\\
\midrule \multicolumn{2}{l}{Yield point}& 305 [MPa] & 275 [MPa] & 250 [MPa]\\
\cmidrule{3-5} \multicolumn{2}{l}{Tensile strength}& 580 [MPa] & 560 [MPa] & 500 [MPa]\\
\midrule \multicolumn{2}{l}{\textbf{Stahlschlüssel}\cite{st ahlschlüssel}} & \textbf{$\varnothing$ 17-40 [mm]}&\textbf{$\varnothing$ 41-100 [mm]} & \textbf{$\varnothing$ 101-160 [mm]}\\
\midrule \multicolumn{2}{l}{Yield point}& 430 [MPa] & 370 [MPa] & - \\
\cmidrule{3-5} \multicolumn{2}{l}{Tensile strength}& 650-800 [MPa] & 630-780 [MPa] & -
\end{tabular}
\end{center}
\end{table}

\end{document}

die "rechnerische" methode scheint mir etwas gar kompliziert, vorallem wenn die tabellen gross werden... kenne allerdings die sache auch noch nicht...

don_shifty
28-07-2010, 11:20
das vorher beschriebene problem scheint am paket arydshln gelegen zu haben. es vermiest offenbar die vertikalen linien...

folgender code wird unschön solange das paket arydshln drin ist...


\documentclass{article}
\usepackage{booktabs,color,amsmath,amssymb,arydshl n}
\begin{document}

\begin{table}[h]
\begin{center}
\begin{tabular}{p{1.5cm} p{2.5cm}p{2.5cm} p{2.5cm}p{2.5cm}}
& \multicolumn{2}{c}{\textbf{279 kN}} & \multicolumn{2}{c}{\textbf{310 kN}} \\
\midrule
\multicolumn{1}{l|}{\textbf{number of strands}} & \textbf{calculated deflection [mm]} & \textbf{calculated stress [MPa]} & \textbf{calculated deflection [mm]} & \textbf{calculated stress [MPa]} \\
\midrule
\multicolumn{1}{l|}{1} & 0.0000 & 2.16 & 0.0000 & 2.40 \\
\multicolumn{1}{l|}{2} & 0.0156 & 198.58 & 0.0173 & 220.64 \\
\multicolumn{1}{l|}{3} & 0.0449 & 371.20 & 0.0499 & 412.45 \\
\multicolumn{1}{l|}{4} & 0.0265 & 257.49 & 0.0294 & 286.10 \\
\multicolumn{1}{l|}{7} & 0.1054 & 487.30 & 0.1171 & 541.44 \\
\multicolumn{1}{l|}{12} & 0.1820 & 503.36 & 0.2022 & 559.29 \\
\multicolumn{1}{l|}{15} & 0.1462 & 387.26 & 0.1625 & 430.28 \\
\multicolumn{1}{l|}{19} & 0.2680 & 501.08 & 0.2978 & 556.75 \\
\multicolumn{1}{l|}{22} & 0.2901 & 476.03 & 0.3224 & 528.93 \\
\multicolumn{1}{l|}{27} & 0.3907 & 513.56 & 0.4341 & 570.62 \\
\multicolumn{1}{l|}{31} & 0.2894 & 444.10 & 0.3216 & 493.45 \\
\multicolumn{1}{l|}{37} & 0.4655 & 481.98 & 0.5172 & 535.54 \\
\multicolumn{1}{l|}{43} & 0.3276 & 384.98 & 0.3640 & 427.76 \\
\multicolumn{1}{l|}{55} & 0.5375 & 466.38 & 0.5972 & 518.20 \\
\midrule \midrule \multicolumn{2}{l}{\textbf{VSL specification MS-1-1-1}} & \textbf{$\varnothing$ 16-100 [mm]}&\textbf{$\varnothing$ 101-250 [mm]} & \textbf{$\varnothing$ $\>$ 250 [mm]}\\
\midrule \multicolumn{2}{l}{Yield point}& 305 [MPa] & 275 [MPa] & 250 [MPa]\\
\cmidrule{3-5} \multicolumn{2}{l}{Tensile strength}& 580 [MPa] & 560 [MPa] & 500 [MPa]\\
\midrule \multicolumn{2}{l}{\textbf{Stahlschlüssel}\cite{st ahlschlüssel}} & \textbf{$\varnothing$ 17-40 [mm]}&\textbf{$\varnothing$ 41-100 [mm]} & \textbf{$\varnothing$ 101-160 [mm]}\\
\midrule \multicolumn{2}{l}{Yield point}& 430 [MPa] & 370 [MPa] & - \\
\cmidrule{3-5} \multicolumn{2}{l}{Tensile strength}& 650-800 [MPa] & 630-780 [MPa] & -
\end{tabular}
\end{center}
\end{table}

\end{document}

don_shifty
30-07-2010, 07:21
die sache funktionniert nicht so schlecht mit multicolumn, allerdings wird eine definition wie zB p{2cm} vom multicolumn befehl überschrieben und es findet kein zeilenumbruch statt...

kann man da was dagegen machen?

mfg shifty

u_fischer
30-07-2010, 09:05
p{cm} im multicolumn-Befehl benutzen.

don_shifty
30-07-2010, 09:09
... naja manchmal hat man einfach zuwenig phantasie....
danke!