I am trying to create a table with tree subtables in it. To do so I have written the following code:
\documentclass[twoside]{article}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage{sidecap}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{extramarks}
\usepackage{graphicx}
\usepackage{mathpazo}
\usepackage{amsmath}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage[toc,page]{appendix}
\usepackage{subcaption}
\begin{document} % <---
\begin{table}[h]
\begin{subtable}[b]{0.5\textwidth}
\centering
\begin{tabular}{ll|ll}
\multicolumn{2}{c|}{Consumo} & \multicolumn{2}{c}{Producción} \\ \hline
Metabolito & Valor & Metabolito & Valor \\ \hline
D-Fructosa & 10,00 & CO\textsubscript{2} & 22,81
\\
Amonio & 4,77 & H\textsubscript{2}O & 29,18
\\
Fosfato & 3,21 & H\textsuperscript{+} & 17,53
\\
O\textsubscript{2} & 22,00 & Acetato & 0,0038 \\ \hline
\end{tabular}
\caption{\textit{E.coli} con fuente de carbono fructosa}\label{tabla4.1}
\end{subtable}
\begin{subtable}[b]{0.5\textwidth}
\centering
\begin{tabular}{ll|ll}
\multicolumn{2}{c|}{Consumo} & \multicolumn{2}{c}{Producción} \\ \hline
Metabolito & Valor & Metabolito & Valor \\ \hline
D-Fructosa & 10,00 & CO\textsubscript{2} & 22,81 \\
Amonio & 4,77 & H\textsubscript{2}O & 29,18 \\
Fosfato & 3,21 & H\textsuperscript{+} & 17,53 \\
O\textsubscript{2} & 22,00 & Acetato & 0,0038 \\ \hline
\end{tabular}
\caption{\textit{E.coli} con fuente de carbono fructosa}\label{tabla4.2}
\end{subtable}
\begin{subtable}[]{0.5\textwidth}
\vspace{15pt}\hspace{0.5\linewidth}\begin{tabular}{ll|ll}
\multicolumn{2}{c|}{Consumo} & \multicolumn{2}{c}{Producción} \\ \hline
Metabolito & Valor & Metabolito & Valor \\ \hline
D-Fructosa & 10,00 & CO\textsubscript{2} & 22,81 \\
Amonio & 4,77 & H\textsubscript{2}O & 29,18 \\
Fosfato & 3,21 & H\textsuperscript{+} & 17,53 \\
O\textsubscript{2} & 22,00 & Acetato & 0,0038 \\ \hline
\end{tabular} \caption{\textit{E.coli} con fuente de carbono fructosa}\label{tabla4.3}
\end{subtable}
\caption{Resultados de las distintas simulaciones}
\end{table}
\end{document}% <---
The problem is that the third subtable is not aligned with its caption:
Is there any easy solution to align them?
Best Answer
\subtable
, consequently using your mwe (after adding missing parts of code, see my comment above) your tables overlaps (red lines on image below indicate your page layout):geometry
(using its default page layout settings) than i obtain after some small tweak of yoursubtable
size, i obtain:Edit: code, where is for chemical formulas used the
mhchem
package, for the last case is: