我需要将拉丁诗歌翻译成英文并加以注释(特别是贺拉斯的讽刺诗,我将从这里),然后注释拉丁。
理想情况下,我必须对复制粘贴的拉丁文进行最少的更改或不做任何更改,以便进行排版(即//
在每一行后附加)。如果可能的话,我想在源代码中将注释的实际文本写在拉丁文文本之外,但这不是必要的。我需要能够注释一个单词、短语,最好是(虽然这不是绝对要求)一系列不连续的字母、单词或短语。注释是英文的,长度从一个句子到一个小段落不等。
如果可能的话,我希望将诗歌分栏排列 - 即拉丁文在一侧,英文在另一侧,行与行大致对齐,但我并不在意注释放在哪里,虽然如果注释与注释的文本在同一页上并且注释与注释的文本之间有某种视觉联系(如一行)会更好。我猜一行会有 1-3 个注释,尽管这个数字有时会更高。
我已经研究过针对两列文本的各种解决方案,但我被困在不需要在注释文本中添加大量标记的注释上,即便如此,我也不确定如何做好注释。
提前致谢。
答案1
以下是一种方法,需要一些准备步骤:
- 使用特定的编辑器,
TexMaker
在这里 - 使用包
paracol
- 使用一些翻译,在这里谷歌翻译为了简单起见
- 使用一些脚本语言,
Perl
在这里
相互冲突的要求
正如OP所述,存在一个冲突:
- 一方面,他/她需要使用标记(Latex)
- 然而,这使得 Latex 代码难以快速读取
- 因此,另一方面,在生成的 pdf 中稍后引入进一步的标记会更好(不是 Latex)
确切的解决方案是提供两者:Latex 和非Latex。
实现此目的的一种方法是separate requirements in space
:
- 点击此处使用 Latex
- 和
- 在那里使用 NOT-Latex
- 即两者兼有
我不知道有哪些软件可以在 Latex (.tex) 和 Not-Latex (例如 pdf) 之间来回切换,所以我查看了一下编辑器。
编辑
我Lyx
为此尝试过,但却没有说服我:
- 可读性也好不到哪里去
- 导出的 Latex 代码是...你最好不要想要那样。
TexMaker
是另一种选择:
- 在一个窗口中输入代码
- 在第二个窗口中显示编译结果
- 您可以指向那里并按住 CTRL 键并单击以转到相关的代码行(但是,由于某种原因,这并不总是有效)
TexMaker without the CTRL+click
也可以使用以下功能来绕过:
- (暂时)引入一些标记
- 在 .pdf 和 .tex 中都很容易识别
- 使导航更加容易
下面我使用了这个绕过方法,你可以用一些versioning
包来增强它,即显示它们draft
,但在final
版本中被删除。
paracol 包
这个包paracol
对于这项诗歌分析和注释任务似乎非常有用。它允许您:
- 有几列
- 在它们之间随意切换
- 根据需要垂直同步它们。
经过一些试验,似乎最好将逐行拉丁文本和英语翻译混合在一起。当然,您也可以考虑将文本分成 5 行,以便稍后进行手动重新排列。
因此,作为起点,该框架提供了Annotation[0]-Latin[1]-Annotation[2]-English[3]
A3 横向格式的 4 列以供演示。
\documentclass[10pt,a4paper]{article}
\usepackage{paracol}
\usepackage[a3paper,landscape]{geometry}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
\begin{paracol}{4}
Annotations
\switchcolumn[1]
Latin
\switchcolumn[2]
Annotations
\switchcolumn[3]
English
% >>> intermix will go here <<<
\end{paracol}
\end{document}
翻译
对于将逐行混合两种语言的脚本,我使用两个简单的文本文件,其中的英语翻译来自谷歌,如上所述,为简单起见。确保两个文件的行数相同(匹配)。
纬度.txt:
Qui fit, Maecenas, ut nemo, quam sibi sortem
seu ratio dederit seu fors obiecerit, illa
contentus vivat, laudet diversa sequentis?
...
英文原文:
Who becomes, Maecenas, like no one, but his lot
either reason will give, or chance will object, she
He lives contentedly, praises the different following?
...
脚本
使用您选择的脚本语言,创建您认为有用的混合行,例如这里的逐行:
mix.pl:
#!/usr/bin/perl
use strict;
use warnings;
# ~~~ texts ~~~~~~~~~~~
my $fl="lat.txt";
my $fe="en.txt";
# ~~~ read them ~~~~~
open my $L, '<', $fl or die "can't open $fl\n";
open my $E, '<', $fe or die "can't open $fe\n";
my @L = <$L>;
my @E = <$E>;
# ~~~ same length ? ~~~
if(scalar(@L) != scalar(@E)) {
print "Different numer of lines in both files. EXIT\n" ;
exit;
}
# ~~~ creating output ~~~~
my $s = "";
for(my $i=0; $i < scalar(@L); $i++) {
$s .= "\\switchcolumn[1]*\n" ;
chomp($L[$i]);
$s .= $L[$i] . "\\\\\n";
$s .= "\\switchcolumn[3]\n" ;
chomp($E[$i]);
$s .= $E[$i] . "\\\\\n";
}
print $s;
结果是:
\switchcolumn[1]*
Qui fit, Maecenas, ut nemo, quam sibi sortem\\
\switchcolumn[3]
Who becomes, Maecenas, like no one, but his lot\\
\switchcolumn[1]*
seu ratio dederit seu fors obiecerit, illa\\
\switchcolumn[3]
either reason will give, or chance will object, she\\
\switchcolumn[1]*
contentus vivat, laudet diversa sequentis?\\
\switchcolumn[3]
He lives contentedly, praises the different following?\\
...
从命令行调用后:
>mix.pl > mix.txt
如您所见,拉丁列(1) 通过 逐行垂直同步所有内容\switchcolumn[1]*
。
将其(mix.txt)复制到您的框架中并开始优化代码。
一段时间后 ...
该代码可能会产生以下内容:
一些评论。
s
\newcommand
提供了一些用于突出显示或更改文本样式的宏。例如,TexMaker
您可以输入这些宏user defined commands
以简化编辑。例如,您可以突出显示一个短语,从图标菜单中将其标记为“强调”,然后手动更改emph
为hla
“highlight
强调”等等。请记住,有时您需要进行第二次编译运行,例如为了让 tikzmarks 正确显示。
要在第 0 列或第 2 列中添加口头注释,只需将其放在下一次同步之前:
\switchcolumn[1]*
miles ait, multo iam fractus membra labore; 5\\
\switchcolumn[3]
said the soldier, whose limbs had already been much broken by exertion; 5\\
% ~~~ here's a remark ~~~~~~~
\switchcolumn[0]
watch out!
- 使用 tikzmark 有点棘手。我放了两个,
t1
和t2
。看来你必须把tikzpicture
我使用的放在离第二个标记很近的地方。还有更多选项,请参阅 tikzmark 手册。
% ~~~ let's put a tickmark here ~~~~~~~~~
\switchcolumn[1]*
'o fortunati mercatores' gravis annis\tikzmark{t1}\\
...
% ~~~ let's put an other tickmark here ~~~~~~~~~
\switchcolumn[1]*
contra mercator navim iactantibus Austris:\tikzmark{t2}
% ~~~ insert the required drawing ~~~~~
\begin{tikzpicture}[remember picture, overlay]
\draw[draw=red,->,thick] ([xshift=5mm]pic cs:t1) to[out=0,in=45] node[blue,anchor=west,pos=.65] {some remark}([xshift=5mm]pic cs:t2);
\end{tikzpicture}\\
“最终”代码
正如您所见,我开始在代码中做些标记,比如 % ... 5 ...
在 .tex 文件中查找第 5 行。由于 Google 在每个第 5 行都附加了行号,因此在 pdf 视图(显示一些数字)和代码窗口之间切换是完全可能的。
或迟或早,您都会开始稍微改变一下缩进样式,以便更好地跟踪正在发生的事情,也许还会指示脚本这样做,例如:
\switchcolumn[1]*
'o fortunati mercatores' gravis annis\tikzmark{t1}\\
\switchcolumn[3]
'O fortunate merchants' in heavy years\\
In summary
,使用 Latex 无法阻止代码中出现各种标记。但是,使用我列出的(绕过)方法,它非常接近开头描述的预期精确解决方案。
“最终的”:
\documentclass[10pt]{article}
\usepackage[a3paper,landscape]{geometry}
\usepackage{paracol}
% ~~~ using tikzmark ~~~~
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows.meta}
% ~~~ for highlighting ~~~~~~~~~~
\usepackage{xcolor, soul}
% ~~~ nicer colors: see also color model and names in xcolor manual
% https://tex.stackexchange.com/questions/615774/where-to-definecolor
\definecolor{es-bg}{HTML}{E7EDF4}% (cornflower light blue ...)
% ~~~ highlighting ~~~~~~~~~~
\newcommand\hly[1]{\sethlcolor{yellow}\hl{#1}}
\newcommand\hlc[1]{\sethlcolor{es-bg}\hl{#1}}
\newcommand\hlg[1]{\sethlcolor{green}\hl{#1}}
\newcommand\hll[1]{\sethlcolor{lime}\hl{#1}}
% ~~~ text in colors ~~~~~~~~~~~~
\newcommand\tr[1]{\textcolor{red}{#1}}
\newcommand\tru[1]{\textcolor{red}{\underline{#1}}}
% ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\begin{document}
\tikzset{>={Latex}} % for better arrow tip
\begin{paracol}{4}
\textbf{Annotations}
\switchcolumn[1]
\textbf{Latin}
\switchcolumn[2]
\textbf{Annotations}
\switchcolumn[3]
\textbf{English}
% ... 1 ...
\switchcolumn[1]*
Qui fit, \hly{Maecenas}, ut nemo, quam sibi sortem\\
\switchcolumn[3]
Who becomes, Maecenas, like no one, but his lot\\
% ~~~ let's put a sentence here ~~~
\switchcolumn[0]
Here the whole poem starts with an opening sentence. And it won't stop. Which means, it will continue for a while.
\switchcolumn[1]*
seu \hlc{r}atio \hlc{ded}erit seu fors obie\hlc{cerit}, illa\\
\switchcolumn[3]
either reason will give, or chance will object, she\\
\switchcolumn[2]
just \tr{watch} \hly{this highlight}
\switchcolumn[1]*
contentus \tru{vivat, laudet} diversa sequentis?\\
\switchcolumn[3]
He lives contentedly, praises the different following?\\
% ~~~ let's put a tickmark here ~~~~~~~~~
\switchcolumn[1]*
'o fortunati mercatores' gravis annis\tikzmark{t1}\\
\switchcolumn[3]
'O fortunate merchants' in heavy years\\
% ... 5 ...
\switchcolumn[1]*
miles ait, multo iam fractus membra labore; 5\\
\switchcolumn[3]
said the soldier, whose limbs had already been much broken by exertion; 5\\
% ~~~ here's a remark ~~~~~~~
\switchcolumn[0]
watch out!
% ~~~ let's put an other tickmark here ~~~~~~~~~
\switchcolumn[1]*
contra mercator navim iactantibus Austris:\tikzmark{t2}
% ~~~ insert the required drawing ~~~~~
\begin{tikzpicture}[remember picture, overlay]
\draw[draw=red,->,thick] ([xshift=5mm]pic cs:t1) to[out=0,in=45] node[blue,anchor=west,pos=.65] {some remark}([xshift=5mm]pic cs:t2);
\end{tikzpicture}\\
\switchcolumn[3]
against the merchant ship of the South:\\
\switchcolumn[1]*
\hlg{'militia est potior. quid enim?} concurritur: horae\\
\switchcolumn[3]
The war is more important. What is? it is run: hours\\
\switchcolumn[1]*
momento cita mors venit aut victoria laeta.'\\
\switchcolumn[3]
at the moment mentioned comes death or happy victory.'\\
\switchcolumn[1]*
agricolam lau\hll{dat} iuris legum\hll{que} peritus,\\
\switchcolumn[3]
the farmer is praised by the expert in law and law,\\
% ... 10 ...
\switchcolumn[1]*
sub galli cantum consultor ubi ostia pulsat; 10\\
\switchcolumn[3]
under the rooster's song, the counselor knocks at the door; 10\\
\switchcolumn[1]*
ille, datis vadibus qui rure extractus in urbem est,\\
\switchcolumn[3]
he, having been drawn from the countryside into the city,\\
\switchcolumn[1]*
solos felicis viventis clamat in urbe.\\
\switchcolumn[3]
He cries out for the happy living alone in the city.\\
\switchcolumn[1]*
cetera de genere hoc—adeo sunt multa—loquacem\\
\switchcolumn[3]
the rest of this kind—and there are many—is eloquent\\
\switchcolumn[1]*
delassare valent Fabium. ne te morer, audi,\\
\switchcolumn[3]
they are able to let down the Fabius. don't let me die, listen\\
\switchcolumn[1]*
quo rem deducam. si quis deus 'en ego' dicat 15\\
\switchcolumn[3]
by which I will conclude the matter. if any god says 'en ego' 15\\
\switchcolumn[1]*
'iam faciam quod voltis: eris tu, qui modo miles,\\
\switchcolumn[3]
I will do what you wish: it will be you who are just a soldier\\
\switchcolumn[1]*
mercator; tu, consultus modo, rusticus: hinc vos,\\
\switchcolumn[3]
merchant; you, just a counselor, a rustic: hence you,\\
\switchcolumn[1]*
vos hinc mutatis discedite partibus. eia,\\
\switchcolumn[3]
you, having changed from here, leave the parties. yes\\
\switchcolumn[1]*
quid statis?' nolint. atqui licet esse beatis.\\
\switchcolumn[3]
what are you standing for?' they don't want but it is permissible to be happy.\\
\switchcolumn[1]*
quid causae est, merito quin illis Iuppiter ambas 20\\
\switchcolumn[3]
what is the cause, by virtue of Jupiter having them both 20\\
\switchcolumn[1]*
iratus buccas inflet neque se fore posthac\\
\switchcolumn[3]
He blew his lips in anger, and said that he would not be hereafter\\
\switchcolumn[1]*
tam facilem dicat, votis ut praebeat aurem?\\
\switchcolumn[3]
so easy to say, do you wish that he would lend an ear?\\
\end{paracol}
\end{document}