diff options
author | Karl Berry <karl@freefriends.org> | 2020-09-26 21:41:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-09-26 21:41:39 +0000 |
commit | 4cf6ce1de7e4eb7cd23871f3d8eca68849a79e56 (patch) | |
tree | 64e5f0868071ebab429e0ee66371423a6edb0209 /Master/texmf-dist/source/latex | |
parent | f09725e0d1775da9c39734e7d8d4e56c20659054 (diff) |
textpos (26sep20)
git-svn-id: svn://tug.org/texlive/trunk@56441 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/textpos/textpos.drv | 19 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/textpos/textpos.dtx | 353 |
2 files changed, 256 insertions, 116 deletions
diff --git a/Master/texmf-dist/source/latex/textpos/textpos.drv b/Master/texmf-dist/source/latex/textpos/textpos.drv index c77cc9eb131..331d0176495 100644 --- a/Master/texmf-dist/source/latex/textpos/textpos.drv +++ b/Master/texmf-dist/source/latex/textpos/textpos.drv @@ -7,7 +7,7 @@ %% textpos.dtx (with options: `driver') %% 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,36 +19,37 @@ %% %% 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 %% \documentclass{ltxdoc} \title{Textpos: absolute positioning of text on the page} -\author{Norman Gray\\(\texttt{http://nxg.me.uk})} -\date{Version 1.9.1, 2019 April 15\footnote{Mercurial ident: 09ee0efc21ac (1.9.1+0), 2019-04-15 22:14 +0100. -This software is copyright, 1999-2019 Norman Gray. +\author{Norman Gray\\(\texttt{https://nxg.me.uk})} +\date{Version 1.10, 2020 September 26\footnote{Mercurial ident: c834991c867a (1.10+1), 2020-09-26 17:44 +0100. +This software is copyright, 1999-2020 Norman Gray. It is released under the terms of the LaTeX Project Public License, either version 1.3 of this licence or (at your option) any later version. The latest version of this license is at \texttt{http://www.latex-project.org/lppl.txt}.}} \newcommand\Lopt[1]{\textsf {\small [#1]}} \newcommand\file[1]{\texttt {#1}} -\newcommand\Lcount[1]{\textsl {\small#1}} +\newcommand\Lcount[1]{\textsl{\small#1}} \newcommand\Lenv[1]{\texttt{\{#1\}}} -\newcommand\pstyle[1]{\textsl {#1}} +\newcommand\pstyle[1]{\textsf{#1}} \makeatletter % make the ttfamily font less overbearingly large \renewcommand\ttfamily{\not@math@alphabet\ttfamily\mathtt \fontfamily\ttdefault \fontsize{9}{\f@baselineskip}\selectfont} \makeatother +\def\LaTeXiie{\LaTeX$2\epsilon$} \def\activemeta#1>{\meta{#1}} {\catcode`\<=\active \gdef\cmd{\begingroup diff --git a/Master/texmf-dist/source/latex/textpos/textpos.dtx b/Master/texmf-dist/source/latex/textpos/textpos.dtx index 7be07003894..7b43236da42 100644 --- a/Master/texmf-dist/source/latex/textpos/textpos.dtx +++ b/Master/texmf-dist/source/latex/textpos/textpos.dtx @@ -3,7 +3,7 @@ % anywhere on the LaTeX page. It's useful for posters. % %%%% 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 @@ -15,41 +15,42 @@ %% %% 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 %% %<+package>\NeedsTeXFormat{LaTeX2e} -%<+package>\ProvidesPackage{textpos}[2019/04/15 v1.9.1] -%<+package>\typeout{Package: textpos 2019/04/15 1.9.1, absolute positioning of text on the page} +%<+package>\ProvidesPackage{textpos}[2020/09/26 v1.10] +%<+package>\typeout{Package: textpos 2020/09/26 1.10, absolute positioning of text on the page} % %<*driver> \documentclass{ltxdoc} \title{Textpos: absolute positioning of text on the page} -\author{Norman Gray\\(\texttt{http://nxg.me.uk})} -\date{Version 1.9.1, 2019 April 15\footnote{Mercurial ident: 09ee0efc21ac (1.9.1+0), 2019-04-15 22:14 +0100. -This software is copyright, 1999-2019 Norman Gray. +\author{Norman Gray\\(\texttt{https://nxg.me.uk})} +\date{Version 1.10, 2020 September 26\footnote{Mercurial ident: c834991c867a (1.10+1), 2020-09-26 17:44 +0100. +This software is copyright, 1999-2020 Norman Gray. It is released under the terms of the LaTeX Project Public License, either version 1.3 of this licence or (at your option) any later version. The latest version of this license is at \texttt{http://www.latex-project.org/lppl.txt}.}} \newcommand\Lopt[1]{\textsf {\small [#1]}} \newcommand\file[1]{\texttt {#1}} -\newcommand\Lcount[1]{\textsl {\small#1}} +\newcommand\Lcount[1]{\textsl{\small#1}} \newcommand\Lenv[1]{\texttt{\{#1\}}} -\newcommand\pstyle[1]{\textsl {#1}} +\newcommand\pstyle[1]{\textsf{#1}} \makeatletter % make the ttfamily font less overbearingly large \renewcommand\ttfamily{\not@math@alphabet\ttfamily\mathtt \fontfamily\ttdefault \fontsize{9}{\f@baselineskip}\selectfont} \makeatother +\def\LaTeXiie{\LaTeX$2\epsilon$} % Make command strings easier to write \def\activemeta#1>{\meta{#1}} {\catcode`\<=\active @@ -114,15 +115,17 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % section headings, citations, graphics inclusion, and so on. Please % let me know if you experience problems in this respect. % -% This package requires the services of Martin Schr\"oder's package -% \texttt{everyshi}. If this is not already part of your \TeX{} +% \emph{If it is running in \LaTeXiie} (as opposed to the newer \LaTeX3), +% this package requires the services of Martin Schr\"oder's package \pstyle{everyshi}. +% If this is not already part of your \TeX{} % installation, you will need to download this package from CTAN. See % \url{https://www.ctan.org/pkg/everyshi}. % % The canonical CTAN URL for Textpos is \url{https://ctan.org/pkg/textpos}. % Textpos has a home page at \url{http://purl.org/nxg/dist/textpos}. -% The source is held at bitbucket: \url{https://bitbucket.org/nxg/textpos}, -% and there is an issues list there, for bug reports. Code +% The source is held at \url{https://code.nxg.name/nxg/tex/textpos}. +% \iffalse and there is an issues list there, for bug reports.\fi +% Code % contributions or fixes are welcome, but note that I feel that % Textpos is pretty mature now, and I'm reluctant to extend its % functionality beyond its natural boundaries, so it would be wise to @@ -219,13 +222,21 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % was changed, and specified, in that version. % % The \Lenv{textblock} environment will most often be used in -% vertical mode. If it is called in horizontal (ie, paragraph) mode, -% however, it will silently create a paragraph break by inserting a -% |\par| command before the environment; it remains in vertical mode -% after the environment is finished. It should have no further -% effects on spacing, and if you find that it does, that's a bug. If -% you try to use the environment when in maths mode, the package -% objects (as it should!). +% vertical mode. It can also be called in horizontal (ie, paragraph) +% mode. In each case, it should be invisible, in the sense of having +% no effect on the spacing of the paragraph text.\footnote{Note: +% \emph{this is a change} in version +% 1.10. Before then the behaviour of the package in horizontal +% mode was deliberately somewhat underspecified (with an intended +% implication of `don't do this'), and the package, for want of anything +% more imaginative to do, simply threw in a paragraph break. As a +% result of user feedback, from version 1.10 it seemed reasonable to try +% a little harder to be invisible in the horizontal case.} +% If called in horizontal mode (in \TeX\ terms), the relative-mode +% `anchor point' is just below the box containing the current line (it +% uses |\vadjust|, if that helps). +% If you try to use the environment when in maths mode, the package +% objects. % % \subsection{Package options} % \label{packopts} @@ -234,7 +245,14 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % \begin{description} % \item[\Lopt{showboxes}]When you are laying things out, it can be % useful to have the boxes drawn in for you. This option draws a box -% fitting closely round the set text. +% fitting closely round the contents of each \Lenv{textblock} environment. +% Note that this option is +% intended to help locate boxes on the page when composing a document, +% and the boxes are not intended to be decorative. However the +% \Lenv{textblock} environment is compatible with (for example) the +% \pstyle{tcolorbox} package, in the sense that you can +% include a \Lenv{tcolorbox} environment within a \Lenv{textblock} +% environment, with the expected effect\footnote{See also \url{https://tex.stackexchange.com/questions/34088/}.}. % \item[\Lopt{noshowtext}]This suppresses the display of the text in % each block (so it's not really usable without the \Lopt{showboxes} % option). The resulting box will be the correct size, but empty, @@ -290,7 +308,8 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % \subsubsection{Setting up a positioning grid} % % \DescribeMacro{\TPGrid} -% You will often wish to set up a grid on your page. Rather than +% The dimensions |\TPHorizModule| and |\TPVertModule| implicitly +% create a positioning grid on the page. Rather than % calculate and specify the two modules explicitly, you can set up the % grid with a command % \cmd|\TPGrid{<nhoriz>}{<nvert>}|, which sets @@ -317,6 +336,16 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % leaving 40mm of a border on the right and left sides, and a 20mm % border top and bottom. % +% \DescribeMacro{\TPShowGrid} +% Note that this sets up a notional layout grid for the page or, put +% another way, it sets the module units with respect to which the +% |(<hpos>,<vpos>)| coordinates are interpreted, but it +% does not actually draw a grid on the page. To display the grid, use +% the |\TPShowGrid{<nhoriz>}{<nvert>}| macro. This has a starred +% variant, which additionally shows the coordinates at each grid +% point. You should do this near the beginning of your file. +% For an alternative approach, see Sect.~\ref{s:interactions}. +% % \subsubsection{Box margin} % % \DescribeMacro{\TPMargin} @@ -445,6 +474,9 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % the width and location arguments to the (unstarred) \Lenv{textblock} % environment. % +% With the unstarred \Lenv{textblock} environment, however, you will generally be able to +% use the |\fpeval| command of the `xfp' package.\footnote{https://ctan.org/pkg/xfp} +% % \subsection{Package parameters} % \begin{raggedright} % \begin{description} @@ -454,7 +486,8 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % size parameters of the \Lenv{textblock} environment. Set it using % the command \cmd|\setlength{\TPHorizModule}{<dimen>}| (or indeed % |\addtolength|). -% The default is one sixteenth of the paper width. +% The default is one sixteenth of the paper width +% (ie, as if set up with |\TPGrid{16}{16}|). % \item[\texttt{\bslash TPVertModule}] % \DescribeMacro{\TPVertModule} % The length unit which is used for the vertical positioning and @@ -719,10 +752,11 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % % Gabriel Zachmann suggested having Textpos put a grid on the % page\marginpar{page grid}, so -% that it is easier to work out \Lenv{textblock} coordinates. I may -% yet do this, but it may not be necessary, since Rolf Niepraschk's -% \texttt{eso-pic} package can help you create this grid yourself. -% There is a vivid example of using Textpos along with Rolf's +% that it is easier to work out \Lenv{textblock} coordinates. I have +% (finally, in 1.10) followed this suggestion, in the |\TPShowGrid| macro, but +% another approach to doing this, which may have further useful +% flexibility, is to use Rolf Niepraschk's +% \texttt{eso-pic} package. There is a vivid example of using Textpos along with Rolf's % \texttt{eso-pic} package and the \texttt{calc} package on the % Textpos web pages, at % \url{http://purl.org/nxg/dist/textpos}, and an example of how to @@ -757,7 +791,40 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % \section{History} % \iffalse @RELEASENOTES@ \fi % \begin{description} -% \item[\textbf{1.9.1, 2019 April 15}]\relax +% \item[\textbf{1.10, 2020 September 26}]\relax +% +% \begin{itemize} +% \item Use the \emph{ltshipout} package to place boxes in absolute mode. +% Therefore the package should now be compatible with LaTeX3. +% Many thanks to Ulrike Fischer for guidance on the changes which were required here. +% \item The code has moved from bitbucket.org to +% code.nxg.name\footnote{\url{https://code.nxg.name/nxg/tex/textpos/}}, +% since bitbucket have closed down support for Mercurial. The +% outstanding issues have been preserved, but have not (yet) been +% migrated to a new system, so may become inaccessible. +% \end{itemize} +% +% +% \item[1.10b1, 2020 January 26]\relax +% +% \begin{itemize} +% \item Add the |\TPShowGrid| macro. +% \item Become invisible in horizontal mode. +% \emph{Note: this is a change in behaviour:} +% Before this the behaviour of the package in horizontal +% mode was deliberately somewhat underspecified (with an intended +% implication of ‘don't do this’), and the package, for want of anything +% more imaginative to do, simply threw in a paragraph break, which +% produced ugly spacing in some circumstances. As a result of +% user +% feedback\footnote{\url{https://tex.stackexchange.com/questions/525453/}}, from version 1.10 it seemed reasonable to try a little +% harder to be invisible in the horizontal case +% (see issue 16\footnote{\url{https://bitbucket.org/nxg/textpos/issues/16/}}). +% \item Various documentation improvements. +% \end{itemize} +% +% +% \item[1.9.1, 2019 April 15]\relax % % \begin{itemize} % \item Added the |\TPReferencePosition| command, to change the @@ -958,6 +1025,9 @@ The latest version of this license is at \texttt{http://www.latex-project.org/lp % The text includes footnoted thanks to various people who have made % (sometimes very detailed) suggestions for functionality. % +% Ulrike Fischer provided detailed guidance on the changes required to +% make \pstyle{textpos} compatible with \LaTeX3. +% % Thanks are additionally due, for general bugreports and other suggestions, to % Jozef Bednarcik, % Richard G Daniel, @@ -1084,13 +1154,33 @@ located at that point, rather than the top-left corner. \ProcessOptions % \end{macrocode} % +% \subsection{\LaTeX3/\LaTeXiie\ compatibility} +% +% This code aims to be compatible with both \LaTeXiie\ and \LaTeX3. This +% means that it must use the \pstyle{everyshi} package in the \LaTeXiie\ +% case, and can use the corresponding built-in \LaTeX3 mechanism otherwise. +% For documentation on the latter, see the `ltshipout' package documentation. +% +% There are a couple of places in where we must switch behaviour. +% Conditionalise them with a single switch. +% \begin{macrocode} +\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} +% \end{macrocode} +% % \subsection{Required Packages} % -% To manipulate |\box255|, this package needs the package -% \texttt{everyshi}, which provides the command |\EveryShipout|. +% To manipulate |\box255| when using \LaTeXiie, +% this package needs the package +% \pstyle{everyshi}, which provides the command |\EveryShipout|. % \begin{macrocode} -\ifTP@abspos - \RequirePackage{everyshi} +\ifTP@Liii + % avoid everyshi package +\else + \ifTP@abspos + \RequirePackage{everyshi} + \fi \fi \RequirePackage{keyval} % \end{macrocode} @@ -1151,9 +1241,15 @@ located at that point, rather than the top-left corner. % When the package is invoked in `absolute' mode, the contents of % |\TP@textbox| are not shipped out immediately, but instead put into the box % |\TP@holdbox|, which holds the boxes until the page as a whole is -% shipped out (these additions contributed by Olaf Maibaum). +% shipped out.\footnote{These additions contributed by Olaf Maibaum} % \changes{v1.1}{1999/02/22}{Introduce holdbox, and absolute/relative modes} % +% Add a flag which is used to recall the vertical/horizontal mode in +% which the textblock is prepared. +% \begin{macrocode} +\newif\ifTP@vmode +% \end{macrocode} +% % Define the holdbox only in the `absolute positioning' mode. % \begin{macrocode} \ifTP@abspos @@ -1166,9 +1262,8 @@ located at that point, rather than the top-left corner. % non-empty; the page is no longer empty, so the output routine must % be called at some point. The alternative is to add such an hbox at % the end of every textblock, when in absolute mode. That solves -% this problem, but introduces others by interfering with vertical spacing. -% (thanks to Bjoern Pedersen for diagnosing this in an old version -% of textpos). +% this problem, but introduces others by interfering with vertical +% spacing.\footnote{Thanks to Bjoern Pedersen for diagnosing this in an old version of textpos} % \begin{macrocode} \AtEndDocument{\ifTP@displayholdbox\ifvoid\TP@holdbox \else \hbox{}\fi\fi} \fi @@ -1274,6 +1369,39 @@ located at that point, rather than the top-left corner. \def\showtextsize{\normalsize} % \end{macrocode} % +% In order to make it easy to visualise the grid, the +% |\TPShowGrid| macro displays it on the page. There's a starred +% version, which shows the coordinates, and an unstarred version, +% which doesn't. +% \begin{macrocode} +\def\TPShowGrid{\@ifstar{\@tempswatrue\@TPShowGrid}{\@tempswafalse\@TPShowGrid}} +% \end{macrocode} +% And the implementation +% \begin{macrocode} +\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}} +% \end{macrocode} +% % \begin{macro}{\textblockorigin} % If we're producing a single page of text, it can be convenient to % set an origin. This command may only be used in absolute mode. @@ -1412,22 +1540,10 @@ located at that point, rather than the top-left corner. % \begin{macrocode} \def\textblock#1{% \@tempdima=#1\TPHorizModule - \ifvmode\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.} - \else % in horizontal mode - \par % force us back into vertical mode - \fi - \fi - \@ifnextchar[{\TP@textblock}{\expandafter\TP@textblock\expandafter[\TP@referenceposition]}%] bracematch + \TP@begintextblock } % \end{macrocode} % \end{macro} -% % \begin{macro}{\textblock*} % |\begin{textblock*}| is a variant of |\begin{textblock}| which takes % absolute values for its arguments. It uses |\setlength| throughout, @@ -1435,20 +1551,32 @@ located at that point, rather than the top-left corner. % \changes{1.2a}{2002/04/28}{Added textblock* env} % \begin{macrocode} \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 + \setlength{\@tempdima}{#1}% + \TP@begintextblock } \expandafter\let\csname textblock*\endcsname\TP@textblockstar % \end{macrocode} % \end{macro} +% Common code for |textblock| and |textblock*|. +% \begin{macrocode} +\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. You cannot use it in maths mode.} + \else % in horizontal mode + \TP@vmodefalse + \@bsphack + \unskip + \fi + \fi + \@ifnextchar[{\TP@textblock}{\expandafter\TP@textblock\expandafter[\TP@referenceposition]}%] bracematch +} +% \end{macrocode} % % \begin{macro}{\TP@textblock} % Command |\TP@textblock| saves all its arguments in a token list, for @@ -1522,7 +1650,7 @@ located at that point, rather than the top-left corner. \hskip\TP@absmargin\vbox\bgroup \textwidth\hsize \columnwidth\hsize \linewidth\hsize \fi - } +} % \end{macrocode} % \end{macro} % @@ -1546,12 +1674,6 @@ located at that point, rather than the top-left corner. % |\TP@endtextblock| with the arguments we saved in the token register % in |\TP@tbargs|. % -% To manipulate the spacing around textblocks, we want to save the -% |\prevdepth| quantity in |\TP@prevdepth|. -% \begin{macrocode} -\newdimen\TP@prevdepth -% \end{macrocode} -% % Now we can handle the end of the textblock. When |\TP@margin| is % non-zero, include a final skip which is the size of the absolute % value of this margin. @@ -1572,26 +1694,11 @@ located at that point, rather than the top-left corner. \egroup % end of \TP@textbox % \end{macrocode} % -% Control vertical spacing: we need to avoid causing the -% insertion of more space in the case where this \texttt{textblock} is -% between paragraphs of text. Save the |\prevdepth|, then set it to -% $-1000pt$, suppressing interline glue; then add the zero-size vbox; -% then restore |\prevdepth| to what it was before. See the discussion -% of interline glue (ie, |\baselineskip| and |\prevdepth|) in -% Chapter~12 (p.~80) of the \TeX book (thanks to Peter M\"unster -% \texttt{<peter@univ-rennes1.fr>} for spotting that I'd got this -% wrong in the previous version). -% \changes{v1.1e}{2001/04/29}{Replace randomly-placed nointerline skip with prevdepth acrobatics, to avoid spacing misfeatures} -% \changes{v1.4}{2003/09/05}{Improve prevdepth calculations, adding TP@prevdepth} -% \begin{macrocode} - \TP@prevdepth=\prevdepth - \prevdepth=-1000pt % = \nointerlineskip -% \end{macrocode} % Finally, call |\TP@endtextblock| to do the work of putting the text % on the page, directly or indirectly. % \begin{macrocode} \expandafter\TP@endtextblock\the\TP@tbargs - } +} % \end{macrocode} % \end{macro} % @@ -1625,8 +1732,8 @@ located at that point, rather than the top-left corner. \@tempdima=#3\TPHorizModule \@tempdimb=#4\TPVertModule \else % absolute/starred endtextblock - \setlength{\@tempdima}{#3} - \setlength{\@tempdimb}{#4} + \setlength{\@tempdima}{#3}% + \setlength{\@tempdimb}{#4}% \fi % \end{macrocode} % Next, we adjust them so that the position |(#1,#2)| is at this @@ -1727,7 +1834,9 @@ located at that point, rather than the top-left corner. % \subsection{Sending the boxes to the output} % % Now switch behaviour depending on whether or not we're in the -% absolute-position mode. If we are, then add the newly-constructed +% absolute-position mode. +% +% If we are in absolute position mode, then add the newly-constructed % box 0 to (the end of) the holdbox. The order matters in some % (many?, all?) circumstances, since this way means that later % textblock environments go `on top of' earlier ones, which is @@ -1750,18 +1859,47 @@ located at that point, rather than the top-left corner. % all offset from the same point, and (b) that we are invisible with % respect to any |\parskip| or |\baselineskip| calculations that were % relevant at the time we started the textblock. +% See the discussion of interline glue +% (ie, |\baselineskip| and |\prevdepth|) +% in Chapter~12 (p.~80) of the \TeX book. % \begin{macrocode} \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 - }% +} % \end{macrocode} % \end{macro} % -% Finally, and only if we are in the absolute-position mode, set up -% the output routine with |\EveryShipout|, and set the textblockorigin -% to the (default) upper-left corner of the paper. Respect the +% Finally, and only if we are in the absolute-position mode, +% set the textblockorigin to the (default) upper-left corner of the paper, +% and organise the shipout mechanism to place the |\TP@holdbox| in a suitable place. +% +% There are two cases here, one when we are using \LaTeX3, and one +% with \LaTeXiie. +% +% First, the \LaTeX3 case: use the `ltshipout' mechanism.. +% \begin{macrocode} +\ifTP@abspos + \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 +% \end{macrocode} +% +% Second, the \LaTeXiie\ case: use the macros provided by the \pstyle{everyshi} package. +% We set up the output routine with |\EveryShipout|, and . Respect the % \Lopt{overlay} option by putting the |\TP@holdbox| contents % \emph{after} the |\@cclv| contents, putting the latter into a size-0 % box (could this cause a problem with spacing? I don't think so, at @@ -1774,21 +1912,22 @@ located at that point, rather than the top-left corner. % If |\ifTP@displayholdbox| is false, then both of these should be no-ops. % \changes{v1.2b}{2002/07/01}{Defend against box 255 not being a vbox} % \begin{macrocode} -\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}% \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 |