From 8b9c1a6c19efe20f71e8e09925d33d25d8cec691 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 13 Feb 2022 21:27:34 +0000 Subject: bidi-atbegshi (13feb22) git-svn-id: svn://tug.org/texlive/trunk@62009 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/xelatex/bidi-atbegshi/README | 13 +- .../xelatex/bidi-atbegshi/bidi-atbegshi-doc.pdf | Bin 24475 -> 108284 bytes .../xelatex/bidi-atbegshi/bidi-atbegshi-doc.tex | 8 +- .../doc/xelatex/bidi-atbegshi/test-LTR.pdf | Bin 11292 -> 13648 bytes .../doc/xelatex/bidi-atbegshi/test-LTR.tex | 8 +- .../doc/xelatex/bidi-atbegshi/test-RTL.pdf | Bin 11299 -> 29260 bytes .../doc/xelatex/bidi-atbegshi/test-RTL.tex | 23 +-- .../xelatex/bidi-atbegshi/test-foreground-LTR.pdf | Bin 11289 -> 13623 bytes .../xelatex/bidi-atbegshi/test-foreground-LTR.tex | 8 +- .../xelatex/bidi-atbegshi/test-foreground-RTL.pdf | Bin 11314 -> 29249 bytes .../xelatex/bidi-atbegshi/test-foreground-RTL.tex | 23 +-- .../tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty | 176 ++++++++------------- 12 files changed, 107 insertions(+), 152 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/README b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/README index cda7c69bf7e..c9d6ed754e6 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/README +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/README @@ -1,27 +1,24 @@ _____________________ The bidi-atbegshi package -v0.1 +v0.2 Bidi-aware shipout macros -The package adds few commands to `atbegshi' package +The package adds few commands to `atbegshi-ltx' package for proper placement of 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 +Current version release date: 2022/02/14 ___________________ Vafa Khalighi -tex.ctan@gmail.com +tex-persian@vafa.ac -Copyright © 2014 +Copyright © 2014--2022 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 diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.pdf b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.pdf index 5e68bec300d..fbb353f73ce 100644 Binary files a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.pdf and b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.tex b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.tex index 9d9276048c3..43635b19eac 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.tex +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/bidi-atbegshi-doc.tex @@ -2,9 +2,9 @@ \usepackage{holtxdoc} \begin{document} \title{The \xpackage{bidi-atbegshi} Package} -\author{Vafa Khalighi\\\xemail{tex.ctan@gmail.com}} +\author{Vafa Khalighi\\\xemail{tex-persian@vafa.ac}} \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: +The \xpackage{bidi-atbegshi} adds bidi support to package \xpackage{atbegshi-ltx}; it defines the following commands: \begin{declcs}{AtBeginShipoutUpperRight} \M{background material} \end{declcs} @@ -52,8 +52,4 @@ Similar to the \cs{AtBeginShipoutUpperRight} command but \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/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.pdf b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.pdf index 90db634619e..697ab72b0d9 100644 Binary files a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.pdf and b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.tex b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.tex index e64e6015871..04c773f6e54 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.tex +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-LTR.tex @@ -8,16 +8,16 @@ \setbox3\hbox{\Huge\textbf{Lower Right}} \AtBeginShipout{% \AtBeginShipoutUpperLeft{% -\put(0,\LengthToUnit{-\ht0}){\usebox0} +\put(0,-\ht0){\usebox0} } \AtBeginShipoutUpperRight{% -\put(\LengthToUnit{-\wd1},\LengthToUnit{-\ht1}){\usebox1} +\put(-\wd1,-\ht1){\usebox1} } \AtBeginShipoutLowerLeft{% -\put(0,\LengthToUnit{\dp2}){\usebox2} +\put(0,\dp2){\usebox2} } \AtBeginShipoutLowerRight{% -\put(\LengthToUnit{-\wd3},\LengthToUnit{\dp3}){\usebox3} +\put(-\wd3,\dp3){\usebox3} } } \begin{document} diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.pdf b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.pdf index 90f2ac5d18e..b9212f97049 100644 Binary files a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.pdf and b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.tex b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.tex index a4d416176b1..5ce8c975b96 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.tex +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-RTL.tex @@ -1,25 +1,26 @@ \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}} +\usepackage{ptext} +\usepackage{xepersian} +\settextfont{IRXLotus} +\setbox0\hboxR{\Huge\textbf{چپ بالا}} +\setbox1\hboxR{\Huge\textbf{راست بالا}} +\setbox2\hboxR{\Huge\textbf{چپ پایین}} +\setbox3\hboxR{\Huge\textbf{راست پایین}} \AtBeginShipout{% \AtBeginShipoutUpperRight{% -\put(0,\LengthToUnit{-\ht1}){\usebox1} +\put(-\wd1,-\ht1){\usebox1} }% \AtBeginShipoutUpperLeft{% -\put(\LengthToUnit{-\wd0},\LengthToUnit{-\ht0}){\usebox0} +\put(0,-\ht0){\usebox0} }% \AtBeginShipoutLowerRight{% -\put(0,\LengthToUnit{\dp3}){\usebox3} +\put(-\wd3,\dp3){\usebox3} }% \AtBeginShipoutLowerLeft{% -\put(\LengthToUnit{-\wd2},\LengthToUnit{\dp2}){\usebox2} +\put(0,\dp2){\usebox2} }% } \begin{document} -\lipsum +\ptext \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.pdf b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.pdf index 6aa0cb81cd7..1a4717adaf5 100644 Binary files a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.pdf and b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.tex b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.tex index 5b4953b2f58..9f28a629344 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.tex +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-LTR.tex @@ -8,16 +8,16 @@ \setbox3\hbox{\Huge\textbf{Lower Right}} \AtBeginShipout{% \AtBeginShipoutUpperLeftForeground{% -\put(0,\LengthToUnit{-\ht0}){\usebox0} +\put(0,-\ht0){\usebox0} } \AtBeginShipoutUpperRightForeground{% -\put(\LengthToUnit{-\wd1},\LengthToUnit{-\ht1}){\usebox1} +\put(-\wd1,-\ht1){\usebox1} } \AtBeginShipoutLowerLeftForeground{% -\put(0,\LengthToUnit{\dp2}){\usebox2} +\put(0,\dp2){\usebox2} } \AtBeginShipoutLowerRightForeground{% -\put(\LengthToUnit{-\wd3},\LengthToUnit{\dp3}){\usebox3} +\put(-\wd3,\dp3){\usebox3} } } \begin{document} diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.pdf b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.pdf index 59ac82e4207..8b7d0b596a4 100644 Binary files a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.pdf and b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.pdf differ diff --git a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.tex b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.tex index 4a8d9d3597d..985a7eb4c66 100644 --- a/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.tex +++ b/Master/texmf-dist/doc/xelatex/bidi-atbegshi/test-foreground-RTL.tex @@ -1,25 +1,26 @@ \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}} +\usepackage{ptext} +\usepackage{xepersian} +\settextfont{IRXLotus} +\setbox0\hboxR{\Huge\textbf{چپ بالا}} +\setbox1\hboxR{\Huge\textbf{راست بالا}} +\setbox2\hboxR{\Huge\textbf{چپ پایین}} +\setbox3\hboxR{\Huge\textbf{راست پایین}} \AtBeginShipout{% \AtBeginShipoutUpperRightForeground{% -\put(0,\LengthToUnit{-\ht1}){\usebox1} +\put(-\wd1,-\ht1){\box1} }% \AtBeginShipoutUpperLeftForeground{% -\put(\LengthToUnit{-\wd0},\LengthToUnit{-\ht0}){\usebox0} +\put(0,-\ht0){\usebox0} }% \AtBeginShipoutLowerRightForeground{% -\put(0,\LengthToUnit{\dp3}){\usebox3} +\put(-\wd3,\dp3){\usebox3} }% \AtBeginShipoutLowerLeftForeground{% -\put(\LengthToUnit{-\wd2},\LengthToUnit{\dp2}){\usebox2} +\put(0,\dp2){\usebox2} }% } \begin{document} -\lipsum +\ptext \end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty b/Master/texmf-dist/tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty index 77b4fdd6d69..21f389d0e28 100644 --- a/Master/texmf-dist/tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty +++ b/Master/texmf-dist/tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty @@ -2,7 +2,7 @@ %% This is file `bidi-atbegshi.sty'. %% %% ___________________________________________ -%% Copyright © 2014 Vafa Khalighi +%% Copyright © 2014--2022 Vafa Khalighi %% %% It may be distributed and/or modified under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of @@ -13,122 +13,82 @@ %% %% \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% +\ProvidesPackage{bidi-atbegshi}[2022/02/14 v0.2 bidi-aware shipout macros] +\RequirePackage{atbegshi-ltx} +\ExplSyntaxOn +\cs_new:Npn \__shipout_picture_overlay_lower_left:n #1 { + \__shipout_init_page_origins: + \kern -\c__shipout_horigin_tl \scan_stop: + \vbox_to_zero:n { + \kern \__dim_eval:w \paperheight - \c__shipout_vorigin_tl \scan_stop: + \unitlength 1pt \scan_stop: + \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } + \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim + \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim + \box_use:N \l__shipout_tmp_box + \tex_vss:D + } } -\newcommand*{\AtBegShi@bidi@horigin@right}{% - \if@RTL% - \dimexpr\paperwidth-\textwidth-\AtBegShi@horigin\relax - \else% - \dimexpr\paperwidth-\AtBegShi@horigin\relax - \fi% +\cs_new:Npn \__shipout_picture_overlay_upper_right:n #1 { + \__shipout_init_page_origins: + \kern \__dim_eval:w \c__shipout_horigin_tl + \oddsidemargin + \evensidemargin + \textwidth \scan_stop: + \vbox_to_zero:n { + \kern -\c__shipout_vorigin_tl \scan_stop: + \unitlength 1pt \scan_stop: + \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } + \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim + \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim + \box_use:N \l__shipout_tmp_box + \tex_vss:D + } } -\newcommand*{\AtBegShi@bidi@vorigin@bottom}[1]{% - \dimexpr\paperheight-\AtBegShi@vorigin\relax +\cs_new:Npn \__shipout_picture_overlay_lower_right:n #1 { + \__shipout_init_page_origins: + \kern \__dim_eval:w \c__shipout_horigin_tl + \oddsidemargin + \evensidemargin + \textwidth \scan_stop: + \vbox_to_zero:n { + \kern \__dim_eval:w \paperheight - \c__shipout_vorigin_tl \scan_stop: + \unitlength 1pt \scan_stop: + \hbox_set_to_wd:Nnn \l__shipout_tmp_box \c_zero_dim + { \ignorespaces #1 \hss } + \box_set_ht:Nn \l__shipout_tmp_box \c_zero_dim + \box_set_dp:Nn \l__shipout_tmp_box \c_zero_dim + \box_use:N \l__shipout_tmp_box + \tex_vss:D + } } -\renewcommand*{\AtBeginShipoutUpperLeft}[1]{% - \AtBeginShipoutAddToBox{% - \kern\AtBegShi@bidi@horigin@left\relax - \vbox to 0pt{% - \kern-\AtBegShi@vorigin\relax - \AtBegShi@BeginPicture - #1% - \AtBegShi@EndPicture - \vss - }% - }% +\cs_new:Npn \__shipout_add_background_picture_lower_left:n #1 { + \__shipout_add_background_box:n { \__shipout_picture_overlay_lower_left:n {#1} } } -\renewcommand*{\AtBeginShipoutUpperLeftForeground}[1]{% - \AtBeginShipoutAddToBoxForeground{% - \kern\AtBegShi@bidi@horigin@left\relax - \vbox to 0pt{% - \kern-\AtBegShi@vorigin\relax - \AtBegShi@BeginPicture - #1% - \AtBegShi@EndPicture - \vss - }% - }% +\cs_new:Npn \__shipout_add_foreground_picture_lower_left:n #1 { + \__shipout_add_foreground_box:n { \__shipout_picture_overlay_lower_left:n {#1} } } -\newcommand*{\AtBeginShipoutUpperRight}[1]{% - \AtBeginShipoutAddToBox{% - \kern\AtBegShi@bidi@horigin@right\relax - \vbox to 0pt{% - \kern-\AtBegShi@vorigin\relax - \AtBegShi@BeginPicture - #1% - \AtBegShi@EndPicture - \vss - }% - }% +\cs_new:Npn \__shipout_add_background_picture_upper_right:n #1 { + \__shipout_add_background_box:n { \__shipout_picture_overlay_upper_right:n {#1} } } -\newcommand*{\AtBeginShipoutUpperRightForeground}[1]{% - \AtBeginShipoutAddToBoxForeground{% - \kern\AtBegShi@bidi@horigin@right\relax - \vbox to 0pt{% - \kern-\AtBegShi@vorigin\relax - \AtBegShi@BeginPicture - #1% - \AtBegShi@EndPicture - \vss - }% - }% +\cs_new:Npn \__shipout_add_foreground_picture_upper_right:n #1 { + \__shipout_add_foreground_box:n { \__shipout_picture_overlay_upper_right:n {#1} } } -\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 - }% - }% +\cs_new:Npn \__shipout_add_background_picture_lower_right:n #1 { + \__shipout_add_background_box:n { \__shipout_picture_overlay_lower_right:n {#1} } } -\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 - }% - }% +\cs_new:Npn \__shipout_add_foreground_picture_lower_right:n #1 { + \__shipout_add_foreground_box:n { \__shipout_picture_overlay_lower_right:n {#1} } } +\cs_set_eq:NN \AtBeginShipoutLowerLeft + \__shipout_add_background_picture_lower_left:n +\cs_set_eq:NN \AtBeginShipoutLowerLeftForeground + \__shipout_add_foreground_picture_lower_left:n +\cs_set_eq:NN \AtBeginShipoutUpperRight + \__shipout_add_background_picture_upper_right:n +\cs_set_eq:NN \AtBeginShipoutUpperRightForeground + \__shipout_add_foreground_picture_upper_right:n +\cs_set_eq:NN \AtBeginShipoutLowerRight + \__shipout_add_background_picture_lower_right:n +\cs_set_eq:NN \AtBeginShipoutLowerRightForeground + \__shipout_add_foreground_picture_lower_right:n +\ExplSyntaxOff \endinput %% %% End of file `bidi-atbegshi.sty'. \ No newline at end of file -- cgit v1.2.3