summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-06-09 20:36:41 +0000
committerKarl Berry <karl@freefriends.org>2020-06-09 20:36:41 +0000
commitbf2f7f8c799ec33913ca367cb6917300cbec570c (patch)
tree7f0024ea153f86dcfc06003eae7beb2c064f590a /Master/texmf-dist/tex
parent1160927a8602c14c2a6c4dd058dc6726394c8b8b (diff)
hvarabic (8jun20)
git-svn-id: svn://tug.org/texlive/trunk@55495 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/hvarabic/hvarabic.sty66
1 files changed, 66 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/hvarabic/hvarabic.sty b/Master/texmf-dist/tex/latex/hvarabic/hvarabic.sty
new file mode 100644
index 00000000000..e1d00bacd0b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/hvarabic/hvarabic.sty
@@ -0,0 +1,66 @@
+%% This is file `hvarabic.sty',
+%%
+%% Copyright (C) 2020
+%% Herbert Voss <hvoss@tug.org>
+%%
+%% It may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%
+% -------------------------------------
+\ProvidesPackage{hvarabic}[2020/06/08 v. 0.01 define macros for RTL typesetting (hv)]
+%
+\RequirePackage{iftex}
+\iftutex
+\else
+ \ExplSyntaxOn
+ \msg_new:nnn {unitconv} {need-lualatex}
+ {
+ The~ hvarabic~ package~ requires~ LuaLaTeX or XeLaTeX.\\\\
+ You~ must~ change~ your~ typesetting~ engine~ to,~
+ "lualatex/xelatex" instead~ of~ "latex", or ~"pdflatex".
+ }
+ \msg_fatal:nn {unitconv} {need-lualatex/xelatex}
+ \ExpSyntaxOff
+ \endinput
+\fi
+
+\RequirePackage{xkeyval,fontspec}
+
+\newif\ifhv@RTLfootnoterule \hv@RTLfootnoterulefalse
+\DeclareOptionX{RTLfootnoterule}[true]{\@nameuse{hv@RTLfootnoterule#1}}
+%
+\ProcessOptionsX\relax
+
+\providefontface\RTLfont
+ [Script=Arabic, % to get correct arabic shaping
+ Scale=1.2]{Scheherazade} % whatever Arabic font you like
+\newfontfamily\hvALM{ALM Fixed}[Scale=0.85]
+\newcommand\textRTL[1]{\bgroup\textdir TRT\RTLfont #1\egroup}% Arabic inside LTR
+\newcommand\nLTR[1]{\bgroup\textdir TLT #1\egroup}% for digits inside Arabic text
+\newcommand\RTLfootnote[1]{\footnote{\textRTL{#1}}}% Arabic footnotes
+
+\ifhv@RTLfootnoterule
+ \newenvironment{RTL}
+ % Arabic paragraph
+ {\setRTLfootnoterule\textdir TRT\pardir TRT\RTLfont}
+ {\setLTRfootnoterule}
+\else
+ \newenvironment{RTL}
+ % Arabic paragraph
+ {\textdir TRT\pardir TRT\RTLfont}
+ {}
+\fi
+\def\setLTRfootnoterule{\let\LTRfootnoterule\footnoterule}
+\def\setRTLfootnoterule{%
+ \global\let\LTRfootnoterule=\footnoterule
+ \gdef\footnoterule{\noindent\parbox{\textwidth}{\hfill\vbox{\LTRfootnoterule}}}}
+
+\def\setRTL{\par\textdir TRT\pardir TRT}
+\def\setLTR{\par\textdir TLT\pardir TLT}
+\endinput
+