2

I'm using the minipage package to put two tables side by side but while the table part works really well the captions for both tables end up being right next to each other and difficult to distinguish... How would I add some sort of padding or something of that sort to make sure that the captions look separated and become readable?

This is my current table (red line added to indicate where the two separate):

enter image description here

As you can see there is no space between Rain and Table 2 which makes it not very readable...

And here is the code that generates it (minus some of the table rows to make it more readable):

\begin{table}[!htb]
\begin{minipage}{.45\linewidth}
  \centering
    \caption{Markov Chain for Rain Season}
    \begin{tabular}{r|r|c|c}
    \multicolumn{4}{c}{Rain Season MC} \\
    \hline
    \hline
      &       & \multicolumn{2}{c}{$x_{t+1}$}   \\
      &       & $S_D$         & $S_R$          
    \end{tabular}
    \label{tab:markov_chain_RS}
\end{minipage}%
\begin{minipage}{.45\linewidth}
  \centering
    \caption{Markov Chain for Dry Season}
    \begin{tabular}{r  r |c|c}
    \multicolumn{4}{c}{Dry Season MC} \\
    \hline
    \hline
      &       & \multicolumn{2}{c}{$x_{t+1}$}   \\
      &       & $S_D$         & $S_R$      
    \end{tabular}
    \label{tab:markov_chain_DS}
\end{minipage}
\end{table}

Thank you for any help!

3
  • 2
    try to replace \end{minipage}% \begin{minipage}{.45\linewidth} with \end{minipage}\hfill \begin{minipage}{.45\linewidth}
    – touhami
    Jun 5, 2021 at 5:43
  • Since your two tables seem to be quite closely related, why not use a shared caption in combination with a subcaption froe each table? (i.sstatic.net/ONcSA.png)
    – leandriis
    Jun 5, 2021 at 8:41
  • @leandriis also a good suggestion! thank you
    – Eisek
    Jun 6, 2021 at 1:07

1 Answer 1

1

I would write your table as follows:

\documentclass{article}
\usepackage{siunitx}
\usepackage{boldline, multirow}
\usepackage[skip=1ex,labelfont=bf]{caption}
\NewExpandableDocumentCommand\mcc{O{1}m}{\multicolumn{#1}{c}{#2}}

\begin{document}
    \begin{table}[!htb]
    \sisetup{table-format=1.2}
    \renewcommand\arraystretch{1.2}
\begin{minipage}{.45\linewidth}
  \centering
    \caption{Markov Chain for Rain Season}
    \label{tab:markov_chain_RS}
    \begin{tabular}{c|c|S|S}
\mcc[4]{Rain Season MC} \\
    \hlineB{2}
                        &       & \mcc[2]{$x_{t+1}$}    \\
                        &       & {$S_D$}   & {$S_R$}   \\
    \hlineB{1.5}
\multirow{2}*{$x_t$}    & $S_D$ & 0.60      & 0.40      \\
                        & $S_R$ & 0.20      & 0.80      \\
    \hline
\mcc[2]{Steady state}           & 0.33      & 0.67
    \end{tabular}
\end{minipage}
\hfill  % <---
\begin{minipage}{.45\linewidth}
  \centering
    \caption{Markov Chain for Dry Season}
    \begin{tabular}{c|c|S|S}
\mcc[4]{Rain Season MC} \\
    \hlineB{2}
                        &       & \mcc[2]{$x_{t+1}$}    \\
                        &       & {$S_D$}   & {$S_R$}   \\
    \hlineB{1.5}
\multirow{2}*{$x_t$}    & $S_D$ & 0.85      & 0.15      \\
                        & $S_R$ & 0.45      & 0.55      \\
    \hline
\mcc[2]{Steady state}           & 0.75      & 0.25
    \end{tabular}
\end{minipage}
\end{table}
\end{document}

enter image description here

1
  • this is great! thank you!
    – Eisek
    Jun 6, 2021 at 1:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .