如何垂直对齐多个表格

如何垂直对齐多个表格

第一个表与其他表不对齐

\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}

答案1

一个空白行开始一个新段落,该段落会缩进。默认情况下,节标题后面的段落不会缩进。因此,您需要防止后续表格缩进以确保垂直对齐:

\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}

对齐

相关内容