# \midrule dashed and colored in booktabs — two kinds of midrules in one booktab

Is it possible to make two \midrules in one booktab? The first one should be colored, the second one colored and dashed, as it is shown in the picture. Before each entry is a horizontal space - how to include such space in my table?

![output as it should be][1]

\documentclass{beamer}

\mode<presentation>
\setbeamercovered{transparent}
}

\usepackage{booktabs}

\usepackage{amsmath}
\usepackage{amsfonts}

\usepackage[utf8x]{inputenc}
\usepackage[MeX]{polski}

\usepackage{tabularx}
\usepackage{color}
\usepackage{graphicx}

\usepackage[utopia]{mathdesign}

\usecolortheme{crane}

\renewcommand\figurename{Rys.}
\def\captionlabeldelim{.}

\renewcommand\tablename{Tab.}
\def\captionlabeldelim{.}
\usepackage[small,bf,singlelinecheck=off]{caption}

\title[Midrule]
{\textbf{midrule}\\ colored and dashed}
\subtitle{}
\author[]{No name}
\institute[Boo]
{    }
\date[19.10.12]
{\\ }

\subject{Foo}
\AtBeginSection[]
{ \begin{frame}<beamer>
\frametitle{Plan}
\tableofcontents[currentsection]
\end{frame}
}

\begin{document}
\begin{frame}
\begin{center}
\begin{table}
\begin{tabular}{@{}m{\dimexpr.45\textwidth}ccc@{}}
\toprule
procesy & Min & Max  & Else\    \midrule
Junior         & 1 000 & 2 800 & 4 500\    \midrule
Senior         &  & ? &\    \midrule
Specjalist     &  & ? &\    \midrule
Team Leader    &  & ? &\    \bottomrule
\end{tabular}
\caption{1. Caption}
\label{tabela1}
\end{table}
\end{center}
\end{frame}
\end{document}

-
To get the leading space you could either insert an \hspace*{<len>}, or add a leading column and use \multicolumn{2}{l}{procesy} for the title row so that it spans the first two columns. And add a leading & for the subsequent rows. – Peter Grill Oct 24 '12 at 19:18
Well, are you sure that your minimal working example (MWE) is really minimal? BTW: I suggest using \centering instead of the center environment. – Stephen Oct 24 '12 at 19:23
Why not avoiding altogether the horizontal rules you want to be dashed? It's a table and it's natural to read it by rows. – egreg Oct 24 '12 at 21:18

You can use the tabu package instead:

\documentclass{beamer}
\usepackage{tabu}

\begin{document}

\begin{frame}
\begin{table}
\tabulinesep =_4pt^4pt
\begin{tabu}to \textwidth{@{}cX[m]ccc@{}}
\tabucline[1pt blue!40 off 0pt]{-}
\multicolumn{2}{@{}l}{procesy} & Min & Max  &Dalkia\\
\tabucline[0.7pt blue!40 off 0pt]{-}
& Junior         & 1 700 & 2 800 & 3 200\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Senior         &  & ? &\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Specjalist     &  & ? &\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Team Leader    &  & ? &\\
\tabucline[1pt blue!40 off 0pt]{-}
\end{tabu}
\caption{1. Wynagrodzenia: Procesy HR}
\label{tabela1}
\end{table}
\end{frame}

\end{document}


-
Great! Gonzalo Medina how to gain more space between text and value [under Min, Max and Dalkia]. Beside that looks like masterpice. Thank You – Daniel Miliński Oct 24 '12 at 22:29
@DanielMiliński you can add a \strut before "procesy": for example, \multicolumn{2}{@{}l}{\strut procesy}. – Gonzalo Medina Oct 24 '12 at 22:39
Still, it dosen't work. Text inside table is to close to numbers. My goal is to get "Min", "Max", "Dalkia" on the left side [as close as possible] and get more space for text on right side. – Daniel Miliński Oct 24 '12 at 22:47
@DanielMiliński Ah, sorry! I misunderstood your previous comment. I've updated my answer. – Gonzalo Medina Oct 25 '12 at 3:28
@azetina booktabs doesn't offer built-in dashed lines; one could do some work to get them, but I don't think it's worth, specially if tabu offers them ready to use. – Gonzalo Medina Oct 25 '12 at 3:35

Here is an option that compares the tabu output of Gonzalo's answer with that of booktabs. It's workable in comparison with tabu, but it's not always pretty.

\documentclass{article}
\usepackage{tabu}% http://ctan.org/pkg/tabu
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\makeatletter
\newcommand{\dashrule}[1][black]{%
}
\newcommand{\rulecolor}[1]{%
\def\CT@arc@{\color{#1}}%
}
\makeatother
\begin{document}

\begin{table}[t]
\tabulinesep =_4pt^4pt
\begin{tabu}to \textwidth{@{}cX[m]X[c]X[c]X[c]@{}}
\tabucline[1pt blue!40 off 0pt]{-}
\multicolumn{2}{@{}l}{procesy} & Min & Max  &Dalkia\\
\tabucline[0.7pt blue!40 off 0pt]{-}
& Junior         & 1 700 & 2 800 & 3 200\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Senior         &  & ? &\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Specjalist     &  & ? &\\
\tabucline[0.4pt blue!40 off 2pt]{-}
& Team Leader    &  & ? &\\
\tabucline[1pt blue!40 off 0pt]{-}
\end{tabu}

\bigskip

\rulecolor{blue!40}
\begin{tabularx}{\linewidth}{X>{\centering}X>{\centering}X>{\centering\arraybackslash}X@{}}
\toprule
procesy & Min & Max & Delta \\
\midrule
Junior & 1\,700 & 2\,800 & 3\,200 \\[-\jot]
\multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
Senior         &  & ? &\\
\multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
Specjalist     &  & ? &\\
\multicolumn{4}{@{}c@{}}{\makebox[\linewidth]{\dashrule[blue!40]}} \\[-\jot]
Team Leader    &  & ? &\\
\bottomrule
\end{tabularx}
\caption{1. Wynagrodzenia: Procesy HR}
\end{table}

\end{document}


The use of tabularx makes it convenient to specify the tabular width. Rule colour is specified using \rulecolor{<color>} and that of the dashed rule is done using \dashrule[<color>].

-
For me - Looks very good. Thank You Werner! – Daniel Miliński Oct 25 '12 at 9:55