I have the following code:
\documentclass[11pt,a4paper]{article}
\begin{document}
\begin{tabular}{p{1cm}l}
1 & 1 \\
1 & 1
\end{tabular}
\section{Section}
\begin{tabular}{p{1cm}l}
1 & 1 \\
1 & 1
\end{tabular}
\end{document}
For some reason that I don't understand the first table is further to the right than the second table. Here is an image:
I want that both tables start at the same horizontal position. Somehow the missalignment is caused by the \section command because if I replace that with some normal text the tables are aligned correctly:
\documentclass[11pt,a4paper]{article}
\begin{document}
\begin{tabular}{p{1cm}l}
1 & 1 \\
1 & 1
\end{tabular}
Some text.
\begin{tabular}{p{1cm}l}
1 & 1 \
1 & 1
\end{tabular}
\end{document}
This code produces two tables that start at the same horizontal position:
I want the tables in the first image be aligned like in the second image but with a section between them.
What is causing this issue with \section and how can I fix it?
EDIT: Adding \mbox as suggested by Peter Wilson seems to fix the alignment problem but the vertical distance is then too big:
\documentclass[11pt,a4paper]{article}
\begin{document}
\begin{tabular}{p{1cm}l}
1 & 1 \\
1 & 1
\end{tabular}
\section{Section}
\mbox{}
\begin{tabular}{p{1cm}l}
1 & 1 \
1 & 1
\end{tabular}
\section{Section}
\begin{tabular}{p{1cm}l}
1 & 1 \
1 & 1
\end{tabular}
\end{document}
I would like to have the same distance between table and section as in the case when there is no mbox.





\sectionis not indented. Try\section{..} \mbox{} \begin{tabular...}(untested). – Peter Wilson Jun 16 '21 at 16:23\noindent \begin{tabular}{p{1cm}l}– Simon Dispa Jun 16 '21 at 16:34