5

行间光泽可用于对文档的翻译进行布局。

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

这是英文版:

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.

这是西班牙语版本:

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.

想像这样手动进行:

\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}\\

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

4

4 回答 4

4

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

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

\usepackage{setspace}
\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.}
\def\spanish{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.}

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

\begin{minipage}[t][0pt]{\linewidth}
    \setstretch{3}
    \english
\end{minipage}

\begin{minipage}[t]{\linewidth}
    \setstretch{3}
    \spanish
\end{minipage}

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

结果(部分): 替代文字

于 2010-05-26T00:56:38.960 回答
2

我不认为有一个包可以做你想做的事,但是可以使用 自己实现这个,这在Tex by Topic\vsplit中有很好的记录(可免费下载,或通过 Lulu 在死树版本中)。基本思想是

  1. 您定义了两个 vbox,一个用于英语,一个用于西班牙语,并且您想一次取出一行内容。调用这些 vbox\ENbox\ESbox;
  2. 您需要确定要使用的正确垂直尺寸:这可能是\lineheight,或者您可能需要不同的值,您必须进行试验。假设\lineheight是对的...
  3. ...然后您可以使用 获取下一行英文\setbox\nextline=\vsplit\ENbox to \lineheight,您可以使用 输出\unvbox\ENbox,然后同样使用 输出下一行\ESbox,然后为 intergloss 间隙留出一些垂直空间;
  4. 然后您需要测试循环,您可以通过使用\ht、 of\ENbox和查询垂直高度来完成\ESbox。这一点会很繁琐。

总而言之,这将是一些棘手的编码:祝你好运,如果遇到困难,请不要犹豫在这里提问。

后记这显然比 Geoff 更简单的解决方案要多得多,出于某种原因,我在写这篇文章时没有看到它,但如果你想摆弄它,它应该更灵活。

于 2010-05-26T06:39:18.613 回答
1

如果您想将西班牙语和英语段落交错排列,并让它们大致正确排列,那么您想要的是逐字(或几个字接几个字)编写您的翻译,并使用可以包裹很长的光泽包句子。我在使用glose.sty之前已经这样做了。它的使用示例(目标是用词性来修饰每个单词):

\gloss Both knowledge and wisdom extend man's reach. Knowledge led to
     cjc  nn0       cjc nn0    vvb    {nn0 pos} {nn0 pun} nn0 vvd prp
\gloss computers, wisdom to chopsticks. Unfortunately our association is
       {nn2 pun}  nn0    prp {nn2 pun}  av0           dps nn1        vbz
\gloss overinvolved with the former. The latter will have to wait for a
       ad0         prp  at0 {nn0 pun} at0 nn0  vm0  vhb to0 vvb  avp at0
\gloss more sublime day.
       av0  aj0     {nn1 pun}
\unhbox\gline

该包使用空格将第一种语言中的单词与第二种“语言”中的单词对齐。要将一种语言中的多个单词与另一种语言中的单个单词(或多个单词)对齐,请使用大括号对多个单词进行分组。虽然这里的线条是交错的,但这只是为了我的编辑方便。如果你愿意,你可以写很长的行,光泽算法会正确地包装它们。

我还使用了并行包的两列逐段方法。

于 2010-06-30T14:04:57.060 回答
0

在每组行之间添加一个额外的换行符:

%
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
%
于 2010-05-25T20:28:59.250 回答