Re: \cline, \hline, \midrule, \cmidrule
- From: "minimus" <minimus@xxxxxxxxxx>
- Date: Mon, 21 Nov 2011 14:03:00 +0100
"Enrico Gregorio" wrote in message news:211120111346587886%Facile.da.trovare@xxxxxxxxxxxxx
minimus <minimus@xxxxxxxxxx> wrote:
I decided to carry the issue to a new thread as I think it might be useful
to discuss what is happening with hline, cline, midrules:
In the minimal example below, I made four examples. What I want is the the
text between the horizontal lines are centered vertically.
\hline and \cline do not really center the text vertically.
\midrule or \cmidrule center the the text vertically. So I would go for
these commands but now, for some reason, the column lines do not touch the
row lines.
Hence my questions:
1. How can I make the text vertically centered while using \hline or
\cline?
2. If 1 is not possible, how can I make the column lines touch the row lines
while using \midrule or \cmidrule?
\documentclass{article}
\usepackage{array, booktabs}
\begin{document}
\begin{tabular}{ | m{2cm} | *{11}{m{0.5cm} | } }
\hline
Age & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72
\\
\hline
\end{tabular}
\begin{tabular}{ | m{2cm} | *{11}{m{0.5cm} | } }
\cline{1-12}
Age & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72
\\
\cline{1-12}
\end{tabular}
\begin{tabular}{ | m{2cm} | *{11}{m{0.5cm} | } }
\midrule[0.04em]
Age & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72
\\
\midrule[0.04em]
\end{tabular}
\begin{tabular}{ | m{2cm} | *{11}{m{0.5cm} | } }
\cmidrule(r){1-12}
Age & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72
\\
\cmidrule(r){1-12}
\end{tabular}
\end{document}
You seem not to notice that the rows /are/ "vertically centered":
in the first sample there is as much space above the "A" as below
the "g". Of course this shows the numbers as "too high".
Using "m" columns doesn't help. Rather, use
\setlength{\extrarowheight}{1.5pt}
as shown here
\begin{table}
\setlength{\extrarowheight}{1.5pt}
\centering
\begin{tabular}{ | p{2cm} | *{11}{>{\centering\arraybackslash}p{0.5cm}
| } }
\hline
Age & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72
\\
\hline
\end{tabular}
\end{table}
In this way the entries will be centered.
However, the rest of the table /is/ relevant if you wish
advice about improving it.
Ciao
Enrico
Hello, Thank you for your reply. In the minimal example below, I replaced "Age" with "HHH". The space above and below H are not same. So to me, the HHH text is not vertically centered. First, we need to agree on this. Am I mistaken or not? I included your solution. This is exactly what I would like to have. And I am wondering why I cannot achieve this in my first approach with \hlines. Why the text in not vertically centered using the \hlines?
(The rest of the table is not releveant because your solution is what I want. So please forget about the rest of the table. It will only complicate the matter for no reason)
\documentclass{article}
\usepackage{array}
\begin{document}
\begin{tabular}{ | m{2cm} | *{11}{m{0.5cm} | } }
\hline
HHH & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72 \\
\hline
\end{tabular}
\setlength{\extrarowheight}{1.5pt}
\centering
\begin{tabular}{ | p{2cm} | *{11}{>{\centering\arraybackslash}p{0.5cm}| } }
\hline
HHH & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 71 & 72 \\
\hline
\end{tabular}
\end{document}
.
- Follow-Ups:
- Re: \cline, \hline, \midrule, \cmidrule
- From: Ulrike Fischer
- Re: \cline, \hline, \midrule, \cmidrule
- References:
- \cline, \hline, \midrule, \cmidrule
- From: minimus
- Re: \cline, \hline, \midrule, \cmidrule
- From: Enrico Gregorio
- \cline, \hline, \midrule, \cmidrule
- Prev by Date: Define MathDelimiter for a single character with additional code
- Next by Date: Re: \cline, \hline, \midrule, \cmidrule
- Previous by thread: Re: \cline, \hline, \midrule, \cmidrule
- Next by thread: Re: \cline, \hline, \midrule, \cmidrule
- Index(es):
Relevant Pages
|