LaTeX 中的双行双语段落

D W*_*D W 5 latex translation linguistics

行间光泽可用于布置文档的翻译。

http://en.wikipedia.org/wiki/Interlinear_gloss

通常这是一个词一个词或一个词素一个词素完成的。但是,我想以不同的方式做到这一点,一次翻译整个段落。以下链接和图像是我想要完成的示例,但我想为更大的不同文本执行此操作。

http://www.optimnem.co.uk/learning/spanish/three-little-pigs.php

形象三只猪

目前我对考虑在语言之间改变顺序的单词或短语的顺序不感兴趣。也就是说,我不介意段落中的单词是否对齐,或者一个段落的长度是否比另一个段落长得多,从而导致悬垂线。

据我所知,以下软件包不能满足我的需求:

covingtn.sty
cgloss4e.sty
gb4e.sty
lingmacros.sty - shortex
Run Code Online (Sandbox Code Playgroud)

这是英文版本:

In the heart of the forest lived three little pigs who were brothers. The wolf always was chasing them in order to eat them. In order to escape the wolf, the pigs decided to make a house each. The smallest made his from straw, to finish first and go out to play. The middle one constructed a cottage from wood. Seeing that his little brother had finished already, he hurried to go and play with him. The oldest worked on his house of brick. 'You'll soon see what the wolf does with your houses,' he scolded his brothers but they were having a great time.
Run Code Online (Sandbox Code Playgroud)

这是西班牙语版本:

En el corazón del bosque vivían tres cerditos que eran hermanos. El lobo siempre andaba persiguiéndoles para comérselos. Para escapar del lobo, los cerditos decidieron hacerse una casa. El pequeño la hizo de paja, para acabar antes y poder irse a jugar. El mediano construyó una casita de madera. Al ver que su hermano perqueño había terminado ya, se dio prisa para irse a jugar con él. El mayor trabajaba en su casa de ladrillo. - Ya veréis lo que hace el lobo con vuestras casas - riñó a sus hermanos mientras éstos se lo pasaban en grande.
Run Code Online (Sandbox Code Playgroud)

想像这样手动完成:

\documentclass{article}
\usepackage[margin=1in, paperwidth=8.5in, paperheight=11in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{url}
\begin{document}

\noindent
\url{http://www.optimnem.co.uk/learning/spanish/three-little-pigs.php}\\
\\
\indent
En el corazón del bosque vivían tres cerditos que eran hermanos. El lobo siempre\\
\indent
In the heart of the forest lived three little pigs who were brothers. The wolf always\\
\\
%
andaba persiguiéndoles para comérselos. Para escapar del lobo, los cerditos decidieron\\
was chasing them in order to eat them. In order to escape the wolf, the pigs decided to\\
\\
%
hacerse una casa. El pequeño la hizo de paja, para acabar antes y poder irse a jugar.\\
make a house each. The smallest made his from straw, to finish first and go out to play.\\
\\
%
El mediano construyó una casita de madera. Al ver que su hermano perqueño había\\
The middle one constructed a cottage from wood. Seeing that his little brother had\\
\\
%
terminado ya, se dio prisa para irse a jugar con él. El mayor trabajaba en su casa de\\
finished already, he hurried to go and play with him. The oldest worked on his house of\\
\\
%
ladrillo. - Ya veréis lo que hace el lobo con vuestras casas - riñó a sus hermanos\\
brick. 'You'll soon see what the wolf does with your houses,' he scolded his brothers\\
\\
%
mientras éstos se lo pasaban en grande.\\
but they were having a great time.\\
\\

\end{document}\\
Run Code Online (Sandbox Code Playgroud)

我想使用一个包或一个宏来自动让英语和西班牙语文本在到达行尾时穿插换行符。如何以更自动化的方式在 Latex 中布局这个简单的双行双语段落(无需手动添加换行符)?

Geo*_*off 4

以下技巧可能会帮助您实现目标。它基于零高度迷你页面重叠两个三倍间距迷你页面的想法。

\n\n

我将使用占位符表示英语和西班牙语文本(分别为\\english\\spanish)。另外,请务必包含该setspace包:

\n\n
\\usepackage{setspace}\n\\def\\english{In the heart of the forest lived three little pigs who were brothers. The wolf always was chasing them in order to eat them. In order to escape the wolf, the pigs decided to make a house each. The smallest made his from straw, to finish first and go out to play. The middle one constructed a cottage from wood. Seeing that his little brother had finished already, he hurried to go and play with him. The oldest worked on his house of brick. \'You\'ll soon see what the wolf does with your houses,\' he scolded his brothers but they were having a great time.}\n\\def\\spanish{En el coraz\xc3\xb3n del bosque viv\xc3\xadan tres cerditos que eran hermanos. El lobo siempre andaba persigui\xc3\xa9ndoles para com\xc3\xa9rselos. Para escapar del lobo, los cerditos decidieron hacerse una casa. El peque\xc3\xb1o la hizo de paja, para acabar antes y poder irse a jugar. El mediano construy\xc3\xb3 una casita de madera. Al ver que su hermano perque\xc3\xb1o hab\xc3\xada terminado ya, se dio prisa para irse a jugar con \xc3\xa9l. El mayor trabajaba en su casa de ladrillo. - Ya ver\xc3\xa9is lo que hace el lobo con vuestras casas - ri\xc3\xb1\xc3\xb3 a sus hermanos mientras \xc3\xa9stos se lo pasaban en grande.}\n
Run Code Online (Sandbox Code Playgroud)\n\n

通过给顶部块高度为 ,0pt我们允许下一个块minipage与它重叠。

\n\n
\\begin{minipage}[t][0pt]{\\linewidth}\n    \\setstretch{3}\n    \\english\n\\end{minipage}\n\n\\begin{minipage}[t]{\\linewidth}\n    \\setstretch{3}\n    \\spanish\n\\end{minipage}\n
Run Code Online (Sandbox Code Playgroud)\n\n

这个想法的主要问题之一是,如果零高度部分比常规部分长,那么您将需要处理一些挥之不去的重叠文本。(编辑:这个问题在下面的评论中得到解决,请注意,换行符也将是这个想法的一个严重缺点。)

\n\n

结果(部分):\n替代文本\n

\n