I am trying to place two tablex next to each other in my TeXstudio Editor. Luckily, the following post already helped me doing so: stackexchange
But I am having issues with my captions. They do not align with my tables. I use a combination of minigpage and longtables and my result looks like this:
The \centering command won't help out. At some locations I even receive error messages. This is my working code so far (content reduced):
\begin{minipage}[t]{.5\linewidth}
\centering
\arrayrulecolor[rgb]{0.753,0.753,0.753}
\arrayrulecolor[rgb]{0.753,0.753,0.753}
\begin{longtable}{>{\hspace{0pt}}m{0.18\linewidth}!{\color{black}\vrule}>{\RaggedLeft\hspace{0pt}}m{0.25\linewidth}|>{\RaggedLeft\hspace{0pt}}m{0.25\linewidth}}
WBP & \multicolumn{1}{>{\hspace{0pt}}m{0.25\linewidth}|}{Min CWT (incl.)} & \multicolumn{1}{>{\hspace{0pt}}m{0.25\linewidth}}{Max CWT (excl.)} \endfirsthead
\arrayrulecolor{black}\hline
MIN & 0 & 6 \\
\arrayrulecolor[rgb]{0.753,0.753,0.753}\hline
N & 6 & 45 \\
[...] \\
\hline
\caption{A}
\end{longtable}
\arrayrulecolor{black}
\end{minipage}%
\begin{minipage}[t]{.5\linewidth}
\centering
\arrayrulecolor[rgb]{0.753,0.753,0.753}
\begin{longtable}{>{\hspace{0pt}}m{0.18\linewidth}!{\color{black}\vrule}>{\RaggedLeft\hspace{0pt}}m{0.25\linewidth}|>{\RaggedLeft\hspace{0pt}}m{0.25\linewidth}}
WBP & \multicolumn{1}{>{\hspace{0pt}}m{0.25\linewidth}|}{Min CWT (incl.)} & \multicolumn{1}{>{\hspace{0pt}}m{0.25\linewidth}}{Max CWT (excl.)} \endfirsthead
\arrayrulecolor{black}\hline
MIN & 0 & 6 \\
\arrayrulecolor[rgb]{0.753,0.753,0.753}\hline
N & 6 & 45 \\
[...] \\
\hline
\caption{B}
\end{longtable}
\arrayrulecolor{black}
\end{minipage}
I would very much appreciate a hint or even exact solution, how my captions get centered below the tables. Furthermore, I assume I could use \vspace*{-Xmm} to move the caption vertically, if necessary.
Thanks a lot in advance and best regards DomHaw

longtablein aminipagedoesn't make any sense, that's justtabularwith extra steps.longtableis all about being page-breakable, whereas aminipagecan't be broken. – Skillmon Jan 18 '21 at 10:59\begin{minipage}{.45\linewidth}\centering\begin{tabular}...\end{tabular}\captionof{table}{...}\end{minipage}\hfill\begin{minipage}{.45\linewidth}\centering\begin{tabular}...\end{tabular}\captionof{table}{...}\end{minipage}.\captionofis provided by the KOMA-script class (scrartcl,scrreprt,scrbook), thecapt-ofpackage, or thecaptionpackage (if you use either of these you don't need the rest, the most lightweight variant iscapt-of). – Skillmon Jan 18 '21 at 11:01\documentclassor\begin{document}perhaps I can guess which package you used to define\arrayrulecolor(as I wrote it) but you should not make people have to guess. – David Carlisle Jan 18 '21 at 12:19\begin{table}\begin{minipage}...doesn't make much sense as well (except if you put bothminipages in the sametableenvironment). If you want the tables to be able to float that would indeed be the correct approach. – Skillmon Jan 18 '21 at 14:21