From 577be2274a2faf8c5170a41ad84090412525d730 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Mon, 12 Dec 2016 22:00:33 +0100
Subject: \bayt now uses 'adjustboxes'

---
 arabluatex.dtx | 41 ++++++++++++++++-------------------------
 1 file changed, 16 insertions(+), 25 deletions(-)

(limited to 'arabluatex.dtx')

diff --git a/arabluatex.dtx b/arabluatex.dtx
index cc4aa16..53fcc5a 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2698,6 +2698,7 @@ wa-ya.sIru ta.hta 'l-jild-i
 \RequirePackage{luacode}
 \RequirePackage{xparse}
 \RequirePackage{environ}
+\RequirePackage{adjustbox}
 \RequirePackage{xkeyval}
 %    \end{macrocode}
 % The following boolean will be set to |true| in |RL| mode:
@@ -2978,19 +2979,17 @@ wa-ya.sIru ta.hta 'l-jild-i
 \define@boolkey[al]{verse}{utf}[true]{}
 \define@choicekey[al]{verse}{mode}{fullvoc, voc, novoc,
   trans}{\def\al@mode{#1}}
+\presetkeys[al]{verse}{metre=\LR{\vskip -\baselineskip}}{}
 \presetkeys[al]{verse}{utf=false}{}
 %    \end{macrocode}
 % Then follows the environment itself:
 %    \begin{macrocode}
 \NewDocumentEnvironment{arabverse}{O{}}%
-{\noindent\bgroup\setkeys[al]{verse}[metre]{#1}%
+{\par\centering\noindent\bgroup\setkeys[al]{verse}[metre]{#1}%
   \ifx\al@mode\al@mode@trans%
   \ifal@verse@utf\setRL\else\setLR\fi%
-  \else\setRL\fi%
-  \ifx\al@mode\al@mode@trans\else%
-  \begin{center}\fi}%
-{\ifx\al@mode\al@mode@trans\else\end{center}\fi%
-\hfill\setkeys[al]{verse}[width,utf,mode]{#1}\egroup}
+  \else\setRL\fi}%
+{\hfill\setkeys[al]{verse}[width,utf,mode]{#1}\egroup}
 %    \end{macrocode}
 % \begin{macro}{\bayt}
 %   \changes{v1.6}{2016/11/30}{New macro \cs{bayt} for typesetting
@@ -3017,30 +3016,22 @@ wa-ya.sIru ta.hta 'l-jild-i
 \def\al@verse@stroke{\leavevmode\xleaders\hbox{\arb{--}}\hfill\kern0pt}
 \NewDocumentCommand{\bayt}{m o m}{%
   \edef\al@tatweel{--}%
-  \ifx\al@mode\al@mode@trans\arb{#1}\else%
-  \makebox[\al@bayt@width][s]{\arb{#1}}\fi%
+  \adjustbox{width=\al@bayt@width, height=\Height}{\arb{#1}}%
   \IfNoValueTF{#2}{%
-    \ifx\al@mode\al@mode@trans\hskip .5em
-    \al@hemistich@delim\hskip .5em%
-    \else
-    \hspace{.25\al@bayt@width}%
-    \fi}{%
+    \hspace{.15\al@bayt@width}%
+  }{%
     \edef\@tempa{#2}%
     \ifx\@tempa\al@tatweel%
-    \ifx\al@mode\al@mode@trans\hskip .5em
-    \al@hemistich@delim\hskip .5em%
-    \else
-    \makebox[.25\al@bayt@width][s]{\al@verse@stroke}%
-    \fi%
-    \else%
     \ifx\al@mode\al@mode@trans%
-    \hskip 1em\arb{#2}\hskip 1em%
+    \hspace{.15\al@bayt@width}%    
     \else%
-    \makebox[.25\al@bayt@width][c]{\arb{#2}}%
-    \fi\fi}%
-  \ifx\al@mode\al@mode@trans\arb{#3}\else%
-  \makebox[\al@bayt@width][s]{\arb{#3}}%
-  \fi}
+    \adjustbox{width=.15\al@bayt@width, height=\Height}{\arb{--}}%
+    \fi%
+    \else%
+    \adjustbox{center=.15\al@bayt@width, height=\Height}{\arb{#2}}
+    \fi}%
+  \adjustbox{width=\al@bayt@width, height=\Height}{\arb{#3}}%
+}
 %    \end{macrocode}
 %   
 % \end{macro} 
-- 
cgit v1.2.3

