diff options
author | Karl Berry <karl@freefriends.org> | 2022-02-13 21:27:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-02-13 21:27:34 +0000 |
commit | 8b9c1a6c19efe20f71e8e09925d33d25d8cec691 (patch) | |
tree | 15367e93a919e8ee848e7545b8bbdc4c817d3d62 /Master/texmf-dist/tex/xelatex | |
parent | 41e0a376b50d2614a40ed17972ee2933b686354a (diff) |
bidi-atbegshi (13feb22)
git-svn-id: svn://tug.org/texlive/trunk@62009 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/bidi-atbegshi/bidi-atbegshi.sty | 176 |
1 files changed, 68 insertions, 108 deletions
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 <vafak@me.com> +%% Copyright © 2014--2022 Vafa Khalighi <tex-persian@vafa.ac> %% %% 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 |