
用阿拉伯文的轉錄排版語言範例時哈姆札和艾因、 ʾ 和 ʿ 分別與下面一行的直譯對齊看起來很尷尬。參見例(1)。這也適用於清單和表格環境。表 1 中的對齊方式不太好。
解決此問題的一種方法是將此\llap{ʾ}
字元推到左側並使該單字與第二個字元對齊。這給出了(在我看來)更好看的例子 (2) 和表 2。
現在回答我的問題。有沒有辦法自動執行此操作?我希望\llap{ʾ}
兩個字符 ʾ 和 ʿ\llap{ʿ}
在某些環境中(主要是example
.該解決方案適用於表格,方法是在項目前面添加一個空格,如表 1 前面的程式碼所示。 (據我所知,可以在 XeLaTeX 中激活 Unicode 字符,這就是我正在使用的。)我知道\@ifnextchar
,但這裡需要的是類似\@ifprevchar
.
編輯:我需要一個解決方案,在其中我可以將單字放入環境中的範例轉錄中,例如\textbf{}
。
\documentclass{article}
\usepackage{fontspec}
%\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{covington}
\begin{document}
\begin{example}
\gll bi-lātīk ʾanā ʾaktub ʾaḥla nuṣūṣ
with-latex I write prittyest texts
\glt `With \LaTeX{} I can write the prettiest texts.'
\glend
\end{example}
\begin{example}
\gll bi-lātīk \llap{ʾ}anā \llap{ʾ}aktub \llap{ʾ}aḥla nuṣūṣ
with-latex I write prittyest texts
\glt `With \LaTeX{} I can write the prettiest texts.'
\glend
\end{example}
\begin{table}[h!]
\centering
\caption{Ugly alignment}
\begin{tabular}{>{\itshape}ll}
ʾanna & comp.\\
ʾinna & `verily'\\
lākinna & `but'\\
laʿalla & `perhaps'\\
layta & `if only'\\
\end{tabular}
\end{table}
\begin{table}[h!]
\centering
\caption{Nice alignment}
\begin{tabular}{>{\itshape}ll}
\llap{ʾ}anna & comp.\\
\llap{ʾ}inna & `verily'\\
lākinna & `but'\\
laʿalla & `perhaps'\\
layta & `if only'\\
\end{tabular}
\end{table}
\end{document}
答案1
不容易,但可行,至少對於tabular
和example
或examples
。請注意應如何指定清單中的字體變更。
\documentclass{article}
\usepackage{fontspec}
\usepackage{etoolbox,array,collcell}
\usepackage{covington}
\makeatletter
\newrobustcmd{\checkforstart}{%
\@ifnextchar ʾ{\llap}{\checkforayn}%
}
\newcommand{\checkforayn}{%
\@ifnextchar ʿ{\llap}{}%
}
\makeatother
\newcolumntype{H}[1]{>{#1\collectcell\docheckforstart}l<{\endcollectcell}}
\newcommand{\docheckforstart}[1]{\checkforstart #1}
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% For technical reasons this can't go in the preamble, sorry
\catcode`\^^M=12
\patchcmd{\getwords}{\strut}{\strut\checkforstart}{}{}%
\catcode`\^^M=5
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{example}
\gll bi-lātīk ʾanā ʾaktub ʾaḥla nuṣūṣ ʿTEST
with-latex I write prittyest texts TEST
\glt `With \LaTeX{} I can write the prettiest texts.'
\glend
\end{example}
\begin{example}
\gll bi-lātīk \llap{ʾ}anā \llap{ʾ}aktub \llap{ʾ}aḥla nuṣūṣ ʿTEST
with-latex I write prittyest texts TEST
\glt `With \LaTeX{} I can write the prettiest texts.'
\glend
\end{example}
\begin{tabular}{H{\itshape} l}
ʾanna & comp.\\
ʾinna & `verily'\\
lākinna & `but'\\
laʿalla & `perhaps'\\
layta & `if only'\\
\end{tabular}
\end{document}