diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/phfthm/phfthm.sty | 118 |
1 files changed, 101 insertions, 17 deletions
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 |