
我在排版文件中的希伯來語引文方面遇到了一個小問題。我以「書籍章節:詩句:希伯來文本」的形式引用了聖經。當希伯來文字繼續下一行時,它是左對齊的,而我希望它是右對齊的。
使用\flushright
不是一個選項,因為聖經參考文獻仍應左對齊。使用\hfill
不是一個選項,因為我不知道換行符號發生在哪裡。
請參閱下面的 MWE。結果應該與第一個範例相同,但第二行右對齊,或等效地與第二個範例相同,但第一行對齊。
當一個段落只有一行長時,它應該左對齊。
\documentclass{article}
\usepackage[margin=4cm]{geometry}
\usepackage{showframe}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\englishfont[Mapping=tex-text]{Latin Modern Roman}
\newfontfamily\hebrewfont[Scale=MatchLowercase]{Ezra SIL}
\DeclareTextFontCommand{\ez}{\hebrewfont}
\parindent0pt
\begin{document}
Nehemia 4:8b--c: \RL{\ez{אל־תיראו מפניהם את־אדני הגדול והנורא זכרו והלחמו על־אחיכם בניכם ובנתיכם נשיכם ובתיכם}}
\flushright{Nehemia 4:8b--c: \RL{\ez{אל־תיראו מפניהם את־אדני הגדול והנורא זכרו והלחמו על־אחיכם בניכם ובנתיכם נשיכם ובתיכם}}}
\end{document}
(使用 XeLaTeX 編譯。需要以斯拉 SIL 字體)。
答案1
嘗試這個:
\documentclass{article}
\usepackage{parskip}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{hebrew}
\newfontfamily\hebrewfont[Scale=MatchLowercase,Script=Hebrew]{SBL BibLit}
\pagestyle{empty}
\newenvironment{RTLpar}{%
\par\ignorespaces
\leftskip=0pt plus .5fil%
\rightskip=0pt plus -.5fil%
\parfillskip=0pt plus .5fil%
}{\par}
\newbox\linebox
\newcount\linecount
\def\countparlines{%
\setbox\linebox\lastbox
\ifvoid\linebox
\else
\global\advance\linecount 1%
\unskip\unpenalty
{\countparlines}%
\fi}
\def\rtlpar#1{%
\vskip-\baselineskip % This is a hack, but I don't know the proper solution
\global\linecount=0%
\vbox{#1\par\countparlines}%
\ifnum\linecount>1
\begingroup
\leftskip=0pt plus .5fil%
\rightskip=0pt plus -.5fil%
\parfillskip=0pt plus .5fil%
#1\par
\endgroup
\else
#1\par
\fi}
\begin{document}
\begin{RTLpar}
Nehemiah 4:8b--c: \texthebrew{אל־תיראו מפניהם את־אדני הגדול והנורא זכרו
והלחמו על־אחיכם בניכם ובנתיכם נשיכם ובתיכם}
\end{RTLpar}
\rtlpar{Nehemiah 4:8b--c: \texthebrew{אל־תיראו מפניהם את־אדני הגדול והנורא זכרו
והלחמו על־אחיכם בניכם ובנתיכם נשיכם ובתיכם}}
\rtlpar{Nehemiah 4:8a: \texthebrew{וארא ואקום ואמר אל־החרים ואל־הסגנים ואל
יתר העם}}
\begin{quote}
\begin{hebrew}
אל־תיראו מפניהם את־אדני הגדול והנורא זכרו והלחמו על־אחיכם בניכם ובנתיכם
נשיכם ובתיכם (\textenglish{Nehemiah 4:8b--c})
\end{hebrew}
\end{quote}
\end{document}