
Ao compor exemplos linguísticos com transcrições das letras árabeshamzaeayn, ʾ e ʿ respectivamente, o alinhamento com a tradução literal na linha abaixo parece estranho. Veja exemplo (1). Isso também vale para listas e ambientes tabulares. O alinhamento na Tabela 1 não é bom.
Uma maneira de remediar isso é empurrar \llap{ʾ}
esse caractere para a esquerda e alinhar a palavra com o segundo caractere. Isso fornece o exemplo (2) e a Tabela 2, muito mais bonitos (na minha opinião).
Agora vamos à minha pergunta. Existe uma maneira de automatizar isso? Quero que dois caracteres, ʾ e ʿ, se tornem \llap{ʾ}
e \llap{ʿ}
quando precedidos por um espaço (e se possível também pelo caractere de tabulação) em determinados ambientes, principalmente example
. Esta solução funcionaria para tabelas adicionando um espaço antes dos itens, como no código da Tabela 1. Acho que seria possível ativar esses caracteres. (Pelo que entendi é possível ativar caracteres Unicode no XeLaTeX, que é o que estou usando.) Eu sei sobre \@ifnextchar
, mas o que seria necessário aqui é algo como \@ifprevchar
.
EDITAR: preciso de uma solução na qual eu possa colocar palavras individuais na transcrição do exemplo em ambientes, por exemplo \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}
Responder1
Não é fácil, mas factível, pelo menos para tabular
e example
ou examples
. Observe como você deve especificar a alteração da fonte na tabela de colunas.
\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}