texlive[41857] Master: phffullpagefigure (16aug16)

commits+karl at tug.org commits+karl at tug.org
Mon Aug 15 22:37:30 CEST 2016


Revision: 41857
          http://tug.org/svn/texlive?view=revision&revision=41857
Author:   karl
Date:     2016-08-15 22:37:30 +0200 (Mon, 15 Aug 2016)
Log Message:
-----------
phffullpagefigure (16aug16)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/phffullpagefigure/
    trunk/Master/texmf-dist/doc/latex/phffullpagefigure/Makefile
    trunk/Master/texmf-dist/doc/latex/phffullpagefigure/README.md
    trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf
    trunk/Master/texmf-dist/doc/latex/phffullpagefigure/pkg.mk
    trunk/Master/texmf-dist/source/latex/phffullpagefigure/
    trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.dtx
    trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.ins
    trunk/Master/texmf-dist/tex/latex/phffullpagefigure/
    trunk/Master/texmf-dist/tex/latex/phffullpagefigure/phffullpagefigure.sty
    trunk/Master/tlpkg/tlpsrc/phffullpagefigure.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/Makefile
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phffullpagefigure/Makefile	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/phffullpagefigure/Makefile	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,10 @@
+
+PKG = phffullpagefigure
+
+-include pkg.mk
+
+pkg.mk:
+	ln -sf ../mkcommon/pkg.mk pkg.mk
+
+install:  install_sty install_doc
+


Property changes on: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phffullpagefigure/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/phffullpagefigure/README.md	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,14 @@
+# The phffullpagefigure package
+
+Typeset figures which fill up a full page of a document.
+
+Provide a figure environment which provides the figure content on its own page,
+with the corresponding caption reading for example "Figure 3 (on next page):
+<caption>".
+
+
+# Documentation
+
+Run 'make sty' to generate the style file and 'make pdf' to generate the package
+documentation. Run 'make' or 'make help' for more info.
+


Property changes on: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf	2016-08-15 20:33:22 UTC (rev 41856)
+++ trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf	2016-08-15 20:37:30 UTC (rev 41857)

Property changes on: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/phffullpagefigure.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/pkg.mk
===================================================================
--- trunk/Master/texmf-dist/doc/latex/phffullpagefigure/pkg.mk	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/phffullpagefigure/pkg.mk	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,167 @@
+
+#
+# Common useful definitions
+#
+LATEX = latex
+
+PDFLATEX = TEXINPUTS="$$TEXINPUTS:../phfnote" pdflatex
+PDFLATEXOPTS = -interaction=batchmode
+PDFLATEXOPTSLAST = -interaction=batchmode --synctex=1
+
+MAKEINDEX = makeindex
+
+
+#
+# Set default PREFIX. This can be overridden with 'make install PREFIX=/installation/directory'
+#
+DEFAULT_PREFIX := $(shell kpsewhich -var-value TEXMFHOME)
+PREFIX ?= $(DEFAULT_PREFIX)
+
+
+#
+# package should be set in variable PKG
+#
+PKGREADME = README.md
+
+#
+# packages may specify additional files in the distribution with this variable
+# (by default empty)
+#
+DIST_ADDITIONAL_FILES ?= 
+
+
+PKGDTX = $(PKG).dtx
+PKGINS = $(PKG).ins
+PKGSTY = $(PKG).sty
+PKGPDF = $(PKG).pdf
+PKGTDSZIP = $(PKG).tds.zip
+PKGZIP = $(PKG).zip
+
+
+
+.PHONY: help sty pdf install install_sty install_doc tdszip dist clean cleanall cleansty cleanaux cleanpdf cleantdszip cleandist
+
+
+help:
+	@echo "Targets for $(PKG):"
+	@echo "make sty             -- generate LaTeX package file $(PKG).sty"
+	@echo "make pdf             -- generate pdf documentation"
+	@echo "make install         -- install style and documentation files to TEXMF tree"
+	@echo "make install PREFIX=[specify texmf directory]"
+	@echo "make $(PKG).tds.zip  -- create TDS.ZIP to include in CTAN upload"
+	@echo "make dist            -- create distribution ZIP, ready for upload to CTAN"
+	@echo "make clean           -- remove LaTeX auxiliary files"
+	@echo "make cleansty        -- remove generated style file"
+	@echo "make cleanpdf        -- remove generated pdf documentation"
+	@echo "make cleanall        -- remove all generated files, incl. distribution zip"
+
+
+clean: cleanaux
+
+cleanall: cleansty cleanaux cleanpdf cleantdszip cleandist
+
+# ------------------------------------------------
+# make sty
+# ------------------------------------------------
+
+sty: $(PKGSTY)
+
+$(PKGSTY): $(PKGINS) $(PKGDTX)
+	$(LATEX) $<
+
+cleansty:
+	@rm -f $(PKGSTY)
+
+# ------------------------------------------------
+# make pdf
+# ------------------------------------------------
+
+pdf: $(PKG).pdf
+
+#
+# fake index & glossary so they get a TOC entry from the beginning, and so the page
+# numbers in the index are correct.
+#
+$(PKG).aux $(PKG).idx $(PKG).glo: $(PKGDTX) $(PKGSTY)
+	DTX=$< ; echo '\\begin{theindex}\\item index here \\end{theindex}' >$${DTX%.dtx}.ind
+	DTX=$< ; echo '\\begin{theglossary}\\item changes here\\end{theglossary}' >$${DTX%.dtx}.gls
+	$(PDFLATEX) $(PDFLATEXOPTS) $<
+	$(PDFLATEX) $(PDFLATEXOPTS) $<
+	$(PDFLATEX) $(PDFLATEXOPTS) $<
+
+$(PKG).ind: $(PKG).idx
+	$(MAKEINDEX) -s gind.ist -o $@ $<
+
+$(PKG).gls: $(PKG).glo
+	$(MAKEINDEX) -s gglo.ist -o $@ $<
+
+# final steps of making the PKG.pdf doc file.  At the end, touch the ind and gls files so
+# that they don't look out-of-date (because the idx and glo files were overwritten again)
+$(PKGPDF): $(PKGDTX) $(PKG).aux $(PKG).ind $(PKG).gls
+	$(PDFLATEX) $(PDFLATEXOPTS) $<
+	$(PDFLATEX) $(PDFLATEXOPTS) $<
+	$(PDFLATEX) $(PDFLATEXOPTSLAST) $<
+	touch $(PKG).ind $(PKG).gls $(PKG).pdf
+
+
+cleanaux:
+	@rm -f *.aux *.log *.toc *.glo *.gls *.ind *.idx *.ilg *.out *.bbl *.blg *.synctex.gz *.hd
+
+cleanpdf:
+	@rm -f $(PKGPDF)
+
+# ------------------------------------------------
+# 'make install' partial installation targets
+# ------------------------------------------------
+
+#
+# The install target itself is defined per-package, in case packages want to install more
+# files (such as bibtex styles)
+#
+
+install_sty: $(PKGSTY)
+	mkdir -p $(DESTDIR)$(PREFIX)/tex/latex/$(PKG)
+	cp $(PKGSTY)  $(DESTDIR)$(PREFIX)/tex/latex/$(PKG)
+
+install_doc: $(PKGPDF)
+	mkdir -p $(DESTDIR)$(PREFIX)/doc/latex/$(PKG)
+	cp $(PKGPDF) $(PKGREADME)  $(DESTDIR)$(PREFIX)/doc/latex/$(PKG)
+
+
+
+# ------------------------------------------------
+# make tdszip
+# ------------------------------------------------
+
+TDSTMPDIR = $(CURDIR)/_install_tds_zip.make.tmp
+
+tdszip: $(PKGTDSZIP)
+
+$(PKGTDSZIP): $(PKGSTY) $(PKGPDF)
+	mkdir $(TDSTMPDIR)
+	$(MAKE) install PREFIX=$(TDSTMPDIR)
+	cd $(TDSTMPDIR) && zip -r $(CURDIR)/$(PKGTDSZIP) *
+	rm -rf $(TDSTMPDIR)
+
+cleantdszip:
+	@rm -f $(PKGTDSZIP)
+
+
+# ------------------------------------------------
+# make dist
+# ------------------------------------------------
+
+DISTTMPDIR = $(CURDIR)/_install_dist_zip.make.tmp
+
+dist: $(PKGZIP)
+
+$(PKGZIP): $(PKGTDSZIP)
+	rm -rf $(DISTTMPDIR)
+	mkdir -p $(DISTTMPDIR)/$(PKG)
+	cp $(PKGTDSZIP) $(DISTTMPDIR)
+	cp $(PKGDTX) $(PKGINS) $(PKGPDF) $(PKGREADME) Makefile pkg.mk $(DIST_ADDITIONAL_FILES) $(DISTTMPDIR)/$(PKG)
+	cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKGTDSZIP) $(PKG)
+	rm -rf $(DISTTMPDIR)
+
+cleandist:
+	@rm -f $(PKGZIP)


Property changes on: trunk/Master/texmf-dist/doc/latex/phffullpagefigure/pkg.mk
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.dtx	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,968 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+% -------------------------------------------------------
+% 
+% This file may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in:
+%
+%    http://www.latex-project.org/lppl.txt
+%
+% and version 1.3 or later is part of all distributions of LaTeX 
+% version 2005/12/01 or later.
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{phffullpagefigure.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+%<package>\ProvidesPackage{phffullpagefigure}
+%<*package>
+    [2016/08/15 v1.0 phffullpagefigure package]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{xcolor}
+\usepackage{phffullpagefigure}
+\usepackage[preset=xpkgdoc]{phfnote}
+\EnableCrossrefs         
+\CodelineIndex
+\RecordChanges
+\begin{document}
+  \DocInput{phffullpagefigure.dtx}
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{0}
+%
+% \CharacterTable
+%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%   Digits        \0\1\2\3\4\5\6\7\8\9
+%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%   Dollar        \$     Percent       \%     Ampersand     \&
+%   Acute accent  \'     Left paren    \(     Right paren   \)
+%   Asterisk      \*     Plus          \+     Comma         \,
+%   Minus         \-     Point         \.     Solidus       \/
+%   Colon         \:     Semicolon     \;     Less than     \<
+%   Equals        \=     Greater than  \>     Question mark \?
+%   Commercial at \@     Left bracket  \[     Backslash     \\
+%   Right bracket \]     Circumflex    \^     Underscore    \_
+%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%   Right brace   \}     Tilde         \~}
+%
+%
+% \changes{v1.0}{2016/04/20}{Initial version}
+%
+% \GetFileInfo{phffullpagefigure.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment,\def,\gdef,\edef,\xdef,\if,\else,\fi,\ifx}
+% 
+% \title{\phfqitltxPkgTitle{phffullpagefigure}}
+% \author{Philippe Faist\quad\email{philippe.faist at bluewin.ch}}
+% \date{\pkgfmtdate\filedate}
+% \maketitle
+%
+% \begin{abstract}
+%   \pkgname{phffullpagefigure}---Figures which fill up a full page of a document.
+% \end{abstract}
+%
+% \inlinetoc
+%
+% \section{Introduction}
+%
+% The package \pkgname{phffullpagefigure} provides an implementation for figures which are
+% to be displayed to occupy a full page.
+%
+% A typical use case: suppose you have a figure in PDF format of the size of the document
+% paper, for example, and wants to include it as a figure.
+%
+% This package takes care to display the caption of the figure on the preceeding page,
+% with a caption of the form ``Figure X (on facing page): \meta{caption}.''
+%
+% For two-sided documents, you may specify on which (odd/even) page side
+% you want the figure to appear.  If the document is not two-sided, the
+% figure may appear on any page.
+%
+% A number of options allow you to set the exact figure contents (usually a
+% PDF file, but it can be constructed from arbitrary \LaTeX{} commands),
+% the figure caption placement (top, own page, bottom), the caption and
+% label as usual, and the formatting of the caption if you want to replace
+% the default ``(on facing page)'' or ``(on next page).''
+%
+%
+% \section{The Full-Page-Figure Environment}
+%
+% \DescribeEnv{fullpagefigure} The |\begin{fullpagefigure}| |...|
+%   |\end{fullpagefigure}| environment starts a full-page-figure.  Inside
+% this environment, only the following commands may be used:
+% \begin{itemize}
+% \item one of the |\fig***| commands;
+% \item the |\caption| command, to provide a figure caption as for regular
+%   figures;
+% \item the |\label| command to set a label for text references to this
+%   figure, also as for regular figures.
+% \end{itemize}
+%
+% A simple example to get started:
+%
+% \begin{verbatim}
+% \begin{fullpagefigure}
+%   \figpdf{fig/my-figure} % my PDF file
+%   \caption{A colorful figure with letters and words.  The table
+%     design may remind you of going to the optician.}
+%   \label{fig:test}
+% \end{fullpagefigure}
+% \end{verbatim}
+%
+% \begin{fullpagefigure}%
+%   \iffalse meta-comment
+%     In this documentation code, we cheat and provide LaTeX code for the
+%     figure instead of a PDF file.  This is really just so that we don't
+%     have to ship an extra PDF file (and for no other reason).
+%     
+%     See a trick in http://tex.stackexchange.com/a/278101/32188 and
+%     http://tex.stackexchange.com/a/40503/32188 .
+%   \fi
+%   \figcontents{\newpage\thispagestyle{empty}\relax
+%     \newgeometry{margin=0.25in}\relax
+%     \sffamily\fontsize{36pt}{42pt}\fontseries{bx}\selectfont
+%     \hbox to 0.9\textwidth{\fcolorbox{red}{yellow}{\vbox to 0.99\textheight{\vfil\vfil\vfil\centering
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{red!50!black} T H I S }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{green!70!red} F I G U R E }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{black!40!blue} F I L L S }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{green!40!blue} U P }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{red!50!gray} T H E }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{blue} W H O L E }\par\vfil
+%         \vfil
+%         \leavevmode\noindent\hbox to 0.8\textwidth{ \color{red!50!yellow} P A G E }\par\vfil
+%         \vfil\vfil\vfil}}}%
+%       \clearpage\aftergroup\restoregeometry}%
+%   \caption{A colorful figure with letters and words.  The table design
+%       may remind you of going to the optician.}%
+%   \label{fig:test}%
+% \end{fullpagefigure}
+%
+% The |\figpdf| command sets the PDF file to be displayed in full page (see
+% more details below).  You may contemplate the result of this code in
+% \autoref{fig:test}.
+%
+% Some wizard once told me that old wise men had determined that the
+% |fullpagefigure| environment should be placed at the beginning of a
+% paragraph, or on its own paragraph.  (TODO: I'm not too sure why this is
+% the case or if this is still relevant.)
+%
+%
+% The contents and appearance of the figure can be adjusted by the
+% following commands, which must be issued within the |fullpagefigure|
+% environment.
+%
+% \DescribeMacro{\figcontents} Specify the contents of the figure by calling
+% |\figcontents|\marg{\LaTeX{} commands}.  The contents can be any \LaTeX{}
+% commands which will generate the figure content.  These commands will be
+% called within an |afterpage| block.\footnote{See documentation for the
+% \pkgname{afterpage} package}
+%
+% If you want a figure to occupy several pages, you may use for example
+% |\figcontents{\includepdf{pdf-1}\includepdf{pdf-2}}|, and request that
+% the figure start on an even-side page with |\figpageside{even}|.
+%
+% If the \meta{\LaTeX{} commands} are not |\includepdf| instructions
+% and want to change the page geometry for the figure and you're using
+% the \pkgname{geometry} package, have a look at these \texttt{TeX.SX}
+% answers\footnote{\url{http://tex.stackexchange.com/a/278101/32188}
+% and \url{http://tex.stackexchange.com/a/40503/32188}} for getting
+% the |\newgeometry| and
+% |\restoregeometry| commands right.  You might use, for example:\\[1ex]
+% \noindent|\figcontents{\newpage\thispagestyle{empty}%|\\
+% \hspace*{2em}|\newgeometry{margin=0.25in}% or 0in for no margins|\\
+% \hspace*{2em}\meta{\ldots{} \LaTeX{} commands to draw figure contents ...}\\
+% \hspace*{2em}|\clearpage\aftergroup\restoregeometry}|.
+%
+%
+% 
+% \DescribeMacro{\figpdf} As a shorthand, you may use
+% |\figpdf|\oarg{options}\marg{pdf-file} as a shorthand for
+% |\figcontents{\includepdf|\oarg{options}\marg{pdf-file}|}|.
+% 
+% You should explore the options provided by |\includepdf| (from the
+% \pkgname{pdfpages} package\footnote{See documentation at
+% \url{https://www.ctan.org/pkg/pdfpages}}).  For example, the figure can
+% be resized to fill the page, pages may be selected individually from a
+% mult-page PDF, the image may be rotated, etc.
+%
+%
+% \DescribeMacro{\caption} \DescribeMacro{\label} The |\caption|\oarg{short
+% caption}\marg{caption} and |\label|\marg{identifier} macros may be used
+% as for a normal figure.  Be warned, though, that some dark manipulations
+% occur here, so it may be for example that the code passed as argument to
+% these commands is expanded only later.
+%
+% \DescribeMacro{\figpageside} Use the commands |\figpageside{odd}|,
+% |\figpageside{}|, or |\figpageside{even}| to specify on which side the
+% figure should appear on if the document is two-sided.  This command has
+% no effect if the document is not two-sided (|twoside| class option for
+% the |article| or |book| classes, for example).  Calling |\figpageside{}|,
+% i.e.\@ with an empty argument, instructs |fullpagefigure| to use either
+% side, whichever is more convenient.
+%
+% \DescribeMacro{\figplacement} Specify the figure caption placement with
+% |\figplacement||{b|$\mid$|t|$\mid$|p}|.  Each of |b| (bottom), |t| (top)
+% and |p| (own page) work as for usual LaTeX floats.  If you specify |p|,
+% do NOT combine it with any other option.  You may leave the argument
+% empty (|\figplacement{}|) to use defaults.
+%
+% The figure placement can also be specified as an optional argument to the
+% environment (e.g., |\begin{fullpagefigure}[p]| \ldots{} |\end{fullpagefigure}|).
+%
+% \DescribeMacro{\figcapmaxheight} Specify the maximum estimated height of
+% the caption with |\figcapmaxheight|\marg{length}.  This is used to see
+% whether the figure caption still fits on the current page.
+%
+% TODO: This is ugly, the height of the caption should be calculated
+% automatically\ldots{} for next time.
+%
+% By default (if no |\figcapmaxheight| is present), the figure will never
+% be assumed to fit in the remainder of the page.
+%
+% \DescribeMacro{\fullpagefigurecaptionfmt}
+% The figure label in the caption may be changed (e.g. ``Figure X (on facing page): \ldots'') by
+% redefining the command |\fullpagefigurecaptionfmt|.  See the default implementation for
+% more info (\autoref{sec:impl}).
+%
+% \DescribeMacro{\FlushAllFullPageFigures} If you need to make sure that
+% all full-page-figures have been placed up to a certain point, you may
+% issue the command |\FlushAllFullPageFigures|.  (You may wish to do so
+% before starting a new chapter.)  An optional argument
+% |\FlushAllFullPageFigures[\clearpage]| or
+% |\FlushAllFullPageFigures[\cleardoublepage]| specifies whether to
+% continue on any page or on an odd-side page only.
+% 
+%
+%
+% \section{Package Options}
+%
+% Only a single package option is recognized:
+%
+% \begin{verbatim} \usepackage[nopdfpages]{phffullpagefigure} \end{verbatim}
+%
+% If this package option is given, then the \pkgname{pdfpages} package
+% is not loaded, and the command |\figpdf| is not made available.  You
+% may use this package option if the \pkgname{pdfpages} package
+% conflicts with your setup.
+%
+%
+%
+%
+%
+%
+%
+%
+% \StopEventually{\PrintChangesAndIndex}
+%
+% \section{Implementation}
+% \label{sec:impl}
+%
+% Include some general useful packages first.
+%    \begin{macrocode}
+\RequirePackage{etoolbox}
+\RequirePackage{ifoddpage}
+\RequirePackage{afterpage}
+%    \end{macrocode}
+% 
+% The \pkgname{placeins} package provies the |\FloatBarrier| command,
+% which we use to ensure that no other float gets in the way.
+%    \begin{macrocode}
+\RequirePackage{placeins}
+%    \end{macrocode}
+% 
+% \begin{macro}{phffpf at internal@pending}
+%   Counter which stores how many full-page-figures still haven't been
+%   placed.  Used for |\FlushAllFullPageFigures| as well as making sure
+%   that the full-page-figures don't interfere with one another.
+%    \begin{macrocode}
+\newcounter{phffpf at internal@pending}
+\setcounter{phffpf at internal@pending}{0}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phffpfFloatBarrier}
+%   Redefine this if you don't want to use a |\FloatBarrier|.  Be warned of
+%   the following points:
+%
+%   \begin{itemize}
+%   \item |\FloatBarrier| introduces automatically a new paragraph.
+%     Nothing you can do about that a priori.
+%
+%   \item If you remove |\FloatBarrier|, you need to either be sure that
+%     there are no floats which can mess up placement of the
+%     fullpagefigure.  Alternatively, you need to provide your own
+%     mechanism that ensures that.
+%   \end{itemize}
+%
+%    \begin{macrocode}
+\def\phffpfFloatBarrier{\FloatBarrier}
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+% \subsection{The Main Environment Definition}
+%
+% \begin{environment}{fullpagefigure}
+%   The main |fullpagefigure| environment.
+%    \begin{macrocode}
+\newenvironment{fullpagefigure}[1][b]{% 
+%    \end{macrocode}
+% 
+% Remember that we have a float pending to be placed:
+%    \begin{macrocode}
+  \addtocounter{phffpf at internal@pending}{1}%
+%    \end{macrocode}
+% 
+% Don't allow any other floats to meddle with our calculations.
+%    \begin{macrocode}
+  \phffpfFloatBarrier%
+  %[YYY]% -- debugging [where is a space being inserted?]
+%    \end{macrocode}
+% 
+% The following variables will store the relevant values of options
+% collected in the definition of the figure with e.g. |\figplacement|,
+% |\figcontents|, etc.
+% 
+% NOTE TO SELF: If you add a |\phffpf at val@...| storage variable, don't
+% forget to fix that value in |\phffpf at takecareofplacingfigure|.
+% 
+%    \begin{macrocode}
+  \xdef\phffpf at val@pageside{\phffpf at side@}%
+  \gdef\phffpf at val@captionopt{}%
+  \gdef\phffpf at val@caption{}%
+  \gdef\phffpf at val@label{}%
+  \gdef\phffpf at val@placement{#1}%
+  \gdef\phffpf at val@capmaxheight{\paperheight}%
+  \gdef\phffpf at val@figcontents{}%
+%    \end{macrocode}
+%
+% If this document is two-sided (facing odd/even pages), then by default
+% place the float on an odd page.  Otherwise, we don't care.
+% 
+%    \begin{macrocode}
+  \if at twoside%
+    \xdef\phffpf at val@pageside{\phffpf at side@odd}%
+  \else\fi%
+%    \end{macrocode}
+%
+% Provide a set of commands within this figure block which allow to specify
+% the figure contents and appearance:
+%    \begin{macrocode}
+  \begingroup%
+  \let\figcontents\phffpf at impl@figcontents%
+  \let\figpageside\phffpf at impl@figpageside%
+  \let\caption\phffpf at impl@caption%
+  \let\label\phffpf at impl@label%
+  \let\figplacement\phffpf at impl@placement%
+  \let\figcapmaxheight\phffpf at impl@capmaxheight%
+%    \end{macrocode}
+% 
+% Provide |\figpdf| as a shorthand, but only if applicable (i.e., the
+% |nopdfpages| package option was not specified and the
+% \pkgname{pdfpages} package was loaded):
+%    \begin{macrocode}
+  \phffpf at provide@figpdf%
+%    \end{macrocode}
+%
+% Finally, ignore any spaces following this command, as well as after the
+% |\endenvironment| command.
+%    \begin{macrocode}
+  \ignorespacesafterend%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% 
+% Now, the definitions for the end of the environment:
+%    \begin{macrocode}
+{%
+%    \end{macrocode}
+%
+% Remove any spaces which might have been inserted.
+%    \begin{macrocode}
+  \ifhmode\unskip\fi%
+%    \end{macrocode}
+%
+% Restore |\caption|, |\label|, etc.\@ to their original meaning:
+%    \begin{macrocode}
+  \endgroup%
+%    \end{macrocode}
+% 
+% Finally we should actually take care of placing the figure.
+%    \begin{macrocode}
+  \phffpf at takecareofplacingfigure%
+%    \end{macrocode}
+% 
+% Finally finally, ignore any spaces following this command.  Note that
+% because the expansion of |\endfullpagefigure| is inside the definition of
+% \LaTeX' ``|\end|'' and has internal commands after that, we can't just
+% simply issue a |\ignorespaces|.
+%
+%    \begin{macrocode}
+  \phfpf at useignorespacesandallpars%
+}
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\phffpf at useignorespacesandallpars}
+%   Utility to ignore spaces and paragraphs after the
+%   |\end{fullpagefigure}| command.\footnote{This solution was adapted from
+% \url{http://tex.stackexchange.com/a/179034/32188} and
+% \url{http://tex.stackexchange.com/a/23101/32188}.}
+%    \begin{macrocode}
+\def\phfpf at useignorespacesandallpars#1\ignorespaces\fi{%
+  #1\fi\phffpf at ignorespacesandallpars}
+\def\phffpf at ignorespacesandallpars{%
+  \begingroup%
+  \catcode`\^^M=10\relax%
+  \catcode`\^^J=10\relax%
+  \@ifnextchar\par%
+    {\endgroup\expandafter\phffpf at ignorespacesandallpars\@gobble}%
+    {\endgroup}%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+%
+% \begin{macro}{\fullpagefigurecaptionfmt}
+% \begin{macro}{\fullpagefigurecaptionfmt at paren@O}
+% \begin{macro}{\fullpagefigurecaptionfmt at paren@E}
+% \begin{macro}{\fullpagefigurecaptionfmt at paren@x}
+%   The macro |\fullpagefigurecaptionfmt| is called to generate the text
+%   which is prepended to the figure caption.  It should essentially say
+%   ``Figure X (on next page): ''.
+%
+%   The argument to |\fullpagefigurecaptionfmt| is |#1| = |O|, |E| or |x|
+%   for if the figure is on an odd page, an even page, or an unspecified
+%   page.
+%    \begin{macrocode}
+\def\fullpagefigurecaptionfmt#1{%
+  \figurename\nobreakspace\thefigure\nobreakspace%
+  (\csname fullpagefigurecaptionfmt at paren@#1\endcsname)%
+}
+\def\fullpagefigurecaptionfmt at paren@O{on facing page} % for odd page figures
+\def\fullpagefigurecaptionfmt at paren@E{on next page}   % for even page figures
+\def\fullpagefigurecaptionfmt at paren@x{on next page}   % for next-page figures
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \subsection{Implementation of \phfverb{\fig}\phfverb{****} Commands}
+%
+% These macros really just store their values for later use.
+%
+% \begin{macro}{\figcontents}
+%   This macro will become |\figcontents| inside the |fullpagefigure|
+%   environment.
+%    \begin{macrocode}
+\newtoks\phffpf at tmp@toks
+\long\def\phffpf at impl@figcontents#1{%
+  \phffpf at tmp@toks={#1}%
+  \xdef\phffpf at val@figcontents{\the\phffpf at tmp@toks}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\phffpf at side@odd}
+% \begin{macro}{\phffpf at side@even}
+% \begin{macro}{\phffpf at side@}
+%   These hold one-character codes to signify ``odd side,'' ``even side,''
+%   or ``no specification.''
+%
+%    \begin{macrocode}
+\def\phffpf at side@odd{O}
+\def\phffpf at side@even{E}
+\def\phffpf at side@{x}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% 
+% \begin{macro}{\figpageside}
+%   This will become |\figpageside| inside the |fullpagefigure|
+%   environment.
+%    \begin{macrocode}
+\def\phffpf at impl@figpageside#1{%
+  \ifcsname phffpf at side@#1\endcsname%
+    \xdef\phffpf at val@pageside{\csname phffpf at side@#1\endcsname}%
+  \else%
+    \PacakgeError{phffullpagefigure}{Unknown page side designation:
+      '#1'. Please use 'odd', 'even', or '' for no preference.}%
+  \fi%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\caption}
+%   This will become |\caption| inside the |fullpagefigure| environment.
+%    \begin{macrocode}
+\def\phffpf at NOARG{}
+\def\phffpf at test@NOARG{\phffpf at NOARG}
+\newcommand\phffpf at impl@caption[2][\phffpf at NOARG]{%
+  \gdef\phffpf at val@captionopt{#1}%
+  \gdef\phffpf at val@caption{#2}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\label}
+%   This will become |\label| inside the |fullpagefigure| environment.
+%    \begin{macrocode}
+\def\phffpf at impl@label#1{%
+  \gdef\phffpf at val@label{#1}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\figplacement}
+%   This will become |\figplacement| inside the |fullpagefigure| environment.
+%    \begin{macrocode}
+\def\phffpf at impl@placement#1{%
+  \gdef\phffpf at val@placement{#1}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\figcapmaxheight}
+%   This will become |\figcapmaxheight| inside the |fullpagefigure|
+%   environment.
+%    \begin{macrocode}
+\def\phffpf at impl@capmaxheight#1{%
+  \gdef\phffpf at val@capmaxheight{#1}%
+  \ignorespaces%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+%
+% \subsection{Placing the figures}
+%
+% Here's the gory details of how the figures are placed.
+%
+%
+% \begin{macro}{\phffpf at place@pending at figs@code}
+%   This macro will store code to be executed after the next figure has
+%   been placed.  This can be used to queue other figures to be placed
+%   later.
+%    \begin{macrocode}
+\def\phffpf at place@pending at figs@code{\phffpf at place@pending at figs@code at start}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phffpf at place@pending at figs@code at start}
+%   When another figure is placed, and the
+%   |\phffpf at place@pending at figs@code| is updated, then the macro
+%   |\phffpf at place@pending at figs@code at start| contains the code which
+%   reinitializes |\phffpf at place@pending at figs@code|.
+%
+%   This reinitialization code consists in precisely making sure that a
+%   future execution of |\phffpf at place@pending at igs@code at start| will start
+%   by reinitializing that macro.
+%    \begin{macrocode}
+\def\phffpf at place@pending at figs@code at start{%
+  \gdef\phffpf at place@pending at figs@code{\phffpf at place@pending at figs@code at start}}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phffpf at impl@figcode}
+%   The code to be inserted to generate the figure.
+%
+%   The argument |#1| is the prefix for macro names where to look up the
+%   contents of the figure and values of the figure settings.  The macro
+%   names are determined as |\csname #1@|\meta{field-name}|\endcsname|.
+%    \begin{macrocode}
+\gdef\phffpf at impl@figcode#1{%
+%    \end{macrocode}
+% 
+% Do we have a figure placement position request (|p|, |t|, |b|)?  If yes,
+% then define a macro which we will expand in front of the |\begin{figure}|
+%   command for the caption.  If no, then that macro should be left blank
+%   (first case below):
+%    \begin{macrocode}
+  \expandafter\ifblank\expandafter{\csname #1 at placement\endcsname}{%
+    \edef\phffpf at tmp@figplacementarg{}%
+  }{%
+    \edef\phffpf at tmp@figplacementarg{[\csname #1 at placement\endcsname]}%
+  }
+%    \end{macrocode}
+% 
+% Invoke the |figure| environment, which we use to typeset the caption.
+% Use specified placement if applicable.  Set up some basic stuff in the
+% figure: the contents, caption and label.
+%    \begin{macrocode}
+  \expandafter\figure\phffpf at tmp@figplacementarg%
+  \centering%
+  \begingroup%
+  \def\fnum at figure{\fullpagefigurecaptionfmt{\csname #1 at pageside\endcsname}}%
+  \expandafter\afterpage\expandafter{\csname #1 at figcontents\endcsname}%
+  \expandafter\ifx\csname #1 at captionopt\endcsname\phffpf at test@NOARG%
+    \expandafter\caption\expandafter{\csname #1 at caption\endcsname}%
+  \else%
+    \def\phffpf at tmp@captioncmdopt{%
+      \expandafter\caption\expandafter[\csname #1 at captionopt\endcsname]}%
+    \expandafter\phffpf at tmp@captioncmdopt\expandafter{\csname #1 at caption\endcsname}%
+  \fi%
+  \expandafter\notblank\expandafter{\csname #1 at label\endcsname}{%
+    \expandafter\label\expandafter{\csname #1 at label\endcsname}%
+  }{%
+  }
+  \endgroup%
+  \endfigure%
+%    \end{macrocode}
+%
+% Now we have placed the |figure|, so decrease our ``pending-to-be-placed''
+% counter.
+%    \begin{macrocode}
+  \addtocounter{phffpf at internal@pending}{-1}%
+%    \end{macrocode}
+%
+% \ldots{} and execute the code to place any other pending figures.  (We
+% set |\ifphffpf at flag@forcenextmaybequeuetoplacefigure| to TRUE to force
+% the next figure in queue to be placed now.)
+%    \begin{macrocode}
+  \afterpage{%
+    \phffpf at flag@forcenextmaybequeuetoplacefiguretrue%
+    \phffpf at place@pending at figs@code%
+  }%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% Now, all options have been set etc., the fullpagefigure environment has finished, so
+% calculate the commands to place the figure appropriately.
+%
+%
+% \begin{macro}{\phffpf at takecareofplacingfigure}
+%   First, fix the values of the contents and settings (in case another
+%   full-page-figure comes along and messes up the |\phffpf at val@...|
+%   commands).
+%
+%   After the values have been fixed (in fact they are stored in the form
+%   of ``restore code''), then we delegate to
+%   |\phffpf at maybequeuefigurecode|, which checks whether we can place a
+%   figure or if we should queue.
+%    \begin{macrocode}
+\def\phffpf at takecareofplacingfigure{%
+%    \end{macrocode}
+%
+% A tricky part: make sure we save the values of |phffpf at val@|\meta{field}
+% in a fixed way so that several figures won't overwrite each other's
+% values.
+%
+% We build a bunch of tokens which are in fact restore code for the given
+% variables, i.e., which is a list of commands of the form
+% |\gdef\phffpf at val@|\meta{field}|{|\meta{first-level-expanded-value-of-this-field}|}|.
+% This set of tokens have the values of these variables expanded to the
+% first level, so that it is OK if the variables |\phffpf at val@|\meta{field}
+% are overwritten.
+%    \begin{macrocode}
+  \edef\phffpf at tmp@fixallfieldvalues{%
+    \noexpand\gdef\noexpand\phffpf at val@pageside{\expandonce\phffpf at val@pageside}%
+    \noexpand\gdef\noexpand\phffpf at val@captionopt{\expandonce\phffpf at val@captionopt}%
+    \noexpand\gdef\noexpand\phffpf at val@caption{\expandonce\phffpf at val@caption}%
+    \noexpand\gdef\noexpand\phffpf at val@label{\expandonce\phffpf at val@label}%
+    \noexpand\gdef\noexpand\phffpf at val@placement{\expandonce\phffpf at val@placement}%
+    \noexpand\gdef\noexpand\phffpf at val@capmaxheight{\expandonce\phffpf at val@capmaxheight}%
+    \noexpand\gdef\noexpand\phffpf at val@figcontents{\expandonce\phffpf at val@figcontents}%
+  }%
+%    \end{macrocode}
+% 
+% Finally, relay the call to
+% |\phffpf at maybequeuefigurecode|\marg{restore-code-for-figure-settings}\hspace{0pt}\marg{full-figure-code}.
+%    \begin{macrocode}
+  \edef\phffpf at tmp@figcodetwoargs{%
+    {\expandonce\phffpf at tmp@fixallfieldvalues}%
+    {\noexpand\phffpf at impl@figcode{phffpf at val}}%
+  }%
+  \expandafter\phffpf at maybequeuefigurecode\phffpf at tmp@figcodetwoargs%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\phffpf at maybequeuefigurecode}
+%   USAGE: |\phffpf at maybequeuefigurecode|\marg{restore-code-for-figure-settings}\hspace{0pt}\marg{full-figure-code}.
+%
+%   Checks if we can place the figure; if yes then place it on the right
+%   page, if no, then add it to the queue.
+%
+%   The arguments are: |#1| = code to restore correct |\phffpf at val@XYZ|
+%   values; |#2| = figure code.  Make sure it's expanded.
+%    \begin{macrocode}
+\long\def\phffpf at maybequeuefigurecode#1#2{%
+%    \end{macrocode}
+% 
+% Possibly we have been told to place the next figure now via the flag
+% |\ifphffpf at flag@forcenextmaybequeuetoplacefigure|.  In this case, reset
+% the flag and place the figure now (relay to |\phffpf at doplacefigure|).
+%    \begin{macrocode}
+  \ifphffpf at flag@forcenextmaybequeuetoplacefigure%
+    \phffpf at flag@forcenextmaybequeuetoplacefigurefalse
+    \phffpf at doplacefigure{#1}{#2}%
+    %
+  \else
+%    \end{macrocode}
+%
+% See if there are other figures waiting to be placed first.  If so, add
+% ours to the queue.
+%    \begin{macrocode}
+    \ifnum\value{phffpf at internal@pending}>1\relax%
+      \xdef\phffpf at place@pending at figs@code{%
+          \expandonce\phffpf at place@pending at figs@code%
+          \unexpanded{\phffpf at maybequeuefigurecode{#1}{#2}}%
+        }%
+        %\show\phffpf at place@pending at figs@code
+        %[figure queued:  \texttt{\detokenize{#1}}]%  -- DEBUGGING
+    \else%
+%    \end{macrocode}
+%
+% If not, deal with placing the figure now:
+%    \begin{macrocode}
+      \phffpf at doplacefigure{#1}{#2}%
+      %[figure placed: \texttt{\detokenize{#1}}]  -- DEBUGGING
+    \fi%
+  \fi%
+}
+%    \end{macrocode}
+% 
+% Define also the flag which will force a next call to
+% |\phffpf at maybequeuefigurecode| to place the next figure in the queue.
+%    \begin{macrocode}
+\newif\ifphffpf at flag@forcenextmaybequeuetoplacefigure
+\phffpf at flag@forcenextmaybequeuetoplacefigurefalse
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+% \begin{macro}{\phffpf at doplacefigure}
+%   Place the figure now.  Determine the correct number of |\afterpage|'s
+%   to use so that the figure caption ends up on the correct page side.
+%
+%   The arguments to this macro are: |#1| = code to restore correct
+%   |phffpf at val@XYZ| values, |#2| = the figure code. Make sure it's
+%   expanded.
+%    \begin{macrocode}
+\long\def\phffpf at doplacefigure#1#2{%
+%    \end{macrocode}
+%
+% Make sure the correct values of |phffpf at val@XYZ| are restored, because we
+% need e.g. |\phffpf at val@pageside|.  They may be wrong because this might
+% be called after a figure has been queued.
+%    \begin{macrocode}
+  #1%
+%    \end{macrocode}
+%
+% Now, determine where exactly to place the figure code.  There are no other pending
+% figures.  If there is no side preference, just place the figure pretty much now.
+%    \begin{macrocode}
+  \ifx\phffpf at val@pageside\phffpf at side@%
+    \let\phffpf at tmp@doplace\@firstofone%
+  \else%
+%    \end{macrocode}
+%
+% If, however, we have a side preference, then check everything more
+% carefully.  Use the helper macros
+% |\phffpf at placecode@on|\meta{\phfverb{same}$\mid$\phfverb{other}}|parity|.
+% (The latter essentially expand to the correct number of |\afterpage|'s.)
+%    \begin{macrocode}
+    \ifx\phffpf at val@pageside\phffpf at side@odd%
+      %[CHECK DONE HERE/WANT ODD] % -- for debugging
+      \checkoddpage\ifoddpage%
+      %[IS ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onotherparity%
+      \else%
+        %[IS NOT ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onsameparity%
+      \fi%
+    \else%
+      %[CHECK DONE HERE/WANT EVEN] % -- for debugging
+      \checkoddpage\ifoddpage%
+        %[IS ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onsameparity%
+      \else%
+        %[IS NOT ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onotherparity%
+      \fi%
+    \fi%
+  \fi%
+%    \end{macrocode}
+% 
+% I think an |\hbox{}| might help to place the anchor which determines
+% which page side we are currently on.  Note that this starts a new
+% paragraph and enters horizontal mode.
+%    \begin{macrocode}
+  \leavevmode\hbox{}%
+%    \end{macrocode}
+%
+% Now, do place the figure somewhere.
+%    \begin{macrocode}
+  \phffpf at tmp@doplace{#1#2}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phffpf at placecode@onsameparity}
+%   Place the figure code on the same parity (page side) as we are
+%   currently.  If enough space remains on the current page, place the
+%   figure immediately.  Otherwise, use two |\afterpage|'s so as the figure
+%   caption to appear in two pages.
+%
+%    \begin{macrocode}
+\newdimen\phffpf at tmp@spaceleft
+\newdimen\phffpf at tmp@compareto
+\long\def\phffpf at placecode@onsameparity#1{%
+%    \end{macrocode}
+%
+% First, see if the caption itself requires to be on its own page (and thus
+% no height calculations are necessary, and an additional |\clearpage| is
+% required)
+% 
+%    \begin{macrocode}
+  \def\@tmpa{p}%
+  \ifx\phffpf at val@placement\@tmpa%
+    \afterpage{\vspace*{0pt}\afterpage{#1\clearpage}}%
+  \else%
+%    \end{macrocode}
+%
+% Otherwise, the figure caption is there along with some text on the page.
+% 
+% See if there is enough place left on this page to place the figure
+% caption; otherwise use two |\afterpage|'s.
+%    \begin{macrocode}
+    %[PLACING FIG CODE ON SAME PARITY]% -- debugging
+    \phffpf at tmp@spaceleft=\textheight\relax%
+    \phffpf at tmp@compareto=\phffpf at val@capmaxheight\relax%
+    \advance\phffpf at tmp@spaceleft by -\pagetotal%
+    %[DIM LEFT: \the\phffpf at tmp@spaceleft]%
+    \ifdim\phffpf at tmp@spaceleft>\phffpf at tmp@compareto%
+      %[ENOUGH DIM LEFT.] % -- debugging
+      #1%\phffpf at tmp@figcode%
+    \else%
+      %[*NOT ENOUGH* DIM LEFT.] % -- debugging
+      \afterpage{\vspace*{0pt}\afterpage{#1}}%
+    \fi%
+  \fi%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\phffpf at placecode@onotherparity}
+%   Place the figure caption on the opposite parity as the current page.
+%   This just requires one |\afterpage| so as the figure code to appear on
+%   the following page.
+%
+%    \begin{macrocode}
+\def\phffpf at placecode@onotherparity#1{%
+  %[PLACING FIG CODE ON OTHER PARITY]% -- debugging
+%    \end{macrocode}
+% 
+% First, see if the caption requires to be on its own page (and thus no
+% height calculations are necessary, and an additional |\clearpage| is
+% required).
+%    \begin{macrocode}
+  \def\@tmpa{p}%
+  \ifx\phffpf at val@placement\@tmpa%
+    \afterpage{#1\clearpage}%
+  \else%
+%    \end{macrocode}
+%
+% The figure caption is not on its own page.  Just use a simple |\afterpage|.
+%    \begin{macrocode}
+    \afterpage{#1}%
+  \fi%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+% \subsection{Commands to Flush All Full-Page-Figures}
+%
+%
+% Here are a set of commands which can be used to ensure that all full-page
+% figure floats have been placed.
+%
+% \begin{macro}{\FlushAllFullPageFigures}
+%   The name is pretty self-explanatory.  The command is documented in the user doc above.
+%    \begin{macrocode}
+\newcommand\FlushAllFullPageFigures[1][\phffpf at clearpage]{%
+%    \end{macrocode}
+% 
+% As long as there are full-page-figures pending, clear pages until those
+% figures have been placed.
+%    \begin{macrocode}
+  \ifnumcomp{\value{phffpf at internal@pending}}{>}{0}{%
+    \clearpage%
+    %[page cleared.]% DEBUG
+    \FlushAllFullPageFigures[#1]% recurse again.
+  }{%
+%    \end{macrocode}
+%
+% All figures placed, all fine.  We still need to flush one last time
+% because at this point the figure code (ie. caption) has been placed only,
+% and we want the text that follows to come after the figure itself.  Here
+% finally we use the clear command in |#1| to continue on any page or on an
+% odd-side page only.
+%    \begin{macrocode}
+    #1%
+  }%
+}
+\def\phffpf at clearpage{\if at twoside\cleardoublepage\else\clearpage\fi}
+%    \end{macrocode}
+% \end{macro}
+% 
+%
+%
+% \subsection{Package Option Parsing}
+%
+% Note the singular form of the word ``option.''
+% 
+%    \begin{macrocode}
+\def\phffpf at provide@figpdf{}
+\newcommand\phffpf at impl@figpdf[2][]{%
+  \figcontents{\includepdf[#1]{#2}}%
+}
+\def\phffpf at do@pdfpages{%
+  \RequirePackage{pdfpages}%
+  \def\phffpf at provide@figpdf{\let\figpdf\phffpf at impl@figpdf}%
+}
+%
+\DeclareOption{nopdfpages}{\def\phffpf at do@pdfpages{}}
+\DeclareOption*{%
+  \@unknownoptionerror%
+}
+\ProcessOptions\relax
+%
+\phffpf at do@pdfpages
+%    \end{macrocode}
+%
+%\Finale
+\endinput


Property changes on: trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/phffullpagefigure/phffullpagefigure.ins	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,55 @@
+%%
+%% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+%%
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3 of this license
+%% or (at your option) any later version.  The latest version of this
+%% license is in:
+%% 
+%%    http://www.latex-project.org/lppl.txt
+%% 
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%%
+
+\input docstrip.tex
+\keepsilent
+
+\usedir{tex/latex/phfqitltx}
+
+\preamble
+
+This is a generated file.
+
+Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+
+This file may be distributed and/or modified under the conditions of
+the LaTeX Project Public License, either version 1.3 of this license
+or (at your option) any later version.  The latest version of this
+license is in:
+
+   http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+\endpreamble
+
+\generate{\file{phffullpagefigure.sty}{\from{phffullpagefigure.dtx}{package}}}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{*                                                           *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX:                    *}
+\Msg{*                                                           *}
+\Msg{*     phffullpagefigure.sty                                 *}
+\Msg{*                                                           *}
+\Msg{* To produce the documentation run the .dtx file through    *}
+\Msg{* (PdF-)LaTeX.                                              *}
+\Msg{*                                                           *}
+\Msg{* Happy TeXing!                                             *}
+\Msg{*                                                           *}
+\Msg{*************************************************************}
+
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/phffullpagefigure/phffullpagefigure.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/phffullpagefigure/phffullpagefigure.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/phffullpagefigure/phffullpagefigure.sty	2016-08-15 20:37:30 UTC (rev 41857)
@@ -0,0 +1,272 @@
+%%
+%% This is file `phffullpagefigure.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% phffullpagefigure.dtx  (with options: `package')
+%% 
+%% This is a generated file.
+%% 
+%% Copyright (C) 2016 by Philippe Faist <philippe.faist at bluewin.ch>
+%% 
+%% This file may be distributed and/or modified under the conditions of
+%% the LaTeX Project Public License, either version 1.3 of this license
+%% or (at your option) any later version.  The latest version of this
+%% license is in:
+%% 
+%%    http://www.latex-project.org/lppl.txt
+%% 
+%% and version 1.3 or later is part of all distributions of LaTeX version
+%% 2005/12/01 or later.
+%% 
+\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\ProvidesPackage{phffullpagefigure}
+    [2016/08/15 v1.0 phffullpagefigure package]
+\RequirePackage{etoolbox}
+\RequirePackage{ifoddpage}
+\RequirePackage{afterpage}
+\RequirePackage{placeins}
+\newcounter{phffpf at internal@pending}
+\setcounter{phffpf at internal@pending}{0}
+\def\phffpfFloatBarrier{\FloatBarrier}
+\newenvironment{fullpagefigure}[1][b]{%
+  \addtocounter{phffpf at internal@pending}{1}%
+  \phffpfFloatBarrier%
+  %[YYY]% -- debugging [where is a space being inserted?]
+  \xdef\phffpf at val@pageside{\phffpf at side@}%
+  \gdef\phffpf at val@captionopt{}%
+  \gdef\phffpf at val@caption{}%
+  \gdef\phffpf at val@label{}%
+  \gdef\phffpf at val@placement{#1}%
+  \gdef\phffpf at val@capmaxheight{\paperheight}%
+  \gdef\phffpf at val@figcontents{}%
+  \if at twoside%
+    \xdef\phffpf at val@pageside{\phffpf at side@odd}%
+  \else\fi%
+  \begingroup%
+  \let\figcontents\phffpf at impl@figcontents%
+  \let\figpageside\phffpf at impl@figpageside%
+  \let\caption\phffpf at impl@caption%
+  \let\label\phffpf at impl@label%
+  \let\figplacement\phffpf at impl@placement%
+  \let\figcapmaxheight\phffpf at impl@capmaxheight%
+  \phffpf at provide@figpdf%
+  \ignorespacesafterend%
+  \ignorespaces%
+}
+{%
+  \ifhmode\unskip\fi%
+  \endgroup%
+  \phffpf at takecareofplacingfigure%
+  \phfpf at useignorespacesandallpars%
+}
+\def\phfpf at useignorespacesandallpars#1\ignorespaces\fi{%
+  #1\fi\phffpf at ignorespacesandallpars}
+\def\phffpf at ignorespacesandallpars{%
+  \begingroup%
+  \catcode`\^^M=10\relax%
+  \catcode`\^^J=10\relax%
+  \@ifnextchar\par%
+    {\endgroup\expandafter\phffpf at ignorespacesandallpars\@gobble}%
+    {\endgroup}%
+}
+\def\fullpagefigurecaptionfmt#1{%
+  \figurename\nobreakspace\thefigure\nobreakspace%
+  (\csname fullpagefigurecaptionfmt at paren@#1\endcsname)%
+}
+\def\fullpagefigurecaptionfmt at paren@O{on facing page} % for odd page figures
+\def\fullpagefigurecaptionfmt at paren@E{on next page}   % for even page figures
+\def\fullpagefigurecaptionfmt at paren@x{on next page}   % for next-page figures
+\newtoks\phffpf at tmp@toks
+\long\def\phffpf at impl@figcontents#1{%
+  \phffpf at tmp@toks={#1}%
+  \xdef\phffpf at val@figcontents{\the\phffpf at tmp@toks}%
+  \ignorespaces%
+}
+\def\phffpf at side@odd{O}
+\def\phffpf at side@even{E}
+\def\phffpf at side@{x}
+\def\phffpf at impl@figpageside#1{%
+  \ifcsname phffpf at side@#1\endcsname%
+    \xdef\phffpf at val@pageside{\csname phffpf at side@#1\endcsname}%
+  \else%
+    \PacakgeError{phffullpagefigure}{Unknown page side designation:
+      '#1'. Please use 'odd', 'even', or '' for no preference.}%
+  \fi%
+  \ignorespaces%
+}
+\def\phffpf at NOARG{}
+\def\phffpf at test@NOARG{\phffpf at NOARG}
+\newcommand\phffpf at impl@caption[2][\phffpf at NOARG]{%
+  \gdef\phffpf at val@captionopt{#1}%
+  \gdef\phffpf at val@caption{#2}%
+  \ignorespaces%
+}
+\def\phffpf at impl@label#1{%
+  \gdef\phffpf at val@label{#1}%
+  \ignorespaces%
+}
+\def\phffpf at impl@placement#1{%
+  \gdef\phffpf at val@placement{#1}%
+  \ignorespaces%
+}
+\def\phffpf at impl@capmaxheight#1{%
+  \gdef\phffpf at val@capmaxheight{#1}%
+  \ignorespaces%
+}
+\def\phffpf at place@pending at figs@code{\phffpf at place@pending at figs@code at start}
+\def\phffpf at place@pending at figs@code at start{%
+  \gdef\phffpf at place@pending at figs@code{\phffpf at place@pending at figs@code at start}}
+\gdef\phffpf at impl@figcode#1{%
+  \expandafter\ifblank\expandafter{\csname #1 at placement\endcsname}{%
+    \edef\phffpf at tmp@figplacementarg{}%
+  }{%
+    \edef\phffpf at tmp@figplacementarg{[\csname #1 at placement\endcsname]}%
+  }
+  \expandafter\figure\phffpf at tmp@figplacementarg%
+  \centering%
+  \begingroup%
+  \def\fnum at figure{\fullpagefigurecaptionfmt{\csname #1 at pageside\endcsname}}%
+  \expandafter\afterpage\expandafter{\csname #1 at figcontents\endcsname}%
+  \expandafter\ifx\csname #1 at captionopt\endcsname\phffpf at test@NOARG%
+    \expandafter\caption\expandafter{\csname #1 at caption\endcsname}%
+  \else%
+    \def\phffpf at tmp@captioncmdopt{%
+      \expandafter\caption\expandafter[\csname #1 at captionopt\endcsname]}%
+    \expandafter\phffpf at tmp@captioncmdopt\expandafter{\csname #1 at caption\endcsname}%
+  \fi%
+  \expandafter\notblank\expandafter{\csname #1 at label\endcsname}{%
+    \expandafter\label\expandafter{\csname #1 at label\endcsname}%
+  }{%
+  }
+  \endgroup%
+  \endfigure%
+  \addtocounter{phffpf at internal@pending}{-1}%
+  \afterpage{%
+    \phffpf at flag@forcenextmaybequeuetoplacefiguretrue%
+    \phffpf at place@pending at figs@code%
+  }%
+}
+\def\phffpf at takecareofplacingfigure{%
+  \edef\phffpf at tmp@fixallfieldvalues{%
+    \noexpand\gdef\noexpand\phffpf at val@pageside{\expandonce\phffpf at val@pageside}%
+    \noexpand\gdef\noexpand\phffpf at val@captionopt{\expandonce\phffpf at val@captionopt}%
+    \noexpand\gdef\noexpand\phffpf at val@caption{\expandonce\phffpf at val@caption}%
+    \noexpand\gdef\noexpand\phffpf at val@label{\expandonce\phffpf at val@label}%
+    \noexpand\gdef\noexpand\phffpf at val@placement{\expandonce\phffpf at val@placement}%
+    \noexpand\gdef\noexpand\phffpf at val@capmaxheight{\expandonce\phffpf at val@capmaxheight}%
+    \noexpand\gdef\noexpand\phffpf at val@figcontents{\expandonce\phffpf at val@figcontents}%
+  }%
+  \edef\phffpf at tmp@figcodetwoargs{%
+    {\expandonce\phffpf at tmp@fixallfieldvalues}%
+    {\noexpand\phffpf at impl@figcode{phffpf at val}}%
+  }%
+  \expandafter\phffpf at maybequeuefigurecode\phffpf at tmp@figcodetwoargs%
+}
+\long\def\phffpf at maybequeuefigurecode#1#2{%
+  \ifphffpf at flag@forcenextmaybequeuetoplacefigure%
+    \phffpf at flag@forcenextmaybequeuetoplacefigurefalse
+    \phffpf at doplacefigure{#1}{#2}%
+    %
+  \else
+    \ifnum\value{phffpf at internal@pending}>1\relax%
+      \xdef\phffpf at place@pending at figs@code{%
+          \expandonce\phffpf at place@pending at figs@code%
+          \unexpanded{\phffpf at maybequeuefigurecode{#1}{#2}}%
+        }%
+        %\show\phffpf at place@pending at figs@code
+        %[figure queued:  \texttt{\detokenize{#1}}]%  -- DEBUGGING
+    \else%
+      \phffpf at doplacefigure{#1}{#2}%
+      %[figure placed: \texttt{\detokenize{#1}}]  -- DEBUGGING
+    \fi%
+  \fi%
+}
+\newif\ifphffpf at flag@forcenextmaybequeuetoplacefigure
+\phffpf at flag@forcenextmaybequeuetoplacefigurefalse
+\long\def\phffpf at doplacefigure#1#2{%
+  #1%
+  \ifx\phffpf at val@pageside\phffpf at side@%
+    \let\phffpf at tmp@doplace\@firstofone%
+  \else%
+    \ifx\phffpf at val@pageside\phffpf at side@odd%
+      %[CHECK DONE HERE/WANT ODD] % -- for debugging
+      \checkoddpage\ifoddpage%
+      %[IS ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onotherparity%
+      \else%
+        %[IS NOT ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onsameparity%
+      \fi%
+    \else%
+      %[CHECK DONE HERE/WANT EVEN] % -- for debugging
+      \checkoddpage\ifoddpage%
+        %[IS ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onsameparity%
+      \else%
+        %[IS NOT ODD] % -- for debugging
+        \let\phffpf at tmp@doplace\phffpf at placecode@onotherparity%
+      \fi%
+    \fi%
+  \fi%
+  \leavevmode\hbox{}%
+  \phffpf at tmp@doplace{#1#2}%
+}
+\newdimen\phffpf at tmp@spaceleft
+\newdimen\phffpf at tmp@compareto
+\long\def\phffpf at placecode@onsameparity#1{%
+  \def\@tmpa{p}%
+  \ifx\phffpf at val@placement\@tmpa%
+    \afterpage{\vspace*{0pt}\afterpage{#1\clearpage}}%
+  \else%
+    %[PLACING FIG CODE ON SAME PARITY]% -- debugging
+    \phffpf at tmp@spaceleft=\textheight\relax%
+    \phffpf at tmp@compareto=\phffpf at val@capmaxheight\relax%
+    \advance\phffpf at tmp@spaceleft by -\pagetotal%
+    %[DIM LEFT: \the\phffpf at tmp@spaceleft]%
+    \ifdim\phffpf at tmp@spaceleft>\phffpf at tmp@compareto%
+      %[ENOUGH DIM LEFT.] % -- debugging
+      #1%\phffpf at tmp@figcode%
+    \else%
+      %[*NOT ENOUGH* DIM LEFT.] % -- debugging
+      \afterpage{\vspace*{0pt}\afterpage{#1}}%
+    \fi%
+  \fi%
+}
+\def\phffpf at placecode@onotherparity#1{%
+  %[PLACING FIG CODE ON OTHER PARITY]% -- debugging
+  \def\@tmpa{p}%
+  \ifx\phffpf at val@placement\@tmpa%
+    \afterpage{#1\clearpage}%
+  \else%
+    \afterpage{#1}%
+  \fi%
+}
+\newcommand\FlushAllFullPageFigures[1][\phffpf at clearpage]{%
+  \ifnumcomp{\value{phffpf at internal@pending}}{>}{0}{%
+    \clearpage%
+    %[page cleared.]% DEBUG
+    \FlushAllFullPageFigures[#1]% recurse again.
+  }{%
+    #1%
+  }%
+}
+\def\phffpf at clearpage{\if at twoside\cleardoublepage\else\clearpage\fi}
+\def\phffpf at provide@figpdf{}
+\newcommand\phffpf at impl@figpdf[2][]{%
+  \figcontents{\includepdf[#1]{#2}}%
+}
+\def\phffpf at do@pdfpages{%
+  \RequirePackage{pdfpages}%
+  \def\phffpf at provide@figpdf{\let\figpdf\phffpf at impl@figpdf}%
+}
+\DeclareOption{nopdfpages}{\def\phffpf at do@pdfpages{}}
+\DeclareOption*{%
+  \@unknownoptionerror%
+}
+\ProcessOptions\relax
+\phffpf at do@pdfpages
+\endinput
+%%
+%% End of file `phffullpagefigure.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/phffullpagefigure/phffullpagefigure.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-08-15 20:33:22 UTC (rev 41856)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-08-15 20:37:30 UTC (rev 41857)
@@ -450,7 +450,7 @@
     pgf pgf-blur pgf-soroban pgf-spectra pgf-umlcd pgf-umlsd
     pgfgantt pgfkeyx pgfmolbio
     pgfopts pgfornament pgfplots
-    phaistos philex philokalia philosophersimprint
+    phaistos phffullpagefigure philex philokalia philosophersimprint
     phonetic phonrule photo physics piano picinpar pict2e
     pictex pictex2 pictexsum piechartmp piff pigpen
     pinlabel pitex pittetd pkfix pkfix-helper pkgloader pkuthss

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-08-15 20:33:22 UTC (rev 41856)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-08-15 20:37:30 UTC (rev 41857)
@@ -768,6 +768,7 @@
 depend perltex
 depend permute
 depend petiteannonce
+depend phffullpagefigure
 depend philex
 depend photo
 depend piff

Added: trunk/Master/tlpkg/tlpsrc/phffullpagefigure.tlpsrc
===================================================================


More information about the tex-live-commits mailing list