# Table size, alignment and columns alignment

I'm new with LaTeX. I want to have two tables. The first table renders fine. For the second table, I want it to take full page width and I want text from first column to be aligned left and text from second column to be aligned right.

I have tried the following based on some researches, but table 2 is not taking full with and while the alignment inside columns is as I expect, the table itself is aligned left. (I'm not sure what htbp is, it comes from some example.)

\begin{center} \Large
\begin{tabular}{ l r }
\emph{Text1} & Text2\\
\emph{Text3} & Text4
\end{tabular}
\end{center}

\vskip 7cm

\begin{table}[htbp]
\centering
\begin{tabularx}{\textwidth}{l r}
\ Text5 & Text6\\
\ Text7 & Text8\\
\ Text9 & Text10\\
\ Text11 & Text12\\
\ Text13 & Text14
\end{tabularx}
\end{table}


When I try the following, all previous elements on my page get extra spaces, like the whole page is stretched and second table ends on next page, which should not happen.

\begin{center} \Large
\begin{tabular}{ l r }
\emph{Text1} & Text2\\
\emph{Text3} & Text4
\end{tabular}
\end{center}

\vskip 9cm

\begin{center} \Large
\begin{tabularx}{\textwidth}{ l r }
\ Text5 & Text6\\
\ Text7 & Text8\\
\ Text9 & Text10\\
\ Text11 & Text12\\
\ Text13 & Text14
\end{tabularx}
\end{center}

• A rabularx environment should have at least one X column. – Bernard Feb 12 at 8:50
• What is one X column? – TTT Feb 12 at 8:50
• It is defined by the tabularx package : the X columns share the remaining space on the line, after the other columns have been placed. – Bernard Feb 12 at 8:53
• What about using \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l r @{}} Text5 & Text6\\ Text7 & Text8\\ Text9 & Text10\\ Text11 & Text12\\ Text13 & Text14 \end{tabular*}? Most likely this will give you the desired result. – leandriis Feb 12 at 9:00
• Youi should post a complete (minimal) code reproducing the problem. – Bernard Feb 12 at 9:04

Below is an MWE (Minimal Working Example), which cover most of the comments in your question:

\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} % generate dummy text filler

\begin{document}
\begin{center}
\Large
\begin{tabular}{ l r }
\emph{Text1} & Text2\\
\emph{Text3} & Text4
\end{tabular}
\end{center}

\lipsum[11]% for dummy text

\begin{center} \Large
\begin{tabularx}{\textwidth}{ X >{\raggedleft\arraybackslash}X}
Text5  & Text6\\
Text7  & Text8\\
Text9  & Text10\\
Text11 & Text12\\
Text13 & Text14
\end{tabularx}
\end{center}
However, people usual add to table at least top and bottom lines:
\begin{center}
\Large
\begin{tabular}{ l r }
\hline
\emph{Text1} & Text2    \\
\emph{Text3} & Text4    \\
\hline
\end{tabular}
\end{center}

\begin{center} \Large
\begin{tabularx}{\textwidth}{ X >{\raggedleft\arraybackslash}X}
\hline
Text5  & Text6     \\
Text7  & Text8     \\
Text9  & Text10    \\
Text11 & Text12    \\
Text13 & Text14    \\
\hline
\end{tabularx}
\end{center}
\end{document}


which generate:

(red lines show page layout)

I strongly encourage you to read some introductory text about tables. For example wiki: latex tables.

For table design, you may choose environments, as tabular, which is part of LaTeX kernel, tabularx, tabulary, longtable, xltabular etc, which are provided by packages of the same name.

I actually want each column to take 50% width

\documentclass{article}
\usepackage{booktabs} % nice rules
\usepackage{tabularx,array}
\newcolumntype{L}{>{\raggedleft\arraybackslash}X}
\begin{document}
\begin{tabularx}{.3\textwidth}{XL}
\toprule
Text5 & Text6\\
Text13 & Text14\\
\bottomrule
\end{tabularx}
\end{document}


I want it to take full page width

I refuse to make such aberration with only two narrow columns, but how change .3\textwidth is obvious, right?