我正在使用 Parallel 包在 LaTeX 中编译双语文档。我无法将颜色包应用于并行列。对于我的项目,我有几个地方习惯于为文本中的单词或短语着色(在本例中为红色),以使其与其他文本形成对比。使用 Parallel 包时,当彩色文本中有换行符时,颜色会溢出到对面的列,就像在包含的 MWE 中一样。在示例中,只有右列(英语)包含红色短语,但并行环境的两列都包含红色。该项目必须使用 LuaLaTeX+se 引擎进行编译,具体取决于此 MWE 中未包含的其他包的要求。
\documentclass[12pt]{book}
\usepackage[paperwidth=8.5in, paperheight=11.0in, margin=1.5in, top=1in, bottom=.5in, footskip=.1in]{geometry}
\usepackage[latin, english]{babel}
\usepackage{libertine}
\usepackage{parallel}
\usepackage{lettrine}
\usepackage{xcolor}
\begin{document}
\begin{Parallel}{}{}
\tolerance=1000
\ParallelLText{
\selectlanguage{latin}
\setlength{\linewidth}{\hsize}\lettrine{L}orem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan ac lorem sit amet consequat. Nulla faucibus sed neque sit amet sollicitudin. Suspendisse ornare eros in nulla mattis, at dictum felis vestibulum. Proin efficitur lectus eu odio hendrerit, eget faucibus mi mattis. Mauris sem odio, efficitur tristique diam pretium, dictum maximus magna. Donec dictum a odio vel rhoncus. In ultricies libero gravida nulla sodales sollicitudin. Praesent urna risus, varius sit amet laoreet et, hendrerit at enim. Pellentesque id ex vel sapien pulvinar molestie in non dolor. Nulla luctus ultricies augue at fermentum. Suspendisse commodo dignissim turpis, eu condimentum tellus gravida sit amet. Phasellus et magna suscipit, cursus velit at, ultricies dui.
}
\ParallelRText{
\selectlanguage{english}
\setlength{\linewidth}{\hsize}\lettrine{B}ut I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, \textcolor{red}{but because those who do not know} how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.
}
\end{Parallel}
\end{document}
答案1
如果可以使用 luatex,则可以使用luacolor
=
\documentclass[12pt]{book}
\usepackage[paperwidth=8.5in, paperheight=11.0in, margin=1.5in, top=1in, bottom=.5in, footskip=.1in]{geometry}
\usepackage[latin, english]{babel}
\usepackage{libertine}
\usepackage{parallel}
\usepackage{lettrine}
\usepackage{luacolor}
\begin{document}
\begin{Parallel}{}{}
\tolerance=1000
\ParallelLText{
\selectlanguage{latin}
\setlength{\linewidth}{\hsize}\lettrine{L}orem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan ac lorem sit amet consequat. Nulla faucibus sed neque sit amet sollicitudin. Suspendisse ornare eros in nulla mattis, at dictum felis vestibulum. Proin efficitur lectus eu odio hendrerit, eget faucibus mi mattis. Mauris sem odio, efficitur tristique diam pretium, dictum maximus magna. Donec dictum a odio vel rhoncus. In ultricies libero gravida nulla sodales sollicitudin. Praesent urna risus, varius sit amet laoreet et, hendrerit at enim. Pellentesque id ex vel sapien pulvinar molestie in non dolor. Nulla luctus ultricies augue at fermentum. Suspendisse commodo dignissim turpis, eu condimentum tellus gravida sit amet. Phasellus et magna suscipit, cursus velit at, ultricies dui.
}
\ParallelRText{
\selectlanguage{english}
\setlength{\linewidth}{\hsize}\lettrine{B}ut I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, \textcolor{red}{but because those who do not know} how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.
}
\end{Parallel}
\end{document}
答案2
借助于,paracol
而不是parallel
:
\documentclass[12pt]{book}
\usepackage[paperwidth=8.5in, paperheight=11.0in, margin=1.5in, top=1in, bottom=.5in, footskip=.1in]{geometry}
\usepackage[latin, english]{babel}
\usepackage{libertine}
\usepackage{paracol}
\usepackage{lettrine}
\usepackage{xcolor}
\begin{document}
\begin{paracol}{2}
\tolerance=1000
\selectlanguage{latin}
\setlength{\linewidth}{\hsize}\lettrine{L}orem ipsum dolor sit amet, consectetur adipiscing elit. Nullam accumsan ac lorem sit amet consequat. Nulla faucibus sed neque sit amet sollicitudin. Suspendisse ornare eros in nulla mattis, at dictum felis vestibulum. Proin efficitur lectus eu odio hendrerit, eget faucibus mi mattis. Mauris sem odio, efficitur tristique diam pretium, dictum maximus magna. Donec dictum a odio vel rhoncus. In ultricies libero gravida nulla sodales sollicitudin. Praesent urna risus, varius sit amet laoreet et, hendrerit at enim. Pellentesque id ex vel sapien pulvinar molestie in non dolor. Nulla luctus ultricies augue at fermentum. Suspendisse commodo dignissim turpis, eu condimentum tellus gravida sit amet. Phasellus et magna suscipit, cursus velit at, ultricies dui.
\switchcolumn
\selectlanguage{english}
\setlength{\linewidth}{\hsize}\lettrine{B}ut I must explain to you how all this mistaken idea of denouncing of a pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, \textcolor{red}{but because those who do not know} how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but occasionally circumstances occur in which toil and pain can procure him some great pleasure.
\end{paracol}
\end{document}