TeX - LaTeX Asked by mklein on July 12, 2021
I’m trying to have two texts parallel in a tabular environment.
My MWE:
documentclass{standalone}
usepackage[nil, main=german, bidi=basic]{babel}
babelfont[hebrew]{rm}{Ezra SIL}
usepackage{array}
% ========================================================
begin{document}
begin{tabular}{>{%
leavevmoderaggedleftarraybackslash% <- fixes vertical alignment issue
selectlanguage{hebrew}}p{2in}p{2in}}%
אַ֥שְֽׁרֵי הָאִ֗ישׁ אֲשֶׁ֤ר לֹ֥א הָלַךְ֮ בַּעֲצַ֪ת רְשָׁ֫עִ֥ים
וּבְדֶ֣רֶ חַ֭טָּאִים לֹ֥א עָמָ֑ד וּבְמוֹשַׁ֥ב לֵ֝צִ֗ים לֹ֣א יָשָֽׁב׃
&%
Wohl dem, der nicht wandelt im Rat der Gottlosen
noch tritt auf den Weg der Sünder noch sitzt, da die Spötter sitzen
end{tabular}
end{document}
As you can see, the texts are not on the same baselines.
(I’m compiling with LuaLaTeX because I could not get the vertical alignment issue fixed in XeLaTeX; see my comment, try for yourself.)
How can I achieve having the right text vertically spaced like the left one? Is there a way to have p-columns that have fixed-height lines, which I would be able to adjust? I want the baselines to match (like in the first line) and the rest to fall where it falls.
Any help is greatly appreciated!
The ta’amim of the Hebrew text don’t fit into the baselineskip
distance, and also your fonts aren’t scaled to the same height. You can fix the former with setspace
and the latter with Scale=MatchUppercase
.
documentclass{standalone}
tracinglostchars=2
usepackage[german, bidi=basic]{babel}
usepackage{fontspec}
usepackage{microtype}
usepackage[onehalfspacing]{setspace}
babelprovide[import]{hebrew}
%% Taamey Ashkenaz is free at http://culmus.sourceforge.net/taamim/index.html
%% Like Ezra SIL, it is based on Hebrew Bibles printed circa 1900. It comes
%% in two weights (of which Bold is more like the original) and in a slanted
%% shape (although some Israelis prefer a left-to-right slant, matching the
%% Latin script).
defaultfontfeatures[TaameyAshkenaz]{
UprightFont = *-Medium ,
BoldFont = *-Bold ,
ItalicFont = *-MediumOblique ,
BoldItalicFont = *-BoldOblique ,
Extension = .ttf
}
defaultfontfeatures{ Scale = MatchUppercase }
babelfont{rm}
[Scale=1.0]{TeX Gyre Schola}
babelfont[hebrew]{rm}
{TaameyAshkenaz}
usepackage{array}
% ========================================================
begin{document}
begin{tabular}{>{%
leavevmoderaggedleftarraybackslash% <- fixes vertical alignment issue
selectlanguage{hebrew}}p{2in}p{2in}}%
אַ֥שְֽׁרֵי הָאִ֗ישׁ אֲשֶׁ֤ר לֹ֥א הָלַךְ֮ בַּעֲצַ֪ת רְשָׁ֫עִ֥ים
וּבְדֶ֣רֶ חַ֭טָּאִים לֹ֥א עָמָ֑ד וּבְמוֹשַׁ֥ב לֵ֝צִ֗ים לֹ֣א יָשָֽׁב׃
&%
Wohl dem, der nicht wandelt im Rat der Gottlosen
noch tritt auf den Weg der Sünder noch sitzt, da die Spötter sitzen
end{tabular}
end{document}
I took the liberty of changing the fonts you used. There are several good alternatives at the Culmus Project and the OpenSiddur project.
Instead of hand-rolling a table, you might want to use the paracol
package. Here, I’ve set up an environment that switches to the appropriate language for each column, turns off hyphenation in the Hebrew column (since we don’t want to introduce any word breaks or marks into the Biblical text that were not originally there), makes the translation wider than the original Hebrew so as to better match the height, and narrows the left and right margins so that the Hebrew doesn’t overflow.
documentclass{article}
tracinglostchars=2
usepackage[left=1cm, right=1cm]{geometry}
usepackage[german, bidi=basic]{babel}
usepackage{fontspec}
usepackage{microtype}
usepackage[onehalfspacing]{setspace}
usepackage{parskip, paracol, xspace}
babelprovide[import]{hebrew}
%% Taamey Ashkenaz is free at http://culmus.sourceforge.net/taamim/index.html
%% Like Ezra SIL, it is based on Hebrew Bibles printed circa 1900. It comes
%% in two weights (of which Bold is more like the original) and in a slanted
%% shape (although some Israelis prefer a left-to-right slant, matching the
%% Latin script).
defaultfontfeatures[TaameyAshkenaz]{
UprightFont = *-Medium ,
BoldFont = *-Bold ,
ItalicFont = *-MediumOblique ,
BoldItalicFont = *-BoldOblique ,
Extension = .ttf
}
defaultfontfeatures{ Scale = MatchUppercase }
babelfont{rm}
[Scale=1.0]{TeX Gyre Schola}
babelfont[hebrew]{rm}
[Language=Default]{TaameyAshkenaz}
newcommandobverses[2]{%
begin{leftcolumn*}begin{otherlanguage}{hebrew}%
righthyphenmin=62%
lefthyphenmin=62%
emergencystretch=3em% Don’t want to hyphenate or introduce any
% additional marks into the Biblical text.
{#1}%
end{otherlanguage}end{leftcolumn*}%
begin{rightcolumn}begin{otherlanguage}{german}%
{#2}%
end{otherlanguage}end{rightcolumn}%
}
%% Set your conventions for translating the Divine Name here.
newcommandHERRN{textsc{Herrn}xspace}
% ========================================================
begin{document}
columnratio{0.33}
columnsep=1cm
begin{paracol}{2}
obverses{
אַ֥שְֽׁרֵי הָאִ֗ישׁ אֲשֶׁ֤ר לֹ֥א הָלַךְ֮ בַּעֲצַ֪ת רְשָׁ֫עִ֥ים
וּבְדֶ֣רֶ חַ֭טָּאִים לֹ֥א עָמָ֑ד וּבְמוֹשַׁ֥ב לֵ֝צִ֗ים לֹ֣א יָשָֽׁב׃
}
{ Wohl dem, der nicht wandelt im Rat der Gottlosen
noch tritt auf den Weg der Sünder noch sitzt, da die Spötter sitzen
}
obverses{
כִּ֤י אִ֥ם בְּתוֹרַ֥ת יְהוָ֗ה חֶ֫פְצ֥וֹ וּֽבְתוֹרָת֥וֹ יֶהְגֶּ֗ה יוֹמָ֥ם וָלָֽיְלָה׃
}
{ sondern hat Lust zum Gesetz des HERRN und redet von seinem
Gesetz Tag und Nacht!
}
obverses{
וְֽהָיָ֗ה כְּעֵץ֮ שָׁת֪וּל עַֽל־פַּלְגֵ֫י מָ֥יִם אֲשֶׁ֤ר פִּרְי֨וֹ ׀ יִתֵּ֬ן בְּעִתּ֗וֹ וְעָלֵ֥הוּ לֹֽא־יִבּ֑וֹל וְכֹ֖ל אֲשֶׁר־יַעֲשֶׂ֣ה יַצְלִֽיחַ׃
}
{ Der ist wie ein Baum, gepflanzt an den Wasserbächen, der seine Frucht
bringt zu seiner Zeit, und seine Blätter verwelken nicht; und was er
macht, das gerät wohl.
}
obverses{
לֹא־כֵ֥ן הָרְשָׁעִ֑ים כִּ֥י אִם־כַּ֝מֹּ֗ץ אֲֽשֶׁר־תִּדְּפֶ֥נּוּ רֽוּחַ׃
}
{ Aber so sind die Gottlosen nicht, sondern wie Spreu, die der Wind
verstreut.
}
end{paracol}
end{document}
Since there are several different conventions for translating the Divine Name, I added a macro HERRN
so you can choose how to typeset it. It’s particularly easy to do a case-sensitive search-and-replace if your translation says HERRN. I went with small caps. You might also want HERR
, LORD
, etc.
Add the option [import, onchar=ids fonts]
to babelprovide
if you want to be able to type in Hebrew anywhere in the document and have it auto-detect the language. Change the settings of geometry
and set pagestyle{empty}
if you really wanted a standalone PDF.
Correct answer by Davislor on July 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP