4

I created a table using 'booktabs' as follows:

\documentclass[12pt,a4paper]{report}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[top=1in,bottom=1in,left=1.25in,right=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx}

\begin{document}
\begin{table}[h]
  \centering
  \begin{tabular}{@{}cr@{}c@{}lSSS@{}}
      \toprule
      \multicolumn{1}{l}{\textbf{Batch}} &
      \multicolumn{3}{c}{\textbf{Ratio}} &
      \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Concentration 1\\ (mole/L)\end{tabular}}} &
      \multicolumn{1}{c}{\textbf{\begin{tabular}[c]{@{}c@{}}Concentration 2\\ (mole/L)\end{tabular}}} \\ 
      \midrule
      1 & 10 & : & 1   & 55.55 & 5.555 \\
      2 & 1 & : & 1    & 7.8   & 7.8   \\
      3 & 1 & : & 10   & 0.61  & 6.1   \\
      4 & 1 & : & 1.43 & 1.134 & 0.795 \\ \bottomrule
  \end{tabular}%
\end{table}
\end{document}

Output of above code is as follows:

enter image description here

Which is very good. Now to enhance the above table, I am willing to convert the last two column of the above table by following two columns without disturbing the formatting of the first two columns of the above table.

enter image description here

I tried several ways, but all of them in one way or another affect the formatting of the first two columns. Any help to this issue is very well welcomed and it would help me a lot to make the table more readable.

3

Here s a small selection of possible layouts: enter image description here

\documentclass[12pt,a4paper]{report}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[top=1in,bottom=1in,left=1.25in,right=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{multirow}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize\bfseries}
\usepackage{calc}
\newlength{\mycolumnwidth}
\setlength{\mycolumnwidth}{\widthof{\textbf{Concentration (mole/L)}}}

\begin{document}
\begin{table}[h]
\sisetup{table-column-width=0.5\mycolumnwidth}
  \centering
  \begin{tabular}{@{}cr@{}c@{}lSS[table-format=2.3]S[table-format=1.3]@{}}
      \toprule
      \multirow{2.5}{*}{\thead{Batch}} &
      \multicolumn{3}{c}{\multirow{2.5}{*}{\thead{Ratio}}} &
      \multicolumn{2}{c}{\thead{Concentration (mole/L)}} \\
      \cmidrule{5-6}
      &&&& {\thead{1}} & {\thead{2}}\\ 
      \midrule
      1 & 10 & : & 1   & 55.55 & 5.555 \\
      2 & 1 & : & 1    & 7.8   & 7.8   \\
      3 & 1 & : & 10   & 0.61  & 6.1   \\
      4 & 1 & : & 1.43 & 1.134 & 0.795 \\ \bottomrule
  \end{tabular}%
\end{table}

\begin{table}[h]
\sisetup{table-column-width=0.5\mycolumnwidth}
  \centering
  \begin{tabular}{@{}cr@{}c@{}lSS[table-format=2.3]S[table-format=1.3]@{}}
      \toprule
      \thead{Batch} &
      \multicolumn{3}{c}{\thead{Ratio}} &
      \multicolumn{2}{c}{\thead{Concentration (mole/L)}} \\
      \cmidrule{5-6}
      &&&& {\thead{1}} & {\thead{2}}\\ 
      \midrule
      1 & 10 & : & 1   & 55.55 & 5.555 \\
      2 & 1 & : & 1    & 7.8   & 7.8   \\
      3 & 1 & : & 10   & 0.61  & 6.1   \\
      4 & 1 & : & 1.43 & 1.134 & 0.795 \\ \bottomrule
  \end{tabular}%
\end{table}

\begin{table}[h]
  \centering
  \begin{tabular}{@{}cr@{}c@{}lSS[table-format=2.3]S[table-format=1.3]@{}}
      \toprule
      \multirow{3.5}{*}{\thead{Batch}} &
      \multicolumn{3}{c}{\multirow{3.5}{*}{\thead{Ratio}}} &
      \multicolumn{2}{c}{\thead{Concentration \\ (mole/L)}} \\
      \cmidrule{5-6}
      &&&& {\thead{1}} & {\thead{2}}\\ 
      \midrule
      1 & 10 & : & 1   & 55.55 & 5.555 \\
      2 & 1 & : & 1    & 7.8   & 7.8   \\
      3 & 1 & : & 10   & 0.61  & 6.1   \\
      4 & 1 & : & 1.43 & 1.134 & 0.795 \\ \bottomrule
  \end{tabular}%
\end{table}

\begin{table}[h]
  \centering
  \begin{tabular}{@{}cr@{}c@{}lSS[table-format=2.3]S[table-format=1.3]@{}}
      \toprule
      \thead{Batch} &
      \multicolumn{3}{c}{\thead{Ratio}} &
      \multicolumn{2}{c}{\thead{Concentration \\ (mole/L)}} \\
      \cmidrule{5-6}
      &&&& {\thead{1}} & {\thead{2}}\\ 
      \midrule
      1 & 10 & : & 1   & 55.55 & 5.555 \\
      2 & 1 & : & 1    & 7.8   & 7.8   \\
      3 & 1 & : & 10   & 0.61  & 6.1   \\
      4 & 1 & : & 1.43 & 1.134 & 0.795 \\ \bottomrule
  \end{tabular}%
\end{table}
\end{document}
| improve this answer | |
3

I would (a) employ only 4 columns in the tabular environment and (b) load the dcolumn package and create a new column type which aligns its contents on the : (colon) character. I would also question the need to shout at readers by using bold-facing in the header row. A well-designed table gets its message across without having to resort to the visual equivalent of shouting.

enter image description here

\documentclass[12pt,a4paper]{report}
%\renewcommand{\familydefault}{\rmdefault}  %% that's the default
\usepackage[vmargin=1in,hmargin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,siunitx,dcolumn}
\newcolumntype{d}[1]{D{:}{:}{#1}}

\begin{document}
\begin{table}[h]
  \centering
  \begin{tabular}{@{} c d{2.3} S[table-format=2.3] S[table-format=1.3] @{}}
    \toprule
    Batch & \multicolumn{1}{c}{Ratio} & \multicolumn{2}{c@{}}{Concentration} \\
    & & \multicolumn{2}{c@{}}{(mole/L)}\\
    \cmidrule(l){3-4}
    & & {1} & {2} \\ 
    \midrule
      1 & 10:1   & 55.55  & 5.555 \\
      2 & 1:1    &  7.8   & 7.8   \\
      3 & 1:10   &  0.61  & 6.1   \\
      4 & 1:1.43 &  1.134 & 0.795 \\ 
    \bottomrule
  \end{tabular}
\end{table}
\end{document}
| improve this answer | |
  • Thank you for your answer, it helps. I thought bold letter improve readability of text. But still, I agree and avoid bold letter in future. – Keerthi vasan Apr 6 at 19:01
  • @Keerthivasan - The main purpose of creating a table is (should be?) to help convey information about things more effectively with the table than without the table. What you want to achieve is that your readers will remember the contents of the entire table -- not just the header lines. By using bold-facing in the header line, you undoubtedly create a strong visual emphasis for the header material. Just be careful that emphasizing the header row doesn't come at the expense of readers not speding sufficient time to study the contents of the body of the table as well. – Mico Apr 6 at 19:12

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.