You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何实现LaTeX中两栏文本左右分栏且均左对齐?

实现LaTeX页面两侧两栏文本均左对齐的方法

你提供的代码中,右侧列使用了\raggedleft指令,导致内容右对齐,这不符合需求。以下是几种可行的实现方案:

方法1:调整tabularx列格式

平分宽度的两栏左对齐

去掉右侧列的\raggedleft设置,让两列均使用tabularx的默认左对齐格式,两栏会平分页面宽度:

\documentclass[12pt, a4paper]{article}
\usepackage[scale=0.8]{geometry}
\usepackage{tabularx}

\begin{document}
    \noindent
    \begin{tabularx}{\textwidth}{X X}
        \textbf{Seller} & \textbf{Buyer} \\
        John Smith & Jane Smith
    \end{tabularx}
\end{document}

右侧栏紧贴页面右侧

如果希望左侧栏占固定宽度,右侧栏填充剩余空间且内容左对齐,可以将左侧列设为固定宽度的左对齐格式:

\documentclass[12pt, a4paper]{article}
\usepackage[scale=0.8]{geometry}
\usepackage{tabularx}

\begin{document}
    \noindent
    \begin{tabularx}{\textwidth}{l X}
        \textbf{Seller} & \textbf{Buyer} \\
        John Smith & Jane Smith
    \end{tabularx}
\end{document}

方法2:使用minipage实现独立栏

通过两个minipage分别承载左右内容,用\hfill将右侧栏推至页面右侧,栏内内容保持左对齐,还可灵活控制栏宽:

\documentclass[12pt, a4paper]{article}
\usepackage[scale=0.8]{geometry}

\begin{document}
    \noindent
    \begin{minipage}{0.4\textwidth}
        \textbf{Seller} \\
        John Smith
    \end{minipage}
    \hfill
    \begin{minipage}{0.4\textwidth}
        \textbf{Buyer} \\
        Jane Smith
    \end{minipage}
\end{document}

方法3:使用multicol包(适合长文本)

如果需要处理较长的多栏内容,multicol包可自动分栏,默认每栏左对齐,用\columnbreak强制分隔左右内容:

\documentclass[12pt, a4paper]{article}
\usepackage[scale=0.8]{geometry}
\usepackage{multicol}

\begin{document}
    \begin{multicols}{2}
        \textbf{Seller} \\
        John Smith
        \columnbreak
        \textbf{Buyer} \\
        Jane Smith
    \end{multicols}
\end{document}

内容的提问来源于stack exchange,提问作者RafalMaziejuk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 03:52:35