gpt4 book ai didi

latex - LaTeX 中的双行双语段落

转载 作者:行者123 更新时间:2023-12-05 00:06:46 27 4
gpt4 key购买 nike

关闭。这个问题是off-topic .它目前不接受答案。












想改进这个问题? Update the question所以它是on-topic对于堆栈溢出。

9年前关闭。




Improve this question




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

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

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

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

image three pigs

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

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

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 中布局这个简单的双行双语段落(无需手动添加换行符)?

最佳答案

以下技巧可以帮助您实现目标。它基于零高度 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.}

通过将顶部 block 的高度设置为 0pt我们允许下一个 minipage重叠它。
\begin{minipage}[t][0pt]{\linewidth}
\setstretch{3}
\english
\end{minipage}

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

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

结果(部分):
alt text

关于latex - LaTeX 中的双行双语段落,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2907327/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com