使用 \selectlanguage 时并行文本的对齐方式错误

使用 \selectlanguage 时并行文本的对齐方式错误

当我将“并行文本”与 \selectlanguage 一起使用时,会发生对齐问题:右侧列比左侧列低一到两行。

这是问题的最小工作示例

\documentclass[11pt,a4paper]{report}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm, headheight=13.6pt]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{gfsdidot}
\usepackage[english, greek, french]{babel}
\languageattribute{greek}{ancient}
\usepackage{parallel}

\begin{document}
\selectlanguage{english}

\begin{Parallel}{0.52\textwidth}{0.43\textwidth}

 \ParallelLText{ 
A \textit{deduction}, then, is a discourse in which,
certain things having been supposed, something different from the things supposed results of necessity through them. 
}
\ParallelRText{\raggedright
\selectlanguage{greek}
 Ἔστι δὴ συλλογισμὸς λόγος ἐν ᾧ τεθέντων τινῶν ἕτερόν τι τῶν κειμένων ἐξ ἀνάγκης συμβαίνει διὰ τῶν κειμένων. }
   \renewcommand{\ParallelAtEnd}{ \selectlanguage{english} \begin{flushright} \textit{Top.} I 1, 100a25--b23; transl. Smith modified \end{flushright}}
\end{Parallel}
\end{document}

pdf 输出,存在对齐问题

如果我去掉 \selectlanguage,并用英语代替希腊语,那就没问题了。

\documentclass[11pt,a4paper]{report}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm, headheight=13.6pt]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{gfsdidot}
\usepackage[english, greek, french]{babel}
\languageattribute{greek}{ancient}
\usepackage{parallel}

\begin{document}
\selectlanguage{english}

\begin{Parallel}{0.52\textwidth}{0.43\textwidth}

 \ParallelLText{ 
A \textit{deduction}, then, is a discourse in which,
certain things having been supposed, something different from the things supposed results of necessity through them. 
}
\ParallelRText{\raggedright
A \textit{deduction}, then, is a discourse in which,
certain things having been supposed, something different from the things supposed results of necessity through them. 
 }
   \renewcommand{\ParallelAtEnd}{ \selectlanguage{english} \begin{flushright} \textit{Top.} I 1, 100a25--b23; transl. Smith modified \end{flushright}}
\end{Parallel}
\end{document}

pdf 输出,没有对齐问题,也没有选择语言

注意:对齐问题不是由于使用希腊语造成的,因为我在使用 \selectlanguage{english} 和英文文本时也遇到了同样的问题。

  \ParallelRText{\raggedright\selectlanguage{english} A
    \textit{deduction}, then, is a discourse in which, certain things
    having been supposed, something different from the things supposed
     results of necessity through them.   
    }

pdf 输出,存在对齐问题和 \selectlanguage{english}

有人知道发生了什么事以及如何解决这个问题吗?非常感谢。

答案1

问题是\selectlanguage{greek}添加了一个空行。请使用\begin{otherlanguage*}{greek}...\end{otherlanguage*}

我建议一个更简单的界面:

\documentclass[11pt,a4paper]{report}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm, headheight=13.6pt]{geometry}
\usepackage[T1]{fontenc}
\usepackage{gfsdidot}
\usepackage[main=english, greek, french]{babel}
\languageattribute{greek}{ancient}
\usepackage{parallel}
%\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later

\NewDocumentEnvironment{xParallel}{mmo}
 {%
  \IfValueT{#3}{%
    \renewcommand{\ParallelAtEnd}{\begin{flushright}#3\end{flushright}}%
  }%
  \Parallel{#1}{#2}%
 }
 {\endParallel}

\NewDocumentCommand{\ParallelText}{mom}{%
  \csname Parallel#1Text\endcsname{%
    \IfValueT{#2}{\begin{otherlanguage*}{#2}}%
    #3\par
    \IfValueT{#2}{\end{otherlanguage*}}%
  }%
}

\begin{document}

\begin{xParallel}{0.52\textwidth}{0.43\textwidth}[
  \textit{Top.} I 1, 100a25--b23; transl. Smith modified
]
\ParallelText{L}{
  A \textit{deduction}, then, is a discourse in which,
  certain things having been supposed, something different
  from the things supposed results of necessity through them. 
}
\ParallelText{R}[greek]{\raggedright
   Ἔστι δὴ συλλογισμὸς λόγος ἐν ᾧ τεθέντων τινῶν ἕτερόν τι τῶν 
  κειμένων ἐξ ἀνάγκης συμβαίνει διὰ τῶν κειμένων.
}
\end{xParallel}

\end{document}

环境xParallel具有用于设置最终文本的尾随可选参数。该\ParallelText命令具有用于侧边(LR)的强制参数以及用于语言的可选参数。

在此处输入图片描述

优点是可以微调间距。例如,你可能想要这样做

\documentclass[11pt,a4paper]{report}
\usepackage[left=3cm, right=3cm, top=3cm, bottom=3cm, headheight=13.6pt]{geometry}
\usepackage[T1]{fontenc}
\usepackage{gfsdidot}
\usepackage[main=english, greek, french]{babel}
\languageattribute{greek}{ancient}
\usepackage{parallel}
%\usepackage{xparse} % not needed with LaTeX 2020-10-01 or later

\usepackage{lipsum}

\NewDocumentEnvironment{xParallel}{mmo}
 {%
  \par\addvspace{\topsep}
  \IfValueT{#3}{%
    \renewcommand{\ParallelAtEnd}{\par\nobreak\vspace{\topsep}{\raggedleft#3\par}}%
  }%
  \Parallel{#1}{#2}%
 }
 {\endParallel\par\addvspace{\topsep}}

\NewDocumentCommand{\ParallelText}{mom}{%
  \csname Parallel#1Text\endcsname{%
    \IfValueT{#2}{\begin{otherlanguage*}{#2}}%
    #3\par
    \IfValueT{#2}{\end{otherlanguage*}}%
  }%
}

\begin{document}

\lipsum[1][1-3]

\begin{xParallel}{0.52\textwidth}{0.43\textwidth}[
  \textit{Top.} I 1, 100a25--b23; transl. Smith modified
]
\ParallelText{L}{
  A \textit{deduction}, then, is a discourse in which,
  certain things having been supposed, something different
  from the things supposed results of necessity through them. 
}
\ParallelText{R}[greek]{\raggedright
   Ἔστι δὴ συλλογισμὸς λόγος ἐν ᾧ τεθέντων τινῶν ἕτερόν τι τῶν 
  κειμένων ἐξ ἀνάγκης συμβαίνει διὰ τῶν κειμένων.
}
\end{xParallel}

\lipsum[1][1-3]

\end{document}

在此处输入图片描述

相关内容