# [Tex/LaTex] How to draw an horizontal line of specific width in a tabular environment

tables

I'm trying to make a table with some numbers and a total result, as follows:

Age        Female Male Total
----------------------------
Under 10        5    8    13
10-30          57   61   118
30-60           5    1     6
Over 60         3    0     3
---  ---   ---
TOTAL          70   70   140
----------------------------


These three --- lines represent a kind of underline spanning a half of a row.

How can I draw it or specify the length of a tabular line?

The command \cmidrule has an optional argument in parenthesis where you can specify the side to be reduced.

Here is how your table can be achieved

\documentclass{article}

\usepackage{booktabs}

\begin{document}

\begin{tabular}{lrrr}
Age        &  Female & Male & Total \\
\midrule
Under 10   &       5 &    8 &    13 \\
10-30      &      57 &   61 &   118 \\
30-60      &       5 &    1 &     6 \\
Over 60    &       3 &    0 &     3 \\
\cmidrule(l){2-2}\cmidrule(l){3-3}\cmidrule(l){4-4}
TOTAL      &      70  &  70 &   140 \\
\bottomrule
\end{tabular}
\end{document}


Here is another version with fixed columns and where the length of \cmidrule is reduced by a fixed value:

\documentclass{article}

\usepackage{booktabs,array}

\newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}}

\begin{document}

\begin{tabular}{l*{3}{R{1.2cm}}}
Age        &  Female & Male & Total \\
\midrule
Under 10   &       5 &    8 &    13 \\
10-30      &      57 &   61 &   118 \\
30-60      &       5 &    1 &     6 \\
Over 60    &       3 &    0 &     3 \\
\cmidrule(l{.7cm}){2-2}\cmidrule(l{.7cm}){3-3}\cmidrule(l{.7cm}){4-4}
TOTAL      &      70  &  70 &   140 \\
\bottomrule
\end{tabular}
\end{document}