summaryrefslogtreecommitdiff
path: root/macros/xetex/latex/bidi-atbegshi
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/xetex/latex/bidi-atbegshi
Initial commit
Diffstat (limited to 'macros/xetex/latex/bidi-atbegshi')
-rw-r--r--macros/xetex/latex/bidi-atbegshi/README30
-rw-r--r--macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.pdfbin0 -> 24475 bytes
-rw-r--r--macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.tex59
-rw-r--r--macros/xetex/latex/bidi-atbegshi/bidi-atbegshi.sty134
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-LTR.pdfbin0 -> 11292 bytes
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-LTR.tex25
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-RTL.pdfbin0 -> 11299 bytes
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-RTL.tex25
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.pdfbin0 -> 11289 bytes
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.tex25
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.pdfbin0 -> 11314 bytes
-rw-r--r--macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.tex25
12 files changed, 323 insertions, 0 deletions
diff --git a/macros/xetex/latex/bidi-atbegshi/README b/macros/xetex/latex/bidi-atbegshi/README
new file mode 100644
index 0000000000..cda7c69bf7
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/README
@@ -0,0 +1,30 @@
+_____________________
+The bidi-atbegshi package
+v0.1
+
+Bidi-aware shipout macros
+
+The package adds few commands to `atbegshi' package
+for proper placement of <background material> in the left
+and right corners of the output page, in both LTR and RTL
+modes.
+
+The package only works with `xelatex' format and should be
+loaded before `bidi' package.
+
+For more information, please see the documentation.
+
+
+Current version release date: 2014/09/11
+
+___________________
+Vafa Khalighi
+tex.ctan@gmail.com
+
+Copyright © 2014
+It may be distributed and/or modified under the LaTeX Project Public License,
+version 1.3c or higher (your choice). The latest version of
+this license is at: http://www.latex-project.org/lppl.txt
+
+This work is “author-maintained” (as per LPPL maintenance status)
+by Vafa Khalighi.
diff --git a/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.pdf b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.pdf
new file mode 100644
index 0000000000..5e68bec300
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.pdf
Binary files differ
diff --git a/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.tex b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.tex
new file mode 100644
index 0000000000..9d9276048c
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi-doc.tex
@@ -0,0 +1,59 @@
+\documentclass{ltxdoc}
+\usepackage{holtxdoc}
+\begin{document}
+\title{The \xpackage{bidi-atbegshi} Package}
+\author{Vafa Khalighi\\\xemail{tex.ctan@gmail.com}}
+\maketitle
+The \xpackage{bidi-atbegshi} adds bidi support to package \xpackage{atbegshi}; it modifies the \cs{AtBeginShipoutUpperLeft}, and \cs{AtBeginShipoutUpperLeftForeground} so that they properly both in LTR and RTL modes. In addition, it also defines the following commands:
+
+\begin{declcs}{AtBeginShipoutUpperRight} \M{background material}
+\end{declcs}
+ This is a macro that puts material in the background of
+ box \cs{AtBeginShipoutBox}.
+ The \meta{background material} is set in an \cs{hbox}, the
+ reference point is the upper right corner of the output page.
+
+
+ The macro \cs{AtBeginShipoutUpperRight} is intended to be used
+ in one of the hook setting macros, such as
+ \cs{AtBeginShipout}, \cs{AtBeginShipoutFirst}, or
+ \cs{AtBeginShipoutNext}.
+
+ The \meta{background material} is set
+ inside a \texttt{picture} environment:
+ \begin{quote}
+ |\begin{picture}(0,0)|\\
+ \mbox{}\quad |\setlength{\unitlength}{1pt}%|\\
+ \mbox{}\quad \meta{background material}\\
+ |\end{picture}|
+ \end{quote}
+
+\begin{declcs}{AtBeginShipoutLowerLeft} \M{background material}
+\end{declcs}
+Similar to the \cs{AtBeginShipoutUpperRight} command but
+ the reference point is the lower left corner of the output page.
+
+\begin{declcs}{AtBeginShipoutLowerRight} \M{background material}
+\end{declcs}
+Similar to the \cs{AtBeginShipoutUpperRight} command but
+ the reference point is the lower right corner of the output page.
+
+ \begin{declcs}{AtBeginShipoutUpperRightForeground} \M{foreground material}
+ \end{declcs}
+ See \cs{AtBeginShipoutUpperRight}. The difference is that the material
+ is put in the foreground.
+
+ \begin{declcs}{AtBeginShipoutLowerLeftForeground} \M{foreground material}
+ \end{declcs}
+ See \cs{AtBeginShipoutLowerLeft}. The difference is that the material
+ is put in the foreground.
+
+ \begin{declcs}{AtBeginShipoutLowerRightForeground} \M{foreground material}
+ \end{declcs}
+ See \cs{AtBeginShipoutLowerRight}. The difference is that the material
+ is put in the foreground.
+
+ \begin{declcs}{LengthToUnit} \M{length with units}
+ \end{declcs}
+ For instance, \cs{LengthToUnit}\texttt{\{12pt\}} converts 12pt to 12 (stripping the unit).
+\end{document} \ No newline at end of file
diff --git a/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi.sty b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi.sty
new file mode 100644
index 0000000000..77b4fdd6d6
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/bidi-atbegshi.sty
@@ -0,0 +1,134 @@
+%%
+%% This is file `bidi-atbegshi.sty'.
+%%
+%% ___________________________________________
+%% Copyright © 2014 Vafa Khalighi <vafak@me.com>
+%%
+%% It may be distributed and/or modified under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is “author-maintained” (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidi-atbegshi}[2014/09/11 v0.1 bidi-aware shipout macros]
+\RequirePackage{atbegshi}
+\newcommand*\LengthToUnit[1]{#1\@gobble}
+\newcommand*{\AtBegShi@bidi@horigin@left}{%
+ \if@RTL%
+ \dimexpr-\textwidth-\AtBegShi@horigin\relax
+ \else%
+ -\AtBegShi@horigin%
+ \fi%
+}
+\newcommand*{\AtBegShi@bidi@horigin@right}{%
+ \if@RTL%
+ \dimexpr\paperwidth-\textwidth-\AtBegShi@horigin\relax
+ \else%
+ \dimexpr\paperwidth-\AtBegShi@horigin\relax
+ \fi%
+}
+\newcommand*{\AtBegShi@bidi@vorigin@bottom}[1]{%
+ \dimexpr\paperheight-\AtBegShi@vorigin\relax
+}
+\renewcommand*{\AtBeginShipoutUpperLeft}[1]{%
+ \AtBeginShipoutAddToBox{%
+ \kern\AtBegShi@bidi@horigin@left\relax
+ \vbox to 0pt{%
+ \kern-\AtBegShi@vorigin\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\renewcommand*{\AtBeginShipoutUpperLeftForeground}[1]{%
+ \AtBeginShipoutAddToBoxForeground{%
+ \kern\AtBegShi@bidi@horigin@left\relax
+ \vbox to 0pt{%
+ \kern-\AtBegShi@vorigin\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutUpperRight}[1]{%
+ \AtBeginShipoutAddToBox{%
+ \kern\AtBegShi@bidi@horigin@right\relax
+ \vbox to 0pt{%
+ \kern-\AtBegShi@vorigin\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutUpperRightForeground}[1]{%
+ \AtBeginShipoutAddToBoxForeground{%
+ \kern\AtBegShi@bidi@horigin@right\relax
+ \vbox to 0pt{%
+ \kern-\AtBegShi@vorigin\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutLowerLeft}[1]{%
+ \AtBeginShipoutAddToBox{%
+ \kern\AtBegShi@bidi@horigin@left\relax
+ \vbox to 0pt{%
+ \kern\AtBegShi@bidi@vorigin@bottom\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutLowerLeftForeground}[1]{%
+ \AtBeginShipoutAddToBoxForeground{%
+ \kern\AtBegShi@bidi@horigin@left\relax
+ \vbox to 0pt{%
+ \kern\AtBegShi@bidi@vorigin@bottom\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutLowerRight}[1]{%
+ \AtBeginShipoutAddToBox{%
+ \kern\AtBegShi@bidi@horigin@right\relax
+ \vbox to 0pt{%
+ \kern\AtBegShi@bidi@vorigin@bottom\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\newcommand*{\AtBeginShipoutLowerRightForeground}[1]{%
+ \AtBeginShipoutAddToBoxForeground{%
+ \kern\AtBegShi@bidi@horigin@right\relax
+ \vbox to 0pt{%
+ \kern\AtBegShi@bidi@vorigin@bottom\relax
+ \AtBegShi@BeginPicture
+ #1%
+ \AtBegShi@EndPicture
+ \vss
+ }%
+ }%
+}
+\endinput
+%%
+%% End of file `bidi-atbegshi.sty'. \ No newline at end of file
diff --git a/macros/xetex/latex/bidi-atbegshi/test-LTR.pdf b/macros/xetex/latex/bidi-atbegshi/test-LTR.pdf
new file mode 100644
index 0000000000..90db634619
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-LTR.pdf
Binary files differ
diff --git a/macros/xetex/latex/bidi-atbegshi/test-LTR.tex b/macros/xetex/latex/bidi-atbegshi/test-LTR.tex
new file mode 100644
index 0000000000..e64e601587
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-LTR.tex
@@ -0,0 +1,25 @@
+\documentclass{article}
+\usepackage{lipsum}
+\usepackage{bidi-atbegshi}
+\usepackage{bidi}
+\setbox0\hbox{\Huge\textbf{Upper Left}}
+\setbox1\hbox{\Huge\textbf{Upper Right}}
+\setbox2\hbox{\Huge\textbf{Lower Left}}
+\setbox3\hbox{\Huge\textbf{Lower Right}}
+\AtBeginShipout{%
+\AtBeginShipoutUpperLeft{%
+\put(0,\LengthToUnit{-\ht0}){\usebox0}
+}
+\AtBeginShipoutUpperRight{%
+\put(\LengthToUnit{-\wd1},\LengthToUnit{-\ht1}){\usebox1}
+}
+\AtBeginShipoutLowerLeft{%
+\put(0,\LengthToUnit{\dp2}){\usebox2}
+}
+\AtBeginShipoutLowerRight{%
+\put(\LengthToUnit{-\wd3},\LengthToUnit{\dp3}){\usebox3}
+}
+}
+\begin{document}
+\lipsum
+\end{document} \ No newline at end of file
diff --git a/macros/xetex/latex/bidi-atbegshi/test-RTL.pdf b/macros/xetex/latex/bidi-atbegshi/test-RTL.pdf
new file mode 100644
index 0000000000..90f2ac5d18
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-RTL.pdf
Binary files differ
diff --git a/macros/xetex/latex/bidi-atbegshi/test-RTL.tex b/macros/xetex/latex/bidi-atbegshi/test-RTL.tex
new file mode 100644
index 0000000000..a4d416176b
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-RTL.tex
@@ -0,0 +1,25 @@
+\documentclass{article}
+\usepackage{lipsum}
+\usepackage{bidi-atbegshi}
+\usepackage[RTLdocument]{bidi}
+\setbox0\hbox{\Huge\textbf{Upper Left}}
+\setbox1\hbox{\Huge\textbf{Upper Right}}
+\setbox2\hbox{\Huge\textbf{Lower Left}}
+\setbox3\hbox{\Huge\textbf{Lower Right}}
+\AtBeginShipout{%
+\AtBeginShipoutUpperRight{%
+\put(0,\LengthToUnit{-\ht1}){\usebox1}
+}%
+\AtBeginShipoutUpperLeft{%
+\put(\LengthToUnit{-\wd0},\LengthToUnit{-\ht0}){\usebox0}
+}%
+\AtBeginShipoutLowerRight{%
+\put(0,\LengthToUnit{\dp3}){\usebox3}
+}%
+\AtBeginShipoutLowerLeft{%
+\put(\LengthToUnit{-\wd2},\LengthToUnit{\dp2}){\usebox2}
+}%
+}
+\begin{document}
+\lipsum
+\end{document} \ No newline at end of file
diff --git a/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.pdf b/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.pdf
new file mode 100644
index 0000000000..6aa0cb81cd
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.pdf
Binary files differ
diff --git a/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.tex b/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.tex
new file mode 100644
index 0000000000..5b4953b2f5
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-foreground-LTR.tex
@@ -0,0 +1,25 @@
+\documentclass{article}
+\usepackage{lipsum}
+\usepackage{bidi-atbegshi}
+\usepackage{bidi}
+\setbox0\hbox{\Huge\textbf{Upper Left}}
+\setbox1\hbox{\Huge\textbf{Upper Right}}
+\setbox2\hbox{\Huge\textbf{Lower Left}}
+\setbox3\hbox{\Huge\textbf{Lower Right}}
+\AtBeginShipout{%
+\AtBeginShipoutUpperLeftForeground{%
+\put(0,\LengthToUnit{-\ht0}){\usebox0}
+}
+\AtBeginShipoutUpperRightForeground{%
+\put(\LengthToUnit{-\wd1},\LengthToUnit{-\ht1}){\usebox1}
+}
+\AtBeginShipoutLowerLeftForeground{%
+\put(0,\LengthToUnit{\dp2}){\usebox2}
+}
+\AtBeginShipoutLowerRightForeground{%
+\put(\LengthToUnit{-\wd3},\LengthToUnit{\dp3}){\usebox3}
+}
+}
+\begin{document}
+\lipsum
+\end{document} \ No newline at end of file
diff --git a/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.pdf b/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.pdf
new file mode 100644
index 0000000000..59ac82e420
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.pdf
Binary files differ
diff --git a/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.tex b/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.tex
new file mode 100644
index 0000000000..4a8d9d3597
--- /dev/null
+++ b/macros/xetex/latex/bidi-atbegshi/test-foreground-RTL.tex
@@ -0,0 +1,25 @@
+\documentclass{article}
+\usepackage{lipsum}
+\usepackage{bidi-atbegshi}
+\usepackage[RTLdocument]{bidi}
+\setbox0\hbox{\Huge\textbf{Upper Left}}
+\setbox1\hbox{\Huge\textbf{Upper Right}}
+\setbox2\hbox{\Huge\textbf{Lower Left}}
+\setbox3\hbox{\Huge\textbf{Lower Right}}
+\AtBeginShipout{%
+\AtBeginShipoutUpperRightForeground{%
+\put(0,\LengthToUnit{-\ht1}){\usebox1}
+}%
+\AtBeginShipoutUpperLeftForeground{%
+\put(\LengthToUnit{-\wd0},\LengthToUnit{-\ht0}){\usebox0}
+}%
+\AtBeginShipoutLowerRightForeground{%
+\put(0,\LengthToUnit{\dp3}){\usebox3}
+}%
+\AtBeginShipoutLowerLeftForeground{%
+\put(\LengthToUnit{-\wd2},\LengthToUnit{\dp2}){\usebox2}
+}%
+}
+\begin{document}
+\lipsum
+\end{document} \ No newline at end of file