[Tex/LaTex] How to align multiple tables vertically

tables

The first tables isn't aligned with the rest

\section{User Requirements}
\hfill
\begin{tabular}{|p{2.8cm}||p{12cm}|}
\hline
\rowcolor{lightgray}\multicolumn{2}{|l|}{Requirements} \\
\hline
Number & 1 \\
\hline
Description  & The app shall store a database of information about                psychoanalytical scales on the phone\\
\hline
Rationale&  This is the main function of the app.  It will hold a list of pyschoanalytical scales and their interpretation for quick review by clinicians\\
\hline
Type &Non-functional \\
\hline
How to validate&User testing - can the user access the database\\
\hline
\end{tabular}

\begin{tabular}{|p{2.8cm}||p{12cm}|}
\hline
\rowcolor{lightgray} \multicolumn{2}{|l|}{Requirements} \\
\hline
Number & 2 \\
\hline
Description  & The user shall be able to scroll through the list of entries in the database\\
\hline
Rationale&  The client identified a similar app that had scrolling behavior in and alphabetical list and really liked the way the app worked.  As users will generally know how to spell the scale name, this is a natural way to access the scales as well as browse available scales\\
\hline
Type &Functional\\
\hline
How to validate&User testing - scroll up and down through the list.  Should test what happens when scrolling  all the way to the top and to the bottom\\
\hline
\end{tabular}

Best Answer

A blank line starts a new paragraph, which is indented. Paragraphs following section headings are not indented, by default. So you need to prevent indentation of subsequent tables to ensure vertical alignment:

\documentclass{article}
\usepackage[table]{xcolor}
\begin{document}
\section{User Requirements}
\hfill
\begin{tabular}{|p{2.8cm}||p{12cm}|}
\hline
\rowcolor{lightgray}\multicolumn{2}{|l|}{Requirements} \\
\hline
Number & 1 \\
\hline
Description  & The app shall store a database of information about                psychoanalytical scales on the phone\\
\hline
Rationale&  This is the main function of the app.  It will hold a list of pyschoanalytical scales and their interpretation for quick review by clinicians\\
\hline
Type &Non-functional \\
\hline
How to validate&User testing - can the user access the database\\
\hline
\end{tabular}

\noindent\begin{tabular}{|p{2.8cm}||p{12cm}|}
\hline
\rowcolor{lightgray} \multicolumn{2}{|l|}{Requirements} \\
\hline
Number & 2 \\
\hline
Description  & The user shall be able to scroll through the list of entries in the database\\
\hline
Rationale&  The client identified a similar app that had scrolling behavior in and alphabetical list and really liked the way the app worked.  As users will generally know how to spell the scale name, this is a natural way to access the scales as well as browse available scales\\
\hline
Type &Functional\\
\hline
How to validate&User testing - scroll up and down through the list.  Should test what happens when scrolling  all the way to the top and to the bottom\\
\hline
\end{tabular}
\end{document}

aligned

Related Question