From f12daf64ff24d47a74a0ac5f8bff673735f4912c Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 2 Mar 2018 00:22:42 +0000 Subject: mpostinl (1mar18) git-svn-id: svn://tug.org/texlive/trunk@46778 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/mpostinl/README.txt | 2 +- Master/texmf-dist/doc/latex/mpostinl/mpinlsmp.tex | 2 +- Master/texmf-dist/doc/latex/mpostinl/mpostinl.pdf | Bin 331717 -> 334352 bytes .../texmf-dist/source/latex/mpostinl/mpostinl.dtx | 110 ++++++++++++++++++--- Master/texmf-dist/tex/latex/mpostinl/mpostinl.sty | 31 +++++- 5 files changed, 131 insertions(+), 14 deletions(-) diff --git a/Master/texmf-dist/doc/latex/mpostinl/README.txt b/Master/texmf-dist/doc/latex/mpostinl/README.txt index bfc76cc91b5..eb63763304f 100644 --- a/Master/texmf-dist/doc/latex/mpostinl/README.txt +++ b/Master/texmf-dist/doc/latex/mpostinl/README.txt @@ -1,4 +1,4 @@ -mpostinl v1.3 +mpostinl v1.4 Copyright 2010-2018 Niklas Beisert mpostinl is a LaTeX2e package diff --git a/Master/texmf-dist/doc/latex/mpostinl/mpinlsmp.tex b/Master/texmf-dist/doc/latex/mpostinl/mpinlsmp.tex index b30c26524a9..7cc99ca2dcb 100644 --- a/Master/texmf-dist/doc/latex/mpostinl/mpinlsmp.tex +++ b/Master/texmf-dist/doc/latex/mpostinl/mpinlsmp.tex @@ -17,7 +17,7 @@ %% version 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[1996/12/01] -\ProvidesFile{mpinlsmp.tex}[2018/02/09 v1.3 sample for mpostinl] +\ProvidesFile{mpinlsmp.tex}[2018/03/01 v1.4 sample for mpostinl] \documentclass[12pt,a4paper]{article} \parindent0pt diff --git a/Master/texmf-dist/doc/latex/mpostinl/mpostinl.pdf b/Master/texmf-dist/doc/latex/mpostinl/mpostinl.pdf index 9101df2924c..7ef6db5a5e9 100644 Binary files a/Master/texmf-dist/doc/latex/mpostinl/mpostinl.pdf and b/Master/texmf-dist/doc/latex/mpostinl/mpostinl.pdf differ diff --git a/Master/texmf-dist/source/latex/mpostinl/mpostinl.dtx b/Master/texmf-dist/source/latex/mpostinl/mpostinl.dtx index 217badda9c9..0d97b258656 100644 --- a/Master/texmf-dist/source/latex/mpostinl/mpostinl.dtx +++ b/Master/texmf-dist/source/latex/mpostinl/mpostinl.dtx @@ -18,10 +18,10 @@ % and the derived files mpostinl.sty and mpinlsmp.tex % %\NeedsTeXFormat{LaTeX2e}[1996/12/01] -%\ProvidesPackage{mpostinl}[2018/02/09 v1.3 metapost inline figures] -%\ProvidesFile{mpinlsmp.tex}[2018/02/09 v1.3 sample for mpostinl] +%\ProvidesPackage{mpostinl}[2018/03/01 v1.4 metapost inline figures] +%\ProvidesFile{mpinlsmp.tex}[2018/03/01 v1.4 sample for mpostinl] %<*driver> -%\ProvidesFile{mpostinl.drv}[2018/02/09 v1.3 mpostinl reference manual file] +%\ProvidesFile{mpostinl.drv}[2018/03/01 v1.4 mpostinl reference manual file] \PassOptionsToClass{10pt,a4paper}{article} \documentclass{ltxdoc} @@ -62,7 +62,7 @@ {\texttt{nbeisert@itp.phys.ethz.ch}}} \hypersetup{pdfauthor={Niklas Beisert}} \hypersetup{pdfsubject={Manual for the LaTeX2e Package mpostinl}} -\date{9 February 2018, \textsf{v1.3}} +\date{1 March 2018, \textsf{v1.4}} \maketitle \begin{abstract}\noindent @@ -365,7 +365,6 @@ display it via the command |\mpostuse| (see below). \medskip \noindent \DescribeMacro{\mpostuse} -\DescribeMacro{\mpostgetname} Figures which have been previously declared with a label \textit{label} can be recycled any number of times with the command: @@ -374,6 +373,17 @@ can be recycled any number of times with the command: \end{center} The options are passed on to |\includegraphics[|\textit{opt}|]{|\textit{filename}|}|. +Note that |\mpostuse| accepts the overlay specification +from the \textsf{beamer} package +\begin{center} +|\mpostuse<|\textit{overlay}|>[|\textit{opts}|]{|\textit{label}|}| +\end{center} +and passes it on to |\includegraphics|. + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\medskip +\noindent +\DescribeMacro{\mpostgetname} Furthermore, the filename of a figure can be obtained by calling |\mpostgetname{|\textit{label}|}|. The filename is returned in the macro |\mpostfigurename|. @@ -603,6 +613,16 @@ such as |section| or |chapter| stabilises the figure numbering by making changes to the sequence have effects only within the present section or chapter. + +\item |beamer|[|=true|$\vert$|false|] +(no value implies |true|, initially set to |true|) -- +Enable/disable processing of overlay parameters |<|\ldots|>| +by |\mpostuse| defined by the \textsf{beamer} package. + +\item |warnunused|[|=true|$\vert$|false|] +(no value implies |true|, initially set to |true|) -- +Enable/disable warnings for unused figure labels. + \end{itemize} % Admittedly, some of these options are hardly necessary @@ -1008,6 +1028,7 @@ Therefore, the environments |mpostfig| and |mpostdef| must not be used within the |frame| environment. Instead, figures should be declared outside the |frame| environment and can be displayed by |\mpostuse| within the |frame| environment. +Note that |\mpostuse| accepts the overlay parameter |<|\ldots|>|. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph{Package \textsf{graphbox}.} @@ -1122,7 +1143,7 @@ distribution, e.g.\ \textit{texmf-root}|/tex/latex/mpostinl|. \end{itemize} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\subsection{Interaction with Other Packages and Software} +\subsection{Required Packages and Software} The package relies on other packages and software: \begin{itemize} @@ -1202,6 +1223,19 @@ to the usual \TeX{} philosophy. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Revision History} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\paragraph{v1.4:} 2018/03/01 + +\begin{itemize} +\item +|\mpostuse| now accepts overlay options |<|\ldots|>| +of the \textsf{beamer} package; +new option |beamer| to control the feature +\item +issue warnings for unused labels; +new option |warnunused| to control the feature +\end{itemize} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \paragraph{v1.3:} 2018/02/09 @@ -1882,6 +1916,8 @@ filename: \mpostgetname{sec8} \newif\ifmpi@nowkeep\mpi@nowkeepfalse \newif\ifmpi@include\mpi@includefalse \newif\ifmpi@defglobal\mpi@defglobalfalse +\newif\ifmpi@warnunused\mpi@warnunusedtrue +\newif\ifmpi@beamer\mpi@beamertrue % \end{macrocode} % \begin{macro}{\mpi@mpostmem} @@ -1936,6 +1972,8 @@ filename: \mpostgetname{sec8} \define@key{\mpi@group}{command}[]{\def\mpi@mpostcompiler{#1}} \define@key{\mpi@group}{class}{\def\mpi@latexclass{#1}} \define@key{\mpi@group}{classopt}[]{\def\mpi@latexoptions{[#1]}} +\define@key{\mpi@group}{beamer}[true]{\csname mpi@beamer#1\endcsname} +\define@key{\mpi@group}{warnunused}[true]{\csname mpi@warnunused#1\endcsname} \define@key{\mpi@group}{now}[true]{\csname mpi@nowactive#1\endcsname} \define@key{\mpi@group}{nowall}[true]{\csname mpi@now#1\endcsname} \define@key{\mpi@group}{nowkeep}[true]{\csname mpi@nowkeep#1\endcsname} @@ -1973,6 +2011,14 @@ filename: \mpostgetname{sec8} % \end{macrocode} % \end{macro} +% \begin{macro}{\mpi@unusedlist} +% Initialise a list of unused figure labels: +% \begin{macrocode} +\def\mpi@unusedlist{} +% \end{macrocode} +% \end{macro} + + % \begin{macro}{\mpi@dblquotchar} % Define a bare double quotation character for writing to the file: % \begin{macrocode} @@ -2123,6 +2169,25 @@ filename: \mpostgetname{sec8} % \end{macrocode} % \end{macro} +% \begin{macro}{\mpi@warnunused} +% This macro processes the list of all figure labels +% and issues a warning for every unused ones: +% \begin{macrocode} +\def\mpi@warnunused#1{% + \begingroup\def\mpi@tmp{#1}\ifx\mpi@tmp\mpi@empty\else% + \ifcsname mpi@lu@#1\endcsname\else + \PackageWarning{mpostinl}{figure label `#1' not used}{}% + \fi% + \def\mpi@tmp{\mpi@warnunused}% + \fi\expandafter\endgroup\mpi@tmp% +} +% \end{macrocode} +% Run |\mpi@warnunused| at the end of the document: +% \begin{macrocode} +\AtEndDocument{\expandafter\mpi@warnunused\mpi@unusedlist{}} +% \end{macrocode} +% \end{macro} + % \begin{macro}{\mpostplaceholder} % Display a placeholder for non-existing files or labels; % this function may be overwritten by the user for customisation purposes @@ -2694,7 +2759,8 @@ filename: \mpostgetname{sec8} \edef\mpi@figfile{\mpi@template{\thempi@count}}% \fi% % \end{macrocode} -% Save filename to label, warn if label has already been defined: +% Save filename to label, warn if label has already been defined, +% remember all labels for checking whether unused: % \begin{macrocode} \ifx\mpi@figlabel\mpi@empty\else% \expandafter\ifx\csname mpi@l@\mpi@figlabel\endcsname\relax\else% @@ -2702,6 +2768,9 @@ filename: \mpostgetname{sec8} overwriting}{}% \fi% \expandafter\xdef\csname mpi@l@\mpi@figlabel\endcsname{\mpi@figfile}% + \ifmpi@warnunused\ifmpi@figshow\else% + \xdef\mpi@unusedlist{\mpi@unusedlist{\mpi@figlabel}}% + \fi\fi% \fi% % \end{macrocode} % Prepare for recording; start file and content section (if needed), @@ -2758,13 +2827,15 @@ filename: \mpostgetname{sec8} % |\mpostuse| includes a metapost figure which was declared earlier % via its label. The optional argument is passed as the optional % argument for |\includegraphics|. -% Remember if a file is currently open for writing: +% Remember that the label has been used, +% remember if a file is currently open for writing: % \begin{macrocode} \newcommand{\mpostuse}[2][]{% \expandafter\ifx\csname mpi@l@#2\endcsname\relax% \PackageWarning{mpostinl}{unknown label `#2'}{}% \mpostplaceholder[label]{#2}% \else% + \ifmpi@warnunused\expandafter\gdef\csname mpi@lu@#2\endcsname{}\fi% \mpi@graphics[#1]{\csname mpi@l@#2\endcsname}% \ifmpi@infile\global\mpi@showinfiletrue\fi% \fi% @@ -2774,13 +2845,15 @@ filename: \mpostgetname{sec8} % \begin{macro}{\mpostgetname} % |\mpostgetname| gets the filename of a figure declared earlier -% via its label and returns it in the macro |\mpostfigurename|: +% via its label and returns it in the macro |\mpostfigurename|. +% Remember that the label has been used: % \begin{macrocode} \newcommand{\mpostgetname}[1]{% \expandafter\ifx\csname mpi@l@#1\endcsname\relax% \PackageWarning{mpostinl}{unknown label `#1'}{}% \let\mpostfigurename\relax% \else% + \ifmpi@warnunused\expandafter\gdef\csname mpi@lu@#1\endcsname{}\fi% \edef\mpostfigurename{\csname mpi@l@#1\endcsname}% \fi% } @@ -2795,7 +2868,7 @@ filename: \mpostgetname{sec8} % |\mpostfile| sets up a new metapost file. % If the previous file is still open, -% it will be closed and processed first. +% it will be closed and processed first: % \begin{macrocode} \newcommand{\mpostfile}[2][]{% \mpi@closefile% @@ -2808,12 +2881,27 @@ filename: \mpostgetname{sec8} % \begin{macro}{\mpostdone} % |\mpostdone| closes the present metapost file -% and processes it if applicable. +% and processes it if applicable: % \begin{macrocode} \newcommand{\mpostdone}{\mpi@closefile} % \end{macrocode} % \end{macro} +% \begin{macro}{\mpostuse<>} +% This overwrites the definition of |\mpostfile| +% to accept the overlay option |<|\ldots|>| +% of the \textsf{beamer} package: +% \begin{macrocode} +\ifmpi@beamer\@ifclassloaded{beamer}{ + \let\mpi@plain@mpostuse\mpostuse% + \newcommand<>{\mpostuse}[2][]{\begingroup% + \expandafter\def\expandafter\includegraphics\expandafter% + {\includegraphics#3}% + \mpi@plain@mpostuse[#1]{#2}\endgroup}% +}{}\fi +% \end{macrocode} +% \end{macro} + %\iffalse % %\fi diff --git a/Master/texmf-dist/tex/latex/mpostinl/mpostinl.sty b/Master/texmf-dist/tex/latex/mpostinl/mpostinl.sty index 4064c4c7b48..bdd79dba95c 100644 --- a/Master/texmf-dist/tex/latex/mpostinl/mpostinl.sty +++ b/Master/texmf-dist/tex/latex/mpostinl/mpostinl.sty @@ -17,7 +17,7 @@ %% version 2005/12/01 or later. %% \NeedsTeXFormat{LaTeX2e}[1996/12/01] -\ProvidesPackage{mpostinl}[2018/02/09 v1.3 metapost inline figures] +\ProvidesPackage{mpostinl}[2018/03/01 v1.4 metapost inline figures] \RequirePackage{verbatim} \RequirePackage{graphicx} @@ -47,6 +47,8 @@ \newif\ifmpi@nowkeep\mpi@nowkeepfalse \newif\ifmpi@include\mpi@includefalse \newif\ifmpi@defglobal\mpi@defglobalfalse +\newif\ifmpi@warnunused\mpi@warnunusedtrue +\newif\ifmpi@beamer\mpi@beamertrue \def\mpi@mpostmem{} \def\mpi@mpostcompiler{} @@ -79,6 +81,8 @@ \define@key{\mpi@group}{command}[]{\def\mpi@mpostcompiler{#1}} \define@key{\mpi@group}{class}{\def\mpi@latexclass{#1}} \define@key{\mpi@group}{classopt}[]{\def\mpi@latexoptions{[#1]}} +\define@key{\mpi@group}{beamer}[true]{\csname mpi@beamer#1\endcsname} +\define@key{\mpi@group}{warnunused}[true]{\csname mpi@warnunused#1\endcsname} \define@key{\mpi@group}{now}[true]{\csname mpi@nowactive#1\endcsname} \define@key{\mpi@group}{nowall}[true]{\csname mpi@now#1\endcsname} \define@key{\mpi@group}{nowkeep}[true]{\csname mpi@nowkeep#1\endcsname} @@ -99,6 +103,8 @@ \def\mpi@empty{} +\def\mpi@unusedlist{} + \begingroup\catcode`\"=12\relax\gdef\mpi@dblquotchar{"}\endgroup \newif\ifmpi@infile\mpi@infilefalse @@ -157,6 +163,16 @@ \fi\fi% } +\def\mpi@warnunused#1{% + \begingroup\def\mpi@tmp{#1}\ifx\mpi@tmp\mpi@empty\else% + \ifcsname mpi@lu@#1\endcsname\else + \PackageWarning{mpostinl}{figure label `#1' not used}{}% + \fi% + \def\mpi@tmp{\mpi@warnunused}% + \fi\expandafter\endgroup\mpi@tmp% +} +\AtEndDocument{\expandafter\mpi@warnunused\mpi@unusedlist{}} + \newcommand{\mpostplaceholder}[2][]{\parbox[c]{1in}{% \hrule\vrule\hfill% \parbox[c]{0pt}{\rule{0cm}{0.6in}}\makebox[0pt][c]{\scriptsize\tt #2}% @@ -491,6 +507,9 @@ overwriting}{}% \fi% \expandafter\xdef\csname mpi@l@\mpi@figlabel\endcsname{\mpi@figfile}% + \ifmpi@warnunused\ifmpi@figshow\else% + \xdef\mpi@unusedlist{\mpi@unusedlist{\mpi@figlabel}}% + \fi\fi% \fi% \mpi@startcontent% \mpi@clearbuf% @@ -531,6 +550,7 @@ \PackageWarning{mpostinl}{unknown label `#2'}{}% \mpostplaceholder[label]{#2}% \else% + \ifmpi@warnunused\expandafter\gdef\csname mpi@lu@#2\endcsname{}\fi% \mpi@graphics[#1]{\csname mpi@l@#2\endcsname}% \ifmpi@infile\global\mpi@showinfiletrue\fi% \fi% @@ -541,6 +561,7 @@ \PackageWarning{mpostinl}{unknown label `#1'}{}% \let\mpostfigurename\relax% \else% + \ifmpi@warnunused\expandafter\gdef\csname mpi@lu@#1\endcsname{}\fi% \edef\mpostfigurename{\csname mpi@l@#1\endcsname}% \fi% } @@ -556,6 +577,14 @@ \newcommand{\mpostdone}{\mpi@closefile} +\ifmpi@beamer\@ifclassloaded{beamer}{ + \let\mpi@plain@mpostuse\mpostuse% + \newcommand<>{\mpostuse}[2][]{\begingroup% + \expandafter\def\expandafter\includegraphics\expandafter% + {\includegraphics#3}% + \mpi@plain@mpostuse[#1]{#2}\endgroup}% +}{}\fi + \endinput %% %% End of file `mpostinl.sty'. -- cgit v1.2.3