4

enter image description here

I am having the issue of width(size of the table). I want the 2nd table to be of the same width as the 1st one. Kindly help me with this. Thanks

Code of 2nd table is:

\begin{table}[]
\begin{tabular}{|l|l|l|}
\hline
\textbf{ID} & \textbf{Priority} & \textbf{Details}                                                                                                                                                                                   \\ \hline
NR-01-001   & 1                 & Delivery: The system development process and deliverable documents shall conform to the process and deliverables dened in document \textbackslash{}CIIT-CE-02H DegreeProject Student's Handbook". \\ \hline
NR-01-002   & 1                 & Standard: The standard of the final product shall be of undergraduate level or above.                                                                                                            \\ \hline
\end{tabular}
\end{table}
1
  • Use a p type column instead of l for the last column in both tabular environments. Make sure to use the identical width argument in both to get equally wide tables. (Something like \begin{tabular}{|l|l|p{7cm}|} used for both tables should result in both tables being equally wide.) Depending on the expected output, you could also give tabularx a try: \begin{tabularx}{\linewidth}{|l|l|X|}(needs the tabularx package). Lastly, it could also be easier to just use a single tabular environment instead of two. – leandriis May 17 at 8:19
5

I suggest you to use tabularx instead simple tabular. Its X (and from it derived ) column's types enables automatic determination of column width and, what is in your case important, breaking text into multi lines:

\documentclass{article}
\usepackage{tabularx}

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document


\begin{document}
\lipsum[1][1-2]
    \begin{table}[ht]
\begin{tabularx}{\linewidth}{|l|l|X|}
    \hline
\textbf{ID} & \textbf{Priority} 
                    & \textbf{Details}  \\ 
    \hline
NR-01-001   & 1     & Delivery: The system development process and deliverable documents shall conform to the process and deliverables dened in document \textbackslash{}CIIT-CE-02H DegreeProject Student's Handbook". \\
    \hline
NR-01-002   & 1     & Standard: The standard of the final product shall be of undergraduate level or above.     \\
    \hline
\end{tabularx}
    \end{table}
\end{document}

enter image description here

(red lines indicate text borders)

2
  • Thank you Zarko, it's absolutely what I want. – Ch Qasim May 17 at 15:32
  • 1
    @ChQasim, you are welcome :-) – Zarko May 17 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.