Search code examples
latex

Left aligning two columns of text


I want to have to columns of text on the opposite sides of the page that both will be left aligned. I have the following LaTeX code so far:

\documentclass[12pt, a4paper]{article}

\usepackage[scale=0.8]{geometry}
\usepackage{tabularx}

\begin{document}
    \noindent
    \begin{tabularx}{\textwidth}{X >{\raggedleft\let\newline\\\arraybackslash}X }
        \textbf{Seller} & \textbf{Buyer} \\
        John Smith & Jane Smith
    \end{tabularx}
\end{document}

Which produces: enter image description here

But still the text on the right isn't left aligned. Is there any other way to achieve my goal?


Solution

  • You could use an l column to left align the second column:

    \documentclass[12pt, a4paper]{article}
    
    \usepackage[scale=0.8]{geometry}
    \usepackage{tabularx}
    
    \begin{document}
        \noindent
        \begin{tabularx}{\textwidth}{Xl}
            \textbf{Seller} & \textbf{Buyer} \\
            John Smith & Jane Smith
        \end{tabularx}
    \end{document}
    

    enter image description here