【问题标题】:Layout parallel columns in LaTeX?在 LaTeX 中布局平行列?
【发布时间】:2019-04-21 08:18:03
【问题描述】:

我正在寻求如下布局段落: 1. 在引言中,我会在所有列中都有段落。 2.然后沿着两个相反意见的专栏并列。与两列布局不同的是,两列将是平行的,左侧的内容将始终保留在左侧,右侧的内容始终位于右侧,跨越多个页面。即使左列的参数数量较短,右列的参数也不应该浮动到左列。

这是一个 HTML 示例: https://www.biblegateway.com/passage/?search=1+Corinthians+15&version=CCB;KJ21 用于比较不同的翻译。

下面是我尝试达到的效果。

\documentclass{report}
\usepackage[english]{babel}
\usepackage{blindtext}
\begin{document}
\section{Introduction}
Here are the normal paragraph crossing colmuns.

\blindtext

\begin{minipage}[t]{0.5\textwidth}
  \section{Argument on the Left}
  Because I am on the left, so must I be not right?

\end{minipage}\begin{minipage}[t]{0.5\textwidth}
  \section{Argument on the Right}
  Because I am on the right, so I must be right!

  \blindtext
\end{minipage}
\end{document}

几乎达到了效果,只是两列之间没有空隙。

这是结果的屏幕截图:

什么是更好的解决方案?

如何在 org 模式下通过导出为 PDF(通过 LaTex)实现相同的功能?

【问题讨论】:

    标签: latex org-mode


    【解决方案1】:

    要分隔列,使用较小的 minipages 并在它们之间添加空格就足够了。 Minipages 是盒子,你可以使用固定的空间(用~~~或\hspace{}),但更好的是橡胶空间\hfill。

    \usepackage[english]{babel}
    \usepackage{blindtext}
    \begin{document}
    \section{Introduction}
    Here are the normal paragraph crossing colmuns.
    
    \blindtext
    
    \noindent\begin{minipage}[t]{0.48\textwidth}
      \section{Argument on the Left}
      Because I am on the left, so must I be not right?
    \end{minipage}%
    \hfill%
    \begin{minipage}[t]{0.48\textwidth}
      \section{Argument on the Right}
      Because I am on the right, so I must be right!
    
      \blindtext
    \end{minipage}
    \end{document}
    

    \noindent 避免了正常的段落间距,\hfill“将 minipage 推向左右边距。

    但这不是最好的解决方案。您将无法正确管理分页符,并且有一个特定的软件包可以完全按照您的意愿行事。

    paracol 包定义了一个具有 2 个(或更多)列的并行环境,并提供了一种通过在列之间切换来“同步”它们的方法。它负责分页,绝对是您想要的。

    这是一个使用 paracol 的例子

    \documentclass{report}
    \usepackage[english]{babel}
    \usepackage{blindtext}
    \usepackage{paracol}
    \begin{document}
    \section{Introduction}
    Here are the normal paragraph crossing colmuns.
    
    \blindtext
    
    \begin{paracol}{2}
      \section{Argument on the\\ Left}
      Because I am on the left, so must I be not right?
    
      \switchcolumn
      \section{Argument on the\\ Right}
      Because I am on the right, so I must be right!
    
      \blindtext
    \end{paracol}
    \end{document}
    

    如您所见,列之间的部分编号是一致的,但如果您不喜欢,可以通过多种方式自定义包。看documentation 另请注意,我必须添加手动换行符才能正确格式化节标题,但这是一个小缺点。

    关于 org-mode,我使用它,但我没有导出经验,无法真正帮助您。但是借助 paracol 的灵活性,您可以找到一些方法来定义满足您需要的宏。也许如果您提供 org-mode 导出,人们可以尝试找到解决方案。

    【讨论】:

    • 感谢您提供近乎完美的解决方案!
    猜你喜欢
    • 2010-12-02
    • 1970-01-01
    • 2016-11-17
    • 1970-01-01
    • 2013-05-09
    • 2021-01-12
    • 2019-12-06
    • 2012-10-16
    • 2018-12-27
    相关资源
    最近更新 更多