1

I generate a table with the following code:

\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\usepackage{multirow}
\usepackage{array}
\begin{table}[H]
\centering
 \caption{Comparison of market prices, Black-Scholes prices and calibrated 
 Kou prices}
\begin{tabular}{>{\bfseries}c*{6}{c}}\toprule
   \multirow{3.5}{*}{\bfseries Exercise Date} & &  &  \textbf{Strike Price} 
& \textbf{}\\
    \cmidrule(r{4pt}){2-6}
& & \multicolumn{3}{c}{\bfseries 4800} &      \\ 
 \cmidrule(r{4pt}){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\midrule
18/11/2017 & x & x  & x & x & x  \\
6/12/2017  & x & x  & x & x & x \\ 
1/05/2018  & x & x  & x & x & x  \\
12/06/2018  & x & x  & x & x & x  \\ \bottomrule
  \end{tabular}
  \begin{tabular}{>{\bfseries}c*{6}{c}}
 & & \multicolumn{3}{c}{\bfseries 5600} &      \\ 
 \cmidrule(r{4pt}){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\midrule
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ 
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ \bottomrule
 \end{tabular}
\begin{tabular}{>{\bfseries}c*{6}{c}}
& & \multicolumn{3}{c}{\bfseries 5900} &      \\ 
 \cmidrule(r{4pt}){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\midrule
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ 
  & x & x  & x & x & x\\
  & x & x  & x & x & x \\ \bottomrule
  \end{tabular}
 \end{table}
 \end{document}

The outputted table is: fout Now, the table should look like:

enter image description here So the second and third tabular need to be aligned with the top tabular. Also the tabular headings need to be centered, as well as the word "Exercise Date" (see the image above).

How can I get this done? (maybe with setting a fixed column widt?)

1 Answers1

2

To keep columns aligned, it is better to merge the three tabulars into one. This is simply achieved via commenting out four lines, \end{tabular}\begin{tabular} .. \end{tabular}\begin{tabular}, as shown below. You will face only one problem, which is how to trim the \bottomrules of the 2nd and 3rd tabulars, this can be solved by using \cmidrule[\heavyrulewidth]{2-6} instead of a \bottomrule.

\documentclass[10pt,a4paper]{article}
\usepackage{multirow,booktabs}
\usepackage{array}
\usepackage[margin=.8in]{geometry}
\begin{document}

\begin{table}
\centering
 \caption{Comparison of market prices, Black-Scholes prices and calibrated 
 Kou prices}
\begin{tabular}{>{\bfseries}c*{6}{c}}\toprule
   \multirow{3.5}{*}{\bfseries Exercise Date} & &  &  \textbf{Strike Price} 
& \textbf{}\\
    \cmidrule(r{4pt}){2-6}
& & \multicolumn{3}{c}{\bfseries 4800} &      \\ 
 \cmidrule(r{4pt}){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\midrule
18/11/2017 & x & x  & x & x & x  \\
6/12/2017  & x & x  & x & x & x \\ 
1/05/2018  & x & x  & x & x & x  \\
12/06/2018  & x & x  & x & x & x  \\ \bottomrule
  %\end{tabular}
  %\begin{tabular}{>{\bfseries}c*{6}{c}}
 & & \multicolumn{3}{c}{\bfseries 5600} &      \\ 
 \cmidrule(rl){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\cmidrule{2-6}
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ 
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ \cmidrule[\heavyrulewidth]{2-6}
 %\end{tabular}
%\begin{tabular}{>{\bfseries}c*{6}{c}}
& & \multicolumn{3}{c}{\bfseries 5900} &      \\ 
 \cmidrule(rl){2-6}
 & \textbf{Market Price} & \textbf{Black-Scholes Price}& \textbf{Kou Price} & \textbf{BS error} & \textbf{Kou error}\\
\cmidrule{2-6}
  & x & x  & x & x & x\\
  & x & x  & x & x & x\\ 
  & x & x  & x & x & x\\
  & x & x  & x & x & x \\ \cmidrule[\heavyrulewidth]{2-6}
  \end{tabular}
 \end{table}

\end{document}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127