Paul Taylor's right-justified end-of-proof mark, 12 April 1994 %%======================================================================== %************************************************************************% %* *% %* Maybe you already have a \qed macro to put a little square *% %* on the right hand side at the end of a mathematical proof? *% %* *% %* IT'S PROBABLY MINE! *% %* *% %* Please compare yours with \parag@pushright below. *% %* *% %* This new file is compatible, it fixes the bugs, has extra *% %* features, and is maintained and portable. Please use it! *% %* *% %************************************************************************% %========================================================================% % NEW FEATURE (12 April 1994) \WillHandleQED and \HandleQED for % environments which do not give access to the right hand side of the page. % COPYRIGHT (C) 1993 Paul Taylor, Imperial College, London SW7 2BZ, UK % You may use this file for any purpose. You may copy it on condition that % you do so in exactly the form in which it was supplied, make no charge % for the copy and impose the same conditions on the recipient. % This software is supplied ``as is'' without warranty, express or implied, % including but not limited to merchantability and fitness for any particular % purpose. No liability is accepted by the author, Imperial College or any % third party for any direct or consequential damages, however caused. % In all cases you must keep several backup versions of your files in a place % to which your machine cannot write, and you must check documents visually % before submitting the final version to a publisher or expensive printer. % WARNING: If you use this with Frank Mittlebach's "theorem.sty" you % MUST load theorem first, then QED, then do the \newtheorem commands. % "theorem.sty" provides a number of typographical styles and is % available by anonymous ftp from ftp.uni-stuttgart.de (129.69.1.12) % in the directory /pub/soft/tex/macros/latex/styles/base/theorem % also Aston: ftp.tex.ac.uk:/pub/archive/macros/latex/styles/base/theorem % Authoritative version: /tex/contrib/Taylor/tex/QED.sty % by anonymous FTP from: theory.doc.ic.ac.uk (146.169.2.27) % author/maintained by: Dr Paul Taylor % WARNING: This file replaces some of the functions of "Paul.sty" % and MUST NOT be used with it as serious conflicts will arise. % A new version is available as /tex/contrib/Taylor/Paul.sty as above. %========================================================================= % USER INTERFACE AND EXAMPLES (see also OPTIONS below) % LaTeX2e \usepackage options: see \DeclareOption commands below % theorems-as-commands roman-theorems italic-theorems % auto-QED explicit-QED number-theorems dont-number-theorems % black-square open-square % \begin{Proof} ... \end{Proof} % or \Proof ... \endProof % or \Proof ... \endproof % or \Proof ... \qed also \QED \QEF and \QEI % WARNING: \qed which doesn't follow \Proof will not print the square. % Each properly nested Proof/endProof pair gets a single % \qedsymbol at the end, on the far right hand side. % Unfortunately, this may still be in the wrong place % if the proof ends with a display or itemisation. % To solve this, \qed may be put *inside* the last substantive % environment; the \qedsymbol will be put at that point % (the visual end) and suppressed at the logical end of proof. % Examples: % \begin{Proof} \begin{Proof} % ... ... % \begin{eqnarray} \begin{itemize} % ... &=& ... \\ \item ... % .. &=& ... &\qed \item ... \qed % \end{eqnarray} \end{itemize} % \end{Proof} \end{Proof} % also works with $$...$$ and \[...\] displays, including fleqn.sty. % Unfortunately some environments, such as picture, do not allow this at all. % See the section "centering environments" below for the mechanism for % passing \qed to such an environment for special processing. % In fact \qed will only work in those environments which provide access to % the right hand side of the page. In other words, wherever you think % "\hfill\square" ought to work then \qed will; of course it is just because % that naive method doesn't work that this macro file is needed at all. % The macro was designed to solve the problem in the case of "unrestricted % horizontal mode" (ie at the end of a paragraph); it also works in $$ % displays by pretending to be an equation number. In most other cases it % basically does "\hfill\square" or "\hfill$\square$" and hopes for the best. % If you have to put \qed outside the environment, it may be appropriate to % put \vskip-\baselineskip before it, unless of course this would over-print. % There is, however, still a danger that TeX will break the page here. % This seems to be unavoidable if the environment ends with a \penalty. % The eqnarray example above does not in fact work: if you try it you'll % get "! Paragraph ended before \llap was complete" with LaTeX in a mess. % This is a very common place where you might want to put the end of proof % mark, and I also consider that the fourth column should be available for % "reasons" for equational steps. The following substitute for \eqnarray % allows this, whilst being compatible with automatic numbering. I have % proposed it to Rainer Sch\"opf for inclusion in LaTeX. If you want to % use it, please copy it to another file rather than uncommenting it here. % Don't forget to use \makeatletter or put it in a documentstyle (.sty) file. % % \def\eqnarray{\stepcounter{equation}\let\@currentlabel\theequation % \global\@eqnswtrue\m@th\global\@eqcnt\z@\tabskip\@centering\let\\\@eqncr % $$\halign to\displaywidth\bgroup\@eqnsel\hskip\@centering$\displaystyle % \tabskip\z@{##}$&\global\@eqcnt\@ne\hskip 2\arraycolsep \hfil${##}$\hfil % &\global\@eqcnt\tw@\hskip2\arraycolsep$\displaystyle\tabskip\z@{##}$\hfil % \tabskip\@centering&% % \global\@eqcnt\thr@@\hbox to\z@\bgroup\hss##%*** instead of "\llap{##}" % \tabskip\z@\cr}% % \def\@@eqncr{\let\@tempa\relax % \ifcase\@eqcnt \def\@tempa{& & &}\or \def\@tempa{& &}% % \or\def\@tempa{&}\else\@eqnswfalse%*** instead of "\else\def\@tempa{&}" % \fi\@tempa\if@eqnsw\@eqnnum\stepcounter{equation}\fi % \egroup%*** added, to match \bgroup in fourth cell of preamble % \global\@eqnswtrue\global\@eqcnt\z@\cr} % Why can't we do all of this with \endProof? Because by that stage % the damage has been done: the environments, paragraphs or % displays have already been closed and their \hbox'es added % to the current vertical list, and cannot be removed for % alteration if this is the current page. % Even if you don't need to put \qed inside an inner environment % to avoid a blank line, it's still a good idea to do so, because % otherwise it's possible that intervening end-of-environment % material may allow TeX to put the mark on the next page. % This file may be called QED.sty, QED.tex, qed.sty or qed.tex. % It may be loaded using \input, \usepackage or as a \documentstyle option, % as it is careful to handle the \catcode of @ appropriately. % If you don't use theorem.sty, this file instead provides options to use % commands to begin theorems, instead of enclosing them in environments, % and to suppress numbering and italicisation. A rudimentary version of % \newtheorem for plain TeX is also implemented (always using commands % rather than environments). % At the end of the file some useful \newtheorem % commands are listed but not executed. % NB \Theorem\Proof\endProof\qed will print the second square, whereas % \begin{Theorem}\end{Theorem}\begin{Proof}\end{Proof}\qed will not.