summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-09-26 21:41:39 +0000
committerKarl Berry <karl@freefriends.org>2020-09-26 21:41:39 +0000
commit4cf6ce1de7e4eb7cd23871f3d8eca68849a79e56 (patch)
tree64e5f0868071ebab429e0ee66371423a6edb0209 /Master/texmf-dist/tex
parentf09725e0d1775da9c39734e7d8d4e56c20659054 (diff)
textpos (26sep20)
git-svn-id: svn://tug.org/texlive/trunk@56441 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/textpos/textpos.sty139
1 files changed, 91 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/latex/textpos/textpos.sty b/Master/texmf-dist/tex/latex/textpos/textpos.sty
index ad216f0a4ab..6a3354e4e38 100644
--- a/Master/texmf-dist/tex/latex/textpos/textpos.sty
+++ b/Master/texmf-dist/tex/latex/textpos/textpos.sty
@@ -7,7 +7,7 @@
%% textpos.dtx (with options: `package')
%% Textpos: absolute positioning of text on the page
%%%% File: textpos.dtx
-%%%% Copyright 1999-2019, Norman Gray
+%%%% Copyright 1999-2020, Norman Gray
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -19,21 +19,21 @@
%%
%% This work has the LPPL maintenance status `maintained'.
%%
-%% The Current Maintainer of this work is Norman Gray <http://nxg.me.uk>
+%% The Current Maintainer of this work is Norman Gray <https://nxg.me.uk>
%%
%% This work consists of the files textpos.dtx and textpos.ins,
%% and the derived file textpos.sty.
%%
-%% Author: Norman Gray, norman@astro.gla.ac.uk.
+%% Author: Norman Gray, gray@nxg.name
%% Department of Physics and Astronomy, University of Glasgow, UK
%%
%% See the file LICENCE for a copy of the LPPL.
%%
-%% Mercurial ident: 09ee0efc21ac (1.9.1+0), 2019-04-15 22:14 +0100
+%% Mercurial ident: c834991c867a (1.10+1), 2020-09-26 17:44 +0100
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{textpos}[2019/04/15 v1.9.1]
-\typeout{Package: textpos 2019/04/15 1.9.1, absolute positioning of text on the page}
+\ProvidesPackage{textpos}[2020/09/26 v1.10]
+\typeout{Package: textpos 2020/09/26 1.10, absolute positioning of text on the page}
\newif\ifTPshowboxes
\TPshowboxesfalse
@@ -56,8 +56,15 @@
\TP@displayholdboxtrue
\DeclareOption{discardcontent}{\TP@displayholdboxfalse}
\ProcessOptions
-\ifTP@abspos
- \RequirePackage{everyshi}
+\newif\ifTP@Liii
+\@ifl@t@r\fmtversion{2020/10/01}\TP@Liiitrue\TP@Liiifalse
+\PackageInfo{textpos}{choosing support for \ifTP@Liii LaTeX3\else LaTeX2e\fi}
+\ifTP@Liii
+ % avoid everyshi package
+\else
+ \ifTP@abspos
+ \RequirePackage{everyshi}
+ \fi
\fi
\RequirePackage{keyval}
\define@key{tp}{absolute}{\csname TP@abspos#1\endcsname}
@@ -80,6 +87,7 @@
{You can't use \protect\marginpar\space within a textblock}
{You're using textpos because you _don't_ want things to float around, yes?}}
\newbox\TP@textbox
+\newif\ifTP@vmode
\ifTP@abspos
\newbox\TP@holdbox % starts off void
\AtEndDocument{\ifTP@displayholdbox\ifvoid\TP@holdbox \else \hbox{}\fi\fi}
@@ -133,6 +141,29 @@
\newdimen\TPboxrulesize
\setlength{\TPboxrulesize}{0.4pt}
\def\showtextsize{\normalsize}
+\def\TPShowGrid{\@ifstar{\@tempswatrue\@TPShowGrid}{\@tempswafalse\@TPShowGrid}}
+\def\@TPShowGrid#1#2{
+ \begin{textblock}{#1}(0,0)
+ \lineskip=0pt % abut boxes directly
+ \setbox0=\hbox{(0)}%
+ \@tempdima=\TPVertModule
+ \advance\@tempdima -1.1\ht0
+ \@tempcnta=0
+ \hrule
+ \loop
+ \vbox to \TPVertModule{\noindent
+ \@tempcntb=0
+ \vrule
+ \loop
+ \hbox to \TPHorizModule{%
+ \if@tempswa\raise\@tempdima\hbox{(\the\@tempcntb,\the\@tempcnta)}\fi
+ \hfil \vrule height \TPVertModule}%
+ \advance\@tempcntb 1
+ \ifnum\@tempcntb<#1 \repeat
+ \vss \hrule}
+ \advance\@tempcnta 1
+ \ifnum\@tempcnta<#2 \repeat
+ \end{textblock}}
\ifTP@abspos
\newdimen\TP@ox
\newdimen\TP@oy
@@ -189,32 +220,30 @@
\def\TPReferencePosition#1{\def\TP@referenceposition{#1}}
\def\textblock#1{%
\@tempdima=#1\TPHorizModule
- \ifvmode\else
+ \TP@begintextblock
+}
+\def\TP@textblockstar#1{%
+ \setlength{\@tempdima}{#1}%
+ \TP@begintextblock
+}
+\expandafter\let\csname textblock*\endcsname\TP@textblockstar
+\def\TP@begintextblock{%
+ \ifvmode
+ \TP@vmodetrue
+ \else
\ifmmode
\PackageError{textpos}
{You cannot use textblock in maths mode}
{You may use the textblock environment only in \MessageBreak
- vertical mode or horizontal mode (when it triggers a\MessageBreak
- new paragraph). You cannot use it in maths mode.}
+ vertical mode or horizontal mode. You cannot use it in maths mode.}
\else % in horizontal mode
- \par % force us back into vertical mode
+ \TP@vmodefalse
+ \@bsphack
+ \unskip
\fi
\fi
\@ifnextchar[{\TP@textblock}{\expandafter\TP@textblock\expandafter[\TP@referenceposition]}%] bracematch
}
-\def\TP@textblockstar#1{%
- \setlength{\@tempdima}{#1}
- \ifvmode\else
- \PackageWarning{textpos}{environment textblock* not in vertical mode.
- \MessageBreak
- Environment textblock* should not have any text\MessageBreak
- or printable material appearing before it.\MessageBreak
- Alignment may work out wrongly.}%
- \par % force us back into vertical mode
- \fi
- \@ifnextchar[{\TP@textblock}{\expandafter\TP@textblock\expandafter[\TP@referenceposition]}%] bracematch
-}
-\expandafter\let\csname textblock*\endcsname\TP@textblockstar
\newtoks\TP@tbargs
\def\TP@textblock[#1,#2](#3,#4){%
\TP@tbargs={{#1}{#2}{#3}{#4}}%
@@ -242,10 +271,9 @@
\hskip\TP@absmargin\vbox\bgroup
\textwidth\hsize \columnwidth\hsize \linewidth\hsize
\fi
- }
+}
\def\endtextblock{\global\@tempswatrue\TP@commonendtextblock}
\@namedef{endtextblock*}{\global\@tempswafalse\TP@commonendtextblock}
-\newdimen\TP@prevdepth
\def\TP@commonendtextblock{%
\ifdim\TP@margin = 0pt
\relax
@@ -260,17 +288,15 @@
{\color{\TP@rulecolour}\hrule depth 0pt height \TPboxrulesize}%
\fi
\egroup % end of \TP@textbox
- \TP@prevdepth=\prevdepth
- \prevdepth=-1000pt % = \nointerlineskip
\expandafter\TP@endtextblock\the\TP@tbargs
- }
+}
\def\TP@endtextblock#1#2#3#4{%
\if@tempswa % modular/unstarred endtextblock
\@tempdima=#3\TPHorizModule
\@tempdimb=#4\TPVertModule
\else % absolute/starred endtextblock
- \setlength{\@tempdima}{#3}
- \setlength{\@tempdimb}{#4}
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#4}%
\fi
\ifdim\TP@margin < 0pt
\advance\@tempdima \TP@margin
@@ -346,25 +372,42 @@
\box0
}%
\else
- \box0
- \prevdepth=\TP@prevdepth
+ \ifTP@vmode
+ \@tempdima=\prevdepth
+ \prevdepth=-1000pt % = \nointerlineskip, supressing interline glue
+ \box0 % zero height+depth
+ \prevdepth=\@tempdima
+ \else
+ \vadjust{\box0}%
+ \@esphack
+ \fi
\fi
- }%
+}
\ifTP@abspos
- \ifTP@overlay
- \EveryShipout{\ifTP@displayholdbox
- \global\setbox\@cclv\vbox{%
- \vbox to 0pt{\ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi \vss}%
- \unvbox\TP@holdbox % TP@holdbox is now void
- }%
- \fi}%
+ \ifTP@Liii
+ \ifTP@overlay
+ \AddToHook{shipout/foreground}{%
+ \ifTP@displayholdbox\put(\strip@pt\dimexpr1in,-\strip@pt\dimexpr1in){\box\TP@holdbox}\fi}
+ \else
+ \AddToHook{shipout/background}{%
+ \ifTP@displayholdbox\put(\strip@pt\dimexpr1in,-\strip@pt\dimexpr1in){\box\TP@holdbox}\fi}
+ \fi
\else
- \EveryShipout{\ifTP@displayholdbox
- \global\setbox\@cclv\vbox{%
- \unvbox\TP@holdbox
- \ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi
- }%
- \fi}%
+ \ifTP@overlay
+ \EveryShipout{\ifTP@displayholdbox
+ \global\setbox\@cclv\vbox{%
+ \vbox to 0pt{\ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi \vss}%
+ \unvbox\TP@holdbox % TP@holdbox is now void
+ }%
+ \fi}%
+ \else
+ \EveryShipout{\ifTP@displayholdbox
+ \global\setbox\@cclv\vbox{%
+ \unvbox\TP@holdbox
+ \ifvbox\@cclv \unvbox\@cclv \else \box\@cclv \fi
+ }%
+ \fi}%
+ \fi
\fi
\textblockorigin{0pt}{0pt}%
\fi