TeX - LaTeX Asked by Tecti on December 17, 2020
An alignment problem occurs when I use Parallel Text together with selectlanguage: the righthand column starts one or two lines below the lefthand column.
Here is a minimum working example of the problem
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.52textwidth}{0.43textwidth}
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}
If I take the selectlanguage out, and replacing the Greek by English, it is fine.
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.52textwidth}{0.43textwidth}
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}
Note: The aligment problem is not due to the use of Greek, since I have the same problem using selectlanguage{english} and the English text.
ParallelRText{raggedrightselectlanguage{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.
}
Does anybody knows what is going on and how to fix this?
Many thanks.
The problem is selectlanguage{greek}
that adds a blank line. Use begin{otherlanguage*}{greek}...end{otherlanguage*}
instead.
I propose a simpler interface:
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}#3end{flushright}}%
}%
Parallel{#1}{#2}%
}
{endParallel}
NewDocumentCommand{ParallelText}{mom}{%
csname Parallel#1Textendcsname{%
IfValueT{#2}{begin{otherlanguage*}{#2}}%
#3par
IfValueT{#2}{end{otherlanguage*}}%
}%
}
begin{document}
begin{xParallel}{0.52textwidth}{0.43textwidth}[
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}
The xParallel
environment has a trailing optional argument for setting the final text. The ParallelText
command has a mandatory argument for the side (L
or R
) and also an optional argument for the language.
The advantage is that it's possible to fine tune the spacings. For instance, you may want to do
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}
{%
paraddvspace{topsep}
IfValueT{#3}{%
renewcommand{ParallelAtEnd}{parnobreakvspace{topsep}{raggedleft#3par}}%
}%
Parallel{#1}{#2}%
}
{endParallelparaddvspace{topsep}}
NewDocumentCommand{ParallelText}{mom}{%
csname Parallel#1Textendcsname{%
IfValueT{#2}{begin{otherlanguage*}{#2}}%
#3par
IfValueT{#2}{end{otherlanguage*}}%
}%
}
begin{document}
lipsum[1][1-3]
begin{xParallel}{0.52textwidth}{0.43textwidth}[
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}
Correct answer by egreg on December 17, 2020
I have found a workaround to the problem:
add selectlanguage to every parallel section.
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.52textwidth}{0.43textwidth}
ParallelLText{ 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.
}
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}
If someone can tell me the reason selectlanguage produces this problem, I would gladly hear it. This solution also has the problem of increasing the vertical space above the Parallel text, but that is a lesser problem and can be adjusted by vspace{-10pt} if necessary.
Answered by Tecti on December 17, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP