水平对齐 gb4e 示例

水平对齐 gb4e 示例

有什么方法可以使所写的例子gb4e按水平顺序排列,而不是垂直排列?

它看起来应该是这样的:

1)a. 简短示例 b. 简短示例 c. 简短示例

代替

1)a. 简短示例

b. 简短示例

c. 简短示例

答案1

使用的解决方案multicol

你可以使用multicol包来执行此操作。不过,示例确实需要非常小:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multicol}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex\label{threeex}
\begin{multicols}{3}
\begin{xlist}
\ex A small example.
\ex Another small example.
\ex And a third one.
\end{xlist}
\end{multicols}
\end{exe}
\end{document}

代码输出

然而,这种方法的缺点是,如果你在列表中放置 3 个以上的示例,则作品multicol将按照你可能不喜欢的顺序排列示例:

代码输出

使用的解决方案tabularx

由于该multicol解决方案存在严重限制,因此我通常使用表格环境来处理此类示例。这是一个已解决的示例。它用于tabularx创建表,并添加命令来增加表中的计数器。

这种方法的主要限制是它无法正确处理使用\gll宏的注释示例。我不知道有什么好方法可以做到这一点。

此外,如果您使用语法判断符号,则应*像这样将它们括起来,\llap{*}以便它们正确排列。

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{tabularx}
\usepackage{array}
\usepackage{environ}
\usepackage{gb4e}

\newcolumntype{T}{>{\refstepcounter{tabenum}}X}
\newcounter{tabenum}[xnumi]
\renewcommand{\thetabenum}{\thexnumi\alph{tabenum}}
\newcommand*{\tabex}{\relax\alph{tabenum}.\quad}
\NewEnviron{multiexe}{%
    \setlength{\extrarowheight}{1ex}
    \begin{tabularx}{\linewidth}[t]{@{}TTT@{}}
       \BODY
    \end{tabularx}
}
\begin{document}

\begin{exe}
\ex\label{firstset}
\begin{multiexe}
\tabex A small example. &
\tabex Another small example. &
\tabex And a third one. \\
\tabex A fourth &
\tabex A fifth \label{foo1}&
\tabex A sixth
\end{multiexe}
\ex\label{secondset}
\begin{multiexe}
\tabex A small example. &
\tabex Another small example. &
\tabex And a third one.\label{foo2} \\
\tabex A fourth &
\tabex A fifth &
\tabex A sixth
\end{multiexe}
\end{exe}
 You can refer to examples (\ref{foo1}) and (\ref{foo2}).
\end{document}

代码输出

相关内容