From f68c780d6454f39b2b65fd74df409817b7c2fe8b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 17 Jan 2008 07:37:48 +0000 Subject: update textpos from ctan git-svn-id: svn://tug.org/texlive/trunk@6283 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/textpos/textpos.drv | 12 +- Master/texmf-dist/source/latex/textpos/textpos.dtx | 158 ++++++++++++++------- 2 files changed, 111 insertions(+), 59 deletions(-) (limited to 'Master/texmf-dist/source/latex/textpos') diff --git a/Master/texmf-dist/source/latex/textpos/textpos.drv b/Master/texmf-dist/source/latex/textpos/textpos.drv index 40f151eb618..71a01a01bea 100644 --- a/Master/texmf-dist/source/latex/textpos/textpos.drv +++ b/Master/texmf-dist/source/latex/textpos/textpos.drv @@ -28,17 +28,17 @@ %% See the file LICENCE for a copy of the GPL. %% You can also find an online copy at http://www.gnu.org/copyleft/gpl.html . %% -%%% Source: $Id: textpos.dtx.in,v 1.13 2007/03/21 20:37:33 norman Exp $ +%%% Source: $Id: textpos.dtx.in,v 1.18 2007/04/04 13:22:51 norman Exp $ %% %%\def\ParseRCSDate$#1: #2 #3 ${\def\TP@Date{#2}} -%%\ParseRCSDate$Date: 2007/03/21 20:37:33 $ +%%\ParseRCSDate$Date: 2007/04/04 13:22:51 $ \def\filename{textpos} -\def\fileversion{1.7b} -\def\filedate{2007/03/21} -\def\docdate{2007 March 21} +\def\fileversion{1.7d} +\def\filedate{2007/03/30} +\def\docdate{2007 March 30} \documentclass{ltxdoc} \title{Textpos: absolute positioning of text on the page} -\author{Norman Gray\\(\texttt{norman@astro.gla.ac.uk})} +\author{Norman Gray\\(\texttt{http://nxg.me.uk})} \date{Version \fileversion, \filedate} \newcommand\Lopt[1]{\textsf {\small [#1]}} \newcommand\file[1]{\texttt {#1}} diff --git a/Master/texmf-dist/source/latex/textpos/textpos.dtx b/Master/texmf-dist/source/latex/textpos/textpos.dtx index b13c43e782e..da206294dc1 100644 --- a/Master/texmf-dist/source/latex/textpos/textpos.dtx +++ b/Master/texmf-dist/source/latex/textpos/textpos.dtx @@ -24,15 +24,15 @@ %% See the file LICENCE for a copy of the GPL. %% You can also find an online copy at http://www.gnu.org/copyleft/gpl.html . %% -%<+package|driver|example>%%% Source: $Id: textpos.dtx.in,v 1.13 2007/03/21 20:37:33 norman Exp $ +%<+package|driver|example>%%% Source: $Id: textpos.dtx.in,v 1.18 2007/04/04 13:22:51 norman Exp $ %% %<*package|driver> %%\def\ParseRCSDate$#1: #2 #3 ${\def\TP@Date{#2}} -%%\ParseRCSDate$Date: 2007/03/21 20:37:33 $ +%%\ParseRCSDate$Date: 2007/04/04 13:22:51 $ \def\filename{textpos} -\def\fileversion{1.7b} -\def\filedate{2007/03/21} -\def\docdate{2007 March 21} +\def\fileversion{1.7d} +\def\filedate{2007/03/30} +\def\docdate{2007 March 30} % %<+package>\NeedsTeXFormat{LaTeX2e} %<+package>\ProvidesPackage{textpos}[\filedate\space v\fileversion] @@ -41,7 +41,7 @@ %<*driver> \documentclass{ltxdoc} \title{Textpos: absolute positioning of text on the page} -\author{Norman Gray\\(\texttt{norman@astro.gla.ac.uk})} +\author{Norman Gray\\(\texttt{http://nxg.me.uk})} \date{Version \fileversion, \filedate} \newcommand\Lopt[1]{\textsf {\small [#1]}} \newcommand\file[1]{\texttt {#1}} @@ -112,12 +112,12 @@ % let me know if you experience problems in this respect. % % This package requires the services of Martin Schr\"oder's package -% \texttt{everyshi}. You will need to download this package from CTAN -% first. See +% \texttt{everyshi}. If this is not already part of your \TeX{} +% installation, you will need to download this package from CTAN. See % \url{http://www.tex.ac.uk/tex-archive/macros/latex/contrib/supported/ms/} % or one of the other CTAN hosts. % -% This software is copyright, 1999, 2001--03, 2005-6, Norman Gray. It +% This software is copyright, 1999, 2001--03, 2005--7, Norman Gray. It % is released under % the terms of the GNU General Public Licence. See the copyright % declaration at the top of file \texttt{textpos.dtx}, and the file @@ -322,28 +322,36 @@ % the width and location arguments to the (unstarred) \Lenv{textblock} % environment. % -% \pstyle{Textpos} overrides any \Lenv{figure} and \Lenv{table} -% \marginpar{Figure and table environments} -% environments \emph{within} instances of the \Lenv{textblock} environment. -% It does not, however, do so outside the environment, so you are -% still able to use \pstyle{textblock} within figures, as described -% above; also it avoids doing so unless the documentclass already -% defined a \Lenv{figure} environment. This is because the normal -% behaviour of these environments -- which is to float their contents -% away from the point of definition -- obviously interacts very badly -% with the \Lenv{textblock} environment, since -% the floats float far from the \Lenv{textblock} where you put them. -% Within a \Lenv{textblock}, therefore, these environments do nothing +% \pstyle{Textpos} changes\marginpar{Figure and table environments} +% the behaviour of any \Lenv{figure} and \Lenv{table} environments +% \emph{within} instances of the \Lenv{textblock} environment, in such +% a way that the figure or table contents do not float away from the +% \Lenv{textblock} environment. For the same reason, |\marginpar| is +% forbidden within a textblock. It makes no change, however, outside +% the environment, where figures float as normal, and you are still +% able to use \pstyle{textblock} within figures, as described above. +% Within a \Lenv{textblock}, these environments do nothing % beyond accepting the usual |\caption| command, which behaves % correctly with respect to caption numbering and |\label| commands % (it also respects |\@makecaption|, so you can tinker with that if % you like that sort of thing). There's no real need to use either -% the \Lenv{figure} or \Lenv{table} environments -- you don't require -% them to allow |\includegraphics| or \Lenv{tabular} to work, for -% example -- but many people automatically use them to surround -% graphics or tables, and also expect to use these environments to -% number figures and tables within \Lenv{textblock} environments; they -% are therefore here on a principle of least surprise. +% the \Lenv{figure} or \Lenv{table} environments within a textblock -- +% you don't require them to allow |\includegraphics| or \Lenv{tabular} +% to work, for example -- but many people automatically use them to +% surround graphics or tables, and also expect to use these +% environments to number figures and tables within \Lenv{textblock} +% environments; they are therefore here on a principle of least +% surprise. +% +% The support here is admittedly simple, and it is known to fail in +% the case where there are \Lenv{figure} (or \Lenv{table}) +% environments both inside and outside \Lenv{textblock}s on the same +% page (the LoF is ordered incorrectly in this case, due to the +% different times that the various environments write to the +% \texttt{.lof} file). I don't have immediate plans to fix this: the +% situation is surely sufficiently rare as not to justify the +% (potentially fragile) complication of the fix -- if you disagree, +% let me know. % % Since both \LaTeX's floats mechanism (that is, \Lenv{figure} and % \Lenv{table}) and the \Lopt{absolute} mode are designed to move @@ -492,6 +500,7 @@ % \end{description} % \end{raggedright} % +% \section{Notes} % \subsection{Suggestions: Producing large-format posters} % % If you are producing a large-format poster, such as A0 size, you @@ -531,7 +540,8 @@ % % \subsection{Interactions} % -% Textpos does not appear to get on terribly well with Prosper (a +% Textpos does not appear to get on terribly well with +% Prosper\marginpar{textpos \& prosper} (a % problem reported by Erik Van Eynde). This is because % Textpos in absolute mode places its text onto the page at the last % moment before the page is shipped out, which will be \emph{after} @@ -544,7 +554,28 @@ % relative mode as long as the \Lenv{textblock} environment is the % first thing on the slide. % -% Gabriel Zachmann suggested having Textpos put a grid on the page, so +% There's also an unfortunate interaction with the \texttt{color} +% package\marginpar{textpos \& color}. Textpos in absolute mode, and +% the \texttt{pdftex} graphics driver, both squabble over who gets to +% redefine the |\shipout| command: using the |\pagecolor| command with +% \texttt{pdflatex} causes textpos absolute mode to behave +% strangely\footnote{See the \texttt{comp.text.tex} thread `Colour in +% a0 poster' starting 2007 April 3}. A fix may appear here in time, but +% for the present, there are three workarounds. The first is to place +% the |\pagecolor{...}| command before |\begin{document}|, which +% causes the redefinitions of |\shipout| to happen in a working +% order. If this is impossible for some reason, then (as with the +% Prosper workaround above) you can use textpos not in absolute +% mode: if the textblocks are the first printable material on the +% page, then they're anchored at a fixed position, and you should be +% able to use textblocks and |\pagecolor| with \texttt{pdflatex} +% much as normal. The final possibility is to use \texttt{latex}, +% \texttt{dvips} and \texttt{ps2pdf} to produce PDF, since the +% dvips driver happens not to have this problem (thanks to Joris Vankerschaver +% for the initial report, and to Heiko Oberdiek for one of the workarounds). +% +% 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. @@ -554,7 +585,8 @@ % \url{http://purl.org/nxg/dist/textpos}. % % Finally, Robert Wenner reported a problem when using Textpos along -% with the \texttt{texdraw} package, with |\move(0,0)| apparently +% with the \texttt{texdraw} package\marginpar{textpos \& texdraw}, with +% |\move(0,0)| apparently % making a difference when it should be a no-op. I haven't worked out % what's going on here. % @@ -585,8 +617,11 @@ % borders, and that it would be useful to turn the bordering feature % on and off within the file. % -% Thanks also for bugreports to Jozef Bednarcik, Wolfgang Fleischer -% and Robert Whittaker. +% Axel Sommerfeldt provided elegant code to fix incorrect +% behaviour of |\caption| within the \Lenv{figure} environment. +% +% Thanks also for bugreports to Jozef Bednarcik, Wolfgang Fleischer, +% Robert Whittaker and Giovanni Radilla. % % If you've reported a bug or made a suggestion and I haven't credited % you here, please do accept my apologies, and please let me know. @@ -703,19 +738,37 @@ located at that point, rather than the top-left corner. % % \subsection{Other initialisation} % -% Handle our local figure and table environments, in the case where -% the current document class has defined a figure environment (we -% assume that the figure and table environments always go together). -% These do almost nothing, but they carefully do not float, which causes mucho -% confusion within documents. Define private macros, to which -% |\TP@textblock| defines |\figure| and |\table|. +% Handle floats. The following definition of |\TP@xfloat| will be +% used to redefine |\@xfloat| within textblocks. It has the same +% `interface' as |\@xfloat| -- and in particular, it sets |\@captype|, +% so that |\caption| will still work -- except that it ignores any +% placement specifiers, and doesn't put anything into the |\@currbox|. +% Thus nothing will actually float from here, and thus float out of the +% textblock. +% +% We have to open a box, and set |\@floatpenalty|, because +% |\end@float| expects to close a box; and we don't want to redefine +% |\end@float| because that would required us to redefine +% |\end@dblfloat| as well. Redefine |\@xympar| to throw an error: +% this means that |\marginpar| is forbidden inside textblocks. Hmm, +% it also means that it's forbidden even within a minipage -- is that +% a bad thing? % \changes{1.6a}{2005/10/13}{remove superfluous definitions of thefigure} +% \changes{1.7c}{2007/03/29}{fix caption handling -- code from Axel Sommerfeldt} +% \changes{1.7d}{2007/03/30}{further figure fixes, building on more Axel suggestions} % \begin{macrocode} -\@ifundefined{figure}{}{ - \newcommand\TP@caption[2]{\refstepcounter{#1}\@caption{#1}[]{#2}} - \newcommand\TP@figure{\par \def\caption##1{\TP@caption{figure}{##1}}} - \newcommand\TP@table {\par \def\caption##1{\TP@caption{table}{##1}}} +\def\TP@xfloat#1[#2]{ + \par\def\@captype{#1}% + \@floatpenalty\z@ + \color@vbox + \normalcolor + \vbox\bgroup } +\def\TP@xympar{ + \PackageError{textpos} + {You can't use \protect\marginpar\space within a textblock} + {You're using textpos because you _don't_ want things to float + around, yes?}} % \end{macrocode} % % \subsection{The box handling starts here} @@ -1024,19 +1077,18 @@ located at that point, rather than the top-left corner. \def\TP@textblock[#1,#2](#3,#4){% \TP@tbargs={{#1}{#2}{#3}{#4}}% % \end{macrocode} -% Now set the \Lenv{figure} and \Lenv{table} environments to be the -% special textpos ones within the textblock. Do this only if the -% \Lenv{figure} environment is already defined (there's no reason why -% we \emph{mustn't} define it in the other case, but the user won't -% expect it, so there's no reason to add it). +% +% Now (re)define |\@xfloat| and |\@xympar| to be the stub ones defined +% above. Do this in all cases, even those where the |\figure| +% environment is not defined: if there's no figure environment, this +% will end up otiose rather than wrong, plus this will cope with the +% rather peculiar case where there are some floats defined +% \emph{other} than |\figure|. % \begin{macrocode} - \@ifundefined{figure}{}{ - \let\figure\TP@figure - \let\table\TP@table - \let\endfigure\relax - \let\endtable\relax - } + \let\@xfloat\TP@xfloat + \let\@xympar\TP@xympar % \end{macrocode} +% % Start the |\TP@textbox|, which contains the contents of the textblock. % \begin{macrocode} \setbox\TP@textbox=\vbox\bgroup -- cgit v1.2.3