summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-15 22:18:48 +0000
committerKarl Berry <karl@freefriends.org>2021-02-15 22:18:48 +0000
commitcf0d1ffa580dbfe425966a2a53a1afb3b2358ca8 (patch)
treedea6d4242ac976876697815c712284cc6aec8989 /Master/texmf-dist/tex/latex
parent9768438230ae9c76f047c5aeda365e27c46a7218 (diff)
bxpdfver (15feb21)
git-svn-id: svn://tug.org/texlive/trunk@57755 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty61
1 files changed, 50 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
index ad472da1b4f..826eef3efdd 100644
--- a/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
+++ b/Master/texmf-dist/tex/latex/bxpdfver/bxpdfver.sty
@@ -1,7 +1,7 @@
%%
%% This is file 'bxpdfver.sty'.
%%
-%% Copyright (c) 2014-2020 Takayuki YATO (aka. "ZR")
+%% Copyright (c) 2014-2021 Takayuki YATO (aka. "ZR")
%% GitHub: https://github.com/zr-tex8r
%% Twitter: @zr_tex8r
%%
@@ -10,7 +10,7 @@
%% package declaration
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bxpdfver}[2020/04/19 v0.5]
+\ProvidesPackage{bxpdfver}[2021/02/14 v0.5a]
\def\bxpv@pkgname{bxpdfver}
%% preparations
@@ -140,6 +140,10 @@
\else \expandafter\@gobble
\fi{\let\ifbxpv@defined\iffalse}
+%% \ifbxpv@old@hook@system
+\newif\ifbxpv@old@hook@system
+\@ifl@t@r\fmtversion{2020/10/01}{}{\bxpv@old@hook@systemtrue}
+
%--------------------------------------- internal dispatchers
%% \bxpv@suppress@compress
@@ -185,6 +189,9 @@
\@onlypreamble\bxpv@begin@document@hook
\let\bxpv@begin@document@hook\@empty
\AtBeginDocument{\bxpv@begin@document@hook}
+\g@addto@macro\bxpv@begin@document@hook{%
+ \bxpv@check@hyperref % must come first
+}
%% 'disabled' driver
\if 0\bxpv@drv@type
@@ -363,6 +370,13 @@
\global\bxpdfverObjCompressionSuppressedtrue
}
+% Note: Priority against hyperref's 'pdfversion' parameter
+% The existing behaviors on PDF mode should be preserved:
+% - If hyperref is loaded but 'pdfversion' is not given, then
+% bxpdfver's setting (explicit request) should win.
+% - If hyperref is loaded and 'pdfversion' is given, then
+% hyperref should win (with a warning).
+
%%<*> \setpdfversion{<version>}
\@onlypreamble\setpdfversion
\newcommand*\setpdfversion[1]{%
@@ -570,11 +584,37 @@
\expandafter\bxpv@tmpa\bxpv@tmpb\bxpv@end
\endgroup
+%% \bxpv@check@hyperref
+\def\bxpv@check@hyperref{%
+ \bxpv@oktrue
+ \ifx\bxpdfverMinorVersion\relax\else
+ \@ifpackageloaded{hyperref}{%
+ \expandafter\ifx\csname ifHy@setpdfversion\expandafter
+ \endcsname\csname iftrue\endcsname
+ \bxpv@okfalse
+ \fi
+ }{}%
+ \fi
+ \ifbxpv@ok\else
+ \PackageWarningNoLine\bxpv@pkgname
+ {Both hyperref and this package try to set the PDF\MessageBreak
+ version; this can cause problems. This package's\MessageBreak
+ setting will be withdrawn for now, but you must\MessageBreak
+ fix your source to avoid it}%
+ % Note: In PDF mode, the real parameters will be overwritten
+ % later by hyperref.
+ \let\bxpdfverMinorVersion\relax
+ \let\bxpdfverMajorVersion\relax
+ \fi
+}
+
%--------------------------------------- dvipdfmx something
\ifx d\bxpv@drv@type % 'dvipdfmx'
%% required packages
+\ifbxpv@old@hook@system
\RequirePackage{atbegshi}[2007/04/19]% v1.2
+\fi
%% variables
\let\bxpv@C@value\relax
@@ -604,16 +644,12 @@
\fi
\ifbxpv@ok
\ifx\bxpdfverMinorVersion\relax\else
- \g@addto@macro\bxpv@page@specials{%
- \special{pdf:minorversion \the\bxpdfverMinorVersion}%
- }%
+ \bxpv@put@special{pdf:minorversion \the\bxpdfverMinorVersion}%
\fi
\ifx\bxpdfverMinorVersion\relax\else
\bxpv@cache@fetch{dvipdfmxver}%
\ifnum\bxpv@cache@@dvipdfmxver<20180217 \else
- \g@addto@macro\bxpv@page@specials{%
- \special{pdf:majorversion \the\bxpdfverMajorVersion}%
- }%
+ \bxpv@put@special{pdf:majorversion \the\bxpdfverMajorVersion}%
\fi
\fi
\fi
@@ -623,9 +659,7 @@
{Cannot suppress compression}%
\ifbxpv@ok
% New dvipdfmx supports this special.
- \g@addto@macro\bxpv@page@specials{%
- \special{dvipdfmx:config z 0}%
- }%
+ \bxpv@put@special{dvipdfmx:config z 0}%
\fi
\fi
% object compression
@@ -673,6 +707,7 @@
% special added to every page
\ifx\bxpv@page@specials\@empty\else
\edef\bxpv@page@specials{\bxpv@page@specials}%
+ \ifbxpv@old@hook@system
\AtBeginShipout{%
\setbox\AtBeginShipoutBox=\vbox{%
\baselineskip\z@skip\lineskip\z@skip\lineskiplimit\z@
@@ -680,6 +715,10 @@
\copy\AtBeginShipoutBox
}%
}%
+ \else
+ \AddToHook{shipout/foreground}{%
+ \hb@xt@\z@{\bxpv@page@specials\hss}}%
+ \fi
\fi
}