0

I am trying to have 2 tables side by side enter link description here. However the title of the table is long and it seemed overlap/touching it. How to avoid it?

Overlap point as shown: enter image description here

\documentclass{article}
\usepackage{subcaption}
\begin{document}

\begin{table}[!htb] \caption{Experimental setup for testing testing testing testing testing} \begin{subtable}{.5\linewidth} \centering \caption{Experimental setup for testing testing testing testing testing} \begin{tabular}{ll} 1 & 2 \end{tabular} \end{subtable}% \begin{subtable}{.5\linewidth} \centering \caption{Experimental setup for testing testing testing testing testing} \begin{tabular}{ll} 3 & 4 \end{tabular} \end{subtable} \end{table}

\end{document}

aan
  • 2,663
  • 1
    I'm not sure I properly got what you need but since the two tables are 0.5\linewidth it almost a sure thiing that they would overlap at the end. – mxnc baud Jan 01 '21 at 20:56
  • @mxncbaud, I mean the caption of the table does a little overlap. The table does not. Even I had changed \begin{subtable}{.25\linewidth}. The caption of the Table do overlap – aan Jan 01 '21 at 21:00
  • Ok, what happens if you add \hfill between the subtables ? – mxnc baud Jan 01 '21 at 21:04
  • @mxncbaud I tried \end{subtable}% \hfill \begin{subtable}{.5\linewidth}. the same – aan Jan 01 '21 at 21:16
  • you also have to reduce a little the width of your subtables. – mxnc baud Jan 01 '21 at 21:24

1 Answers1

1

Is this somewhat close to your expectations ?

\documentclass{article}
\usepackage{subcaption}
 \usepackage{amsmath}
      \usepackage{amsfonts}
      \usepackage{amssymb}
\begin{document}
\begin{table}[!htb]
    \caption{Experimental setup for testing testing testing testing testing}
    \begin{subtable}{.45\linewidth}
      \centering
      \caption{Experimental setup for testing testing testing testing testing}
        \begin{tabular}{ll}
            1 & 2
        \end{tabular}
    \end{subtable}\hfill
    \begin{subtable}{.45\linewidth}
      \centering
      \caption{Experimental setup for testing testing testing testing testing}
        \begin{tabular}{ll}
            3 & 4
        \end{tabular}
    \end{subtable} 
\end{table}

\end{document}

enter image description here

mxnc baud
  • 501