diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/phfthm/README.md | 13 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/phfthm/phfthm.pdf | bin | 381267 -> 400744 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/phfthm/Makefile (renamed from Master/texmf-dist/doc/latex/phfthm/Makefile) | 0 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/phfthm/phfthm.dtx | 329 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/phfthm/phfthm.ins | 4 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/phfthm/pkg.mk (renamed from Master/texmf-dist/doc/latex/phfthm/pkg.mk) | 49 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/phfthm/phfthm.sty | 118 |
7 files changed, 429 insertions, 84 deletions
diff --git a/Master/texmf-dist/doc/latex/phfthm/README.md b/Master/texmf-dist/doc/latex/phfthm/README.md index 8f0aece3fee..f97a2e62d63 100644 --- a/Master/texmf-dist/doc/latex/phfthm/README.md +++ b/Master/texmf-dist/doc/latex/phfthm/README.md @@ -11,5 +11,14 @@ and "Proof of Theorem 4: ..." # 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. +Run `make sty` to generate the style file, `make pdf` to generate the package +documentation, and `make install` to install the package in your local texmf +tree. Run 'make' or 'make help' for more info. + + +# Author and License + +(C) 2016 Philippe Faist, philippe.faist@bluewin.ch + +License: [LaTeX project public license](http://www.ctan.org/license/lppl1.3), +version 1.3 or above diff --git a/Master/texmf-dist/doc/latex/phfthm/phfthm.pdf b/Master/texmf-dist/doc/latex/phfthm/phfthm.pdf Binary files differindex ce5c5ecce36..9a4c7af7b6a 100644 --- a/Master/texmf-dist/doc/latex/phfthm/phfthm.pdf +++ b/Master/texmf-dist/doc/latex/phfthm/phfthm.pdf diff --git a/Master/texmf-dist/doc/latex/phfthm/Makefile b/Master/texmf-dist/source/latex/phfthm/Makefile index fa97b2d7fd9..fa97b2d7fd9 100644 --- a/Master/texmf-dist/doc/latex/phfthm/Makefile +++ b/Master/texmf-dist/source/latex/phfthm/Makefile diff --git a/Master/texmf-dist/source/latex/phfthm/phfthm.dtx b/Master/texmf-dist/source/latex/phfthm/phfthm.dtx index 6e9656689bd..87495d9d9c4 100644 --- a/Master/texmf-dist/source/latex/phfthm/phfthm.dtx +++ b/Master/texmf-dist/source/latex/phfthm/phfthm.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright (C) 2016 by Philippe Faist <philippe.faist@bluewin.ch> +% Copyright (C) 2016 by Philippe Faist, philippe.faist@bluewin.ch % ------------------------------------------------------- % % This file may be distributed and/or modified under the @@ -22,7 +22,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] %<package>\ProvidesPackage{phfthm} %<*package> - [2016/08/15 v1.0 phfthm package] + [2021/03/01 v1.2 phfthm package] %</package> % %<*driver> @@ -31,6 +31,9 @@ \usepackage{phfthm} \usepackage[preset=xpkgdoc]{phfnote} \usepackage{needspace} +\expandafter\def\csname eqsign@\endcsname{=} +\def\eqsign{\expandafter\protect\csname eqsign@\endcsname} +\robustify\eqsign \EnableCrossrefs \CodelineIndex \RecordChanges @@ -150,7 +153,7 @@ % style adjustments; this allows you to enable features individually and % selectively: % \begin{verbatim} -% \usepackage[resetstyle,prooftitleitbf=true]{../phfthm} +% \usepackage[resetstyle,prooftitleitbf=true]{phfthm} % \end{verbatim} % % @@ -168,10 +171,9 @@ % % Possible theorem sets are: % \begin{pkgoptions} -% \item[thmset=]\pkgoptionscombineitem -% \item[thmset=empty] Do not define any environment at package loading. You may -% of course invoke |\phfLoadThmSet| or |\phfMakeTheorem| manually at any -% later point. +% \item[thmset=,thmset=empty] Do not define any environment at package loading. +% You may of course invoke |\phfLoadThmSet| or |\phfMakeTheorem| manually at +% any later point. % \item[thmset=simple] % \DescribeEnv{theorem} \DescribeEnv{proposition} % \DescribeEnv{lemma} \DescribeEnv{corollary} \DescribeEnv{definition} @@ -182,14 +184,17 @@ % environments |theorem|, |proposition|, |lemma|, |corollary|, |conjecture|, % |remark| as theorem-like environments, and |definition| as a definition-like % environment. -% \item[thmset=shortnames] For if you like typing less: the same environments +% \item[thmset=shortnames] \iffalse\DescribeEnv{thm}\DescribeEnv{prop} +% \DescribeEnv{lem}\DescribeEnv{cor}\DescribeEnv{conj}\DescribeEnv{rem} +% \DescribeEnv{defn}\fi In case you prefer to type less: the same environments % are defined as the default set, but with shorter names. Define the % environments |thm|, |prop|, |lem|, |cor|, |conj|, |rem| as theorem-like % environments, and |defn| as a definition-like environment. % \item[thmset=rich] \DescribeEnv{idea} \DescribeEnv{question} -% \DescribeEnv{problem} Provides the same environments as the |default| -% theorem set, as well as in addition: |idea|, |question| and |problem| as -% theorem-like environments. +% \DescribeEnv{claim} \DescribeEnv{observation} \DescribeEnv{problem} Provides +% the same environments as the |default| theorem set, as well as in addition: +% |idea|, |question|, |claim|, |observation|, and |problem| as theorem-like +% environments. % \end{pkgoptions} % % You may also load a theorem set at a later @@ -222,21 +227,28 @@ % \pkgoptionfmt{thmset} package option will use a separate counter if this % option is set; otherwise (the default), there is a single counter which is % shared by all those theorem environments. +% \item[parentcounter=\meta{counter name}] Theorem counters will reset each time +% the parent counter is increased. Use this option for per-chapter or +% per-section numbering (use parent counter |parentcounter=chapter| or +% |parentcounter=section|). See also the \pkgoptionfmt{countpersection} +% package option. % \end{pkgoptions} % % The \pkgoptionfmt{proofref} package option allows to specify a comma-separated % list of attributes to apply to the proof reference (``proof on page XYZ'') % displayed along with the theorem. The following attributes may be specified: % \begin{pkgoptions} -% \item[proofref=\pkgoptattribempty{}]\pkgoptionscombineitem -% \item[proofref=\pkgoptattribnodots{default}] Do not change the default -% proof reference appearance. +% \item[proofref=\pkgoptattribempty{},proofref=\pkgoptattribnodots{default}] Do +% not change the default proof reference appearance. % % \item[proofref=false] Deactivate the proof-ref mechanism. % % \item[proofref=\pkgoptattrib{margin}] The proof reference is displayed in % the margin, instead of after the theorem. % +% \item[proofref=\pkgoptattrib{marginbottom}] The proof reference is displayed +% in the margin, but aligned with the bottom of the theorem statement. +% % \item[proofref=\pkgoptattrib{longref}] The proof reference is displayed as % a full sentence (``The proof of this \meta{Theorem Name} can be found on % page \meta{XYZ}.''). @@ -430,8 +442,10 @@ % the margin, long sentence, ...). Possible styles are % \cmdoptionfmt{proofrefstyle=default} (the default), % \cmdoptionfmt{proofrefstyle=margin} (display the proof ref in the margin of -% the page) and \cmdoptionfmt{proofrefstyle=longref} (as by default but with a -% full sentence). See \autoref{sec:proof-ref-customize-appearance} for how to +% the page), \cmdoptionfmt{proofrefstyle=marginbottom} (display the proof ref +% in the margin of the page aligned with the bottom of the theorem statement) +% and \cmdoptionfmt{proofrefstyle=longref} (as by default but with a full +% sentence). See \autoref{sec:proof-ref-customize-appearance} for how to % further customize the appearance of the proof reference. % % \end{cmdoptions} @@ -456,8 +470,8 @@ % |\phfLoadThmSet| is: % % \noindent |\phfLoadThmSet|\hspace{0pt}\marg{options to -% \phfverb{\phfLoadThmSet} for theorem-like -% environments}\hspace{0pt}\marg{options to \phfverb{\phfLoadThmSet} for +% \phfverb{\phfMakeTheorem} for theorem-like +% environments}\hspace{0pt}\marg{options to \phfverb{\phfMakeTheorem} for % definition-like environments}\hspace{0pt}\marg{name of theorem set to load} % % The first and second argument to this macro are tokens to expand in front of @@ -490,6 +504,7 @@ % \DescribeMacro{\definitionname} % \DescribeMacro{\ideaname} % \DescribeMacro{\questionname} +% \DescribeMacro{\claimname} % \DescribeMacro{\problemname} % % This package is language agnostic (with titles defined by default in English), @@ -498,9 +513,9 @@ % the relevant names to the corresponding |\captions|\meta{language name} macro, % for example: % \begin{verbatim} -% \usepackage[francais,...]{babel} +% \usepackage[french,...]{babel} % ... -% \addto\captionsfrancais{% +% \addto\captionsfrench{% % \def\theoremname{Th\'eor\`eme}% % \def\propositionname{Proposition}% % \def\lemmaname{Lemme}% @@ -510,9 +525,10 @@ % \def\definitionname{D\'efinition}% % \def\ideaname{Id\'ee}% % \def\questionname{Question}% +% \def\claimname{Affirmation}% % \def\problemname{Probl\`eme}% % } -% ... \selectlanguage{francais} ... +% ... \selectlanguage{french} ... % \end{verbatim} % % @@ -690,12 +706,16 @@ % \newcommand\proofofname[1]{\proofname{} of #1} % \end{verbatim} % You may override this to obtain something fancier, of you wish to display the -% document in a different language: +% document in a different language. For instance, you might want to display +% (``D\'emonstration (Th\'eor\`eme 5)'' in french: % \begin{verbatim} -% \def\proofofnamefrancais#1{\proofname{} (#1)} -% \addto\captionsfrancais{\let\proofofname\proofofnamefrancais} +% \def\proofofnameinparentheses#1{\proofname\ (#1)} +% \addto\captionsfrench{% +% \def\proofname{D\'emonstration}% +% \let\proofofname\proofofnameinparentheses% +% } % ... -% \selectlanguage{francais} ... +% \selectlanguage{french} ... % \end{verbatim} % % @@ -799,9 +819,9 @@ % \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax} % \textbf{Theorem 17} (Gauss). For a closed surface $S$ enclosing a % volume $V$, we have -% \setcounter{equation}{41} % \begin{equation} % \oint_S\vec u\cdot d\vec S = \int_V(\vec\nabla\cdot\vec u)\,dV\ . +% \tag*{(41)} % \end{equation} % \hfill{\small\itshape (Proof on page XXX.)}\hfilneg % {\par\vspace{1ex}\relax @@ -810,6 +830,41 @@ % \end{minipage} % }\endgroup % +% A positive side-effect is that in your LaTeX source, if you consistently +% label your proofs then you always know what theorem a proof refers to. If +% you would like to simply output ``Proof.'' instead of ``Proof of Theorem +% X.'', for instance, because the proof immediately succeeds the theorem in +% question, you may use the syntax |[**thm:label]| instead. In this case, the +% proof-reference mechanism will know that this is the proof of the theorem +% labeled |thm:label| and will avoid undefined references. For example, +% the following code: +% \begin{verbatim} +% \begin{theorem}[Gauss] +% \label{thm:Gauss} +% For a closed surface $S$ enclosing a volume $V$, we have +% \begin{equation} +% \oint_S\vec u\cdot d\vec S = \int_V(\vec\nabla\cdot\vec u)\,dV\ . +% \end{equation} +% \end{theorem} +% \begin{proof}[**thm:Gauss] +% ... +% \end{proof} +% \end{verbatim} +% might output: +% \begingroup\setlength{\fboxsep}{1em} +% \par\noindent\fbox{% +% \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax} +% \textbf{Theorem 17} (Gauss). For a closed surface $S$ enclosing a +% volume $V$, we have +% \begin{equation} +% \oint_S\vec u\cdot d\vec S = \int_V(\vec\nabla\cdot\vec u)\,dV\ . +% \tag*{(41)} +% \end{equation} +% \par\textit{Proof.}\hspace{2em}\ldots +% \end{minipage} +% }\endgroup +% +% % \subsection{On the theorem side} % % On the theorem side, the proof-ref mechanism works by hacking into the @@ -875,6 +930,17 @@ % \ldots},'' where the page number corresponds to the page on which this proof % is located. % +% You may also use the syntax |\begin{proof}[**|\meta{label}|]|, which has the +% effect of producing the simple output ``Proof.'' (this is desirable e.g.\@ +% if the proof immediately follows the theorem statement) but which still +% informs the proof-reference mechanism that this proof is associated with the +% given theorem labeled by \meta{label}. This can avoid undefined references, +% and can simplify your job if you want to move proofs around in your document. +% +% (It would be nice, of course, to have the package automatically output +% ``Proof'' only if the proof immediately follows the theorem and output ``Proof +% of XXX'' if the proof is further away. Unfortunately this is hard to detect +% in \LaTeX\ and I currently have no plans to try to implement this.) % % \subsection{Customizing appearance of the proof reference text} % \label{sec:proof-ref-customize-appearance} @@ -1048,6 +1114,7 @@ \define@boolkey{phfmkthm}{defnostar}[true]{} \define@boolkey{phfmkthm}{defstar}[true]{} \define@boolkey{phfmkthm}{proofref}[true]{} +\define@cmdkey{phfmkthm}{parentcounter}{} \define@cmdkey{phfmkthm}{proofrefstyle}{} % \end{macrocode} % @@ -1067,6 +1134,7 @@ \KV@phfmkthm@defnostartrue% \KV@phfmkthm@defstartrue% \KV@phfmkthm@proofreftrue% + \def\cmdKV@phfmkthm@parentcounter{}% \def\cmdKV@phfmkthm@proofrefstyle{default}% \setkeys{phfmkthm}{#1}% % \end{macrocode} @@ -1096,9 +1164,16 @@ \ifKV@phfmkthm@defnostar% \if\relax\detokenize\expandafter{\cmdKV@phfmkthm@counter}\relax% % \end{macrocode} -% ---in case we use a separate counter (if \cmdoptionfmt{counter=}): +% ---in case we use a separate given counter (if \cmdoptionfmt{counter=} is +% given empty or not specified). Also check if we want a parent counter +% (per-section or per-chapter numbering) and take that into account: % \begin{macrocode} - \newtheorem{phfthm@#2}{#3}% + \if\relax\detokenize\expandafter{\cmdKV@phfmkthm@parentcounter}\relax% + \edef\x{\noexpand\newtheorem{phfthm@#2}{#3}}% + \else + \edef\x{\noexpand\newtheorem{phfthm@#2}{#3}[\expandonce\cmdKV@phfmkthm@parentcounter]}% + \fi + \x \csdef{phfthm@#2autorefname}{#3}% \else% \ifKV@phfmkthm@aliascounter% @@ -1111,7 +1186,8 @@ \csdef{#2autorefname}{#3}% \else% % \end{macrocode} -% ---in case we directly instruct |\newtheorem| to use the other counter (does not work with |\autoref|): +% ---in case we directly instruct |\newtheorem| to use the other counter (does +% not work with |\autoref|): % \begin{macrocode} \newtheorem{phfthm@#2}[\cmdKV@phfmkthm@counter]{#3}% \fi% @@ -1121,7 +1197,7 @@ % And also define the actual theorem environment, adding calls to hooks. % \begin{macrocode} \newenvironment{#2}[1][]{% - \begin{phfthm@#2}[##1]% + \begin{phfthm@#2}[{##1}]% \begingroup% \csname phfthm@hook@start@#2\endcsname{##1}% }{% @@ -1430,10 +1506,15 @@ \else \noexpand\phfthm@proof@noparselabel{##1}% \fi - \noexpand\def\noexpand\phfthm@val@displayargs{[{% - \expandafter\noexpand\csname phfthm@prfenv@#2@val@proofofname\endcsname - {\noexpand\phfthm@val@prooftitle}% - }]}% + \noexpand\if\noexpand\relax\noexpand\detokenize% + \noexpand\expandafter{\noexpand\phfthm@val@prooftitle}\noexpand\relax + \noexpand\def\noexpand\phfthm@val@displayargs{} + \noexpand\else + \noexpand\def\noexpand\phfthm@val@displayargs{[{% + \expandafter\noexpand\csname phfthm@prfenv@#2@val@proofofname\endcsname + {\noexpand\phfthm@val@prooftitle}% + }]}% + \noexpand\fi } % \end{macrocode} % @@ -1645,16 +1726,30 @@ \def\phfthm@proof@parselabel#1{% \phfthm@proof@parselabel@maybelabel#1\phfthm@proof@parselabel@END% } +% \end{macrocode} +% If the argument is |[*thm-label]| we want ``Proof of \meta{ref to +% thm-label}.''. If the argument is |[**thm-label]| we want ``Proof.'' but +% we're informing the proofref-system that this is the proof of \meta{thm-label} +% (e.g., to avoid undefined references to proofs). Otherwise if we get % +% |[Some Custom Theorem]| then we want ``Proof of Some Custom Theorem.''. +% \begin{macrocode} \def\phfthm@proof@parselabel@maybelabel{% \@ifnextchar*\phfthm@proof@parselabel@label\phfthm@proof@parselabel@title% } -\def\phfthm@proof@parselabel@label*#1\phfthm@proof@parselabel@END{% +\def\phfthm@proof@parselabel@label*{% + \@ifnextchar*\phfthm@proof@parselabel@labelsilent\phfthm@proof@parselabel@labelnormal% +} +\def\phfthm@proof@parselabel@labelsilent*#1\phfthm@proof@parselabel@END{% % \end{macrocode} % The use of |\detokenize| here is a trick to make sure that all chars in the % label text have a non-active category (e.g.\@ we would have problems, e.g., if % in the label ``|thm:gauss|'' the ``|:|'' is an active char---such as in French): % \begin{macrocode} \edef\phfthm@val@proofoflabel{\detokenize{#1}}% + \def\phfthm@val@prooftitle{}% +} +\def\phfthm@proof@parselabel@labelnormal#1\phfthm@proof@parselabel@END{% + \edef\phfthm@val@proofoflabel{\detokenize{#1}}% \def\phfthm@val@prooftitle{\phfthm@autoref{#1}}% } \def\phfthm@proof@parselabel@title#1\phfthm@proof@parselabel@END{% @@ -1679,12 +1774,14 @@ % % % In order to look up what we are a proof of, we use |\autoref| provided by the -% \pkgname{hyperref} package. If it is not available, fall back to the regular -% |\ref| command. +% \pkgname{hyperref} package. Crucially, it is NOT the job of \pkgname{phfthm} +% to load this package, and we should only use them if they are available (we +% don't want to depend on it). If it is not available, then we fall back to the +% regular |\ref| command. % \begin{macrocode} \def\phfthm@autoref{\ref} \AtBeginDocument{% - \@ifpackageloaded{hyperref}{\def\phfthm@autoref{\autoref}}{} + \@ifpackageloaded{hyperref}{\def\phfthm@autoref{\autoref}}{}% } % \end{macrocode} % @@ -1983,11 +2080,53 @@ % \end{macro} % % -% \subsubsection{Other proof-ref styles: only \phfverb{margin} for now} +% \subsubsection{Other proof-ref styles: \phfverb{margin} and \phfverb{marginbottom}} % % These styles simply use the same mechanism as the default style, but plug in % different sub-callbacks. % +% Here's a command that actually places the marginpar: +% \begin{macro}{\phfthmproofref@placemarginpar} +% \begin{macrocode} +\newcommand\phfthmproofref@placemarginpar[2]{% + \marginpar[% + \raggedleft #1% + ]{% + \raggedright #2% + }% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\phfthmproofref@placephantommarginpar} +% In the |marginbottom| proof-ref style, we place an invisible |\marginpar| at +% the top of the proof so that the proof-ref margin note will not be shifted +% too high when we try to align it to the bottom of the theorem statement. To +% work around a weird bug in Rev\TeX, where I get the error message `command +% sequence undefined: |\@captype|', I have found that a fix is to override +% this local invisible |\marginpar| to locally make sure the |\@captype| is +% defined. The wild fix I've found---no guarantees, there are dark magic +% forces at work here---is the following, which you can include in your +% document preamble if you're banging your head against this problem and +% you're desperate: +% \begin{verbatim} +% \makeatletter +% \renewcommand\phfthmproofref@placephantommarginpar{% +% \begingroup\csdef{@captype}{figure}\marginpar{% +% \vspace{-\baselineskip}\rule{0pt}{0pt}}\endgroup% +% } +% \makeatother +% \end{verbatim} +% \begin{macrocode} +\newcommand\phfthmproofref@placephantommarginpar{% + \leavevmode\marginpar{\vspace{-\baselineskip}\rule{\z@}{\z@}}% +}% +% \end{macrocode} +% \end{macro} +% +% +% \paragraph{The \phfverb{margin} style} +% % \begin{macro}{\phfthm@proofrefstyle@margin@setup} % Set-up macro for the ``|margin|'' proof-ref style (displays the proof % reference in the margin of the page). @@ -2011,12 +2150,65 @@ % \url{http://tex.stackexchange.com/a/16161/32188}} % \begin{macrocode} \def\phfthm@proofref@impl@fmt##1##2{% - \leavevmode\marginpar{\proofrefsize{\proofonname{##1}{##2}}}% + \leavevmode\phfthmproofref@placemarginpar{% + \proofrefsize{\proofonname{##1}{##2}}% + }{% + \proofrefsize{\proofonname{##1}{##2}}% + }% }% } % \end{macrocode} % \end{macro} % +% \paragraph{The \phfverb{marginbottom} style} +% +% \begin{macro}{\phfthm@proofrefstyle@marginbottom@setup} +% Set-up macro for the ``|marginbottom|'' proof-ref style (displays the proof +% reference in the margin of the page). +% \begin{macrocode} +\def\phfthm@proofrefstyle@marginbottom@setup{% + \phfthm@proofrefstyle@default@setup +% \end{macrocode} +% +% The proof reference should be displayed directly at the bottom, not at the end +% of the theorem, so plug in |\phfthm@proofref@default@main| onto |...@end| and +% not onto |...@afterlabel|. Don't forget that these macros accept one +% argument, the theorem label. In |...@afterlabel| we place a dummy marginpar +% with an invisible rule one |\baselineskip| upwards, so that we force any +% proof-ref marginpar not to extend above the top of the theorem statement. +% \begin{macrocode} + \def\phfthm@proofref@impl@afterlabel##1{% + \phfthmproofref@placephantommarginpar + }% + \let\phfthm@proofref@impl@end\phfthm@proofrefstyle@default@main +% \end{macrocode} +% +% Define the formatting callback to put the note in the margin of the page using +% a |\marginpar|. We use a trick to align the margin note with the bottom of +% the paragraph.\footnote{\url{https://tex.stackexchange.com/a/388018/32188}} +% \begin{macrocode} + \def\phfthm@proofref@impl@fmt##1##2{% + \phfthmproofref@marginbottom@domarginpar{##1}{##2}% + }% +} +\def\phfthmproofref@marginbottom@domarginpar#1#2{% + \setbox\phfthm@tmp@boxa=\hbox to \marginparwidth{% + \parbox[b]{\marginparwidth}{\raggedleft\sloppy + \proofrefsize{\strut\proofonname{#1}{#2}\strut}}}% + \setbox\phfthm@tmp@box=\hbox to \marginparwidth{% + \parbox[b]{\marginparwidth}{\raggedright\sloppy + \proofrefsize{\strut\proofonname{#1}{#2}\strut}}}% + \phfthmproofref@placemarginpar{% + \box\phfthm@tmp@boxa% + }{% + \box\phfthm@tmp@box% + }% +} +\newbox\phfthm@tmp@box +\newbox\phfthm@tmp@boxa +% \end{macrocode} +% \end{macro} +% % % \subsection{Thmheading definition-like environments} % @@ -2150,6 +2342,8 @@ \def\definitionname{Definition} \def\ideaname{Idea} \def\questionname{Question} +\def\claimname{Claim} +\def\observationname{Observation} \def\problemname{Problem} % \end{macrocode} % @@ -2230,6 +2424,8 @@ \phfthm@thmset@default \phfthm@def@thmset@mktheorem{idea}{\ideaname} \phfthm@def@thmset@mktheorem{question}{\questionname} + \phfthm@def@thmset@mktheorem{claim}{\claimname} + \phfthm@def@thmset@mktheorem{observation}{\observationname} \phfthm@def@thmset@mktheorem{problem}{\problemname} } % \end{macrocode} @@ -2291,6 +2487,7 @@ \KV@phfthmpkg@qedsymbolblacksquarefalse% \KV@phfthmpkg@prooftitleitbffalse% \KV@phfthmpkg@sepcountersfalse% + \KV@phfthmpkg@countpersectionfalse% \KV@phfthmpkg@proofreffalse% \if\relax\detokenize{#1}\relax\else% \PackageError{phfthm}{'resetstyle' does not take any argument.}{You @@ -2312,13 +2509,18 @@ \KV@phfthmpkg@sepcountersfalse % \end{macrocode} % +% The \pkgoptionfmt{countpersection} option, off by default. +% \begin{macrocode} +\define@boolkey{phfthmpkg}{countpersection}[true]{} +\KV@phfthmpkg@countpersectionfalse +% \end{macrocode} +% % -% The \pkgoptionfmt{proofref} option. The proof-ref is off initially by -% default. +% The \pkgoptionfmt{proofref} option. The proof-ref is on initially by default. % \begin{macrocode} \newif\ifKV@phfthmpkg@proofref -\KV@phfthmpkg@proofreffalse -\def\cmdKV@phfthmpkg@proofref@style{} +\KV@phfthmpkg@proofreftrue +\def\cmdKV@phfthmpkg@proofref@style{default} % \end{macrocode} % Actually define the option itself. Here we do some customized parsing of the % value of the |proofref=...| option, to treat the cases |proofref=| (empty @@ -2451,6 +2653,9 @@ \def\phfthm@proofref@style@margin{ \def\phfthm@val@mkthmopt@proofrefstyle{proofrefstyle=margin} } + \def\phfthm@proofref@style@marginbottom{ + \def\phfthm@val@mkthmopt@proofrefstyle{proofrefstyle=marginbottom} + } \def\phfthm@proofref@style@longref{ % \end{macrocode} % For |longref|: by setting |\proofonname| globally, this option can be combined @@ -2476,6 +2681,16 @@ \def\x{% \phfthm@internal@execattribs{phfthm@proofref@style@}{ProofRef Style}} \expandafter\x\expandafter{\cmdKV@phfthmpkg@proofref@style} +% \end{macrocode} +% +% Prepare the proof-ref option in case we don't want any proof reference +% mechanism on. +% +% \changed[chg-bugfix-pkgopt-proofreffalse]{v1.1}{2019/03/12}{Bug fix: package +% option \texttt{proofref\eqsign false} didn't have any effect} +% \begin{macrocode} +\else + \def\phfthm@val@mkthmopt@proofrefstyle{proofref=false} \fi % \end{macrocode} % @@ -2490,12 +2705,28 @@ % \end{macrocode} % % Prepare an argument to |\phfMakeTheorem| according to the -% \pkgoptionfmt{sepcounters} option. +% \pkgoptionfmt{countpersection} and \pkgoptionfmt{sepcounters} options. First +% determine the parent counter in case \pkgoptionfmt{countpersection} is set +% (|chapter| if |chapter| counter exists, else |section|). % \begin{macrocode} +\ifKV@phfthmpkg@countpersection + \ifcsname c@chapter\endcsname + \def\phfthm@tmp@parentcountername{chapter} + \else + \def\phfthm@tmp@parentcountername{section} + \fi +\fi \ifKV@phfthmpkg@sepcounters - \def\phfthm@val@mkthmopt@counteropts{} + \ifKV@phfthmpkg@countpersection + \edef\phfthm@val@mkthmopt@counteropts{parentcounter=\phfthm@tmp@parentcountername} + \else + \def\phfthm@val@mkthmopt@counteropts{} + \fi \else \def\phfthm@val@mkthmopt@counteropts{counter=phfthmcounter} + \ifKV@phfthmpkg@countpersection + \numberwithin{phfthmcounter}{\phfthm@tmp@parentcountername} + \fi \fi % \end{macrocode} % @@ -2525,19 +2756,19 @@ \fi } \ifKV@phfthmpkg@smallproofs - \phfthm@pkgopterr@require@proofenv{smallproofs} + %\phfthm@pkgopterr@require@proofenv{smallproofs} \apptocmd\phfthm@hookproof@startcommon{% \def\baselinestretch{1.2}\footnotesize}{}{% Failed to change command \string\phfthm@hook@start@proof} \fi \ifKV@phfthmpkg@qedsymbolblacksquare - \phfthm@pkgopterr@require@proofenv{qedsymbolblacksquare} + %\phfthm@pkgopterr@require@proofenv{qedsymbolblacksquare} \RequirePackage{amssymb} \providecommand\filledsquare{\ensuremath{\blacksquare}} \renewcommand\qedsymbol{\text{\tiny\ensuremath{\filledsquare}}} \fi \ifKV@phfthmpkg@prooftitleitbf - \phfthm@pkgopterr@require@proofenv{prooftitleitbf} + %\phfthm@pkgopterr@require@proofenv{prooftitleitbf} \def\phfthm@ProofTitleFmt#1{{\itshape\bfseries#1.}} \fi % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/phfthm/phfthm.ins b/Master/texmf-dist/source/latex/phfthm/phfthm.ins index 133090b2138..566fc7ee409 100644 --- a/Master/texmf-dist/source/latex/phfthm/phfthm.ins +++ b/Master/texmf-dist/source/latex/phfthm/phfthm.ins @@ -1,5 +1,5 @@ %% -%% Copyright (C) 2016 by Philippe Faist <philippe.faist@bluewin.ch> +%% Copyright (C) 2016 by Philippe Faist, philippe.faist@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 @@ -21,7 +21,7 @@ This is a generated file. -Copyright (C) 2016 by Philippe Faist <philippe.faist@bluewin.ch> +Copyright (C) 2016 by Philippe Faist, philippe.faist@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 diff --git a/Master/texmf-dist/doc/latex/phfthm/pkg.mk b/Master/texmf-dist/source/latex/phfthm/pkg.mk index 3cc121ce5ec..328b5fc36d3 100644 --- a/Master/texmf-dist/doc/latex/phfthm/pkg.mk +++ b/Master/texmf-dist/source/latex/phfthm/pkg.mk @@ -4,7 +4,9 @@ # LATEX = latex -PDFLATEX = TEXINPUTS="$$TEXINPUTS:../phfnote" pdflatex +PDFLATEXNAME = pdflatex + +PDFLATEX = TEXINPUTS="$$TEXINPUTS:../phfnote" $(PDFLATEXNAME) PDFLATEXOPTS = -interaction=batchmode PDFLATEXOPTSLAST = -interaction=batchmode --synctex=1 @@ -29,29 +31,38 @@ PKGREADME = README.md # DIST_ADDITIONAL_FILES ?= +# +# Additional files automatically generated by the .ins file, such as .def files +# (by default empty) +# +ADDITIONAL_GENERATED_FILES ?= + + +# By default, the generated style file is a '.sty' latex package. If it's a +# '.cls' class file instead, the local Makefile will redefine this to 'cls'. +PKGSTYEXT ?= sty PKGDTX = $(PKG).dtx +PKGSTY = $(PKG).$(PKGSTYEXT) 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 +.PHONY: help sty cls pdf install install_sty install_cls install_doc tdszip dist clean cleanall cleansty cleancls cleanaux cleanpdf cleantdszip cleandist help: @echo "Targets for $(PKG):" - @echo "make sty -- generate LaTeX package file $(PKG).sty" + @echo "make $(PKGSTYEXT) -- generate LaTeX package file $(PKG).$(PKGSTYEXT)" @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 install -- install style and documentation files to $(DEFAULT_PREFIX)" + @echo "make install PREFIX=[specify texmf directory destination]" + @echo "make $(PKG).tds.zip -- create TDS.ZIP package for distribution" @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 clean$(PKGSTYEXT) -- remove generated style file" @echo "make cleanpdf -- remove generated pdf documentation" @echo "make cleanall -- remove all generated files, incl. distribution zip" @@ -66,11 +77,17 @@ cleanall: cleansty cleanaux cleanpdf cleantdszip cleandist sty: $(PKGSTY) +# synonym of `sty` in case of LaTeX classes, we use same commands etc. +cls: $(PKGSTY) + $(PKGSTY): $(PKGINS) $(PKGDTX) $(LATEX) $< cleansty: - @rm -f $(PKGSTY) + @rm -f $(PKGSTY) $(ADDITIONAL_GENERATED_FILES) + +cleancls: cleansty + # ------------------------------------------------ # make pdf @@ -121,7 +138,9 @@ cleanpdf: install_sty: $(PKGSTY) mkdir -p $(DESTDIR)$(PREFIX)/tex/latex/$(PKG) - cp $(PKGSTY) $(DESTDIR)$(PREFIX)/tex/latex/$(PKG) + cp $(PKGSTY) $(ADDITIONAL_GENERATED_FILES) $(DESTDIR)$(PREFIX)/tex/latex/$(PKG) + +install_cls: install_sty install_doc: $(PKGPDF) mkdir -p $(DESTDIR)$(PREFIX)/doc/latex/$(PKG) @@ -155,12 +174,14 @@ DISTTMPDIR = $(CURDIR)/_install_dist_zip.make.tmp dist: $(PKGZIP) -$(PKGZIP): $(PKGTDSZIP) +# feedback from CTAN upload manager: prefer not to provide tds.zip in CTAN upload +$(PKGZIP): #$(PKGTDSZIP) rm -rf $(DISTTMPDIR) mkdir -p $(DISTTMPDIR)/$(PKG) - cp $(PKGTDSZIP) $(DISTTMPDIR) +# cp $(PKGTDSZIP) $(DISTTMPDIR) cp $(PKGDTX) $(PKGINS) $(PKGPDF) $(PKGREADME) Makefile pkg.mk $(DIST_ADDITIONAL_FILES) $(DISTTMPDIR)/$(PKG) - cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKGTDSZIP) $(PKG) +# cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKG) $(PKGTDSZIP) + cd $(DISTTMPDIR) && zip -r $(CURDIR)/$(PKGZIP) $(PKG) rm -rf $(DISTTMPDIR) cleandist: diff --git a/Master/texmf-dist/tex/latex/phfthm/phfthm.sty b/Master/texmf-dist/tex/latex/phfthm/phfthm.sty index d437ff24da2..d17c6ee9c75 100644 --- a/Master/texmf-dist/tex/latex/phfthm/phfthm.sty +++ b/Master/texmf-dist/tex/latex/phfthm/phfthm.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2016 by Philippe Faist <philippe.faist@bluewin.ch> +%% Copyright (C) 2016 by Philippe Faist, philippe.faist@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 @@ -22,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{phfthm} - [2016/08/15 v1.0 phfthm package] + [2021/03/01 v1.2 phfthm package] \RequirePackage{xkeyval} \RequirePackage{etoolbox} \RequirePackage{aliascnt} @@ -43,6 +43,7 @@ \define@boolkey{phfmkthm}{defnostar}[true]{} \define@boolkey{phfmkthm}{defstar}[true]{} \define@boolkey{phfmkthm}{proofref}[true]{} +\define@cmdkey{phfmkthm}{parentcounter}{} \define@cmdkey{phfmkthm}{proofrefstyle}{} \newcommand\phfMakeTheorem[3][]{% } \KV@phfmkthm@aliascountertrue% @@ -51,6 +52,7 @@ \KV@phfmkthm@defnostartrue% \KV@phfmkthm@defstartrue% \KV@phfmkthm@proofreftrue% + \def\cmdKV@phfmkthm@parentcounter{}% \def\cmdKV@phfmkthm@proofrefstyle{default}% \setkeys{phfmkthm}{#1}% \if\relax\detokenize\expandafter{\cmdKV@phfmkthm@thmstyle}\relax% @@ -59,7 +61,12 @@ \fi% \ifKV@phfmkthm@defnostar% \if\relax\detokenize\expandafter{\cmdKV@phfmkthm@counter}\relax% - \newtheorem{phfthm@#2}{#3}% + \if\relax\detokenize\expandafter{\cmdKV@phfmkthm@parentcounter}\relax% + \edef\x{\noexpand\newtheorem{phfthm@#2}{#3}}% + \else + \edef\x{\noexpand\newtheorem{phfthm@#2}{#3}[\expandonce\cmdKV@phfmkthm@parentcounter]}% + \fi + \x \csdef{phfthm@#2autorefname}{#3}% \else% \ifKV@phfmkthm@aliascounter% @@ -72,7 +79,7 @@ \fi% \fi% \newenvironment{#2}[1][]{% - \begin{phfthm@#2}[##1]% + \begin{phfthm@#2}[{##1}]% \begingroup% \csname phfthm@hook@start@#2\endcsname{##1}% }{% @@ -193,10 +200,15 @@ \else \noexpand\phfthm@proof@noparselabel{##1}% \fi - \noexpand\def\noexpand\phfthm@val@displayargs{[{% - \expandafter\noexpand\csname phfthm@prfenv@#2@val@proofofname\endcsname - {\noexpand\phfthm@val@prooftitle}% - }]}% + \noexpand\if\noexpand\relax\noexpand\detokenize% + \noexpand\expandafter{\noexpand\phfthm@val@prooftitle}\noexpand\relax + \noexpand\def\noexpand\phfthm@val@displayargs{} + \noexpand\else + \noexpand\def\noexpand\phfthm@val@displayargs{[{% + \expandafter\noexpand\csname phfthm@prfenv@#2@val@proofofname\endcsname + {\noexpand\phfthm@val@prooftitle}% + }]}% + \noexpand\fi } \cslet{phfthm@prfenv@#2@val@proofofname}\cmdKV@phfmkprf@proofofname% \csdef{phfthm@prfenv@#2@val@pinproofanchor}{% @@ -290,7 +302,14 @@ \def\phfthm@proof@parselabel@maybelabel{% \@ifnextchar*\phfthm@proof@parselabel@label\phfthm@proof@parselabel@title% } -\def\phfthm@proof@parselabel@label*#1\phfthm@proof@parselabel@END{% +\def\phfthm@proof@parselabel@label*{% + \@ifnextchar*\phfthm@proof@parselabel@labelsilent\phfthm@proof@parselabel@labelnormal% +} +\def\phfthm@proof@parselabel@labelsilent*#1\phfthm@proof@parselabel@END{% + \edef\phfthm@val@proofoflabel{\detokenize{#1}}% + \def\phfthm@val@prooftitle{}% +} +\def\phfthm@proof@parselabel@labelnormal#1\phfthm@proof@parselabel@END{% \edef\phfthm@val@proofoflabel{\detokenize{#1}}% \def\phfthm@val@prooftitle{\phfthm@autoref{#1}}% } @@ -304,7 +323,7 @@ } \def\phfthm@autoref{\ref} \AtBeginDocument{% - \@ifpackageloaded{hyperref}{\def\phfthm@autoref{\autoref}}{} + \@ifpackageloaded{hyperref}{\def\phfthm@autoref{\autoref}}{}% } \providecommand\proofonname[2]{Proof on #2.} \def\proofrefsize{\footnotesize} @@ -406,14 +425,53 @@ \let\phfthm@proofref@impl@fmtcloseby\phfthm@proofrefstyle@default@fmtcloseby \let\phfthm@proofref@impl@fmt\phfthm@proofrefstyle@default@fmt } +\newcommand\phfthmproofref@placemarginpar[2]{% + \marginpar[% + \raggedleft #1% + ]{% + \raggedright #2% + }% +} +\newcommand\phfthmproofref@placephantommarginpar{% + \leavevmode\marginpar{\vspace{-\baselineskip}\rule{\z@}{\z@}}% +}% \def\phfthm@proofrefstyle@margin@setup{% \phfthm@proofrefstyle@default@setup \let\phfthm@proofref@impl@afterlabel\phfthm@proofrefstyle@default@main \let\phfthm@proofref@impl@end\@gobble \def\phfthm@proofref@impl@fmt##1##2{% - \leavevmode\marginpar{\proofrefsize{\proofonname{##1}{##2}}}% + \leavevmode\phfthmproofref@placemarginpar{% + \proofrefsize{\proofonname{##1}{##2}}% + }{% + \proofrefsize{\proofonname{##1}{##2}}% + }% + }% +} +\def\phfthm@proofrefstyle@marginbottom@setup{% + \phfthm@proofrefstyle@default@setup + \def\phfthm@proofref@impl@afterlabel##1{% + \phfthmproofref@placephantommarginpar + }% + \let\phfthm@proofref@impl@end\phfthm@proofrefstyle@default@main + \def\phfthm@proofref@impl@fmt##1##2{% + \phfthmproofref@marginbottom@domarginpar{##1}{##2}% }% } +\def\phfthmproofref@marginbottom@domarginpar#1#2{% + \setbox\phfthm@tmp@boxa=\hbox to \marginparwidth{% + \parbox[b]{\marginparwidth}{\raggedleft\sloppy + \proofrefsize{\strut\proofonname{#1}{#2}\strut}}}% + \setbox\phfthm@tmp@box=\hbox to \marginparwidth{% + \parbox[b]{\marginparwidth}{\raggedright\sloppy + \proofrefsize{\strut\proofonname{#1}{#2}\strut}}}% + \phfthmproofref@placemarginpar{% + \box\phfthm@tmp@boxa% + }{% + \box\phfthm@tmp@box% + }% +} +\newbox\phfthm@tmp@box +\newbox\phfthm@tmp@boxa \define@cmdkey{phfthmmkthmheading}{thmstyle}{} \define@cmdkey{phfthmmkthmheading}{internalcounter}{} \newcounter{phfthmheadingcounter}% @@ -454,6 +512,8 @@ \def\definitionname{Definition} \def\ideaname{Idea} \def\questionname{Question} +\def\claimname{Claim} +\def\observationname{Observation} \def\problemname{Problem} \def\phfthm@def@thmset@optlist{} \def\phfthm@def@thmset#1{% @@ -493,6 +553,8 @@ \phfthm@thmset@default \phfthm@def@thmset@mktheorem{idea}{\ideaname} \phfthm@def@thmset@mktheorem{question}{\questionname} + \phfthm@def@thmset@mktheorem{claim}{\claimname} + \phfthm@def@thmset@mktheorem{observation}{\observationname} \phfthm@def@thmset@mktheorem{problem}{\problemname} } \newcommand\phfLoadThmSet[3]{% @@ -510,6 +572,7 @@ \KV@phfthmpkg@qedsymbolblacksquarefalse% \KV@phfthmpkg@prooftitleitbffalse% \KV@phfthmpkg@sepcountersfalse% + \KV@phfthmpkg@countpersectionfalse% \KV@phfthmpkg@proofreffalse% \if\relax\detokenize{#1}\relax\else% \PackageError{phfthm}{'resetstyle' does not take any argument.}{You @@ -520,9 +583,11 @@ } \define@boolkey{phfthmpkg}{sepcounters}[true]{} \KV@phfthmpkg@sepcountersfalse +\define@boolkey{phfthmpkg}{countpersection}[true]{} +\KV@phfthmpkg@countpersectionfalse \newif\ifKV@phfthmpkg@proofref -\KV@phfthmpkg@proofreffalse -\def\cmdKV@phfthmpkg@proofref@style{} +\KV@phfthmpkg@proofreftrue +\def\cmdKV@phfthmpkg@proofref@style{default} \define@key{phfthmpkg}{proofref}[]{% \ifblank{#1}{% \KV@phfthmpkg@proofreftrue% @@ -577,6 +642,9 @@ \def\phfthm@proofref@style@margin{ \def\phfthm@val@mkthmopt@proofrefstyle{proofrefstyle=margin} } + \def\phfthm@proofref@style@marginbottom{ + \def\phfthm@val@mkthmopt@proofrefstyle{proofrefstyle=marginbottom} + } \def\phfthm@proofref@style@longref{ \def\proofonname##1##2{The proof of this \phfthm@autorefnameof{##1} can be found on ##2.} @@ -590,13 +658,29 @@ \def\x{% \phfthm@internal@execattribs{phfthm@proofref@style@}{ProofRef Style}} \expandafter\x\expandafter{\cmdKV@phfthmpkg@proofref@style} +\else + \def\phfthm@val@mkthmopt@proofrefstyle{proofref=false} \fi \newcounter{phfthmcounter} \setcounter{phfthmcounter}{0} +\ifKV@phfthmpkg@countpersection + \ifcsname c@chapter\endcsname + \def\phfthm@tmp@parentcountername{chapter} + \else + \def\phfthm@tmp@parentcountername{section} + \fi +\fi \ifKV@phfthmpkg@sepcounters - \def\phfthm@val@mkthmopt@counteropts{} + \ifKV@phfthmpkg@countpersection + \edef\phfthm@val@mkthmopt@counteropts{parentcounter=\phfthm@tmp@parentcountername} + \else + \def\phfthm@val@mkthmopt@counteropts{} + \fi \else \def\phfthm@val@mkthmopt@counteropts{counter=phfthmcounter} + \ifKV@phfthmpkg@countpersection + \numberwithin{phfthmcounter}{\phfthm@tmp@parentcountername} + \fi \fi \phfLoadThmSet% {[\phfthm@val@mkthmopt@counteropts,\phfthm@val@mkthmopt@proofrefstyle, @@ -610,19 +694,19 @@ \fi } \ifKV@phfthmpkg@smallproofs - \phfthm@pkgopterr@require@proofenv{smallproofs} + %\phfthm@pkgopterr@require@proofenv{smallproofs} \apptocmd\phfthm@hookproof@startcommon{% \def\baselinestretch{1.2}\footnotesize}{}{% Failed to change command \string\phfthm@hook@start@proof} \fi \ifKV@phfthmpkg@qedsymbolblacksquare - \phfthm@pkgopterr@require@proofenv{qedsymbolblacksquare} + %\phfthm@pkgopterr@require@proofenv{qedsymbolblacksquare} \RequirePackage{amssymb} \providecommand\filledsquare{\ensuremath{\blacksquare}} \renewcommand\qedsymbol{\text{\tiny\ensuremath{\filledsquare}}} \fi \ifKV@phfthmpkg@prooftitleitbf - \phfthm@pkgopterr@require@proofenv{prooftitleitbf} + %\phfthm@pkgopterr@require@proofenv{prooftitleitbf} \def\phfthm@ProofTitleFmt#1{{\itshape\bfseries#1.}} \fi \ifKV@phfthmpkg@proofenv |