2

Need to draw a midrule like highlighted style

I could draw most parts of this table. But I have no idea how to draw dash-liked midrule.

Thanks a lot.


\begin{table}
\captionsetup{labelformat=empty}\
\centering \caption{REVENUE INTEREST}\
\begin{tabular}{ccccc}
\toprule
\multirow{2}{*}{\hspace{5 mm}}&EXPENSE&Oil&Plant&Gas\\
\makebox[3em]{}&\makebox[6em]{INTEREST}&\makebox[6em]{Condensate}&\makebox[6em]{Products}&\makebox[6em]{\hspace{5 mm}} \\
A&\parbox[c][3em][c]{6em}{0.0000}&4&2&1\\
\bottomrule [0.0 pt]

\end{tabular}
\end{table}
Werner
  • 603,163
  • Welcome to TeX.SX! You mean \cmidrule perhaps? –  May 14 '15 at 22:40
  • An alternative could be this answer of mine: http://tex.stackexchange.com/questions/169098/dotted-line-instead-of-hline-in-table-environment/169103#169103 –  May 14 '15 at 22:55
  • Yes, I need to create a template for report, that's is the exactly thing bug me for a day. Thank you very much. – Cheng Zhang May 15 '15 at 02:28

2 Answers2

2

Here is my own homebrew concoction of \tabdashline, based on my answer at Dotted line instead of \hline in table environment. Here, I don't extend it out to the cell boundaries. It only does one column at a time. The syntax &&&\tabdashline will place the dashfill in the 4th column.

Parameters like \repfrac, \replength, and \rulewidth allow the dashed line to be tailored.

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs,multirow}
\newlength\replength
\newcommand\repfrac{.66}
\newcommand\dashfrac[1]{\renewcommand\repfrac{#1}}
\setlength\replength{5pt}
\newcommand\rulewidth{.8pt}
\newcommand\tdashfill[1][\repfrac]{\cleaders\hbox to \replength{%
  \smash{\rule[\arraystretch\ht\strutbox]{\repfrac\replength}{\rulewidth}}}\hfill}
\newcommand\tabdashline{%
  \tdashfill\hfil%
  \\[-\arraystretch\dimexpr\ht\strutbox+\dp\strutbox\relax]%
}
\begin{document}
\begin{table}
\captionsetup{labelformat=empty}\
\centering \caption{REVENUE INTEREST}\
\begin{tabular}{ccccc}
\toprule
\multirow{2}{*}{\hspace{5 mm}}&EXPENSE&Oil&Plant&Gas\\
\makebox[3em]{}&\makebox[6em]{INTEREST}&\makebox[6em]{Condensate}&\makebox[6em]{Products}&\makebox[6em]{\hspace{5 mm}} \\
   & \tabdashline
  && \tabdashline
 &&& \tabdashline 
&&&& \tabdashline
A&\parbox[c][3em][c]{6em}{0.0000}&4&2&1\\
\bottomrule [0.0 pt]
\end{tabular}
\end{table}
\end{document}

enter image description here

If one is unhappy with the syntax of

   & \tabdashline
  && \tabdashline
 &&& \tabdashline 
&&&& \tabdashline

then here is an alternate version that instead uses

 & \tabdashline & \tabdashline & \tabdashline & \tabdashline\tabdashnewline

Here is the MWE:

\documentclass{article}
\usepackage{caption}
\usepackage{booktabs,multirow}
\newlength\replength
\newcommand\repfrac{.66}
\newcommand\dashfrac[1]{\renewcommand\repfrac{#1}}
\setlength\replength{5pt}
\newcommand\rulewidth{.8pt}
\newcommand\tdashfill[1][\repfrac]{\cleaders\hbox to \replength{%
  \smash{\rule[\arraystretch\ht\strutbox]{\repfrac\replength}{\rulewidth}}}\hfill}
\newcommand\tabdashline{%
  \tdashfill\hfil%
}
\newcommand\tabdashnewline{%
  \\[-\arraystretch\dimexpr\ht\strutbox+\dp\strutbox\relax]%
}
\begin{document}
\begin{table}
\captionsetup{labelformat=empty}\
\centering \caption{REVENUE INTEREST}\
\begin{tabular}{ccccc}
\toprule
\multirow{2}{*}{\hspace{5 mm}}&EXPENSE&Oil&Plant&Gas\\
\makebox[3em]{}&\makebox[6em]{INTEREST}&\makebox[6em]{Condensate}&\makebox[6em]{Products}&\makebox[6em]{\hspace{5 mm}} \\
 & \tabdashline & \tabdashline & \tabdashline & \tabdashline\tabdashnewline
A&\parbox[c][3em][c]{6em}{0.0000}&4&2&1\\
\bottomrule [0.0 pt]
\end{tabular}
\end{table}
\end{document}
1

For numeric tables, use siunitx.

\documentclass{article}
\usepackage{siunitx,booktabs,caption}

\begin{document}

\begin{table}

\captionsetup{labelformat=empty}
\centering \caption{REVENUE INTEREST}
\begin{tabular}{
  *{4}{S[table-format=1.4]}
 }
\toprule
{Expense}  & {Oil/}       & {Plant}    &       \\
{Interest} & {Condensate} & {Products} & {Gas} \\
\cmidrule(lr){1-1} \cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4}
1.2345 & 1.2345 & 1.2345 & 1.2345 \\
1.2345 & 1.2345 & 1.2345 & 1.2345 \\
1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\midrule[\heavyrulewidth]
\multicolumn{4}{l}{%
  \footnotesize
  All amounts are expressed in thousands of dollars%
}
\end{tabular}

\end{table}

\end{document}

enter image description here

egreg
  • 1,121,712