3

First thing first, my LaTeX code,

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.25in, bottom=0.25in, left=0.25in, right=0.25in]{geometry}
\usepackage{multirow,array,varwidth,spreadtab,caption}
\usepackage{booktabs}
\usepackage{siunitx,booktabs,caption}
\usepackage{multirow,array,varwidth,spreadtab,}
\usepackage{siunitx,booktabs,caption}
\usepackage{ragged2e}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\RaggedLeft\hspace{0pt}}p{#1}}
%%% change contents font %%%
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
\usepackage[T1]{fontenc}
%%% %%% %%% %%% %%% %%% %%%%
\begin{document}
\begin{table}
\large                              
\captionsetup{labelformat=empty,font=large}
\centering \caption{REVENUE INTERESTS}
\begin{tabular}{
  *{5}{S[table-format=1.4]}
 }
  \toprule
& {Expense}  & {Oil/}       & {Plant}    &       \\
& {Interest} & {Condensate} & {Products} & {Gas} \\
\cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
\bf{INITIAL} & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\bf{FINAL}   & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\bf{REMARKS} & \multicolumn{4}{c}{\bf{ALL AMOUNTS ARE EXPRESSED IN THOUSANDS OF DOLLARS.}}\\
  \multicolumn{5}{l}{%
  \scriptsize
  %
}
\end{tabular}
\end{table}
\end{document}

and export table looks like below, What I am currently at

What I want to edit the table into,

1. Partial Toprule line, make caption centered with shorten toprule. 2. Even sub column distribution 3. Reduce the veritcal distance between caption and table itself.

which should be looks like pic below, Hoping to finish like this

Thanks a lot.

3

You can define a local command that sets all headers in a \makebox with the same width; experiment with the width until you're satisfied.

In the code I left just the packages necessary for typesetting the table. Note that you don't want \caption, as “Revenue Interests” is the header of the table.

\documentclass{article}
\usepackage[T1]{fontenc}

%%% change contents font %%%
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
%%% %%% %%% %%% %%% %%% %%%%

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}
\newcommand{\fl}[1]{\makebox[.15\textwidth]{#1}}
\centering
\begin{tabular}{
  l
  *{4}{S[table-format=1.4]}
 }
& \multicolumn{4}{c}{\textbf{REVENUE INTERESTS}}\\
\cmidrule[\heavyrulewidth]{2-5}
& {\fl{Expense}}  & {\fl{Oil/}}       & {\fl{Plant}}    &       \\
& {\fl{Interest}} & {\fl{Condensate}} & {\fl{Products}} & {\fl{Gas}} \\
\cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
\textbf{INITIAL} & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\textbf{FINAL}   & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\textbf{REMARKS} & 
  \multicolumn{4}{c}{\textbf{ALL AMOUNTS ARE EXPRESSED IN THOUSANDS OF DOLLARS.}}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

You get right alignment with respect to the \cmidrule with the option table-alignment=right:

\documentclass{article}
\usepackage[letterpaper, top=0.25in, bottom=0.25in, left=0.25in, right=0.25in]{geometry}
\usepackage[T1]{fontenc}

%%% change contents font %%%
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault} 
%%% %%% %%% %%% %%% %%% %%%%

\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}
\newcommand{\fl}[1]{\makebox[.12\textwidth]{#1}}
\centering
\begin{tabular}{
  l
  *{4}{S[table-format=1.4,table-alignment=right]}
 }
& \multicolumn{4}{c}{\textbf{REVENUE INTERESTS}}\\
\cmidrule[\heavyrulewidth]{2-5}
& {\fl{Expense}}  & {\fl{Oil/}}       & {\fl{Plant}}    &       \\
& {\fl{Interest}} & {\fl{Condensate}} & {\fl{Products}} & {\fl{Gas}} \\
\cmidrule(lr){2-2} \cmidrule(lr){3-3} \cmidrule(lr){4-4} \cmidrule(lr){5-5}
\textbf{INITIAL} & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\textbf{FINAL}   & 1.2345 & 1.2345 & 1.2345 & 1.2345 \\
\textbf{REMARKS} & 
  \multicolumn{4}{c}{\textbf{ALL AMOUNTS ARE EXPRESSED IN THOUSANDS OF DOLLARS.}}\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

enter image description here

| improve this answer | |
  • How could I set all value and value only flush right? – Cheng Zhang May 18 '15 at 21:13
  • @ChengZhang Flush right with respect to what? Believe me, you want them centered, because the headers have different widths. – egreg May 18 '15 at 21:14
  • @ egreg With respect to the right end of midrule. It's a typesetting requirement, otherwise I would definitely follow your advice. – Cheng Zhang May 18 '15 at 21:23
  • @ChengZhang You have all my sympathy. ;-). Added. – egreg May 18 '15 at 21:35
  • How do I make another newcommand to control specific sub column width? – Cheng Zhang May 19 '15 at 19:32
1

Try:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[letterpaper, top=0.25in, bottom=0.25in, left=0.25in, right=0.25in]{geometry}
\usepackage{multirow,array,varwidth,spreadtab,caption}
\usepackage{booktabs}
\usepackage{siunitx,booktabs,caption}
\usepackage{multirow,array,varwidth,spreadtab,}
\usepackage{ragged2e}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}}p{#1}}
\newcolumntype{R}[1]{>{\RaggedLeft\hspace{0pt}}p{#1}}
%%% change contents font %%%
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
\usepackage[T1]{fontenc}

\usepackage[active,floats,tightpage]{preview}% just for showing only table
    \setlength\PreviewBorder{1em}
%%% %%% %%% %%% %%% %%% %%%%
    \begin{document}
\begin{table}
\large
\centering 
\begin{tabular}{>{\bfseries}l}
\\
\\
\\[0.8em] % determined experimentally 
INITIAL         \\
FINAL           \\
REMARKS         \\%
    \end{tabular}
    \begin{tabular}{*{4}{S[table-format=1.4]}}
\multicolumn{4}{c}{\textbf{REVENUE INTERESTS.}} \\
    \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 \\
\multicolumn{4}{c}{\textbf{ALL AMOUNTS ARE EXPRESSED IN THOUSANDS OF DOLLARS.}}
    \end{tabular}
\end{table}
    \end{document}

In preamble I erase duplicate package. Since Caption is not enumerated, I put it in first row of second tabular environment.

enter image description here

Edit: equal width of columns you can obtain to merge first and second row in second tabular environment (last one is wider since text in last row is to wide).

    \begin{document}
\begin{table}
\large
\centering 
\begin{tabular}{>{\bfseries}l}
\\
\\[0.75em] 
INITIAL         \\
FINAL           \\
\midrule
REMARKS         \\%
    \end{tabular}%
    \begin{tabular}{*{4}{S[table-format=1.4]}}
\multicolumn{4}{c}{\textbf{REVENUE INTERESTS.}} \\
    \toprule
{Expense Interest}   
            &   {Oil/Condensate}      
                            & {Plant 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 \\
    \midrule
\multicolumn{4}{c}{\textbf{ALL AMOUNTS ARE EXPRESSED IN THOUSANDS OF DOLLARS.}}
    \end{tabular}
\end{table}
    \end{document}

I add just a content of table ...

enter image description here

| improve this answer | |
  • Your answer perfectly fit my first and third questions, and I would applied your answer for sure. But do you have any idea how to get my second question and how to evenly distribute sub 4 columns ? – Cheng Zhang May 18 '15 at 20:09
  • Sorry, I do not understand your second question. Do you like to have al columns with equal with or something else? – Zarko May 18 '15 at 20:10
  • With same width in each column. BTW, How to draw a midrule above [REMAKRS] row, since this is a combination of two tabular environment. Thanks a lot. – Cheng Zhang May 18 '15 at 20:15
  • See a code (it should be self explanatory. In each tabular i put '\midrule' and also put % after first tabular that i stick with next one. – Zarko May 18 '15 at 20:37
  • Thanks a lot, well learned! Appreciated your kind help. Perfect answer! – Cheng Zhang May 18 '15 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.