Graphics, Figures & Tablestable - text closer to the line - how?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
maddus
Posts: 3
Joined: Sat Jun 11, 2011 6:45 pm

table - text closer to the line - how?

Post by maddus »

I try to put the Text "Arithmetisches Mittel" more down to the line. Here is a small sample...

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{multirow}

\begin{document}

\renewcommand\multirowsetup{\RaggedRight}
\newcolumntype{N}{>{}} \newcolumntype{C}{>{}c}
\newcolumntype{N}{>{}} \newcolumntype{L}{>{}l}
\newcolumntype{N}{>{}} \newcolumntype{R}{>{}r}
\newcommand\mc[3]{\multicolumn{#1}{#2}{#3}}

\begin{table}[!h]
\begin{center}
	\begin{tabular}{@{} *{6}{r} @{}} \toprule
	& \multirow{2}{7em}{%
	 Arithmetisches Mittel}  & & &  \mc{2}{C}{Quartile} \\ \cmidrule(l){5-6}	
	\mc{1}{L}{VW Passat}	&	& \mc{1}{R}{Median}	& \mc{1}{R}{Modus}	& \mc{1}{R}{25}	& \mc{1}{R}{75} \\ \cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5} \cmidrule(l){6-6}
	\mc{1}{L}{Preis}			& 12\,585,39	& 13\,000		& 16\,000		& 5\,100	& 17\,745 \\
	\mc{1}{L}{Laufleistung}	& 110\,661,27	& 113\,000	& 150\,000	& 67\,195	& 150\,500 \\
	\bottomrule
	\end{tabular}
\end{center}
\end{table}

\end{document}
thx
maddus
Last edited by maddus on Sat Jun 11, 2011 7:36 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

table - text closer to the line - how?

Post by Stefan Kottwitz »

H maddus,

you can use \multirow in the next line, with a negative row number:

Code: Select all

\begin{tabular}{@{} *{6}{r} @{}} \toprule
&  & & &  \mc{2}{C}{Quartile} \\ \cmidrule(l){5-6}   
\mc{1}{L}{VW Passat}   & \multirow{-2}{7em}{%
 Arithmetisches Mittel}  & \mc{1}{R}{Median}   & \mc{1}{R}{Modus}   & \mc{1}{R}{25}   & \mc{1}{R}{75} \\ \cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5} \cmidrule(l){6-6}
Stefan
LaTeX.org admin
maddus
Posts: 3
Joined: Sat Jun 11, 2011 6:45 pm

table - text closer to the line - how?

Post by maddus »

Thank you very much. That was the solution. Here again the correct result. I down't know if to ask in this thread or open a new one. Is it possible to arrange "Arithmetisches Mittel" to right instead of left like now?

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{multirow}

\begin{document}

\renewcommand\multirowsetup{\RaggedRight}
\newcolumntype{N}{>{}} \newcolumntype{C}{>{}c}
\newcolumntype{N}{>{}} \newcolumntype{L}{>{}l}
\newcolumntype{N}{>{}} \newcolumntype{R}{>{}r}
\newcommand\mc[3]{\multicolumn{#1}{#2}{#3}}

\begin{table}[!h]
\begin{center}
	\begin{tabular}{@{} *{6}{r} @{}} \toprule
	&   & & &  \mc{2}{C}{Quartile} \\ \cmidrule(l){5-6}	
	\mc{1}{L}{VW Passat}	&\multirow{-2}{7em}{%
	 Arithmetisches Mittel}	& \mc{1}{R}{Median}	& \mc{1}{R}{Modus}	& \mc{1}{R}{25}	& \mc{1}{R}{75} \\ \cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5} \cmidrule(l){6-6}
	\mc{1}{L}{Preis}			& 12\,585,39	& 13\,000		& 16\,000		& 5\,100	& 17\,745 \\
	\mc{1}{L}{Laufleistung}	& 110\,661,27	& 113\,000	& 150\,000	& 67\,195	& 150\,500 \\
	\bottomrule
	\end{tabular}
\end{center}
\end{table}

\end{document}
thx
maddus
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

table - text closer to the line - how?

Post by Stefan Kottwitz »

No problem, just insert \raggedleft in the \multirow cell.

Code: Select all

\multirow{-2}{\raggedleft Arithmetisches Mittel}
Stefan
LaTeX.org admin
maddus
Posts: 3
Joined: Sat Jun 11, 2011 6:45 pm

table - text closer to the line - how?

Post by maddus »

Thanks a lot. Here the full solution...

Code: Select all

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{ragged2e}
\usepackage{multirow}

\begin{document}

\renewcommand\multirowsetup{\RaggedRight}
\newcolumntype{N}{>{}} \newcolumntype{C}{>{}c}
\newcolumntype{N}{>{}} \newcolumntype{L}{>{}l}
\newcolumntype{N}{>{}} \newcolumntype{R}{>{}r}
\newcommand\mc[3]{\multicolumn{#1}{#2}{#3}}

\begin{table}[!h]
\begin{center}
	\begin{tabular}{@{} *{6}{r}} \toprule
	&   & & &  \mc{2}{C}{Quartile} \\ \cmidrule(l){5-6}	
	\mc{1}{L}{VW Passat}	&\multirow{-2}{7em}{%
	 \raggedleft Arithmetisches Mittel}	& \mc{1}{R}{Median}	& \mc{1}{R}{Modus}	& \mc{1}{R}{25}	& \mc{1}{R}{75} \\ \cmidrule(r){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5} \cmidrule(l){6-6}
	\mc{1}{L}{Preis}			& 12\,585,39	& 13\,000		& 16\,000		& 5\,100	& 17\,745 \\
	\mc{1}{L}{Laufleistung}	& 110\,661,27	& 113\,000	& 150\,000	& 67\,195	& 150\,500 \\
	
	\bottomrule
	\end{tabular}
\end{center}
\end{table}

\end{document}
Post Reply