summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/bibtex/bst/phfnote/naturemagdoi.bst1657
-rw-r--r--Master/texmf-dist/doc/latex/phfnote/Makefile14
-rw-r--r--Master/texmf-dist/doc/latex/phfnote/README.md18
-rw-r--r--Master/texmf-dist/doc/latex/phfnote/phfnote.pdfbin0 -> 646717 bytes
-rw-r--r--Master/texmf-dist/doc/latex/phfnote/pkg.mk167
-rw-r--r--Master/texmf-dist/source/latex/phfnote/phfnote.dtx3157
-rw-r--r--Master/texmf-dist/source/latex/phfnote/phfnote.ins56
-rw-r--r--Master/texmf-dist/tex/latex/phfnote/phfnote.sty1028
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/phfnote.tlpsrc0
11 files changed, 6099 insertions, 1 deletions
diff --git a/Master/texmf-dist/bibtex/bst/phfnote/naturemagdoi.bst b/Master/texmf-dist/bibtex/bst/phfnote/naturemagdoi.bst
new file mode 100644
index 00000000000..f2bb40df3cc
--- /dev/null
+++ b/Master/texmf-dist/bibtex/bst/phfnote/naturemagdoi.bst
@@ -0,0 +1,1657 @@
+%%
+%% PhF: I've shamelessly hacked & patched this file manually (2015). ABSOLUTELY
+%% NO GUARANTEES!!!!!!!
+%%
+%% Original header:
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% This is file `naturemag.bst',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% merlin.mbs (with options: `head,seq-no,nm-rev,ed-rev,jnrlst,nmlm,x5,m1,yr-par,xmth,vol-bf,vnum-x,volp-com,num-xser,jnm-x,bkpg-x,pub-date,edparxc,ppx,ed,abr,xedn,jabr,amper,and-xcom,etal-it,eprint,url,url-blk,bibinfo,nfss,{}')
+%% physjour.mbs (with options: `seq-no,nm-rev,ed-rev,jnrlst,nmlm,x5,m1,yr-par,xmth,vol-bf,vnum-x,volp-com,num-xser,jnm-x,bkpg-x,pub-date,edparxc,ppx,ed,abr,xedn,jabr,amper,and-xcom,etal-it,eprint,url,url-blk,bibinfo,nfss,{}')
+%% geojour.mbs (with options: `seq-no,nm-rev,ed-rev,jnrlst,nmlm,x5,m1,yr-par,xmth,vol-bf,vnum-x,volp-com,num-xser,jnm-x,bkpg-x,pub-date,edparxc,ppx,ed,abr,xedn,jabr,amper,and-xcom,etal-it,eprint,url,url-blk,bibinfo,nfss,{}')
+%% photjour.mbs (with options: `seq-no,nm-rev,ed-rev,jnrlst,nmlm,x5,m1,yr-par,xmth,vol-bf,vnum-x,volp-com,num-xser,jnm-x,bkpg-x,pub-date,edparxc,ppx,ed,abr,xedn,jabr,amper,and-xcom,etal-it,eprint,url,url-blk,bibinfo,nfss,{}')
+%% merlin.mbs (with options: `tail,seq-no,nm-rev,ed-rev,jnrlst,nmlm,x5,m1,yr-par,xmth,vol-bf,vnum-x,volp-com,num-xser,jnm-x,bkpg-x,pub-date,edparxc,ppx,ed,abr,xedn,jabr,amper,and-xcom,etal-it,eprint,url,url-blk,bibinfo,nfss,{}')
+%% ----------------------------------------
+%% *** Style for the journal Nature (created by Peter Czoschke) ***
+%%
+%% Copyright 1994-2002 Patrick W Daly
+ % ===============================================================
+ % IMPORTANT NOTICE:
+ % This bibliographic style (bst) file has been generated from one or
+ % more master bibliographic style (mbs) files, listed above.
+ %
+ % This generated file can be redistributed and/or modified under the terms
+ % of the LaTeX Project Public License Distributed from CTAN
+ % archives in directory macros/latex/base/lppl.txt; either
+ % version 1 of the License, or any later version.
+ % ===============================================================
+ % Name and version information of the main mbs file:
+ % \ProvidesFile{merlin.mbs}[2002/10/21 4.05 (PWD, AO, DPC)]
+ % For use with BibTeX version 0.99a or later
+ %-------------------------------------------------------------------
+ % This bibliography style file is intended for texts in ENGLISH
+ % This is a numerical citation style, and as such is standard LaTeX.
+ % It requires no extra package to interface to the main text.
+ % The form of the \bibitem entries is
+ % \bibitem{key}...
+ % Usage of \cite is as follows:
+ % \cite{key} ==>> [#]
+ % \cite[chap. 2]{key} ==>> [#, chap. 2]
+ % where # is a number determined by the ordering in the reference list.
+ % The order in the reference list is that by which the works were originally
+ % cited in the text, or that in the database.
+ %---------------------------------------------------------------------
+
+ENTRY
+ { address
+ archive
+ author
+ booktitle
+ chapter
+ edition
+ editor
+ eprint
+ howpublished
+ institution
+ journal
+ key
+ month
+ note
+ number
+ organization
+ pages
+ publisher
+ school
+ series
+ title
+ type
+ doi
+ url
+ volume
+ year
+ }
+ {}
+ { label }
+INTEGERS { output.state before.all mid.sentence after.sentence after.block }
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+ #1 'mid.sentence :=
+ #2 'after.sentence :=
+ #3 'after.block :=
+}
+STRINGS { s t}
+FUNCTION {output.nonnull}
+{ 's :=
+ output.state mid.sentence =
+ { ", " * write$ }
+ { output.state after.block =
+ { add.period$ write$
+ newline$
+ "\newblock " write$
+ }
+ { output.state before.all =
+ 'write$
+ { add.period$ " " * write$ }
+ if$
+ }
+ if$
+ mid.sentence 'output.state :=
+ }
+ if$
+ s
+}
+FUNCTION {output}
+{ duplicate$ empty$
+ 'pop$
+ 'output.nonnull
+ if$
+}
+FUNCTION {output.check}
+{ 't :=
+ duplicate$ empty$
+ { pop$ "empty " t * " in " * cite$ * warning$ }
+ 'output.nonnull
+ if$
+}
+FUNCTION {fin.entry}
+{ add.period$
+ write$
+ newline$
+}
+
+FUNCTION {new.block}
+{ output.state before.all =
+ 'skip$
+ { after.block 'output.state := }
+ if$
+}
+FUNCTION {new.sentence}
+{ output.state after.block =
+ 'skip$
+ { output.state before.all =
+ 'skip$
+ { after.sentence 'output.state := }
+ if$
+ }
+ if$
+}
+FUNCTION {add.blank}
+{ " " * before.all 'output.state :=
+}
+
+FUNCTION {date.block}
+{
+ new.block
+}
+
+FUNCTION {not}
+{ { #0 }
+ { #1 }
+ if$
+}
+FUNCTION {and}
+{ 'skip$
+ { pop$ #0 }
+ if$
+}
+FUNCTION {or}
+{ { pop$ #1 }
+ 'skip$
+ if$
+}
+FUNCTION {new.block.checka}
+{ empty$
+ 'skip$
+ 'new.block
+ if$
+}
+FUNCTION {new.block.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.block
+ if$
+}
+FUNCTION {new.sentence.checka}
+{ empty$
+ 'skip$
+ 'new.sentence
+ if$
+}
+FUNCTION {new.sentence.checkb}
+{ empty$
+ swap$ empty$
+ and
+ 'skip$
+ 'new.sentence
+ if$
+}
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+ { pop$ "" }
+ 'skip$
+ if$
+}
+FUNCTION {emphasize}
+{ duplicate$ empty$
+ { pop$ "" }
+ { "\emph{" swap$ * "}" * }
+ if$
+}
+FUNCTION {bolden}
+{ duplicate$ empty$
+ { pop$ "" }
+ { "\textbf{" swap$ * "}" * }
+ if$
+}
+FUNCTION {tie.or.space.prefix}
+{ duplicate$ text.length$ #3 <
+ { "~" }
+ { " " }
+ if$
+ swap$
+}
+
+FUNCTION {capitalize}
+{ "u" change.case$ "t" change.case$ }
+
+FUNCTION {space.word}
+{ " " swap$ * " " * }
+ % Here are the language-specific definitions for explicit words.
+ % Each function has a name bbl.xxx where xxx is the English word.
+ % The language selected here is ENGLISH
+FUNCTION {bbl.and}
+{ "and"}
+
+FUNCTION {bbl.etal}
+{ "et~al." }
+
+FUNCTION {bbl.editors}
+{ "eds." }
+
+FUNCTION {bbl.editor}
+{ "ed." }
+
+FUNCTION {bbl.edby}
+{ "edited by" }
+
+FUNCTION {bbl.edition}
+{ "edn." }
+
+FUNCTION {bbl.volume}
+{ "vol." }
+
+FUNCTION {bbl.of}
+{ "of" }
+
+FUNCTION {bbl.number}
+{ "no." }
+
+FUNCTION {bbl.nr}
+{ "no." }
+
+FUNCTION {bbl.in}
+{ "in" }
+
+FUNCTION {bbl.pages}
+{ "" }
+
+FUNCTION {bbl.page}
+{ "" }
+
+FUNCTION {bbl.chapter}
+{ "chap." }
+
+FUNCTION {bbl.techrep}
+{ "Tech. Rep." }
+
+FUNCTION {bbl.mthesis}
+{ "Master's thesis" }
+
+FUNCTION {bbl.phdthesis}
+{ "Ph.D. thesis" }
+
+MACRO {jan} {"Jan."}
+
+MACRO {feb} {"Feb."}
+
+MACRO {mar} {"Mar."}
+
+MACRO {apr} {"Apr."}
+
+MACRO {may} {"May"}
+
+MACRO {jun} {"Jun."}
+
+MACRO {jul} {"Jul."}
+
+MACRO {aug} {"Aug."}
+
+MACRO {sep} {"Sep."}
+
+MACRO {oct} {"Oct."}
+
+MACRO {nov} {"Nov."}
+
+MACRO {dec} {"Dec."}
+
+ %-------------------------------------------------------------------
+ % Begin module:
+ % \ProvidesFile{physjour.mbs}[2002/01/14 2.2 (PWD)]
+MACRO {aa}{"Astron. \& Astrophys."}
+MACRO {aasup}{"Astron. \& Astrophys. Suppl. Ser."}
+MACRO {aj} {"Astron. J."}
+MACRO {aph} {"Acta Phys."}
+MACRO {advp} {"Adv. Phys."}
+MACRO {ajp} {"Amer. J. Phys."}
+MACRO {ajm} {"Amer. J. Math."}
+MACRO {amsci} {"Amer. Sci."}
+MACRO {anofd} {"Ann. Fluid Dyn."}
+MACRO {am} {"Ann. Math."}
+MACRO {ap} {"Ann. Phys. (NY)"}
+MACRO {adp} {"Ann. Phys. (Leipzig)"}
+MACRO {ao} {"Appl. Opt."}
+MACRO {apl} {"Appl. Phys. Lett."}
+MACRO {app} {"Astroparticle Phys."}
+MACRO {apj} {"Astrophys. J."}
+MACRO {apjsup} {"Astrophys. J. Suppl."}
+MACRO {apss} {"Astrophys. Space Sci."}
+MACRO {araa} {"Ann. Rev. Astron. Astrophys."}
+MACRO {baas} {"Bull. Amer. Astron. Soc."}
+MACRO {baps} {"Bull. Amer. Phys. Soc."}
+MACRO {cmp} {"Comm. Math. Phys."}
+MACRO {cpam} {"Commun. Pure Appl. Math."}
+MACRO {cppcf} {"Comm. Plasma Phys. \& Controlled Fusion"}
+MACRO {cpc} {"Comp. Phys. Comm."}
+MACRO {cqg} {"Class. Quant. Grav."}
+MACRO {cra} {"C. R. Acad. Sci. A"}
+MACRO {fed} {"Fusion Eng. \& Design"}
+MACRO {ft} {"Fusion Tech."}
+MACRO {grg} {"Gen. Relativ. Gravit."}
+MACRO {ieeens} {"IEEE Trans. Nucl. Sci."}
+MACRO {ieeeps} {"IEEE Trans. Plasma Sci."}
+MACRO {ijimw} {"Interntl. J. Infrared \& Millimeter Waves"}
+MACRO {ip} {"Infrared Phys."}
+MACRO {irp} {"Infrared Phys."}
+MACRO {jap} {"J. Appl. Phys."}
+MACRO {jasa} {"J. Acoust. Soc. America"}
+MACRO {jcp} {"J. Comp. Phys."}
+MACRO {jetp} {"Sov. Phys.--JETP"}
+MACRO {jfe} {"J. Fusion Energy"}
+MACRO {jfm} {"J. Fluid Mech."}
+MACRO {jmp} {"J. Math. Phys."}
+MACRO {jne} {"J. Nucl. Energy"}
+MACRO {jnec} {"J. Nucl. Energy, C: Plasma Phys., Accelerators, Thermonucl. Res."}
+MACRO {jnm} {"J. Nucl. Mat."}
+MACRO {jpc} {"J. Phys. Chem."}
+MACRO {jpp} {"J. Plasma Phys."}
+MACRO {jpsj} {"J. Phys. Soc. Japan"}
+MACRO {jsi} {"J. Sci. Instrum."}
+MACRO {jvst} {"J. Vac. Sci. \& Tech."}
+MACRO {nat} {"Nature"}
+MACRO {nature} {"Nature"}
+MACRO {nedf} {"Nucl. Eng. \& Design/Fusion"}
+MACRO {nf} {"Nucl. Fusion"}
+MACRO {nim} {"Nucl. Inst. \& Meth."}
+MACRO {nimpr} {"Nucl. Inst. \& Meth. in Phys. Res."}
+MACRO {np} {"Nucl. Phys."}
+MACRO {npb} {"Nucl. Phys. B"}
+MACRO {nt/f} {"Nucl. Tech./Fusion"}
+MACRO {npbpc} {"Nucl. Phys. B (Proc. Suppl.)"}
+MACRO {inc} {"Nuovo Cimento"}
+MACRO {nc} {"Nuovo Cimento"}
+MACRO {pf} {"Phys. Fluids"}
+MACRO {pfa} {"Phys. Fluids A: Fluid Dyn."}
+MACRO {pfb} {"Phys. Fluids B: Plasma Phys."}
+MACRO {pl} {"Phys. Lett."}
+MACRO {pla} {"Phys. Lett. A"}
+MACRO {plb} {"Phys. Lett. B"}
+MACRO {prep} {"Phys. Rep."}
+MACRO {pnas} {"Proc. Nat. Acad. Sci. USA"}
+MACRO {pp} {"Phys. Plasmas"}
+MACRO {ppcf} {"Plasma Phys. \& Controlled Fusion"}
+MACRO {phitrsl} {"Philos. Trans. Roy. Soc. London"}
+MACRO {prl} {"Phys. Rev. Lett."}
+MACRO {pr} {"Phys. Rev."}
+MACRO {physrev} {"Phys. Rev."}
+MACRO {pra} {"Phys. Rev. A"}
+MACRO {prb} {"Phys. Rev. B"}
+MACRO {prc} {"Phys. Rev. C"}
+MACRO {prd} {"Phys. Rev. D"}
+MACRO {pre} {"Phys. Rev. E"}
+MACRO {ps} {"Phys. Scripta"}
+MACRO {procrsl} {"Proc. Roy. Soc. London"}
+MACRO {rmp} {"Rev. Mod. Phys."}
+MACRO {rsi} {"Rev. Sci. Inst."}
+MACRO {science} {"Science"}
+MACRO {sciam} {"Sci. Am."}
+MACRO {sam} {"Stud. Appl. Math."}
+MACRO {sjpp} {"Sov. J. Plasma Phys."}
+MACRO {spd} {"Sov. Phys.--Doklady"}
+MACRO {sptp} {"Sov. Phys.--Tech. Phys."}
+MACRO {spu} {"Sov. Phys.--Uspeki"}
+MACRO {st} {"Sky and Telesc."}
+ % End module: physjour.mbs
+ %-------------------------------------------------------------------
+ % Begin module:
+ % \ProvidesFile{geojour.mbs}[2002/07/10 2.0h (PWD)]
+MACRO {aisr} {"Adv. Space Res."}
+MACRO {ag} {"Ann. Geophys."}
+MACRO {anigeo} {"Ann. Geofis."}
+MACRO {angl} {"Ann. Glaciol."}
+MACRO {andmet} {"Ann. d. Meteor."}
+MACRO {andgeo} {"Ann. d. Geophys."}
+MACRO {andphy} {"Ann. Phys.-Paris"}
+MACRO {afmgb} {"Arch. Meteor. Geophys. Bioklimatol."}
+MACRO {atph} {"Atm\'osphera"}
+MACRO {aao} {"Atmos. Ocean"}
+MACRO {ass}{"Astrophys. Space Sci."}
+MACRO {atenv} {"Atmos. Environ."}
+MACRO {aujag} {"Aust. J. Agr. Res."}
+MACRO {aumet} {"Aust. Meteorol. Mag."}
+MACRO {blmet} {"Bound.-Lay. Meteorol."}
+MACRO {bams} {"Bull. Amer. Meteorol. Soc."}
+MACRO {cch} {"Clim. Change"}
+MACRO {cdyn} {"Clim. Dynam."}
+MACRO {cbul} {"Climatol. Bull."}
+MACRO {cap} {"Contrib. Atmos. Phys."}
+MACRO {dsr} {"Deep-Sea Res."}
+MACRO {dhz} {"Dtsch. Hydrogr. Z."}
+MACRO {dao} {"Dynam. Atmos. Oceans"}
+MACRO {eco} {"Ecology"}
+MACRO {empl}{"Earth, Moon and Planets"}
+MACRO {envres} {"Environ. Res."}
+MACRO {envst} {"Environ. Sci. Technol."}
+MACRO {ecms} {"Estuarine Coastal Mar. Sci."}
+MACRO {expa}{"Exper. Astron."}
+MACRO {geoint} {"Geofis. Int."}
+MACRO {geopub} {"Geofys. Publ."}
+MACRO {geogeo} {"Geol. Geofiz."}
+MACRO {gafd} {"Geophys. Astrophys. Fluid Dyn."}
+MACRO {gfd} {"Geophys. Fluid Dyn."}
+MACRO {geomag} {"Geophys. Mag."}
+MACRO {georl} {"Geophys. Res. Lett."}
+MACRO {grl} {"Geophys. Res. Lett."}
+MACRO {ga} {"Geophysica"}
+MACRO {gs} {"Geophysics"}
+MACRO {ieeetap} {"IEEE Trans. Antenn. Propag."}
+MACRO {ijawp} {"Int. J. Air Water Pollut."}
+MACRO {ijc} {"Int. J. Climatol."}
+MACRO {ijrs} {"Int. J. Remote Sens."}
+MACRO {jam} {"J. Appl. Meteorol."}
+MACRO {jaot} {"J. Atmos. Ocean. Technol."}
+MACRO {jatp} {"J. Atmos. Terr. Phys."}
+MACRO {jastp} {"J. Atmos. Solar-Terr. Phys."}
+MACRO {jce} {"J. Climate"}
+MACRO {jcam} {"J. Climate Appl. Meteor."}
+MACRO {jcm} {"J. Climate Meteor."}
+MACRO {jcy} {"J. Climatol."}
+MACRO {jgr} {"J. Geophys. Res."}
+MACRO {jga} {"J. Glaciol."}
+MACRO {jh} {"J. Hydrol."}
+MACRO {jmr} {"J. Mar. Res."}
+MACRO {jmrj} {"J. Meteor. Res. Japan"}
+MACRO {jm} {"J. Meteor."}
+MACRO {jpo} {"J. Phys. Oceanogr."}
+MACRO {jra} {"J. Rech. Atmos."}
+MACRO {jaes} {"J. Aeronaut. Sci."}
+MACRO {japca} {"J. Air Pollut. Control Assoc."}
+MACRO {jas} {"J. Atmos. Sci."}
+MACRO {jmts} {"J. Mar. Technol. Soc."}
+MACRO {jmsj} {"J. Meteorol. Soc. Japan"}
+MACRO {josj} {"J. Oceanogr. Soc. Japan"}
+MACRO {jwm} {"J. Wea. Mod."}
+MACRO {lao} {"Limnol. Oceanogr."}
+MACRO {mwl} {"Mar. Wea. Log"}
+MACRO {mau} {"Mausam"}
+MACRO {meteor} {"``Meteor'' Forschungsergeb."}
+MACRO {map} {"Meteorol. Atmos. Phys."}
+MACRO {metmag} {"Meteor. Mag."}
+MACRO {metmon} {"Meteor. Monogr."}
+MACRO {metrun} {"Meteor. Rundsch."}
+MACRO {metzeit} {"Meteor. Z."}
+MACRO {metgid} {"Meteor. Gidrol."}
+MACRO {mwr} {"Mon. Weather Rev."}
+MACRO {nwd} {"Natl. Weather Dig."}
+MACRO {nzjmfr} {"New Zeal. J. Mar. Freshwater Res."}
+MACRO {npg} {"Nonlin. Proc. Geophys."}
+MACRO {om} {"Oceanogr. Meteorol."}
+MACRO {ocac} {"Oceanol. Acta"}
+MACRO {oceanus} {"Oceanus"}
+MACRO {paleoc} {"Paleoceanography"}
+MACRO {pce} {"Phys. Chem. Earth"}
+MACRO {pmg} {"Pap. Meteor. Geophys."}
+MACRO {ppom} {"Pap. Phys. Oceanogr. Meteor."}
+MACRO {physzeit} {"Phys. Z."}
+MACRO {pps} {"Planet. Space Sci."}
+MACRO {pss} {"Planet. Space Sci."}
+MACRO {pag} {"Pure Appl. Geophys."}
+MACRO {qjrms} {"Quart. J. Roy. Meteorol. Soc."}
+MACRO {quatres} {"Quat. Res."}
+MACRO {rsci} {"Radio Sci."}
+MACRO {rse} {"Remote Sens. Environ."}
+MACRO {rgeo} {"Rev. Geophys."}
+MACRO {rgsp} {"Rev. Geophys. Space Phys."}
+MACRO {rdgeo} {"Rev. Geofis."}
+MACRO {revmeta} {"Rev. Meteorol."}
+MACRO {sgp}{"Surveys in Geophys."}
+MACRO {sp} {"Solar Phys."}
+MACRO {ssr} {"Space Sci. Rev."}
+MACRO {tellus} {"Tellus"}
+MACRO {tac} {"Theor. Appl. Climatol."}
+MACRO {tagu} {"Trans. Am. Geophys. Union (EOS)"}
+MACRO {wrr} {"Water Resour. Res."}
+MACRO {weather} {"Weather"}
+MACRO {wafc} {"Weather Forecast."}
+MACRO {ww} {"Weatherwise"}
+MACRO {wmob} {"WMO Bull."}
+MACRO {zeitmet} {"Z. Meteorol."}
+ % End module: geojour.mbs
+ %-------------------------------------------------------------------
+ % Begin module:
+ % \ProvidesFile{photjour.mbs}[1999/02/24 2.0b (PWD)]
+
+MACRO {appopt} {"Appl. Opt."}
+MACRO {bell} {"Bell Syst. Tech. J."}
+MACRO {ell} {"Electron. Lett."}
+MACRO {jasp} {"J. Appl. Spectr."}
+MACRO {jqe} {"IEEE J. Quantum Electron."}
+MACRO {jlwt} {"J. Lightwave Technol."}
+MACRO {jmo} {"J. Mod. Opt."}
+MACRO {josa} {"J. Opt. Soc. America"}
+MACRO {josaa} {"J. Opt. Soc. Amer.~A"}
+MACRO {josab} {"J. Opt. Soc. Amer.~B"}
+MACRO {jdp} {"J. Phys. (Paris)"}
+MACRO {oc} {"Opt. Commun."}
+MACRO {ol} {"Opt. Lett."}
+MACRO {phtl} {"IEEE Photon. Technol. Lett."}
+MACRO {pspie} {"Proc. Soc. Photo-Opt. Instrum. Eng."}
+MACRO {sse} {"Solid-State Electron."}
+MACRO {sjot} {"Sov. J. Opt. Technol."}
+MACRO {sjqe} {"Sov. J. Quantum Electron."}
+MACRO {sleb} {"Sov. Phys.--Leb. Inst. Rep."}
+MACRO {stph} {"Sov. Phys.--Techn. Phys."}
+MACRO {stphl} {"Sov. Techn. Phys. Lett."}
+MACRO {vr} {"Vision Res."}
+MACRO {zph} {"Z. f. Physik"}
+MACRO {zphb} {"Z. f. Physik~B"}
+MACRO {zphd} {"Z. f. Physik~D"}
+
+MACRO {CLEO} {"CLEO"}
+MACRO {ASSL} {"Adv. Sol.-State Lasers"}
+MACRO {OSA} {"OSA"}
+ % End module: photjour.mbs
+%% Copyright 1994-2002 Patrick W Daly
+MACRO {acmcs} {"ACM Comput. Surv."}
+
+MACRO {acta} {"Acta Inf."}
+
+MACRO {cacm} {"Commun. ACM"}
+
+MACRO {ibmjrd} {"IBM J. Res. Dev."}
+
+MACRO {ibmsj} {"IBM Syst.~J."}
+
+MACRO {ieeese} {"IEEE Trans. Software Eng."}
+
+MACRO {ieeetc} {"IEEE Trans. Comput."}
+
+MACRO {ieeetcad}
+ {"IEEE Trans. Comput. Aid. Des."}
+
+MACRO {ipl} {"Inf. Process. Lett."}
+
+MACRO {jacm} {"J.~ACM"}
+
+MACRO {jcss} {"J.~Comput. Syst. Sci."}
+
+MACRO {scp} {"Sci. Comput. Program."}
+
+MACRO {sicomp} {"SIAM J. Comput."}
+
+MACRO {tocs} {"ACM Trans. Comput. Syst."}
+
+MACRO {tods} {"ACM Trans. Database Syst."}
+
+MACRO {tog} {"ACM Trans. Graphic."}
+
+MACRO {toms} {"ACM Trans. Math. Software"}
+
+MACRO {toois} {"ACM Trans. Office Inf. Syst."}
+
+MACRO {toplas} {"ACM Trans. Progr. Lang. Syst."}
+
+MACRO {tcs} {"Theor. Comput. Sci."}
+
+
+% Phf: adding support for DOI, code pasted from apsrev4-1.bst
+FUNCTION {doi.command.href}
+{
+ "\Doi "
+}
+FUNCTION {noop.command}
+{
+ "\myhrefnoop "
+}
+FUNCTION {href.command}
+{
+ "\myhref "
+}
+FUNCTION {link.tag.open}
+{
+ doi duplicate$ empty$
+ {
+ pop$
+ url duplicate$ empty$
+ {
+ pop$ "" noop.command
+ }{
+ href.command
+ }
+ if$
+ }
+ {
+ doi.command.href
+ }
+ if$
+ "{" * swap$ * "} {" *
+}
+
+FUNCTION {link.tag.shut}
+{
+ "}"
+}
+FUNCTION {link.open}
+{
+ link.tag.open
+}
+FUNCTION {link.shut}
+{
+ link.tag.shut *
+}
+FUNCTION {add.doi}
+{
+ link.tag.open swap$ * link.tag.shut *
+}
+
+
+
+FUNCTION {bibinfo.check}
+{ swap$
+ duplicate$ missing$
+ {
+ pop$ pop$
+ ""
+ }
+ { duplicate$ empty$
+ {
+ swap$ pop$
+ }
+ { swap$
+ "\bibinfo{" swap$ * "}{" * swap$ * "}" *
+ }
+ if$
+ }
+ if$
+}
+FUNCTION {bibinfo.warn}
+{ swap$
+ duplicate$ missing$
+ {
+ swap$ "missing " swap$ * " in " * cite$ * warning$ pop$
+ ""
+ }
+ { duplicate$ empty$
+ {
+ swap$ "empty " swap$ * " in " * cite$ * warning$
+ }
+ { swap$
+ "\bibinfo{" swap$ * "}{" * swap$ * "}" *
+ }
+ if$
+ }
+ if$
+}
+FUNCTION {format.eprint}
+{ eprint duplicate$ empty$
+ 'skip$
+ { "\eprint"
+ archive empty$
+ 'skip$
+ { "[" * archive * "]" * }
+ if$
+ "{" * swap$ * "}" *
+ }
+ if$
+}
+FUNCTION {format.url}
+{ url empty$
+ { "" }
+ { "\urlprefix\url{" url * "}" * }
+ if$
+}
+
+STRINGS { bibinfo}
+INTEGERS { nameptr namesleft numnames }
+
+FUNCTION {format.names}
+{ 'bibinfo :=
+ duplicate$ empty$ 'skip$ {
+ 's :=
+ "" 't :=
+ #1 'nameptr :=
+ s num.names$ 'numnames :=
+ numnames 'namesleft :=
+ { namesleft #0 > }
+ { s nameptr
+ "{vv~}{ll}{, f.}{, jj}"
+ format.name$
+ bibinfo bibinfo.check
+ 't :=
+ nameptr #1 >
+ {
+ nameptr #1
+ #1 + =
+ numnames #5
+ > and
+ { "others" 't :=
+ #1 'namesleft := }
+ 'skip$
+ if$
+ namesleft #1 >
+ { ", " * t * }
+ {
+ s nameptr "{ll}" format.name$ duplicate$ "others" =
+ { 't := }
+ { pop$ }
+ if$
+ t "others" =
+ {
+ " " * bbl.etal emphasize *
+ }
+ {
+ "\&"
+ space.word * t *
+ }
+ if$
+ }
+ if$
+ }
+ 't
+ if$
+ nameptr #1 + 'nameptr :=
+ namesleft #1 - 'namesleft :=
+ }
+ while$
+ } if$
+}
+FUNCTION {format.names.ed}
+{
+ format.names
+}
+FUNCTION {format.authors}
+{ author "author" format.names
+}
+FUNCTION {get.bbl.editor}
+{ editor num.names$ #1 > 'bbl.editors 'bbl.editor if$ }
+
+FUNCTION {format.editors}
+{ editor "editor" format.names duplicate$ empty$ 'skip$
+ {
+ " " *
+ get.bbl.editor
+ "(" swap$ * ")" *
+ *
+ }
+ if$
+}
+FUNCTION {format.note}
+{
+ note empty$
+ { "" }
+ { note #1 #1 substring$
+ duplicate$ "{" =
+ 'skip$
+ { output.state mid.sentence =
+ { "l" }
+ { "u" }
+ if$
+ change.case$
+ }
+ if$
+ note #2 global.max$ substring$ * "note" bibinfo.check
+ }
+ if$
+}
+
+FUNCTION {format.title}
+{ title
+ duplicate$ empty$ 'skip$
+ { "t" change.case$ }
+ if$
+ "title" bibinfo.check
+}
+FUNCTION {output.bibitem}
+{ newline$
+ "\bibitem{" write$
+ cite$ write$
+ "}" write$
+ newline$
+ ""
+ before.all 'output.state :=
+}
+
+FUNCTION {n.dashify}
+{
+ 't :=
+ ""
+ { t empty$ not }
+ { t #1 #1 substring$ "-" =
+ { t #1 #2 substring$ "--" = not
+ { "--" *
+ t #2 global.max$ substring$ 't :=
+ }
+ { { t #1 #1 substring$ "-" = }
+ { "-" *
+ t #2 global.max$ substring$ 't :=
+ }
+ while$
+ }
+ if$
+ }
+ { t #1 #1 substring$ *
+ t #2 global.max$ substring$ 't :=
+ }
+ if$
+ }
+ while$
+}
+
+FUNCTION {word.in}
+{ bbl.in capitalize
+ " " * }
+
+FUNCTION {format.date}
+{
+ ""
+ duplicate$ empty$
+ year "year" bibinfo.check duplicate$ empty$
+ { swap$ 'skip$
+ { "there's a month but no year in " cite$ * warning$ }
+ if$
+ *
+ }
+ { swap$ 'skip$
+ {
+ swap$
+ " " * swap$
+ }
+ if$
+ *
+ }
+ if$
+ duplicate$ empty$
+ 'skip$
+ {
+ before.all 'output.state :=
+ " (" swap$ * ")" *
+ }
+ if$
+}
+FUNCTION {format.btitle}
+{ title "title" bibinfo.check
+ duplicate$ empty$ 'skip$
+ {
+ emphasize
+ }
+ if$
+}
+FUNCTION {either.or.check}
+{ empty$
+ 'pop$
+ { "can't use both " swap$ * " fields in " * cite$ * warning$ }
+ if$
+}
+FUNCTION {format.bvolume}
+{ volume empty$
+ { "" }
+ { bbl.volume volume tie.or.space.prefix
+ "volume" bibinfo.check * *
+ series "series" bibinfo.check
+ duplicate$ empty$ 'pop$
+ { swap$ bbl.of space.word * swap$
+ emphasize * }
+ if$
+ "volume and number" number either.or.check
+ }
+ if$
+}
+FUNCTION {format.number.series}
+{ volume empty$
+ { number empty$
+ { series field.or.null }
+ { series empty$
+ { number "number" bibinfo.check }
+ { output.state mid.sentence =
+ { bbl.number }
+ { bbl.number capitalize }
+ if$
+ number tie.or.space.prefix "number" bibinfo.check * *
+ bbl.in space.word *
+ series "series" bibinfo.check *
+ }
+ if$
+ }
+ if$
+ }
+ { "" }
+ if$
+}
+
+FUNCTION {format.edition}
+{ edition duplicate$ empty$ 'skip$
+ {
+ output.state mid.sentence =
+ { "l" }
+ { "t" }
+ if$ change.case$
+ "edition" bibinfo.check
+ " " * bbl.edition *
+ }
+ if$
+}
+INTEGERS { multiresult }
+FUNCTION {multi.page.check}
+{ 't :=
+ #0 'multiresult :=
+ { multiresult not
+ t empty$ not
+ and
+ }
+ { t #1 #1 substring$
+ duplicate$ "-" =
+ swap$ duplicate$ "," =
+ swap$ "+" =
+ or or
+ { #1 'multiresult := }
+ { t #2 global.max$ substring$ 't := }
+ if$
+ }
+ while$
+ multiresult
+}
+FUNCTION {format.pages}
+{ pages duplicate$ empty$ 'skip$
+ { duplicate$ multi.page.check
+ {
+ n.dashify
+ }
+ {
+ }
+ if$
+ "pages" bibinfo.check
+ }
+ if$
+}
+FUNCTION {format.journal.pages}
+{ pages duplicate$ empty$ 'pop$
+ { swap$ duplicate$ empty$
+ { pop$ pop$ format.pages }
+ {
+ ", " *
+ swap$
+ n.dashify
+ "pages" bibinfo.check
+ *
+ }
+ if$
+ }
+ if$
+}
+FUNCTION {format.vol.num.pages}
+{ volume field.or.null
+ duplicate$ empty$ 'skip$
+ {
+ "volume" bibinfo.check
+ }
+ if$
+ bolden
+ format.journal.pages
+}
+
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+ 'format.pages
+ { type empty$
+ { bbl.chapter }
+ { type "l" change.case$
+ "type" bibinfo.check
+ }
+ if$
+ chapter tie.or.space.prefix
+ "chapter" bibinfo.check
+ * *
+ pages empty$
+ 'skip$
+ { ", " * format.pages * }
+ if$
+ }
+ if$
+}
+
+FUNCTION {format.booktitle}
+{
+ booktitle "booktitle" bibinfo.check
+ emphasize
+}
+FUNCTION {format.in.ed.booktitle}
+{ format.booktitle duplicate$ empty$ 'skip$
+ {
+ editor "editor" format.names.ed duplicate$ empty$ 'pop$
+ {
+ " " *
+ get.bbl.editor
+ "(" swap$ * ") " *
+ * swap$
+ * }
+ if$
+ word.in swap$ *
+ }
+ if$
+}
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+ month empty$ year empty$ note empty$
+ and and and and and
+ { "all relevant fields are empty in " cite$ * warning$ }
+ 'skip$
+ if$
+}
+FUNCTION {format.thesis.type}
+{ type duplicate$ empty$
+ 'pop$
+ { swap$ pop$
+ "t" change.case$ "type" bibinfo.check
+ }
+ if$
+}
+FUNCTION {format.tr.number}
+{ number "number" bibinfo.check
+ type duplicate$ empty$
+ { pop$ bbl.techrep }
+ 'skip$
+ if$
+ "type" bibinfo.check
+ swap$ duplicate$ empty$
+ { pop$ "t" change.case$ }
+ { tie.or.space.prefix * * }
+ if$
+}
+FUNCTION {format.article.crossref}
+{
+ key duplicate$ empty$
+ { pop$
+ journal duplicate$ empty$
+ { "need key or journal for " cite$ * " to crossref " * crossref * warning$ }
+ { "journal" bibinfo.check emphasize word.in swap$ * }
+ if$
+ }
+ { word.in swap$ * " " *}
+ if$
+ " \cite{" * crossref * "}" *
+}
+FUNCTION {format.crossref.editor}
+{ editor #1 "{vv~}{ll}" format.name$
+ "editor" bibinfo.check
+ editor num.names$ duplicate$
+ #2 >
+ { pop$
+ "editor" bibinfo.check
+ " " * bbl.etal
+ emphasize
+ *
+ }
+ { #2 <
+ 'skip$
+ { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+ {
+ "editor" bibinfo.check
+ " " * bbl.etal
+ emphasize
+ *
+ }
+ {
+ " \& "
+ * editor #2 "{vv~}{ll}" format.name$
+ "editor" bibinfo.check
+ *
+ }
+ if$
+ }
+ if$
+ }
+ if$
+}
+FUNCTION {format.book.crossref}
+{ volume duplicate$ empty$
+ { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+ pop$ word.in
+ }
+ { bbl.volume
+ capitalize
+ swap$ tie.or.space.prefix "volume" bibinfo.check * * bbl.of space.word *
+ }
+ if$
+ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { series empty$
+ { "need editor, key, or series for " cite$ * " to crossref " *
+ crossref * warning$
+ "" *
+ }
+ { series emphasize * }
+ if$
+ }
+ { key * }
+ if$
+ }
+ { format.crossref.editor * }
+ if$
+ " \cite{" * crossref * "}" *
+}
+FUNCTION {format.incoll.inproc.crossref}
+{
+ editor empty$
+ editor field.or.null author field.or.null =
+ or
+ { key empty$
+ { format.booktitle duplicate$ empty$
+ { "need editor, key, or booktitle for " cite$ * " to crossref " *
+ crossref * warning$
+ }
+ { word.in swap$ * }
+ if$
+ }
+ { word.in key * " " *}
+ if$
+ }
+ { word.in format.crossref.editor * " " *}
+ if$
+ " \cite{" * crossref * "}" *
+}
+FUNCTION {format.org.or.pub}
+{ 't :=
+ ""
+ year empty$
+ { "empty year in " cite$ * warning$ }
+ 'skip$
+ if$
+ address empty$ t empty$ and
+ year empty$ and
+ 'skip$
+ {
+ add.blank "(" *
+ t empty$
+ { address "address" bibinfo.check *
+ }
+ { t *
+ address empty$
+ 'skip$
+ { ", " * address "address" bibinfo.check * }
+ if$
+ }
+ if$
+ year empty$
+ 'skip$
+ { t empty$ address empty$ and
+ 'skip$
+ { ", " * }
+ if$
+ year "year" bibinfo.check
+ *
+ }
+ if$
+ ")" *
+ }
+ if$
+}
+FUNCTION {format.publisher.address}
+{ publisher "publisher" bibinfo.warn format.org.or.pub
+}
+
+FUNCTION {format.organization.address}
+{ organization "organization" bibinfo.check format.org.or.pub
+}
+
+% ###PhF: for revtex (?)
+FUNCTION {control}
+{
+}
+
+FUNCTION {article}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.title "title" output.check
+ %duplicate$ empty$ { pop$ } { output } if$
+ new.block
+ crossref missing$
+ {
+ link.open
+ output
+ journal
+ "journal" bibinfo.check
+ emphasize
+ "journal" output.check
+ add.blank
+ format.vol.num.pages output
+ format.date "year" output.check
+ link.shut
+ }
+ { format.article.crossref output.nonnull
+ format.pages output
+ }
+ if$
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+FUNCTION {book}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ add.blank
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ { format.bvolume output
+ new.block
+ format.number.series output
+ new.sentence
+ format.publisher.address output
+ }
+ {
+ new.block
+ format.book.crossref output.nonnull
+ format.date "year" output.check
+ }
+ if$
+ format.edition output
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+FUNCTION {booklet}
+{ output.bibitem
+ format.authors output
+ new.block
+ format.title "title" output.check
+ new.block
+ howpublished "howpublished" bibinfo.check output
+ address "address" bibinfo.check output
+ format.date output
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {inbook}
+{ output.bibitem
+ author empty$
+ { format.editors "author and editor" output.check
+ }
+ { format.authors output.nonnull
+ crossref missing$
+ { "author and editor" editor either.or.check }
+ 'skip$
+ if$
+ }
+ if$
+ new.block
+ format.btitle "title" output.check
+ crossref missing$
+ {
+ format.bvolume output
+ format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.number.series output
+ new.sentence
+ format.publisher.address output
+ }
+ {
+ format.chapter.pages "chapter and pages" output.check
+ new.block
+ format.book.crossref output.nonnull
+ format.date "year" output.check
+ }
+ if$
+ format.edition output
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {incollection}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ {
+ link.open
+ output
+ format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.chapter.pages output
+ link.shut
+ new.sentence
+ format.publisher.address output
+ format.edition output
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.chapter.pages output
+ }
+ if$
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+FUNCTION {inproceedings}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.title "title" output.check
+ new.block
+ crossref missing$
+ {
+ link.open
+ output
+ format.in.ed.booktitle "booktitle" output.check
+ format.bvolume output
+ format.number.series output
+ format.pages output
+ link.shut
+ new.sentence
+ publisher empty$
+ { format.organization.address output }
+ { organization "organization" bibinfo.check output
+ format.publisher.address output
+ }
+ if$
+ }
+ { format.incoll.inproc.crossref output.nonnull
+ format.pages output
+ }
+ if$
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+FUNCTION {conference} { inproceedings }
+FUNCTION {manual}
+{ output.bibitem
+ author empty$
+ { organization "organization" bibinfo.check
+ duplicate$ empty$ 'pop$
+ { output
+ address "address" bibinfo.check output
+ }
+ if$
+ }
+ { format.authors output.nonnull }
+ if$
+ new.block
+ format.btitle "title" output.check
+ author empty$
+ { organization empty$
+ {
+ address new.block.checka
+ address "address" bibinfo.check output
+ }
+ 'skip$
+ if$
+ }
+ {
+ organization address new.block.checkb
+ organization "organization" bibinfo.check output
+ address "address" bibinfo.check output
+ }
+ if$
+ format.edition output
+ format.date output
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {mastersthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.btitle
+ "title" output.check
+ new.block
+ bbl.mthesis format.thesis.type output.nonnull
+ school "school" bibinfo.warn output
+ address "address" bibinfo.check output
+ format.date "year" output.check
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {misc}
+{ output.bibitem
+ format.authors output
+ title howpublished new.block.checkb
+ format.title output
+ howpublished new.block.checka
+ howpublished "howpublished" bibinfo.check output
+ format.date output
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+ empty.misc.check
+}
+FUNCTION {phdthesis}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.btitle
+ "title" output.check
+ new.block
+ link.open
+ output
+ bbl.phdthesis format.thesis.type output.nonnull
+ link.shut
+ school "school" bibinfo.warn output
+ address "address" bibinfo.check output
+ format.date "year" output.check
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {proceedings}
+{ output.bibitem
+ editor empty$
+ { organization "organization" bibinfo.check output
+ }
+ { format.editors output.nonnull }
+ if$
+ new.block
+ format.btitle "title" output.check
+ format.bvolume output
+ format.number.series output
+ editor empty$
+ { publisher empty$
+ 'skip$
+ {
+ new.sentence
+ format.publisher.address output
+ }
+ if$
+ }
+ { publisher empty$
+ {
+ new.sentence
+ format.organization.address output }
+ {
+ new.sentence
+ organization "organization" bibinfo.check output
+ format.publisher.address output
+ }
+ if$
+ }
+ if$
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {techreport}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.title
+ "title" output.check
+ new.block
+ format.tr.number output.nonnull
+ institution "institution" bibinfo.warn output
+ address "address" bibinfo.check output
+ format.date "year" output.check
+ new.block
+ format.url output
+ new.block
+ format.note output
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {unpublished}
+{ output.bibitem
+ format.authors "author" output.check
+ new.block
+ format.title "title" output.check
+ format.date output
+ new.block
+ format.url output
+ new.block
+ format.note "note" output.check
+ format.eprint output
+ fin.entry
+}
+
+FUNCTION {default.type} { misc }
+READ
+STRINGS { longest.label }
+INTEGERS { number.label longest.label.width }
+FUNCTION {initialize.longest.label}
+{ "" 'longest.label :=
+ #1 'number.label :=
+ #0 'longest.label.width :=
+}
+FUNCTION {longest.label.pass}
+{ number.label int.to.str$ 'label :=
+ number.label #1 + 'number.label :=
+ label width$ longest.label.width >
+ { label 'longest.label :=
+ label width$ 'longest.label.width :=
+ }
+ 'skip$
+ if$
+}
+EXECUTE {initialize.longest.label}
+ITERATE {longest.label.pass}
+FUNCTION {begin.bib}
+{ preamble$ empty$
+ 'skip$
+ { preamble$ write$ newline$ }
+ if$
+ "\begin{thebibliography}{" longest.label * "}" *
+ write$ newline$
+ "\expandafter\ifx\csname url\endcsname\relax"
+ write$ newline$
+ " \def\url#1{\texttt{#1}}\fi"
+ write$ newline$
+ "\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{Available at }\fi"
+ write$ newline$
+ "\providecommand{\bibinfo}[2]{#2}"
+ write$ newline$
+ "\providecommand{\eprint}[2][]{\url{#2}}"
+ write$ newline$
+
+ "\makeatletter"
+ write$ newline$
+
+ "\let\doibase\relax"
+ write$ newline$
+ "\providecommand \doibase [0]{http://dx.doi.org/}"
+ write$ newline$
+ "\providecommand \@sanitize@url [0]{\catcode `\\12\catcode `\$12\catcode"
+ write$ newline$
+ " `\&12\catcode `\#12\catcode `\^12\catcode `\_12\catcode `\%12\relax}"
+ write$ newline$
+ "\providecommand \Doi [0]{\begingroup \@sanitize@url \@Doi }%"
+ write$ newline$
+ "\providecommand \@Doi [1]{\endgroup\@@startlink{\doibase#1}\@@Doi}%"
+ write$ newline$
+ %% ugly hacks because I don't know how to program BST files and I very unshamefully totally
+ %% hacked the naturemag.bst style to add DOI's but I'm getting stray commas in bib entries
+ "\def\gobbledotblock , {}"
+ write$ newline$
+ "\let\@@Doi\relax"
+ write$ newline$
+ "\newcommand \@@Doi [1]{\textcolor{docnotelinkcolor}{\gobbledotblock#1}\@@endlink}"
+ write$ newline$
+ "\newcommand\myhrefnoop[2]{\gobbledotblock#2}"
+ write$ newline$
+ "\newcommand\@@myhref[2]{\href{#1}{\gobbledotblock#2}}"
+ write$ newline$
+ "\newcommand\@myhref[1]{\endgroup\@@myhref{#1}}"
+ write$ newline$
+ "\newcommand\myhref{\begingroup\@sanitize@url\@myhref}"
+ write$ newline$
+ % with code taken from revtex4-1.cls:
+ "\providecommand\@@startlink[1]{%"
+ write$ newline$
+ "\leavevmode%"
+ write$ newline$
+ "\pdfstartlink\pdfstartlink@attr%"
+ write$ newline$
+ " user{/Subtype/Link/A<</Type/Action/S/URI/URI(#1)>>}\relax%"
+ write$ newline$
+ "}"
+ write$ newline$
+ "\providecommand\@@endlink{\pdfendlink}"
+ write$ newline$
+ "\providecommand\pdfstartlink@attr{attr{/Border[0 0 0 [1 5] ]/H/I/C[0 1 1]}}"
+ write$ newline$
+
+ "\makeatother"
+ write$ newline$
+
+ ""
+ write$ newline$
+}
+EXECUTE {begin.bib}
+EXECUTE {init.state.consts}
+ITERATE {call.type$}
+FUNCTION {end.bib}
+{ newline$
+ "\end{thebibliography}" write$ newline$
+}
+EXECUTE {end.bib}
+%% End of customized bst file
+%%
+%% End of file `nature.bst'.
diff --git a/Master/texmf-dist/doc/latex/phfnote/Makefile b/Master/texmf-dist/doc/latex/phfnote/Makefile
new file mode 100644
index 00000000000..1def9236c43
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/phfnote/Makefile
@@ -0,0 +1,14 @@
+
+PKG = phfnote
+
+DIST_ADDITIONAL_FILES = naturemagdoi.bst
+
+-include pkg.mk
+
+pkg.mk:
+ ln -sf ../mkcommon/pkg.mk pkg.mk
+
+install: install_sty install_doc
+ mkdir -p $(DESTDIR)$(PREFIX)/bibtex/bst/$(PKG)
+ cp naturemagdoi.bst $(DESTDIR)$(PREFIX)/bibtex/bst/$(PKG)
+
diff --git a/Master/texmf-dist/doc/latex/phfnote/README.md b/Master/texmf-dist/doc/latex/phfnote/README.md
new file mode 100644
index 00000000000..f55c41ba90a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/phfnote/README.md
@@ -0,0 +1,18 @@
+# The phfnote package
+
+A handy LaTeX class for typesetting short notes and medium-length reports, full
+of goodies to make it look just right.
+
+The package phfnote provides basic formatting for short documents, such as notes
+on a specific topic, short documentation, or quick memos. It aims to cover all
+basic needs for such purposes: include a standard set of relevant packages, a
+nice title which doesn't take up too much space, better page margin sizes, and
+some basic styling to make the note look nicer. At the same time, it is highly
+flexible and customizable.
+
+
+# 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.
+
diff --git a/Master/texmf-dist/doc/latex/phfnote/phfnote.pdf b/Master/texmf-dist/doc/latex/phfnote/phfnote.pdf
new file mode 100644
index 00000000000..1150b2ba4ed
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/phfnote/phfnote.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/phfnote/pkg.mk b/Master/texmf-dist/doc/latex/phfnote/pkg.mk
new file mode 100644
index 00000000000..3cc121ce5ec
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/phfnote/pkg.mk
@@ -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)
diff --git a/Master/texmf-dist/source/latex/phfnote/phfnote.dtx b/Master/texmf-dist/source/latex/phfnote/phfnote.dtx
new file mode 100644
index 00000000000..05deb875182
--- /dev/null
+++ b/Master/texmf-dist/source/latex/phfnote/phfnote.dtx
@@ -0,0 +1,3157 @@
+% \iffalse meta-comment
+%
+% 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 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{phfnote.dtx}
+%</driver>
+%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+%<package>\ProvidesPackage{phfnote}
+%<*package>
+ [2016/08/15 v1.0 phfnote package]
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{xcolor}
+\usepackage{lipsum}
+\usepackage[preset=xpkgdoc]{phfnote}
+
+\usepackage{needspace}
+
+\makeatletter
+\newsavebox\phfnoteDocVirtualPage@contents
+\newenvironment{phfnoteDocVirtualPage}{%
+ \par%
+ \begingroup%
+ \makeatletter%
+ \begin{lrbox}{\phfnoteDocVirtualPage@contents}%
+ \begin{minipage}{12cm}\vspace*{0.5cm}\relax%
+ \def\rmdefault{cmr}\def\sfdefault{cmbr}\normalfont%
+ \def\shortlipsum{Lorem ipsum dolor sit amet, consectetuer
+ adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
+ adipiscing vitae, felis. Curabitur dictum gravida
+ mauris. Nam arcu libero, nonummy eget, consectetuer id,
+ vulputate a, magna.}%
+ \def\@title{Notes on Lambda-Majorization}%
+ \def\@author{Ph. Faist}%
+ \def\@date{23.12.2011}%
+ \def\notetitletopspace{0pt}%
+ \def\notetitlefont{\sffamily\bfseries}%
+ \def\morepagecontents{\par\vspace{1em}\centering\ldots}%
+ \ignorespaces%
+ }%
+ {%
+ \end{minipage}%
+ \end{lrbox}%
+ %%\centering%
+ \begin{tcolorbox}[text width=6cm,sharp corners,%
+ before={\par\vspace{5pt}\centering\nopagebreak\parindent=0pt},after={\par\vspace{5pt}},%
+ leftrule=0.4pt,toprule=0.4pt,rightrule=0.6pt,bottomrule=0.6pt,%
+ colframe=black,colback=white]%
+ \scalebox{0.5}{\usebox{\phfnoteDocVirtualPage@contents}}%
+ \end{tcolorbox}%
+ %%\par%
+ \endgroup%
+}
+\makeatother
+
+\def\RevTeX{{\small R\raise-0.2ex\hbox{\textsc{ev}}}\TeX}
+
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+
+\begin{document}
+ \DocInput{phfnote.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{phfnote.dtx}
+%
+% \iffalse Bypass indexing for following commands: \fi
+% \DoNotIndex{\newcommand,\newenvironment,\renewcommand,\long,\def,\edef,\gdef,\xdef,\if,\else,\fi,\par,\relax,\vspace,\vskip,\hspace,\hskip,\vbox,\hbox}
+%
+% \title{\phfqitltxPkgTitle{phfnote}}
+% \author{Philippe Faist\quad\email{philippe.faist@bluewin.ch}}
+% \date{\pkgfmtdate\filedate}
+% \maketitle
+%
+% \begin{abstract}
+% \pkgname{phfnote}---A handy \LaTeX{} class for typesetting short notes and
+% medium-length reports, full of goodies to make it look just right.
+% \end{abstract}
+%
+% \phantomsection\label{sec:toc}
+% \inlinetoc
+%
+% \section{Introduction}
+%
+% Have you ever thought, ``let me write up these short notes using \LaTeX,'' but
+% then disliked the default style of the |article| class? Have you ever asked
+% yourself why half the page should be taken up by the title? Yes? Then
+% welcome to \pkgname{phfnote}.
+%
+% The package \pkgname{phfnote} provides basic formatting for short
+% documents, such as notes on a specific topic, short documentation, or
+% quick memos. It aims to cover all basic needs for such purposes: include
+% a standard set of relevant packages, a nice title which doesn't take up
+% too much space, better page margin sizes, and some basic styling to make
+% the note look nicer. At the same time, it is highly configurable so that
+% nothing is really unchangeable. And all overridden features can be
+% restored individually to their class-provided defaults.
+%
+% This package has been designed to work optimally along with the |article|
+% document class, but in principle any relatively standard \LaTeX{} class should
+% work. Notes can be typeset in \index{two-column} two-column mode with the
+% |twocolumn| option of for example the |article| class. Settings such as the
+% page margins and font goodies are automatically adapted to look best according
+% to the standard document font size (10pt, 11pt, or 12pt).
+%
+% Be aware that this package is not meant as a full-fledged formatting class for
+% complicated articles. For that, you should use a specialized class such as
+% \RevTeX.\footnote{See \url{https://journals.aps.org/revtex}}
+%
+% In the following, we detail individual features of this class, and explain how
+% to activate, deactivate, and customize them.
+%
+%
+% \section{Basic Usage}
+%
+% \subsection{Loading the Package}
+%
+% You can get started with the minimal template:
+%
+% \begin{verbatim}
+% \documentclass[11pt,a4paper]{article}
+% \usepackage{phfnote}
+%
+% \begin{document}
+% \title{Title of my notes}
+% \author{Me}
+% \date{\today}
+% \maketitle
+%
+% ...
+%
+% \end{document}
+% \end{verbatim}
+%
+% The package \pkgname{phfnote} introduces its default note formatting
+% style, with a more compact title, and some formatting adjustments in the
+% text and section headings.
+%
+% \subsection{Presets}
+% \label{sec:presets}
+%
+% There are a number of package options which can be provided to activate,
+% deactivate or adjust the formatting. The most straightforward way of changing
+% the formatting is to use \emph{presets}.
+%
+% Presets are processed immediately when given in the package option list,
+% meaning that their position in the list is meaningful. For example, the
+% option list
+% \begin{verbatim}
+% \usepackage[title=small,preset=article,par=skip]{phfnote}
+% \end{verbatim}
+% will set |title=small| only if it is not overridden by the |article| preset,
+% but will enforce |par=skip| in any case. You may in theory load several
+% presets, e.g. |preset=sfnote,preset=article|, but this is essentially useless
+% since presets tend to set a wide range of settings such that in any case the
+% last preset specified is effectively applied.
+%
+% First, there is a set of presets which are different alternative ``note''
+% styles. All the following define the note to have spacing between paragraphs
+% and no first line indentation, use the default note title style, and use a
+% wider page geometry.
+%
+% \begin{pkgoptions}
+% \item[preset=sfnote] {\fontfamily{cmbr}\selectfont Format the note in \LaTeX'
+% sans-serif ``Computer Modern Bright'' font. This is a nice, light, font for
+% short notes, but I find it more difficult to read at smaller font sizes or
+% in longer paragraphs.}
+% \item[preset=sfssnote] {\fontfamily{cmss}\selectfont Format the note in
+% \LaTeX' default sans-serif font. A very nice sans serif font. It might
+% look heavy though, depending on your taste.}
+% \item[preset=opensansnote] {\fontfamily{fosj}\selectfont Format the note
+% in Open Sans font (using the `\pkgname{opensans}' package with some
+% default options). A very beautiful and readable sans serif font.}
+% \item[preset=utopianote] {\fontfamily{futs}\selectfont Format the note in
+% Utopia font (by using the \pkgname{fourier} package). Perfect to my
+% taste for documenting code for example, but I find it a bit heavy for
+% scientific documents.}
+% \item[preset=mnmynote] Format the note in Minion Pro font, with sans
+% serif text formatted with the Myriad Pro font (professional fonts by
+% Adobe which can be used in \LaTeX{} with the \pkgname{MinionPro} and
+% \pkgname{MyriadPro} packages\footnote{See
+% \url{https://github.com/sebschub/FontPro}; the fonts themselves ship
+% with some Adobe products}). These beautiful fonts can be used for any
+% purpose.
+% \end{pkgoptions}
+%
+% Based essentially on |utopianote|, the preset |pkgdoc| sets up the
+% document to look nice for a \LaTeX{} package documentation. The preset
+% |xpkgdoc| adds additional definitions to aid in documenting \LaTeX{}
+% packages on top of |pkgdoc|.
+% \begin{pkgoptions}
+% \item[preset=pkgdoc] Basic formatting and settings for documenting \LaTeX{}
+% packages. This preset was used for the current document.
+% \item[preset=xpkgdoc] Same as |preset=pkgdoc|, but in addition a set of
+% useful commands are also provided, the \pkgname{tcolorbox} package is
+% loaded along with some default boxes. Also some commands are patched
+% to achieve some fixes. This preset is used for the documentation of
+% packages in the \pkgname{phfqitltx} package suite. (For details see
+% the implementation of |\phfnote@preset@xpkgdoc| below.)
+% \end{pkgoptions}
+%
+%
+% The following preset makes the document look more like an article. There are
+% some slight minor differences with respect to the default |article| class'
+% title in the choice of formatting the title and text.
+%
+% \begin{pkgoptions}
+% \item[preset=article] Sets a more title style closer to |article|'s default
+% title style (but slightly more compact) and sets paragraphs to indent with
+% no skip.
+% \end{pkgoptions}
+%
+% The last preset, |reset|, guarantees that including this package is
+% non-invasive, meaning that only new \LaTeX{} macros are made available without
+% altering any appearance. This is useful if you want to use a small feature
+% provided by this package, but you already have all the page geometry, title,
+% etc.\@ set up and want to make sure those aren't touched.
+%
+% \begin{pkgoptions}
+% \item[preset=reset] Deactivates all features of this package by default.
+% Individual settings can still later be switched on via specific package
+% options. Use this to activate only a specific set of features:
+% |[preset=reset,...]| will ensure that only the additional given features are
+% set.
+%
+% This is safer than deactivating individually all other features, because in
+% the future we may add new features which may be on by default. In this
+% case, the preset |reset| will guarantee all features to be deactivated.
+% \end{pkgoptions}
+%
+% \section{Features}
+%
+% This package provides a large collection of small features, which, put all
+% together, make the document look nicer (hopefully). Let's go through these
+% features, one by one.
+%
+% Note also that some features provided in the presets, such changing the
+% document font, are not provided as individual features here. This is because
+% they may be set and customized directly using few lines of \LaTeX{} code or
+% directly by including an external package. In those cases, you may have a
+% look at the preset's definition for inspiration (see \autoref{impl:presets}).
+%
+% For a summary of package options, see \autoref{sec:package-options}.
+%
+%
+% \subsection{Title Formatting}
+%
+% \subsubsection{Title Styles}
+% \label{sec:title-styles}
+% \label{sec:main-default-title-style}
+%
+% The \pkgname{phfnote} package allows a set of alternative title styles.
+% By default, the |default| title style is used. You may change this
+% setting with the |title=...| package option.
+%
+% \begin{pkgoptions}
+% \item[title=default] The default title style displays the title in large bold
+% sans serif font, left-aligned. Below the title appears the information
+% about author and date, indented, followed by a horizontal rule. It looks
+% like this:
+% \begin{phfnoteDocVirtualPage}
+% \notetitle@style@default\null \shortlipsum \morepagecontents
+% \end{phfnoteDocVirtualPage}
+% As you can see, it saves more space on the page compared to the default
+% article title.
+%
+% \item[title=small] A smaller title style which displays all the relevant
+% information on a single line. This is useful for when even the default
+% title style appears too large. It looks like this:
+% \begin{phfnoteDocVirtualPage}
+% \notetitle@style@small\null \shortlipsum \morepagecontents
+% \end{phfnoteDocVirtualPage}
+%
+% \item[title=article] Mimics the default title style from the |article| class,
+% but saves a little more space. It looks like this:
+% \begin{phfnoteDocVirtualPage}
+% \vspace*{3em}\notetitle@style@article\null \shortlipsum \morepagecontents
+% \end{phfnoteDocVirtualPage}
+%
+% \item[title=] An empty argument to |title| instructs \pkgname{phfnote} not to
+% override any title definition, thus preserving the default class title
+% style.
+%
+% Beware that some other title goodies, such as our more advanced |\thanks|
+% notes, or spacing adjustments for the abstract, will probably not work.
+% \end{pkgoptions}
+%
+%
+% \subsubsection{Customizing the style of the \phfverb{default} and \phfverb{small} title styles}
+%
+% You may customize the appearance of the |default| and |small| title styles by
+% overriding some macros.
+%
+% \needspace{3\baselineskip}
+% \DescribeMacro{\notetitlefont}\DescribeMacro{\notetitleauthorfont}
+% \DescribeMacro{\notetitledatefont} The macros
+% |\notetitlefont|, |\notetitleauthorfont|, and |\notetitledatefont| set the
+% default main font title, author text and date text. You may override these
+% settings with, for instance:
+% \begin{verbatim}
+% \renewcommand{\notetitlefont}{\sffamily\bfseries}
+% \renewcommand{\notetitleauthorfont}{\itshape}
+% \renewcommand{\notetitledatefont}{\footnotesize}
+% \end{verbatim}
+% The spacing of the title may be adjusted with the macros
+% \DescribeMacro{\notetitlebelowspace} |\notetitlebelowspace| and
+% \DescribeMacro{\notetitletopspace} |\notetitletopspace|. Override these with
+% e.g.:
+% \begin{verbatim}
+% \renewcommand{\notetitlebelowspace}{4mm}
+% \renewcommand{\notetitletopspace}{-1.2cm}
+% \end{verbatim}
+% Finally, you may override the command \DescribeMacro{\notetitlehrule}
+% |\notetitlehrule| which draws the rule below the title:
+% \begin{verbatim}
+% \renewcommand{\notetitlehrule}{\hrule height 0.8pt}
+% \end{verbatim}
+%
+%
+%
+% \subsubsection{Title notes: \phfverb\thanks{} and \phfverb\thanksmark}
+%
+% \DescribeMacro{\thanks}
+% Notes in the title can be introduced with the |\thanks| macro. You may use
+% this to specify an e-mail address, an affiliation, or any other more specific
+% information. |\thanks| may appear in all three title, authors and date.
+%
+% The appearance of this additional information depends on the title style. In
+% the default note title style, such thanks-notes appear directly below the
+% title. For example, with
+% {\ttfamily|\|author\{Ph.\@ Faist|\|thanks\{|\|itshape Institute for Theoretical Physics, ETH Zurich\}\}}, you get:
+% \begin{phfnoteDocVirtualPage}
+% \author{Ph. Faist\thanks{\itshape Institute for Theoretical Physics, ETH Zurich}}\relax
+% \notetitle@style@default\null \morepagecontents
+% \end{phfnoteDocVirtualPage}
+% whereas with the other styles, this information is typeset as regular footnotes.
+%
+% \leavevmode\marginpar{\raggedleft \phfverb\thanks\phfverb{[N]}}\relax
+% You may specify an optional argument to |\thanks|, forcing the footnote to a
+% specific number (it must be a number). For example, with
+% {\ttfamily|\|author\{Ph.\@ Faist|\|thanks[9]\{|\|itshape Institute for
+% Theoretical Physics, ETH Zurich\}\}}, you get:
+% \begin{phfnoteDocVirtualPage}
+% \author{Ph. Faist\thanks[9]{\itshape Institute for Theoretical Physics, ETH Zurich}}\relax
+% \notetitle@style@default\null \morepagecontents
+% \end{phfnoteDocVirtualPage}
+%
+% \DescribeMacro{\thanksmark} |\thanksmark[N]| works with |\thanks| as
+% |\footnotemark| works with |\footnote|. It just displays the given number as
+% a footnote mark. In this way, you can have for example several shared
+% affiliations:
+% \begin{phfnoteDocVirtualPage}
+% \title{Notes about Stuff}
+% \date{25.12.2015}
+% \author{First Author\thanks[1]{\itshape Institute ABC}, Second Author\thanks[2]{\itshape Somewhere else},
+% and Third Author\thanksmark[1]}\relax
+% \notetitle@style@default\null \morepagecontents
+% \end{phfnoteDocVirtualPage}
+% the author code was:
+% \begin{verbatim}
+% \author{First Author\thanks[1]{\itshape Institute ABC},
+% Second Author\thanks[2]{\itshape Somewhere else},
+% and Third Author\thanksmark[1]}
+% \end{verbatim}
+%
+% Unfortunately, you still have to provide the numbering manually. On the other
+% hand, this package is not meant to replace \RevTeX, so if you're writing a
+% complicated article with many authors and affiliations, you probably shouldn't
+% be using \pkgname{phfnote} in the first place.
+%
+% \begin{pkgwarning}
+% The optional argument to |\thanks|, as well as the command |\thanksmark|,
+% are not made available if you don't use one of |\phfnote|'s title styles.
+%
+% This behavior is such as to prevent interference with more advanced class
+% mechanisms, such as \RevTeX's.
+% \end{pkgwarning}
+%
+%
+% \subsection{Abstract}
+% \label{sec:abstract-attributes}
+%
+% \DescribeEnv{abstract} The |abstract| environment renders indented text aimed
+% to provide a short summary of the document. We might use, for example, the
+% following code:
+% \begin{verbatim}
+% \begin{abstract}
+% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
+% elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
+% Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget,
+% consectetuer id, vulputate a, magna.
+% \end{abstract}
+% \end{verbatim}
+%
+% which would look like this:
+% \begin{phfnoteDocVirtualPage}
+% \title{Notes about Stuff}\relax
+% \date{25.12.2015}\relax
+% \author{Me}\relax
+% \notetitle@style@default
+% \def\noteabstract@nameline{{\parskip=0pt\relax\par\centering\noteabstractnamefont\abstractname\par}\vskip 1ex\relax}%
+% \def\noteabstracttextwidth{0.8\textwidth}%
+% \begin{abstract}
+% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
+% elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
+% Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget,
+% consectetuer id, vulputate a, magna.
+% \end{abstract}
+% \morepagecontents
+% \end{phfnoteDocVirtualPage}
+%
+% The |abstract| environment should be given \emph{after} the |\maketitle|
+% command. (In contrast to, e.g., \RevTeX.)
+%
+% You may customize the appearance of the abstract via a list of attributes
+% given as argument to a package option. When you combine arguments, make sure
+% to put them in a braced group: |[abstract={wide,noname,it}]|.
+%
+% \begin{pkgoptions}
+% \item[abstract=\pkgoptattrib{wide}] The abstract should not be indented, and
+% should instead be aligned to the rest of the text.
+% \item[abstract=\pkgoptattrib{narrow}] The abstract should be indented narrower
+% then by default.
+% \item[abstract=\pkgoptattrib{noname}] The title ``Abstract.'' above the text
+% will not be typeset. The abstract text is typeset directly instead.
+% \item[abstract=\pkgoptattrib{original}] Revert to the class' default
+% implementation of the |abstract| environment. The class' implementation is
+% restored and no longer tampered with.
+% \item[abstract=\pkgoptattrib{small}] Use a smaller font for the abstract text
+% (|\small| font).
+% \item[abstract=\pkgoptattrib{compact}] Reduce spacing before and after the
+% abstract. If the abstract is short, this might look slightly better.
+% \item[abstract=\pkgoptattrib{it}] Typeset the abstract text using an italic
+% typeface.
+% \end{pkgoptions}
+%
+%
+% The abstract environment's appearance can be customized more finely
+% by redefining some macros. (In fact, this is what the package
+% options |abstract=...| actually do.) The font used for the text of
+% the abstract is set by \DescribeMacro{\noteabstracttextfont}
+% |\noteabstracttextfont|. This macro should expand to font selection
+% commands, such as |\itshape|, |\bfseries|, |\small|, etc. The title
+% of the abstract (the word ``Abstract.\@'') is typeset in the font set
+% by \DescribeMacro\noteabstractnamefont |\noteabstractnamefont|. The
+% width of the whole abstract text is determined by
+% \DescribeMacro{\noteabstracttextwidth} |\noteabstracttextwidth|.
+% Observe that |\noteabstracttextwidth| is a macro, and not a proper
+% length, so that it can determine more dynamically the length. The
+% spacing below \DescribeMacro{\noteabstractafterspacing}
+% (|\noteabstractafterspacing|) and above
+% \DescribeMacro{\noteabstractbeforespacing}
+% (|\noteabstractbeforespacing|) the abstract can further be
+% specified, also as macros.
+%
+% \subsection{Table of Contents}
+% \label{sec:inline-toc}
+%
+% \DescribeMacro{\inlinetoc} The package \pkgname{phfnote} also provides a
+% table of contents typeset with reduced spacing to be more compact, and
+% with horizontal rules before and after. You can insert the table of
+% contents with the command |\inlinetoc|. It looks like this:
+%
+% \begin{phfnoteDocVirtualPage}
+% \title{Notes about Stuff}\relax
+% \date{25.12.2015}\relax
+% \author{Me}\relax
+% \notetitle@style@default
+% \def\noteabstract@nameline{{\parskip=0pt\relax\par\centering\noteabstractnamefont\abstractname\par}\vskip 1ex\relax}%
+% \def\noteabstracttextwidth{0.8\textwidth}%
+% \begin{abstract}
+% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus
+% elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
+% \end{abstract}
+% \def\@starttoc#1{\relax
+% \contentsline {section}{\numberline {1}Introduction}{2}{section.1}
+% \contentsline {section}{\numberline {2}Basic Usage}{3}{section.2}
+% \contentsline {subsection}{\numberline {2.1}Loading the Package}{3}{subsection.2.1}
+% \contentsline {subsection}{\numberline {2.2}Presets}{3}{subsection.2.2}
+% }\relax
+% \inlinetoc
+% \morepagecontents
+% \end{phfnoteDocVirtualPage}
+%
+%
+% \subsection{Predefined Package Sets}
+% \label{sec:package-sets}
+%
+% The \pkgname{phfnote} package also provides sets of standard \LaTeX{}
+% packages to load. You may choose between a varying degree of
+% ``richness'' of packages included.
+%
+% \begin{pkgoptions}
+% \item[pkgset=none] Do not include any package set.
+%
+% \item[pkgset=minimal] Include some basic minimal set useful for
+% scientific notes: the \AmS{} packages \pkgname{amsmath},
+% \pkgname{amssymb}, \pkgname{amsfonts}, and \pkgname{amsthm}. The
+% \pkgname{xcolor} package is also loaded.
+%
+% \item[pkgset=rich] Include a fair amount of packages which may be useful.
+% On top of the |minimal| package set, this set includes the packages
+% \pkgname{enumitem}, \pkgname{graphicx}, \pkgname{microtype},
+% \pkgname{caption}, \pkgname{setspace}, as well as \pkgname{inputenc}
+% with the |utf8| option and \pkgname{fontenc} with the |T1| option.
+%
+% This package set is loaded by default.
+%
+% \item[pkgset=extended] Additionally, include packages \pkgname{float},
+% \pkgname{verbdef}, \pkgname{csquotes}, \pkgname{dsfont}, \pkgname{bbm}
+% and \pkgname{mathtools}.
+%
+% \end{pkgoptions}
+%
+%
+% \subsection{Page Geometry}
+% \label{sec:pagegeomdefs}
+%
+% Another important aspect of \pkgname{phfnote} is the handling of page
+% margins. Often the default page margins of the \pkgname{article} class
+% are quite narrow. While it is a good typographical practice to avoid
+% long lines, on occasion we prefer to have notes typeset with wider text.
+% The general answer is the \pkgname{geometry} package, which allows to set all
+% margins in full detail.
+%
+% The \pkgname{phfnote} package provides some standard choices of options for the
+% \pkgname{geometry} package, which are adjusted according to the document font size,
+% and whether the document is typeset in two columns.
+%
+% If you want anything more complicated than what is provided by a default
+% setting here, just use |pagegeomdefs=false| and invoke the \pkgname{geometry} package
+% directly with your preferred set of options.
+%
+% \begin{pkgoptions}
+% \item[pagegeomdefs=true] Include the \pkgname{geometry} package, using the default
+% settings or whatever is specified with the |pagegeom| option.
+% \item[pagegeomdefs=false] Do not attempt to change the document margins, and
+% don't load the \pkgname{geometry} package.
+% \item[nopagegeomdefs] Same as |pagegeomdefs=false|.
+% \end{pkgoptions}
+%
+% The page geometry predefined settings are the following.
+%
+% \begin{pkgoptions}
+% \item[pagegeom=default] Default settings. Not too wide, not too
+% narrow. Settings vary according to single or double column setting, and
+% according to default font point size.
+% \item[pagegeom=narrow] Narrower style. For single-column documents, this is
+% closer to the typographically-advertised-optimal of 50--80 characters per
+% line, but it might look narrow to some.
+% \item[pagegeom=wide] Wide, comfortable style. Wastes less paper.
+% \item[pagegeom=xwide] Extra wide. Use if you pity trees.
+% \item[pagegeom=bigmargin] Makes the margins asymmetric, so that a wide margin
+% note can fit. This style is used in this package documentation, for
+% example.
+% \end{pkgoptions}
+%
+%
+% \subsection{Section Headers Styling}
+% \label{sec:secfmt}
+%
+% The \pkgname{phfnote} package provides some limited styling of section headers. The
+% font, size and ``compactness'' of the headers can be adjusted with title options.
+% But really, these options are quite basic. You should use \pkgname{titlesec} or
+% \pkgname{sectsty} directly if you want anything serious.
+%
+% The section headings are customized using the \pkgname{sectsty} package. If this
+% conflicts in your document, then use the |[secfmt={}]| package option to
+% indicate that section headings should NOT be styled by this package. Then take
+% care of section styling manually.
+%
+% Package options may be used to customize the appearance of the section
+% headings by specifying a list of attributes. When you combine arguments, make
+% sure to put them in a braced group: |[secfmt={section,compact}]|. Beware that
+% attributes are not merged between different occurrences of the |secfmt|
+% keyword in the package options; the last occurrence defines all set
+% attributes. If the |secfmt| package option is not given, then by default only
+% the |section| attribute is set.
+%
+% \begin{pkgnote}
+% Don't forget to include the attribute `|section|' and/or `|paragraph|'
+% depending on which type of heading you want your settings to apply to. For
+% example, \pkgoptionfmt{secfmt=\pkgoptattribnodots{sffamily}} has no effect,
+% you need to use e.g.\@
+% \pkgoptionfmt{secfmt=\pkgoptattribnodots{section,sffamily}}.
+% \end{pkgnote}
+%
+% Available attributes are the following:
+%
+% \begin{pkgoptions}
+% \item[secfmt=\pkgoptattrib{section}] Use the |section| attribute to activate
+% the styling of section-level headings, that is, |\section|, |\subsection|
+% and |\subsubsection|.
+% \item[secfmt=\pkgoptattrib{paragraph}] This attribute indicates that the
+% styling should apply to paragraph-level headings as well (|\paragraph| and
+% |\subparagraph|).
+% \item[secfmt=\pkgoptattrib{compact}] Reduce the sizes of the section headings
+% (if the section-level headings are styled, i.e.\@ you need to specify the
+% |section| attribute), giving the document a more ``compact'' appearance.
+% \item[secfmt=\pkgoptattrib{larger}] Increase the sizes of the section
+% headings. Suitable for longer documents or for small document font sizes.
+% \item[secfmt=\pkgoptattrib{secsquares}] Display black squares on the left side
+% of |\section|-level commands, making them stand out better. This is useful
+% for documents (such as the present one) with several layers of sub-sections.
+% \item[secfmt=\pkgoptattrib{secnummargin}] Display the section, subsection, and
+% subsubsection numbering in the left margin and have the title occupy the
+% full width of the text (such as for this document). If you want both
+% \pkgoptionfmt{secsquares} and \pkgoptionfmt{secnummargin}, you must specify
+% them in that order, or the black square may end up overlapping with the
+% number.
+% \item[secfmt=\pkgoptattrib{rmfamily}] Typeset headings in the regular
+% roman font of the document, instead of trying to apply the
+% {\fontfamily{ppl}\fontseries{bx}\selectfont Palatino font}. This
+% applies to section-level and/or paragraph-level headings, depending on
+% which of the attributes |section| and/or |paragraph| have been
+% specified.
+% \item[secfmt=\pkgoptattrib{sffamily}] Typeset headings in a sans-serif font.
+% The default document sans serif font is used. This applies to section-level
+% and/or paragraph-level headings, depending on which of the attributes
+% |section| and/or |paragraph| have been specified.
+% \item[secfmt=\pkgoptattrib{itpar}] Typeset paragraph-level headings in italic.
+% \item[secfmt=\pkgoptattrib{blockpar}] Change the paragraph-level headings not
+% to be in ``run-in'' style, but to be typeset on their own line like section
+% headings.
+% \item[secfmt=\pkgoptattribempty] Leave the argument empty to keep the original class styling;
+% nothing will be overridden and the \pkgname{sectsty} package is not loaded.
+% \end{pkgoptions}
+%
+% You can also directly modify the section heading style by redefining some
+% macros. Note that these macros only affect those sectioning commands which we
+% have decided to style, which is specified by the |section| and |paragraph|
+% attributes to be specified in the |secfmt={...}| package option.
+%
+% \DescribeMacro{\notesectionallfont} The macro |\notesectionallfont| is invoked
+% for every sectioning command (for those which are styled, see the |section|
+% and |paragraph| attributes). The macro |\notesectionallfont| internally
+% invokes \DescribeMacro{\notesectionallfontfamily} |\notesectionallfontfamily|
+% to select which font family to use. The family should be given as the font
+% code, e.g.: |pbk| = {\fontfamily{pbk}\selectfont Bookman}; |bch| =
+% {\fontfamily{bch}\selectfont Charter}; |ppl| = {\fontfamily{ppl}\selectfont
+% Palatino}; |ptm| = {\fontfamily{ptm}\selectfont Adobe Times}; |phv| =
+% {\fontfamily{phv}\selectfont Adobe Helvetica}; |pcr| =
+% {\fontfamily{pcr}\selectfont Adobe Courier}; |put| =
+% {\fontfamily{put}\selectfont Utopia}; |cmr| = {\fontfamily{cmr}\selectfont
+% Computer Modern Roman}; |cmss| = {\fontfamily{cmss}\selectfont CM Sans Serif};
+% |cmbr| = {\fontfamily{cmbr}\selectfont CM Bright}; google many more or look
+% directly into the source of corresponding \LaTeX{} packages.
+%
+% You may customize these either via attributes or by redefining them directly.
+% Beware that if you redefine |\notesectionallfont| then you are responsible for
+% honoring, or ignoring, the value of |\notesectionallfontfamily|.
+%
+% \DescribeMacro{\notesectionfont} \DescribeMacro{\notesubsectionfont}
+% \DescribeMacro{\notesubsubsectionfont} \DescribeMacro{\noteparagraphfont}
+% \DescribeMacro{\notesubparagraphfont} These macros define the font commands to
+% apply for the section heading corresponding to the given sectioning command.
+% This macro is invoked after |\notesectionallfont|, which means that font
+% definitions in these macros take precedence over those in
+% |\notesectionallfont|.
+%
+% \DescribeMacro{\notesectionsetfonts} The macro |\notesectionsetfonts| is a
+% shorthand to set all section font definitions for the section-level commands
+% |\section|, |\subsection|, and |\subsubsection|. For example,
+% \begin{verbatim}
+% \notesectionsetfonts{\Large}{\large}{\normalsize}
+% \end{verbatim}
+% will set the font sizes for |\section|, |\subsection| and |\subsubsection| in
+% this order.
+%
+% \DescribeMacro{\noteparagraphsetfonts} The macro |\noteparagraphsetfonts| is
+% the corresponding shorthand for the paragraph-level commands. It takes two
+% arguments, the font definitions to apply for headings of level |\paragraph|
+% and |\subparagraph|.
+%
+% \subsection{Appearance of Paragraphs}
+% \label{sec:par-defs}
+%
+% Several presets may be set to define the appearance of paragraphs.
+%
+% \begin{pkgoptions}
+% \item[par=indent] Paragraphs are indented, bearing some
+% similarity to the \pkgname{article} class' default paragraph style.
+% \item[par=skip] Paragraphs are separated by additional spacing,
+% and not indented.
+% \item[par=indentminiskip] Paragraphs are indented, but there is also a small
+% space between each paragraph.
+% \item[par=original] Do not modify the appearance of paragraphs, and leave the
+% class default.
+% \end{pkgoptions}
+%
+% \subsection{Adjusting Spacing of Lines and Words}
+% \label{sec:spacingdefs}
+%
+% The \pkgname{phfnote} package also provides definitions to adjust spacing of lines and
+% words.
+%
+% This includes definitions to avoid overflowing words in the margin in case of
+% long words.
+%
+% \begin{pkgoptions}
+% \item[spacingdefs=true] Apply adjustments to line and word spacing.
+% \item[spacingdefs=false] Do not attempt any adjustments of line or word
+% spacing.
+% \item[nospacingdefs] Alias for |spacingdefs=false|.
+% \end{pkgoptions}
+%
+%
+% \subsection{Adjustments for Fonts}
+% \label{sec:fontdefs}
+%
+% The \pkgname{phfnote} package provides as well some adjustments for fonts to make some
+% fonts look nicer.
+%
+% Concretely, the {\fontfamily{cmbr}\selectfont Computer Modern Bright} font is
+% used as sans serif font instead of {\fontfamily{cmss}\selectfont \LaTeX's
+% default sans serif font}, and the more universal |T1| font encoding is used
+% instead of the default |OT1|.
+%
+% \begin{pkgoptions}
+% \item[fontdefs=true] Apply adjustments to fonts.
+% \item[fontdefs=false] Do not apply adjustments to fonts.
+% \item[nofontdefs] Same as |fontdefs=false|.
+% \end{pkgoptions}
+%
+% \subsection{Footnote Figure Style}
+% \label{sec:footnotedefs}
+%
+% The footnotes' appearance can also be slightly enhanced.
+%
+% \begin{pkgoptions}
+% \item[footnotedefs=true] Changes the symbol appearance a little bit---the
+% footnote number is smaller and typeset in boldface.
+% \item[footnotedefs=false] Do not change the footnote appearance.
+% \item[nofootnotedefs] Same as |footnotedefs=false|.
+% \end{pkgoptions}
+%
+%
+% \subsection{Hyperref Loading}
+% \label{sec:hyperrefdefs}
+%
+% There are many options for setting up the \pkgname{hyperref} package, and often, the
+% defaults (with boxed links) are pretty ugly in my opinion. Enable the
+% |hyperrefdefs| feature of \pkgname{phfnote} to alter the defaults to something I
+% personally like better (dark blue links as in this document).
+%
+% \begin{pkgoptions}
+% \item[hyperrefdefs=true] Load the \pkgname{hyperref} package, and set some sensible
+% settings. Also ensures the |\email| and |\url| commands are made available.
+% \item[hyperrefdefs=false] Do not load the \pkgname{hyperref} package, do not set
+% sensible settings.
+% \item[nohyperrefdefs] Same as |hyperrefdefs=false|.
+% \end{pkgoptions}
+%
+% \DescribeMacro{\url} In order to typeset URLs, the |\url| command is made
+% available from the package \pkgname{url} (which is then linkified by \pkgname{hyperref}). For
+% example, you can type |\url{https://github.com/phfaist/}|.
+%
+% \DescribeMacro{\email} A similar command allows to typeset e-mail addresses.
+% The text is displayed as a hyperlink, which when clicked opens a e-mail
+% composer to that address (via a |mailto:XXX| link). For example, try
+% |\email{pulp_fiction@tarantino.com}|.
+%
+% \DescribeMacro{\phfnotePdfLinkColor} The command |\phfnotePdfLinkColor| may by
+% used to set the color of the links. It takes one argument, a color
+% specification understood by the \pkgname{xcolor} package. For example:
+% \begin{verbatim}
+% \phfnotePdfLinkColor{green!50!black}
+% \end{verbatim}
+%
+% \begin{pkgnote}
+% The package \pkgname{xcolor} must be loaded for |\phfnotePdfLinkColor|
+% to work. (The \pkgname{xcolor} package is automatically loaded as part
+% of a package set as long as you're not using the option |pkgset=none|;
+% see \autoref{sec:package-sets}.)
+% \end{pkgnote}
+%
+%
+% \subsection{Bibliography Definitions}
+% \label{sec:bibliographydefs}
+%
+% This package also provides some definitions for the bibliography.
+%
+% It sets the |naturemagdoi| style by default, which is a hacked (by yours
+% truly) version of the |naturemag| style to include the journal name as a
+% hyperlink (as in APS bibliography styles).
+%
+% The bibliography is also typeset in a smaller font.
+%
+% Finally, an entry in the table of contents is generated.
+%
+% \begin{pkgoptions}
+% \item[bibliographydefs=true] Load the \pkgname{hyperref} package, and set some sensible
+% settings. Also ensures the |\email| and |\url| commands are made available.
+% \item[bibliographydefs=false] Do not load the \pkgname{hyperref} package, do not set
+% sensible settings.
+% \item[nobibliographydefs] Same as |bibliographydefs=false|.
+% \end{pkgoptions}
+%
+% \DescribeMacro{\bibliography} \DescribeMacro{\bibliographystyle} The
+% |\bibliographystyle| and |\bibliography| macros can be used as usual, for
+% example:
+% \begin{verbatim}
+% \bibliographystyle{apsrmp4-1} % optional
+% \bibliography{mybibfile}
+% \end{verbatim}
+% bearing in mind that if the |\bibliographystyle| command is not present, our
+% custom |naturemagdoi| bibliography style is used.
+%
+%
+% \subsection{URL Styles}
+% \label{sec:url-styles}
+%
+% As a bonus, the \pkgname{phfnote} package provides an alternative set of URL styles to
+% use with the |\url| and |\email| commands (see \autoref{sec:hyperrefdefs}).
+%
+% All the styles described below typeset the URL in a slightly smaller size, so
+% as to avoid a common issue with URLs that they tend to appear too large.
+% Also, the tilde character is fixed so that it appears nicely, as in:\\
+% \url{https://people.phys.ethz.ch/~pfaist/}.
+%
+% The URL style can be set with the command |\urlstyle|\marg{name of style}.
+%
+% \begin{description}[font=\ttfamily,labelwidth=8em]
+% \item[notett] typewriter font
+% \item[notesf] default sans serif font
+% \item[notesfss] Computer Modern Sans Serif font
+% \item[noteitsf] italic using default sans serif font
+% \item[noterm] normal roman typeface
+% \item[noteit] just italic typeface
+% \item[notesml] just smaller than surrounding text
+% \end{description}
+%
+%
+% \subsection{A \phfverb{\notesmaller} Command}
+%
+% This general-purpose command is handy to typeset text smaller than its
+% surrounding text, for when you don't know what size the surrounding text is
+% typeset at. In some sense, this is a very very lightweight analogue of what
+% the \pkgname{relsize} package does. (This is used, for example, in our implementation
+% of URL styles introduced in \autoref{sec:url-styles}.)
+%
+% \DescribeMacro{\notesmaller}\DescribeMacro{\notesmaller[0.8]} Set the font
+% size to a fraction of the surrounding font size. The fraction may be
+% specified as an optional argument. A fraction of 0.8 makes the text size 0.8
+% times that of the surrounding text, that is, smaller than the surrounding
+% text. A value of 1 does not change the font size. If the fraction is not
+% specified, the value stored in |\notesmallerfrac| is used.
+%
+% \DescribeMacro{\notesmallerfrac} The fraction by which |\notesmaller| typesets
+% smaller text when no optional argument is given. You may redefine this
+% command to set the default ``smaller'' size fraction.
+%
+% \subsection{Tools Mostly for Hackers}
+%
+% The \pkgname{phfnote} package also provides some small hacks. They are documented
+% further in \autoref{sec:impl-other-stand-alone-defs}. These are:
+% \DescribeMacro{\phfnoteHackSectionStarWithTOC} a macro
+% |\phfnoteHackSectionStarWithTOC| to hack into a command which generates a
+% |\section*|, in order for that command to also generate a corresponding entry
+% in the table of contents; and
+% \DescribeMacro{\phfnoteSaveDefs}\DescribeMacro{\phfnoteRestoreDefs} a pair of
+% commands to save and restore \LaTeX{} definitions.
+%
+%
+%
+%
+% \section{Summary of Package Options}
+% \label{sec:package-options}
+%
+% \begin{pkgoptions}
+% \item[preset=\meta{preset name}] Load a preset specifying a predefined set of
+% options for the general appearance of the document. See documentation in
+% \autoref{sec:presets}
+% \item[title=\meta{title style}] Set the title style. Documentation in
+% \autoref{sec:title-styles}
+% \item[abstract=\meta{abstract attributes}] Set the abstract style by
+% specifying a comma-separated list of attributes. Don't forget to
+% put the list of attributes within braces,
+% |[abstract={wide,noname,it}]|. Documentation in
+% \autoref{sec:abstract-attributes}
+% \item[pkgset=\meta{package set}] Specify a standard set of \LaTeX{}
+% packages to load. See \autoref{sec:package-sets}.
+% \item[pagegeomdefs=\meta{true or false}] Whether to care about page
+% margins. |nopagegeomdefs| is synonym for |pagegeomdefs=false|.
+% \item[pagegeom=\meta{geom style}] Set a page margin style. Only has effect if
+% |pagegeomdefs=true|. Options are documented in \autoref{sec:pagegeomdefs}.
+% \item[secfmt=\meta{section formatting attributes}] A list of attributes
+% defining how section (and possibly paragraph) headings should look like.
+% See \autoref{sec:secfmt}.
+% \item[par=\meta{par style}] Define how paragraphs should be spaced. Refer to
+% \autoref{sec:par-defs}.
+% \item[spacingdefs=\meta{true or false}] Adjust spacing of lines and words
+% (\autoref{sec:spacingdefs}).
+% \item[fontdefs=\meta{true or false}] Adjust some fonts
+% (\autoref{sec:fontdefs}).
+% \item[footnotedefs=\meta{true or false}] Adjust slighly the appearance of
+% footnotes. See \autoref{sec:footnotedefs}.
+% \item[hyperrefdefs=\meta{true or false}] Load the \pkgname{hyperref} package, and set
+% some defaults settings. See \autoref{sec:hyperrefdefs}.
+% \item[bibliographydefs=\meta{true or false}] Adjust the appearance and style
+% of the bibliography. See \autoref{sec:bibliographydefs}.
+% \end{pkgoptions}
+%
+% \begin{pkgtip}
+% To activate only a subset of features, use \pkgoptionfmt{preset=reset} and then
+% enable only the features required. In this way, you can ensure that only those
+% features which are explicitly specified are enabled.
+% \end{pkgtip}
+%
+%
+% \StopEventually{\PrintChangesAndIndex}
+%
+% \section{Implementation}
+%
+% Here comes the gory code.
+%
+% Let's start by loading the \pkgname{kvoptions} package, which we need to
+% parse the package options. It's better to use \pkgname{xkeyval} as
+% backend, because the |\setkeys| by \pkgname{keyval} is a little fragile:
+% for example, it gets confused if, within a preset, we include a package
+% or run a command which itself parses key-vals.
+%
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+\RequirePackage{kvoptions}
+% \end{macrocode}
+%
+% Also load \pkgname{etoolbox}, for various utilities.
+% \begin{macrocode}
+\RequirePackage{etoolbox}
+% \end{macrocode}
+%
+% \subsection{Internal Generic Code}
+%
+% \begin{macro}{\phfnote@internal@execattribbs}
+% An internal general-purpose macro to execute all definitions given in list of
+% attributes.
+%
+% Often, a list of attributes are given via a package option (e.g.\@ for the abstract),
+% and these attributes need to be executed, or implemented, in the order they are given.
+% This macro takes care of that. Each possible attribute must be defined as a macro
+% with a common prefix, to which the attribute is appended.
+%
+% The arguments are:
+% \begin{itemize}
+% \item |#1| = prefix to look for attributes (e.g.\@ |noteabstract@attr@|);
+% \item |#2| = a human-readable name of what |#1| represents, which is used in an error
+% message in case the required attribute is not found (e.g.\@ |{abstract attribute}|);
+% \item |#3| = the list of attributes specified by the user.
+% \end{itemize}
+%
+% For example, |\phfnote@internal@execattribs{noteabstract@attr@}|\hskip0pt\relax
+% |{abstract attribute}|\hskip0pt\relax |{noname,small}| causes the commands
+% |\noteabstract@attr@noname| and |\noteabstract@attr@small| to be invoked, in this
+% order.
+%
+% \begin{macrocode}
+\def\phfnote@internal@execattribs#1#2#3{%
+ \@for\next:=#3\do{%
+ \ifcsname #1\next\endcsname%
+ \csname #1\next\endcsname%
+ \else%
+ \PackageWarning{phfnote}{Unknown #2: '\next'. Ignoring.}
+ \fi
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Title Styling}
+%
+% See \autoref{sec:title-styles} for a description of the styles and which
+% features are available.
+%
+% \subsubsection{First, some common simple definitions for our different styles}
+%
+% \needspace{3\baselineskip}
+% \begin{macro}{\notetitlefont}
+% \begin{macro}{\notetitleauthorfont}
+% \begin{macro}{\notetitledatefont}
+% These may be redefined to adapt the font of the title, author and date.
+%
+% \begin{macrocode}
+\newcommand{\notetitlefont}{\sffamily\bfseries}
+\newcommand{\notetitleauthorfont}{}
+\newcommand{\notetitledatefont}{\footnotesize}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\notetitlebelowspace}
+% \begin{macro}{\notetitletopspace}
+% These macros may be redefined to adjust spacing above and after the title. They are
+% macros, not lengths, so they can be adjusted dynamically on the spot.
+% \begin{macrocode}
+\newcommand{\notetitlebelowspace}{4mm}
+\newcommand{\notetitletopspace}{-1.2cm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\notetitlehrule}
+% Allow customization of the horizontal rule below the title. The macro
+% |\notetitlehrule| expands to commands which generate the rule, such as
+% ``|\hrule height 1pt|''.
+% \begin{macrocode}
+\newcommand{\notetitlehrule}{\hrule}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\notetitle@title}
+% Provide a ``long'' definition for |\title|, so that the title can have several
+% paragraphs. Our style handles this by putting the title on several lines, and it can
+% be useful depending on how you want to format the title.
+%
+% This macro will replace |\title| when a title style is actually selected in
+% |\phfnote@do@notetitle|.
+% \begin{macrocode}
+\long\def\notetitle@title#1{\long\gdef\@title{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@title@checksetspace}
+% Some of our title styles require the \pkgname{setspace} package. This utility checks that
+% this package is loaded, and generates an error otherwise.
+%
+% |#1| = the current title style name; this is required only for the error message.
+% \begin{macrocode}
+\def\phfnote@title@checksetspace#1{%
+ \ifdefined\singlespace\else%
+ \PackageError{phfnote}{Note title style `#1' requires the
+ `setspace' package to be loaded! Please load it, or use a
+ pkgset which loads it automatically}%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Implementation of \phfverb\thanks{} and \phfverb\thanksmark}
+%
+% Here we provide a few fixes for the implementation of |\thanks|, both for our main
+% `default' title style as well as for other simpler styles. Our implementation supports
+% |\thanks[N]{...}| and |\thanksmark[N]| as for footnotes.
+%
+% These newer implementations are only applied if one of our title styles is set.
+% Otherwise, the class defaults are left (which may be needed, e.g., for \RevTeX).
+%
+% \paragraph{Implementation of \phfverb{\thanks} and friends for our main
+% `default' title style}
+%
+% \begin{macro}{\phfnote@setupthanksmpfootnote}
+% Internal---called at the beginning of a |minipage| environment, it sets up necessary
+% stuff to support |\thanks| notes within the minipage, in a single paragraph.
+%
+% Some of this code was taken or really inspired directly from |latex.ltx|.
+% \begin{macrocode}
+\def\phfnote@setupthanksmpfootnote{%
+% \end{macrocode}
+%
+% The |\thanks| macro is implemented as a |\footnote| in a minipage. So we hack into the
+% `mpfootnote' mechanism.
+% \begin{macrocode}
+ \def\thempfootnote{\arabic{mpfootnote}}%
+ \let\footnoterule\relax%
+ \let\thanks\footnote%
+% \end{macrocode}
+%
+% All footnote material is stored in a macro |\phfnote@mpfootmaterial|, initially
+% empty:\footnote{NOTE: this differs from how footnotes are usually treated (directly
+% typeset into a vbox I think). Not sure what the side-effects might be. Because this is
+% just for simple email/institute info/etc. in the title, hopefully this shouldn't have
+% any serious consequences.}
+% \begin{macrocode}
+ \def\phfnote@mpfootmaterial{}%
+% \end{macrocode}
+% and locally define |\@mpfootnotetext| to store the footnote content into that buffer,
+% \begin{macrocode}
+ \long\def\@mpfootnotetext##1{%
+ \protected@edef\@currentlabel%
+ {\csname p@mpfootnote\endcsname\@thefnmark}%
+ \protected@edef\@tmpa{\protect\phfnote@mympfootnotemark{\@thefnmark}{##1}%
+ \protect\phfnote@mpfootnoteglue}%
+ \expandafter\g@addto@macro\expandafter\phfnote@mpfootmaterial%
+ \expandafter{\@tmpa}%
+ }%
+% \end{macrocode}
+%
+% Also provide |\thanksmark|, so that we can refer to other thanks/footnote-marks.
+% \begin{macrocode}
+ \def\thanksmark[##1]{\phfnote@mympfootnotemark{##1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@finalizempfootnotes}
+% Macro to call at the end of a |minipage| environment, to ensure that all |\footnote|'s
+% (and thus |\thanks|'s) are properly formatted.
+%
+% This simply takes all the tokens collected in |\phfnote@mpfootmaterial| (see just
+% above), and typesets it in the |\@mpfootins| box. The latter is automatically typeset
+% by the minipage in |\end{minipage}|.
+% \begin{macrocode}
+\def\phfnote@finalizempfootnotes{%
+ \global\setbox\@mpfootins=\vbox{%
+ \parskip=0pt\parindent=0pt\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ \noindent\leavevmode%
+ \reset@font\footnotesize%
+ \phfnote@fmt@titlefootnotes%
+ \phfnote@mpfootmaterial}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \needspace{3\baselineskip}
+% \begin{macro}{\phfnote@fmt@titlefootnotes}
+% \begin{macro}{\phfnote@mympfootnotemark}
+% \begin{macro}{\phfnote@mpfootnoteglue}
+% Some formatting utilities which can be overridden if you know what you're doing.
+% |\phfnote@fmt@titlefootnotes| allows you to override the font in which the
+% title-footnotes/thanks are typeset. |\phfnote@mympfootnotemark| is responsible for
+% formatting its argument as a footnote mark, usually in superscript.
+% |\phfnote@mpfootnoteglue| is the glue which is used between two footnote texts (as
+% they are typeset in a single paragraph).
+% \begin{macrocode}
+\def\phfnote@fmt@titlefootnotes{}
+\def\phfnote@mympfootnotemark#1{\@textsuperscript{\normalfont#1}}
+\def\phfnote@mpfootnoteglue{\hskip 1.2em plus 2em minus 0.5em\relax}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \paragraph{For those not using the main `default' title style}
+%
+% We use \LaTeX's own |\thanks| mechanism, however we patch on the possibility for using
+% |\thanks[N]{text}| and |\thanksmark[N]| for overriding the number which is used.
+%
+% \begin{macro}{\notetitle@thanksmark}
+% The |\thanksmark| is trivially implemented by |\footnotemark|. Very handy indeed.
+%
+% Again, this macro is only made available as |\thanksmark| when a title style is set in
+% |\phfnote@do@notetitle|.
+% \begin{macrocode}
+\def\notetitle@thanksmark{\footnotemark}
+% \end{macrocode}
+% \end{macro}
+%
+% Start by saving the old |\thanks| macro, just in case.
+% \begin{macrocode}
+\let\phfnote@old@thanks\thanks
+% \end{macrocode}
+%
+% \begin{macro}{\notetitle@thanks}
+% Now, we need to extend \LaTeX's |\thanks| to allow an optional argument as for
+% footnotes. This macro will be renamed |\thanks| in |\phfnote@do@notetitle|.
+%
+% Check whether there is an optional argument; if there is none we execute \LaTeX's
+% original thanks code (replicated here), otherwise, we specify the optional argument
+% explicitly at the relevant location in \LaTeX's implementation:
+% \begin{macrocode}
+\def\notetitle@thanks{\@ifnextchar[\phfnote@thanks{\phfnote@thanks[]}}%]
+\long\def\phfnote@thanks[#1]#2{%
+ \if\relax\detokenize{#1}\relax%
+% \end{macrocode}
+%
+% The optional argument is empty---just execute \LaTeX's original |\thanks| code,
+% replicated here:
+% \begin{macrocode}
+ \footnotemark%
+ \protected@xdef\@thanks{\@thanks\protect\footnotetext[\the\c@footnote]{#2}}%
+% \end{macrocode}
+%
+% Otherwise, execute \LaTeX's original |\thanks| code, but with the optional argument
+% inserted wherever needed:
+% \begin{macrocode}
+ \else% argument, pass on to sub-commands:
+ \footnotemark[#1]%
+ \protected@xdef\@thanks{\@thanks\protect\footnotetext[#1]{#2}}%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Title Styles Definition}
+%
+% The title styles are documented in \autoref{sec:title-styles}.
+%
+% \paragraph{Title style: `default'}
+%
+% Implementation our main `default' title style. See \autoref{sec:main-default-title-style}.
+%
+% \begin{macro}{\notetitle@style@default}
+% The default title style. Nothing mysterious, hopefully.
+% \begin{macrocode}
+\newcommand{\notetitle@style@default}{%
+ \begingroup\par\raggedright%
+ \phfnote@setupthanksmpfootnote%
+ \vspace*{\notetitletopspace}%
+ \phfnote@title@checksetspace{default}%
+ \begin{minipage}{\textwidth}%
+ \begin{singlespace}%
+ \parskip=0pt\parindent=0pt\relax%
+ {\let\phfnote@old@par\par%
+ \def\par{\phfnote@old@par%
+ \parskip=1.5ex\relax\parshape 1 0pt \textwidth\relax%
+ \noindent}%
+ \par%
+ \Large {\notetitlefont \@title}\par}%
+ \vskip 2mm\relax
+ \if\relax\detokenize\expandafter{\@author}\relax\else%
+ \par\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ {\notetitleauthorfont \@author}%
+ \vskip 2mm\relax%
+ \fi
+ \if\relax\detokenize\expandafter{\@date}\relax\else%
+ \par\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ {\notetitledatefont \@date}
+ \vskip 2mm\relax%
+ \fi
+ \global\let\@thanks\@empty%
+ \phfnote@finalizempfootnotes%
+ \end{singlespace}%
+ \end{minipage}\par%
+ \vspace*{2mm}%
+ \notetitlehrule\relax%
+ \par%
+ \endgroup%
+ \vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Title style: `small'}
+%
+% Implementation an alternate `small' title style.
+%
+% \begin{macro}{\notetitle@style@small}
+% The default title style. Nothing mysterious, hopefully.
+% \begin{macrocode}
+\newcommand{\notetitle@style@small}{%
+ \begingroup\par\raggedright%
+ \let\footnote\thanks%
+ \vspace*{\notetitletopspace}%
+ {\notetitlefont \@title}%
+ \hfill\makebox{\fontsize{9pt}{10pt}\selectfont {\notetitleauthorfont \@author}%
+ \hspace*{2mm}--\hspace*{2mm}{\emph{\notetitledatefont \@date}}}%
+ \vspace*{1mm}\notetitlehrule\relax\vspace*{1mm}%
+ \par%
+ \endgroup%
+ \vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Title style: `article'}
+%
+% Implementation the `article' title style.
+%
+% \begin{macro}{\notetitle@style@article}
+% The title style definition. Nothing mysterious, hopefully.
+% \begin{macrocode}
+\newcommand{\notetitle@style@article}{%
+ \vspace*{-3em}%
+ \begingroup
+ \centering
+ \let\footnote\thanks%
+ {\LARGE \@title \par}%
+ \vskip 1.5em%
+ {\large%
+ \lineskip .5em%
+ \begin{tabular}[t]{c}%
+ \@author%
+ \end{tabular}\par}%
+ \vskip 1.5em%
+ {\large \@date}%
+ \par%
+ \endgroup%
+ \par%
+ \vskip 2.5em\relax%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Plugging into \phfverb{\maketitle}}
+%
+% Actually perform the definitions to make |\maketitle| produce the
+% title with the given style. Specifically, we override
+% |\@maketitle|. The latter is called internally by |\maketitle|, and
+% the advantage of overriding |\@maketitle| only is that we inherit
+% the mechanism provided by the style class to deal with two-column
+% layouts.
+%
+% \begin{macro}{\phfnote@do@notetitle}
+% This macro takes care of installing the correct title into the
+% document, by overriding |\@maketitle|.
+%
+% This macro is called later after processing the package options.
+% Its argument |#1| is the style name, e.g., |default|.
+%
+% \begin{macrocode}
+\def\phfnote@do@notetitle#1{
+% \end{macrocode}
+% If we have an empty title style, then we leave default title provided by the class.
+% \begin{macrocode}
+ \if\relax\detokenize\expandafter{#1}\relax
+ \else
+% \end{macrocode}
+% Otherwise, we have a title style to set. Do some checks that the given style is indeed
+% defined.
+% \begin{macrocode}
+ \ifcsname notetitle@style@#1\endcsname
+ \def\phfnote@tmp@titsty{#1}%
+ \else
+ \PackageError{phfnote}{Unknown title style: '#1'.}{Unknown title
+ style: '#1'. Please consult the package documentation for available
+ styles.}
+ \def\phfnote@tmp@titsty{default}%
+ \fi
+% \end{macrocode}
+% Apply new (default) definitions of |\thanks|, |\thanksmark| and |\title|. Do this here
+% only, because this can clash with more complicated versions from, e.g., \RevTeX.
+% \begin{macrocode}
+ \let\title\notetitle@title
+ \let\thanks\notetitle@thanks
+ \let\thanksmark\notetitle@thanksmark
+% \end{macrocode}
+% Now, actually overload the title style by redefining |\@maketitle|.
+% \begin{macrocode}
+ \def\@maketitle{\csname notetitle@style@\phfnote@tmp@titsty\endcsname}
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Abstract}
+%
+% Now we can take care of the abstract. Unlike the title styles, the abstract has a base
+% implementation. Then, we may have attributes which change some parameters.
+%
+%
+% \begin{environment}{notedefaultabstract}
+% First, save the old environment |\begin{abstract}...\end{abstract}| provided by the
+% class (if any).
+% \begin{macrocode}
+\let\notedefaultabstract\abstract
+\let\endnotedefaultabstract\endabstract
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\noteabstracttextfont}
+% \begin{macro}{\noteabstractnamefont}
+% \begin{macro}{\noteabstracttextwidth}
+% \begin{macro}{\noteabstractafterspacing}
+% \begin{macro}{\noteabstractbeforepacing}
+% Macros which can be overridden to customize the abstract. See
+% \autoref{sec:abstract-attributes}.
+% \begin{macrocode}
+\newcommand{\noteabstracttextfont}{}
+\newcommand{\noteabstractnamefont}{\bfseries\small}
+\if@twocolumn
+ \newcommand\noteabstracttextwidth{\hsize}
+\else
+ \newcommand{\noteabstracttextwidth}{0.9\hsize}
+\fi
+\newcommand\noteabstractafterspacing{1.5em}
+\newcommand\noteabstractbeforespacing{1.5em}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\noteabstract@nameline}
+% Create the line which contains the title of the abstract, that is, the word
+% ``Abstract.'' This can be overloaded, of course, for customization.
+% \begin{macrocode}
+\def\noteabstract@nameline{
+ {\parskip=0pt\relax\par\centering\noteabstractnamefont%
+ \abstractname%
+ \par}\vskip 1ex\relax%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{noteabstract}
+% The proper |noteabstract| environment.
+%
+% \begin{macrocode}
+\newenvironment{noteabstract}{%
+ \removelastskip%
+ \vspace{\noteabstractbeforespacing}%
+ \begingroup%
+ \par\noindent\centering%
+ \begin{minipage}{\noteabstracttextwidth}%
+ \noteabstract@nameline%
+ \noteabstracttextfont%
+ }%
+ {%
+ \end{minipage}%
+ \par%
+ \endgroup%
+ \vspace{\noteabstractafterspacing}%
+}
+% \end{macrocode}
+% \end{environment}
+%
+% The abstract can be customized by the attributes. Here we define them:
+% \begin{macrocode}
+\def\noteabstract@attr@wide{%
+ \def\noteabstracttextwidth{\textwidth}%
+}
+\def\noteabstract@attr@narrow{%
+ \if@twocolumn
+ \else
+ \def\noteabstracttextwidth{0.8\textwidth}%
+ \fi
+}
+\def\noteabstract@attr@noname{%
+ \def\noteabstract@nameline{}%\vspace*{1ex}}%
+}
+\def\noteabstract@attr@original{%
+ \let\abstract\notedefaultabstract
+ \let\endabstract\endnotedefaultabstract
+}
+\def\noteabstract@attr@small{%
+ \g@addto@macro\noteabstracttextfont{\small}%
+}
+\def\noteabstract@attr@compact{%
+ \renewcommand\noteabstractafterspacing{1ex}%
+ \renewcommand\noteabstractbeforespacing{1ex}%
+}
+\def\noteabstract@attr@it{%
+ \g@addto@macro\noteabstracttextfont{\itshape}%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\phfnote@do@noteabstract}
+% This helper both defines the |abstract| environment, and also sets the abstract
+% attributes. This macro will be called according to the package options.
+%
+% |#1| = a comma-separated list of attributes.
+% \begin{macrocode}
+\def\phfnote@do@noteabstract#1{
+ \let\abstract\noteabstract
+ \let\endabstract\endnoteabstract
+ \phfnote@internal@execattribs{noteabstract@attr@}{abstract attribute}{#1}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Page Geometry Settings}
+%
+% For the page geometry settings, we just have a bunch of styles which we define as
+% macros. The macros just set up |\PassOptionsToPackage| for the \pkgname{geometry} package.
+% Then the correct macro will be selected according to the current \pkgname{phfnote} package
+% options.
+%
+% The description of these settings are given in \autoref{sec:pagegeomdefs}.
+%
+% \begin{macro}{\phfnote@pagegeomstyle@default}
+% Default setting.
+% \begin{macrocode}
+\def\phfnote@pagegeomstyle@default{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@pagegeomstyle@narrow}
+% Narrow style.
+% \begin{macrocode}
+\def\phfnote@pagegeomstyle@narrow{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.5in}{geometry}%
+ \fi%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@pagegeomstyle@wide}
+% Wide style.
+% \begin{macrocode}
+\def\phfnote@pagegeomstyle@wide{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=0.75in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@pagegeomstyle@xwide}
+% Extra wide.
+% \begin{macrocode}
+\def\phfnote@pagegeomstyle@xwide{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=0.5in,vmargin=0.5in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=0.75in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@pagegeomstyle@bigmargin}
+% |bigmargin| style.
+% \begin{macrocode}
+\def\phfnote@pagegeomstyle@bigmargin{%
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin={2in,1.5in},vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@do@pagegeomdefs}
+% Finally, provide a helper to set the page geometry. Just call the right macro.
+% \begin{macrocode}
+\newcommand{\phfnote@do@pagegeomdefs}[1]{
+ \ifcsname phfnote@pagegeomstyle@#1\endcsname
+ \csname phfnote@pagegeomstyle@#1\endcsname
+ \else
+ \PackageWarning{phfnote}{Unknown page geometry style: `#1'!}
+ \fi
+
+ \RequirePackage{geometry}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Text, Paragraph and Line Spacing}
+%
+% \paragraph{Text \& Line Spacing}
+%
+% \begin{macro}{\phfnote@do@spacing}
+% Some cosmetic definitions to adjust line spacing. The line spacing is slightly
+% adjusted according to font size to make the document more readable. Depending on
+% whether the \pkgname{setspace} package is loaded, we use it or go low-level with a
+% redefinition of \LaTeX{}' |\baselinestretch|. If the \pkgname{captions} package is loaded,
+% the figure captions' line spacing is also adjusted.
+%
+% Also set an |\emergencystretch| so that lines get spaced out for underfull boxes,
+% rather than overflowing far into the margin.
+% \begin{macrocode}
+\def\phfnote@do@spacing{
+ \@ifpackageloaded{setspace}{
+ \def\phfnote@dostretch##1{%
+ \setstretch{##1}\phfnote@docaptionstretch{##1}}
+ }{
+ \def\phfnote@dostretch##1{%
+ \renewcommand\baselinestretch{##1}\phfnote@docaptionstretch{##1}}
+ }
+ \@ifpackageloaded{caption}{
+ \def\phfnote@docaptionstretch##1{\captionsetup{font={stretch=##1}}}
+ }{
+ \def\phfnote@docaptionstretch##1{\PackageWarning{phfnote}{Can't
+ set line spacing for captions, because the package `caption'
+ is not loaded. Please load it before `phfnote', or use an
+ appropriate (e.g. `rich') pkgset which loads this package
+ automatically .}}
+ }
+ \if@twocolumn
+ \phfnote@dostretch{1.0} % leave default
+ \emergencystretch=3em\relax
+ \else
+ \ifcase\@ptsize% 10pt
+ \phfnote@dostretch{1.1}
+ \or% 11pt
+ \phfnote@dostretch{1.0} % 1.05? better 1.0...
+ \or% 12pt
+ \phfnote@dostretch{1.0} % 1.03? not really noticeable...
+ \fi
+ \emergencystretch=6em\relax
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \paragraph{Paragraph Spacing Presets}
+%
+% Here again, we define several possibilities for paragraph settings as
+% individual macros (see \autoref{sec:par-defs}). Depending on the package
+% option, we execute the corresponding macro.
+%
+% \begin{macrocode}
+\def\phfnote@par@original{%
+}
+\def\phfnote@par@indent{%
+ \parindent=1.5em\relax
+ \parskip=0pt\relax
+}
+\def\phfnote@par@indentminiskip{%
+ \parindent=1.5em\relax
+ \parskip=0.3em plus 0.1em\relax
+}
+\def\phfnote@par@skip{%
+ \parindent=0pt\relax
+ \parskip=0.8em plus 0.2em minus 0.1em\relax
+}
+% \end{macrocode}
+%
+% \begin{macro}{\phfnote@do@par}
+% Execute the given paragraph setting. The argument |#1| is the setting, for example,
+% |skip|.
+% \begin{macrocode}
+\def\phfnote@do@par#1{%
+ \ifcsname phfnote@par@#1\endcsname
+ \csname phfnote@par@#1\endcsname
+ \else
+ \PackageWarning{phfnote}{Bad paragraph setting: #1. Leaving original}
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{Section Styling}
+%
+% Very limited support for styling section and paragraph headers
+% (\autoref{sec:secfmt}). If you want anything serious, use \pkgname{sectsty} or
+% \pkgname{titlesec} directly.
+%
+% \begin{macro}{\notesectionallfont}
+% \begin{macro}{\notesectionallfontfamily}
+% Define the |\notesectionallfont| and |\notesectionallfontfamily|, which
+% control the general font used in section headings.
+% \begin{macrocode}
+\newcommand{\notesectionallfont}{%
+ \fontfamily{\notesectionallfontfamily}\fontseries{bx}\selectfont}
+\newcommand{\notesectionallfontfamily}{ppl}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\notesectionfont}
+% \begin{macro}{\notesubsectionfont}
+% \begin{macro}{\notesubsubsectionfont}
+% \begin{macro}{\noteparagraphfont}
+% \begin{macro}{\notesubparagraphfont}
+% These macros are called for their respective sectioning command,
+% after |\notesectionallfont| has been invoked. (Again, only for
+% those sectioning commands which are styled by us.)
+%
+% \begin{macrocode}
+\newcommand{\notesectionfont}{\large}
+\newcommand{\notesubsectionfont}{\normalsize}
+\newcommand{\notesubsubsectionfont}{\small}
+\newcommand{\noteparagraphfont}{\normalsize}
+\newcommand{\notesubparagraphfont}{\normalsize}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\notesectionsetfonts}
+% \begin{macro}{\noteparagraphsetfonts}
+% Helpers to directly set the font commands for |\section|,
+% |\subsection| and |\subsubsection| (with |\notesectionsetfonts|),
+% and for |\paragraph| and |\subparagraph| (with |\noteparagraphsetfonts|).
+% \begin{macrocode}
+\newcommand{\notesectionsetfonts}[3]{%
+ \renewcommand{\notesectionfont}{#1}%
+ \renewcommand{\notesubsectionfont}{#2}%
+ \renewcommand{\notesubsubsectionfont}{#3}%
+}
+\newcommand{\noteparagraphsetfonts}[2]{%
+ \renewcommand{\noteparagraphfont}{#1}%
+ \renewcommand{\notesubparagraphfont}{#2}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% Define the attributes which the user can set. See
+% \autoref{sec:secfmt}.
+%
+% \begin{macrocode}
+\def\phfnote@do@secfmt@section{
+ \RequirePackage{sectsty}
+ \sectionfont{\notesectionallfont\notesectionfont}
+ \subsectionfont{\notesectionallfont\notesubsectionfont}
+ \subsubsectionfont{\notesectionallfont\notesubsubsectionfont}
+}
+\def\phfnote@do@secfmt@paragraph{
+ \RequirePackage{sectsty}
+ \paragraphfont{\notesectionallfont\noteparagraphfont}
+ \subparagraphfont{\notesectionallfont\notesubparagraphfont}
+}
+\def\phfnote@do@secfmt@compact{
+ \notesectionsetfonts{\normalsize}{\small}{\small}
+}
+\def\phfnote@do@secfmt@larger{
+ \notesectionsetfonts{\Large}{\large}{\normalsize}
+}
+
+\def\phfnote@do@secfmt@secsquares{
+ \RequirePackage{amssymb}
+ \let\phfnote@secsquares@old@seccntformat\@seccntformat
+ \def\@seccntformat##1{%
+ \expandafter\ifx\csname ##1\endcsname\section\relax%
+ \unexpanded{\makebox[0pt][r]{\raisebox{0.15ex}{{%
+ \notesmaller[0.6]\ensuremath{\blacksquare}}}%
+ \hspace*{1.2ex}}}%
+ \fi%
+ \phfnote@secsquares@old@seccntformat{##1}}
+}
+\def\phfnote@do@secfmt@secnummargin{
+ \let\phfnote@secnummargin@old@seccntformat\@seccntformat
+ \def\@seccntformat##1{%
+ \protect\makebox[0pt][r]{\phfnote@secnummargin@old@seccntformat{##1}}}
+}
+
+\def\phfnote@do@secfmt@rmfamily{
+ \renewcommand\notesectionallfontfamily{\rmdefault}
+}
+\def\phfnote@do@secfmt@sffamily{
+ \renewcommand\notesectionallfontfamily{\sfdefault}
+}
+\def\phfnote@do@secfmt@itpar{
+ \def\noteparagraphfont{\normalfont\normalsize\itshape}
+ \def\notesubparagraphfont{\normalfont\normalsize\itshape}
+}
+\def\phfnote@do@secfmt@blockpar{
+ \let\phfnote@old@paragraph\paragraph
+ \def\paragraph##1{%
+ \phfnote@old@paragraph{##1}%
+ \hspace*{0pt}\par\nopagebreak% ugly hack!!
+ }
+}
+% \end{macrocode}
+%
+%
+% \begin{macro}{\phfnote@do@secfmt}
+% Actually perform the required styling, according to the package
+% options given as argument. The argument is a comma-separated list
+% of attributes specified by the user.
+% \begin{macrocode}
+\def\phfnote@do@secfmt#1{%
+ \phfnote@internal@execattribs{phfnote@do@secfmt@}{section formatting preset}{#1}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{\LaTeX{} Package Sets}
+%
+% Define the package sets as macros. Depending on the user-specified
+% options we load the corresponding one(s) (several may be specified).
+%
+% See \autoref{sec:package-sets} for a description of what these
+% package sets do.
+%
+% \begin{macro}{\phfnote@do@pkgset@none}
+% \begin{macro}{\phfnote@do@pkgset@minimal}
+% \begin{macro}{\phfnote@do@pkgset@rich}
+% \begin{macro}{\phfnote@do@pkgset@extended}
+% Macros which implement the package sets. Each macro invokes |\RequirePackage|
+% for the appropriate packages.
+% \begin{macrocode}
+\def\phfnote@do@pkgset@none{
+}
+
+\def\phfnote@do@pkgset@minimal{
+
+ \RequirePackage{amsmath}
+ \RequirePackage{amsfonts}
+ \RequirePackage{amssymb}
+ \RequirePackage{amsthm}
+
+ \RequirePackage{xcolor}
+
+}
+
+\def\phfnote@do@pkgset@rich{
+
+ \phfnote@do@pkgset@minimal
+
+ \RequirePackage{setspace}
+ \RequirePackage{caption}
+
+ \RequirePackage{microtype}
+
+ \PassOptionsToPackage{shortlabels}{enumitem}
+ \RequirePackage{enumitem}
+
+ \RequirePackage{graphicx}
+
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+
+ \PassOptionsToPackage{utf8}{inputenc}
+ \RequirePackage{inputenc}
+}
+
+\def\phfnote@do@pkgset@extended{
+
+ \phfnote@do@pkgset@rich
+
+ \RequirePackage{float}
+
+ \RequirePackage{verbdef}
+
+ \PassOptionsToPackage{autostyle,autopunct=true}{csquotes}
+ \RequirePackage{csquotes}
+
+ \RequirePackage{dsfont}
+ \RequirePackage{bbm}
+ \RequirePackage{mathtools}
+
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@do@pkgset}
+% Finally, define the helper which will load the required package sets.
+% \begin{macrocode}
+\def\phfnote@do@pkgset#1{
+ \phfnote@internal@execattribs{phfnote@do@pkgset@}{package set}{#1}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Hyperref Support and Hyperlinks}
+%
+% \begin{pkgnote}
+% The name `|docnotelinkcolor|' is historical and hard-coded in many
+% other files I've used, so I'm DEFINITELY NOT changing it.
+% \end{pkgnote}
+%
+% \needspace{3\baselineskip}
+% \begin{macro}{\phfnote@do@pdfhyperrefdefs}
+% \begin{macro}{\email}
+% \begin{macro}{\url}
+% Load the \pkgname{hyperref} package and provide sensible defaults.
+% \begin{macrocode}
+\newcommand{\phfnote@do@pdfhyperrefdefs}{%
+% \end{macrocode}
+% Make sure a color-managing package is loaded, {color} or {xcolor}, and define our default color:
+% \begin{macrocode}
+ \phfnote@requirecolorpackage%
+ \definecolor{docnotelinkcolor}{rgb}{0,0,0.4}%
+% \end{macrocode}
+%
+% Load URL package, and save a version of |\url| which is not patched
+% by \pkgname{hyperref}:
+% \begin{macrocode}
+ \RequirePackage{url}%
+ \DeclareUrlCommand\phfnote@format@url{}%
+% \end{macrocode}
+%
+% Set up \pkgname{hyperref} options:
+% \begin{macrocode}
+ \PassOptionsToPackage{bookmarks=true,backref=false}{hyperref}%
+ \RequirePackage{hyperref}%
+ %
+ \hypersetup{unicode=true,%
+ bookmarksnumbered=false,bookmarksopen=false,bookmarksopenlevel=1,%
+ breaklinks=true,pdfborder={0 0 0},colorlinks=true}%
+ \hypersetup{%
+ anchorcolor=docnotelinkcolor,citecolor=docnotelinkcolor,%
+ filecolor=docnotelinkcolor,linkcolor=docnotelinkcolor,%
+ menucolor=docnotelinkcolor,runcolor=docnotelinkcolor,%
+ urlcolor=docnotelinkcolor}%
+% \end{macrocode}
+%
+% Provide an |\email| command for specifying e-mails. Note that the |\url| command is
+% already provided by the packages \pkgname{url} and \pkgname{hyperref}.
+% \begin{macrocode}
+ \let\email\phfnote@email%
+% \end{macrocode}
+%
+% And finally set a nicer default |\url|/|\email| style:
+% \begin{macrocode}
+ \urlstyle{notesf}%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\phfnotePdfLinkColor}
+% Set links color. Use as |\phfnotePdfLinkColor|\marg{color}.
+% Color may be any color name or specification recognized by the
+% \pkgname{xcolor} package.
+%
+% \begin{macrocode}
+\newcommand{\phfnotePdfLinkColor}[1]{%
+ \@ifpackageloaded{xcolor}{%
+ \colorlet{docnotelinkcolor}{#1}%
+ }{% else:
+ \PackageWarning{phfnote}{\protect\phfnotePdfLinkColor may only be
+ used if the package xcolor is loaded.}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \needspace{3\baselineskip}
+% \begin{macro}{\phfnote@sanitize@url}
+% \begin{macro}{\phfnote@format@url}
+% \begin{macro}{\phfnote@email}
+% Provide base macros to be able to build up |\email| command for emails and other
+% URL-like commands which should sanitize their arguments.
+%
+% Also prepare the command |\phfnote@email| which will be renamed |\email| in our
+% \pkgname{hyperref} package setup (see above).
+%
+% \begin{macrocode}
+\def\phfnote@sanitize@url{%
+ \catcode`\$12%
+ \catcode`\&12%
+ \catcode`\#12%
+ \catcode`\^12%
+ \catcode`\_12%
+ \catcode`\%12%
+ % \catcode`\^^J10% newline = space
+ % \catcode`\^^M10% newline = space
+ \relax%
+}%
+\providecommand\phfnote@format@url{\texttt}
+\def\phfnote@email{\begingroup\phfnote@sanitize@url\phfnote@impl@email@}%
+\def\phfnote@impl@email@#1{\endgroup\href{mailto:#1}{\phfnote@format@url{#1}}}%
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\phfnote@requirecolorpackage}
+% And finally define an internal utility to make sure that a color package (either
+% \pkgname{color} or \pkgname{xcolor}) is loaded. If none are loaded, the \pkgname{xcolor} package is loaded.
+% \begin{macrocode}
+\def\phfnote@requirecolorpackage{%
+ \@ifpackageloaded{color}{%
+ }{%
+ \@ifpackageloaded{xcolor}{%
+ }{%
+ \RequirePackage{xcolor}%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Cosmetic Font Definitions}
+%
+% \begin{macro}{\phfnote@do@fontdefs}
+% Minimalist cosmetic definition for fonts: load the |T1| font
+% encoding which is better. Also, use Computer Modern Bright as
+% sans-serif font by default instead of Computer Modern Sans Serif.
+%
+% \begin{macrocode}
+\def\phfnote@do@fontdefs{
+
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+
+ \renewcommand\sfdefault{cmbr}
+
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Bibliography Stuff}
+%
+% Provide some fixes for the bibliography.
+%
+% \begin{macro}{\phfnote@bibstyle}
+% \begin{macro}{\phfnote@bibfont}
+% Our default bibliography style is stored in |\phfnote@bibstyle|.
+% By default, it's our own hacked version of the |naturemag| style.
+% The font in which to typeset the bibliography is stored in
+% |\phfnote@bibfont|. By default, it's a little smaller than the
+% main text.
+% \begin{macrocode}
+\newcommand{\phfnote@bibstyle}{naturemagdoi}
+\newcommand{\phfnote@bibfont}{\fontsize{9}{11}\selectfont}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@bibliography}
+% These are a tentative implementation for |\bibliography|. The latter will be set to
+% this implementation according to the user's package options.
+% \begin{macrocode}
+\let\phfnote@old@bibliography\bibliography
+\let\phfnote@old@bibliographystyle\bibliographystyle
+\newcommand{\phfnote@bibliography}[1]{%
+ \begingroup%
+ \phfnote@bibfont%
+ \phfnote@old@bibliographystyle{\phfnote@bibstyle}%
+% \end{macrocode}
+%
+% Our hack: make sure that the next instance of |\section*| will generate a TOC
+% entry. (See |\phfnoteHackSectionStarWithTOC|.)
+% \begin{macrocode}
+ \phfnoteHackSectionStarWithTOC%
+% \end{macrocode}
+%
+% Some special chars may appear in output of some ill-advised bibliography
+% managers. Mostly the |&| symbol, such as in |Taylor & Francis|. We won't be needing a
+% \LaTeX{} alignment operator here, so just make |&| a normal printable character
+% (``other'' catcode).
+% \begin{macrocode}
+ \catcode`\&=12\relax% normal char
+% \end{macrocode}
+%
+% Adjust the appearance of e-prints. We assume e-prints refer to the arXiv; here we
+% generate a hyperlink and format them better.
+%
+% \begin{macrocode}
+ \providecommand\eprint[2][]{\href{http://arxiv.org/abs/##2}{arXiv:##2}}
+% \end{macrocode}
+%
+% Relay the call to the ``old'' |\bibliography| command to actually implement the
+% bibliography.
+% \begin{macrocode}
+ \phfnote@old@bibliography{#1}%
+ \endgroup%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\phfnote@bibliographystyle}
+% Tentative implementation of |\bibliographystyle|. Just register the new style in an
+% internal variable, so that the style is actually loaded in |\phfnote@bibliography|.
+%
+% This will be renamed to replace |\bibliographystyle| later, according to package
+% options.
+% \begin{macrocode}
+\newcommand{\phfnote@bibliographystyle}[1]{%
+ \renewcommand{\phfnote@bibstyle}{#1}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@do@bibliographydefs}
+% Make our changes live. Will be called later according to package options.
+% \begin{macrocode}
+\def\phfnote@do@bibliographydefs{%
+ \let\bibliographystyle\phfnote@bibliographystyle%
+ \let\bibliography\phfnote@bibliography%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \subsection{Better Footnote Style}
+%
+% \begin{macro}{\phfnote@do@footnotedefs}
+% Adjust the formatting of footnotes so they look better. Again,
+% this is called later according to the package options.
+% \begin{macrocode}
+\def\phfnote@do@footnotedefs{
+ \let\phfnote@orig@makefnmark\@makefnmark
+%% \def\@makefnmark{\hbox{\@textsuperscript{%
+%% \normalfont\tiny\fontseries{sb}\selectfont\@thefnmark}}}
+ \def\@makefnmark{\hbox{\@textsuperscript{%
+ \normalfont\tiny\bfseries\@thefnmark}}}
+%% \def\@makefnmark{\hbox{\@textsuperscript{%
+%% \normalfont\scriptsize\bfseries\@thefnmark}}}% too large
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{Other Stand-Alone Definitions and Helpers}
+% \label{sec:impl-other-stand-alone-defs}
+%
+% \subsubsection{A \phfverb{\notesmaller} command}
+%
+%
+% \begin{macro}{\notesmaller}
+% Relative font size command. Makes the text a fraction smaller
+% than its surroundings. The fraction is either given explicitly as
+% optional argument (1.0=same size) or is by default set by
+% |\notesmallerfrac|.
+%
+% To impalement this, we exploit the fact that \LaTeX{} saves the
+% current font size in the macro |\f@size|.
+% \begin{macrocode}
+\newcommand\notesmaller[1][\notesmallerfrac]{%
+ \fontsize{#1\dimexpr\f@size pt\relax}{#1\dimexpr\f@baselineskip pt\relax}%
+ \selectfont\ignorespaces%
+}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\notesmallerfrac}
+% Default fraction by which |\notesmaller| acts. Redefine to change defaults.
+% \begin{macrocode}
+\def\notesmallerfrac{0.9}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Customized, ``Inline,'' Table of Contents}
+%
+% \begin{macro}{\inlinetoc}
+% Just a customized table of contents. Horizontal rules before and
+% after, and spacing is adjusted, and no ``Contents'' title. The
+% table of contents looks just like at the \hyperref[sec:toc]{top of
+% this document}. The command is described in
+% \autoref{sec:inline-toc}.
+%
+% We call |\@starttoc| directly, bypassing the |\section*| included by
+% |\tableofcontents| (see definition |\tableofcontents| in latex sources).
+% \begin{macrocode}
+\newcommand{\inlinetoc}{%
+ \begingroup%
+ \vspace*{2mm}%
+ \hrule%
+ \vspace*{2mm}%
+ \parskip=1pt\relax%
+ \@starttoc{toc}%
+ \vspace*{4mm}%
+ \hrule%
+ \vspace*{6mm}%
+ \endgroup%
+}
+% \end{macrocode}
+%
+% \end{macro}
+%
+% \subsubsection{URL Styles}
+%
+% \needspace{7\baselineskip}
+% \begin{macro}{\url@notettstyle}
+% \begin{macro}{\url@notesfstyle}
+% \begin{macro}{\url@notesfssstyle}
+% \begin{macro}{\url@noteitsfstyle}
+% \begin{macro}{\url@notermstyle}
+% \begin{macro}{\url@noteitstyle}
+% \begin{macro}{\url@notesmlstyle}
+% We also provide some URL styles. These can directly set with
+% |\urlstyle|\marg{style-name}.
+%
+% \begin{macrocode}
+\def\url@notettstyle{%
+ \def\UrlFont{\ttfamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesfstyle{%
+ \def\UrlFont{\sffamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesfssstyle{%
+ \def\UrlFont{\fontfamily{cmss}\selectfont\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@noteitsfstyle{%
+ \def\UrlFont{\sffamily\itshape\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notermstyle{%
+ \def\UrlFont{\rmfamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@noteitstyle{%
+ \def\UrlFont{\itshape\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesmlstyle{%
+ \def\UrlFont{\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@urlstyle@common}
+% The following code is common to all our styles. We do an ugly hack
+% in which the tilde character (`\textasciitilde') is fixed to the
+% tilde char in the Adobe Times font (|ptm| code), so that it looks
+% nicer and its alignment is correct.
+% \begin{macrocode}
+\def\phfnote@url@tilde{\hbox{\fontfamily{ptm}\selectfont\textasciitilde}}
+%%\def\phfnote@url@tilde{\raise-0.8ex\hbox{%
+%% \kern-0.2ex\fontfamily{cmbr}\selectfont\textasciitilde}}
+\def\phfnote@urlstyle@common{%
+ \def\UrlTildeSpecial{\do\~{\phfnote@url@tilde}}%
+ \let\Url@force@Tilde\UrlTildeSpecial%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Utility to Add TOC Entry For Starred Section }
+%
+% Here we provide an ugly hack which introduces an entry in the table
+% of contents for |\section*| commands.
+%
+% [Note: An existing way of adding the toc entry in these cases is to issue
+% a |\addcontentsline| command before the relevant command
+% (say |\bibliography|). However this is unreliable, because on page
+% boundaries the |\addcontentsline| will pick up the previous page. This
+% is why |\addcontentsline| should be issued right \emph{after} the
+% |\section*| command.]
+%
+% \begin{pkgwarning}
+% This command is truly a hack, don't apply it globally! It forces
+% (locally) the |\section| command to be followed by a `|*|' ! Do this
+% within a group, just before a command which you are sure is
+% invoking |\section*| (such as |\bibliography| in the \pkgname{article}
+% class).
+% \end{pkgwarning}
+%
+% \begin{macro}{\phfnoteHackSectionStarWithTOC}
+% Locally force |\section| to be followed by |*| and introduce an
+% entry in the table of contents.
+% \begin{macrocode}
+\def\phfnoteHackSectionStarWithTOC{%
+ \let\phfnote@old@section\section%
+ \def\section*##1{\phfnote@old@section*{##1}\addcontentsline{toc}{section}{##1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnoteHackSectionStarWithTOCInCommand}
+% Patches the given command (|#1|), which is known to invoke
+% |\section*|, to locally first invoke
+% |\phfnoteHackSectionStarWithTOC| and thus generate a TOC entry.
+%
+% \begin{macrocode}
+\def\phfnoteHackSectionStarWithTOCInCommand#1{%
+ \expandafter\let\csname phfnote@old@\string#1\endcsname#1%
+ \gdef#1{%
+ \begingroup%
+ \phfnoteHackSectionStarWithTOC%
+ \csname phfnote@old@\string#1\endcsname%
+ \endgroup%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{Hack to save \& restore a set of commands}
+%
+% Exactly what it sounds like. You can store a set of commands, specified by
+% their name, by specifying an identifier. The commands corresponding to a
+% given identifier can then later be restored.
+%
+% \begin{macro}{\phfnoteSaveDefs}
+% The command |\phfnoteSaveDefs|\marg{identifier}\marg{list of macro names}
+% saves the current definitions of the given list of macro and associates them
+% to the given identifier.
+% The list of macros is specified as a comma-separated list of macro names.
+% \begin{macrocode}
+\def\phfnoteSaveDefs#1#2{%
+% \end{macrocode}
+%
+% The macro |\phfnote@restoredefs@<identifier>| will store the code necessary to
+% restore the macros.
+% \begin{macrocode}
+ \csgdef{phfnote@restoredefs@#1}{}%
+% \end{macrocode}
+%
+% Iterate over the macros we are supposed to store.
+% \begin{macrocode}
+ \def\@tmpa{#2}%
+ \@for\next:=\@tmpa\do{%
+% \end{macrocode}
+%
+% For each macro we are supposed to store (whose name is given in |\next|), we
+% |\let| |\phfnote@restoredefs@<identifier>@<macro-name>| store the current value
+% of the macro.
+% \begin{macrocode}
+ \global\csletcs{phfnote@restoredefs@#1@\next}{\next}%
+% \end{macrocode}
+%
+% Then, we append to |\phfnote@restoredefs@<identifier>| the code necessary to
+% restore this macro. That code is simply a |\cslet| instruction.
+%
+% Recall that |\xappto| expands its second argument (as |\xdef| does), allowing
+% us to expand the value of |\next|.
+% \begin{macrocode}
+ \expandafter\xappto\csname phfnote@restoredefs@#1\endcsname{%
+ \noexpand\csletcs{\next}{phfnote@restoredefs@#1@\next}%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnoteRestoreDefs}
+% Restores the macro saved by |\phfnoteSaveDefs|. We simply execute the macro
+% |\phfnote@restoredefs@<identifier>|, in which we duly stored the code
+% necessary to restore all the saved macros.
+% \begin{macrocode}
+\def\phfnoteRestoreDefs#1{%
+ \ifcsname phfnote@restoredefs@#1\endcsname%
+ \csname phfnote@restoredefs@#1\endcsname%
+ \else%
+ \PackageError{phfnote}{\string\phfnoteRestoreDefs: no such
+ definitions stored (#1)}
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \subsubsection{A utility for verbatim stuff in arguments of other macros}
+%
+% FIXME: DOCUMENT ME!
+%
+% A utility for using verbatim stuff in arguments of other macros---exploit
+% |\detokenize|
+%
+% \begin{macrocode}
+\def\phfverb#1{%
+ \ifx\protect\relax%
+ \phfverbfmt{\detokenize{#1}\unskip}%
+ \else%
+ \noexpand\phfverb{\unexpanded{#1}}%
+ \fi%
+}
+\def\phfverbfmt#1{{\normalfont\texttt{#1}}}
+% \end{macrocode}
+%
+% \subsection{Handle Package Options}
+%
+% \subsubsection{Define and Parse Package Options}
+%
+% Initialization code for \pkgname{kvoptions} for our package options. See \autoref{sec:package-options}.
+%
+% \begin{macrocode}
+\SetupKeyvalOptions{
+ family=phfnote,
+ prefix=phfnote@opt@
+}
+% \end{macrocode}
+%
+%
+% The title style to use. \marginpar{\raggedleft \phfverb{[title=...]}}
+% See \autoref{sec:title-styles}.
+% \begin{macrocode}
+\DeclareStringOption[default]{title}
+% \end{macrocode}
+%
+%
+% Option for abstract attributes \marginpar{\raggedleft
+% \phfverb{[abstract=...]}} (\autoref{sec:abstract-attributes}).
+% \begin{macrocode}
+\DeclareStringOption[]{abstract}
+% \end{macrocode}
+%
+% Option for Package sets \marginpar{\raggedleft \phfverb{[pkgset=...]}}
+% (\autoref{sec:package-sets})
+% \begin{macrocode}
+\DeclareStringOption[rich]{pkgset}
+% \end{macrocode}
+%
+% Define the page geometry. \marginpar{\raggedleft
+% \phfverb{[pagegeomdefs=...]}} \marginpar{\raggedleft \phfverb{[pagegeom=...]}}
+% See \autoref{sec:pagegeomdefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{pagegeomdefs}
+\DeclareComplementaryOption{nopagegeomdefs}{pagegeomdefs}
+\DeclareStringOption[default]{pagegeom}
+% \end{macrocode}
+%
+%
+%
+% Styling of section headings. \marginpar{\raggedleft \phfverb{[secfmt=...]}}
+% See \autoref{sec:secfmt}.
+% \begin{macrocode}
+\DeclareStringOption[section]{secfmt}
+% \end{macrocode}
+%
+% How to treat paragraphs. \marginpar{\raggedleft \phfverb{[par=...]}} See
+% \autoref{sec:par-defs}.
+% \begin{macrocode}
+\DeclareStringOption[skip]{par}
+% \end{macrocode}
+%
+% Add definitions to adjust spacing of lines and words. \marginpar{\raggedleft
+% \phfverb{[spacingdefs=...]}} See \autoref{sec:spacingdefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{spacingdefs}
+\DeclareComplementaryOption{nospacingdefs}{spacingdefs}
+% \end{macrocode}
+%
+% Do some adjustments to the fonts. \marginpar{\raggedleft
+% \phfverb{[fontdefs=...]}} See \autoref{sec:fontdefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{fontdefs}
+\DeclareComplementaryOption{nofontdefs}{fontdefs}
+% \end{macrocode}
+%
+% Adjustments for footnotes. \marginpar{\raggedleft
+% \phfverb{[footnotedefs=...]}} See \autoref{sec:footnotedefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{footnotedefs}
+\DeclareComplementaryOption{nofootnotedefs}{footnotedefs}
+% \end{macrocode}
+%
+% Load hyperref and corresponding definitions. \marginpar{\raggedleft
+% \phfverb{[hyperrefdefs=...]}} See \autoref{sec:hyperrefdefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{hyperrefdefs}
+\DeclareComplementaryOption{nohyperrefdefs}{hyperrefdefs}
+% \end{macrocode}
+%
+% Adjustments for bibliography, including default style. \marginpar{\raggedleft
+% \phfverb{[bibliographydefs=...]}} See \autoref{sec:bibliographydefs}.
+% \begin{macrocode}
+\DeclareBoolOption[true]{bibliographydefs}
+\DeclareComplementaryOption{nobibliographydefs}{bibliographydefs}
+% \end{macrocode}
+%
+%
+% Preset option. \marginpar{\raggedleft \phfverb{[preset=...]}} See
+% \autoref{sec:presets}.
+% \begin{macrocode}
+\define@key{phfnote}{preset}{%
+ \ifcsname phfnote@preset@#1\endcsname%
+ \csname phfnote@preset@#1\endcsname%
+ \else%
+ \PackageError{phfnote}{Unknown preset: `#1'!}{You specified the
+ option 'preset=...' with an invalid value. Please look up the
+ package documentation corresponding to your version of phfnote
+ for possible values.}
+ \fi%
+}
+% \end{macrocode}
+%
+%
+% Provide the standard error message for unknown options.
+% \begin{macrocode}
+\DeclareDefaultOption{%
+ \@unknownoptionerror
+}
+% \end{macrocode}
+%
+% \subsubsection{Define Global Presets}
+% \label{impl:presets}
+%
+% Define the global presets here. See \autoref{sec:presets} for a description
+% of what these presets do.
+%
+% \begin{macro}{\phfnote@hook@atendload}
+% A hook for presets to do stuff at the end of package load.
+% \begin{macrocode}
+\def\phfnote@hook@atendload{}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@preset@article}
+% Article preset.
+% \begin{macrocode}
+\def\phfnote@preset@article{
+ \def\phfnote@opt@title{article}
+ \def\phfnote@opt@par{indent}
+ \def\phfnote@opt@pagegeom{default}
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@presetcommon@xnote}
+% Specify some common definitions for all our |*note| preset styles. The
+% optional argument is the URL style to set.
+% \begin{macrocode}
+\newcommand\phfnote@presetcommon@xnote[1][noteitsf]{
+ \def\phfnote@opt@title{default}
+ \def\phfnote@opt@par{skip}
+ \phfnote@opt@pagegeomdefstrue
+ \def\phfnote@opt@pagegeom{wide}
+ \setlength{\footnotesep}{5pt}
+ \g@addto@macro\phfnote@hook@atendload{
+ \ifdefined\urlstyle
+ \urlstyle{#1}
+ \fi
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \needspace{5\baselineskip}
+% \begin{macro}{\phfnote@preset@sfnote}
+% \begin{macro}{\phfnote@preset@sfssnote}
+% \begin{macro}{\phfnote@preset@opensansnote}
+% \begin{macro}{\phfnote@preset@utopianote}
+% \begin{macro}{\phfnote@preset@mnmynote}
+% Define the different |*note| styles.
+% \begin{macrocode}
+\def\phfnote@preset@sfnote{
+ \phfnote@presetcommon@xnote
+ \phfnote@opt@footnotedefstrue
+ \phfnote@opt@fontdefstrue
+ \renewcommand\familydefault{\sfdefault}
+ \renewcommand{\notesectionallfontfamily}{\sfdefault}
+}
+\def\phfnote@preset@sfssnote{
+% \end{macrocode}
+% set up all the settings as for |sfnote| \ldots
+% \begin{macrocode}
+ \phfnote@preset@sfnote
+% \end{macrocode}
+% \ldots but override:
+% \begin{macrocode}
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \renewcommand\sfdefault{cmss}
+}
+\def\phfnote@preset@opensansnote{
+% \end{macrocode}
+% set up all the settings as for |sfnote| \ldots
+% \begin{macrocode}
+ \phfnote@preset@sfnote
+% \end{macrocode}
+% \ldots but override:
+% \begin{macrocode}
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \PassOptionsToPackage{default,osfigures,scale=0.9}{opensans}
+ \RequirePackage{opensans}
+}
+\def\phfnote@preset@utopianote{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \RequirePackage{fourier}
+ \renewcommand{\notesectionallfontfamily}{put}
+ \renewcommand{\notetitlefont}{\bfseries}
+ \renewcommand{\sfdefault}{phv}
+}
+\def\phfnote@preset@mnmynote{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@footnotedefsfalse
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \renewcommand{\notesectionallfontfamily}{\sfdefault}
+% \end{macrocode}
+%
+% Require these packages AFTER the default package set, because some symbols may
+% be defined in package sets, and I've had problems with re-definitions
+% etc\ldots anyway this seems to work this way:
+% \begin{macrocode}
+ \g@addto@macro\phfnote@hook@atendload{
+ \RequirePackage{MnSymbol}
+ \PassOptionsToPackage{medfamily,textosf,mathlf,minionint,footnotefigures}{MinionPro}
+ \RequirePackage{MinionPro}
+ \PassOptionsToPackage{medfamily}{MyriadPro}
+ \RequirePackage{MyriadPro}
+ }
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@preset@pkgdoc}
+% Preset for a package documentation.
+%
+% Start by setting the same settings as for other |Xnote| presets.
+% \begin{macrocode}
+\def\phfnote@preset@pkgdoc{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@fontdefsfalse
+% \end{macrocode}
+%
+% Then set up the font, which is done in a separate macro
+% |\phfnote@pkgdoc@setupfont| in case individual documents would like more
+% specific settings. (For example, some packages may want a different math
+% font.)
+% \begin{macrocode}
+ \phfnote@pkgdoc@setupfont
+% \end{macrocode}
+%
+% Finally, set up general appearance.
+% \begin{macrocode}
+ \def\phfnote@opt@secfmt{section,paragraph,itpar,blockpar,larger,secsquares,secnummargin}
+ \def\phfnote@opt@pagegeom{bigmargin}
+ \def\phfnote@opt@abstract{noname}
+}
+% \end{macrocode}
+%
+% Also provide a helper macro which is to load the font packages we
+% want. By default, we use Utopia fonts via the \pkgname{fourier}
+% package, but some package documentations may want a different math
+% font. Override |\phfnote@pkgdoc@setupfont| to adjust the whole font
+% set-up, or |\phfnote@pkgdoc@setupmainfont| to adjust only the main
+% document font.
+% \begin{macrocode}
+\providecommand\phfnote@pkgdoc@setupfont{
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \phfnote@pkgdoc@setupmainfont
+ \renewcommand{\notesectionallfontfamily}{put}
+ \renewcommand{\notetitlefont}{\bfseries}
+ \IfFileExists{opensans.sty}{}{\PackageError{phfnote}{Font OpenSans is not
+ available (need `opensans' package)}{Please install the opensans
+ package, which provides the OpenSans font.}}
+ \def\opensans@scale{s*[0.85]}
+ \renewcommand{\sfdefault}{fosj}
+}
+\providecommand\phfnote@pkgdoc@setupmainfont{\RequirePackage{fourier}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\phfnote@preset@xpkgdoc}
+% Same as |preset=pkgdoc|, but also provide some handy hacks and
+% commands.
+%
+% \begin{macrocode}
+\def\phfnote@preset@xpkgdoc{
+ \phfnote@preset@pkgdoc
+% \end{macrocode}
+%
+% Include the \pkgname{verbdef} package, because it's always useful.
+% \begin{macrocode}
+ \RequirePackage{verbdef}
+% \end{macrocode}
+%
+% \textbf{Some patching first:}
+% Patch up |\PrintChanges| and |\PrintIndex|, if they are defined (for if we are
+% using the \pkgname{ltxdoc} package for latex package documentation). We want
+% these to generate an entry in the table of contents. Also provide the utility
+% |\PrintChangesAndIndex|, which calls both |\PrintChanges| and |\PrintIndex| with
+% some additional spacing.
+% \begin{macrocode}
+ \ifdefined\PrintChanges
+ \phfnoteHackSectionStarWithTOCInCommand\PrintChanges
+ \fi
+ \ifdefined\PrintIndex
+ \phfnoteHackSectionStarWithTOCInCommand\PrintIndex
+ \fi
+ \def\PrintChangesAndIndexSpacing{\vspace{3cm plus 2cm minus 2cm}}
+ \def\PrintChangesAndIndex{\PrintChangesAndIndexSpacing\PrintChanges
+ \PrintChangesAndIndexSpacing\PrintIndex}
+% \end{macrocode}
+%
+% Set the index to TWO columns only (three is too tight).
+% \begin{macrocode}
+ \ifdefined\c@IndexColumns
+ \setcounter{IndexColumns}{2}
+ \fi
+% \end{macrocode}
+%
+% And set the glossary, that is, the list of changes history to single-column. For this,
+% renew the environment completely to remove the |multicols| environment.
+% \begin{macrocode}
+ \let\phfnote@xpkgdoc@old@theglossary\theglossary
+ \let\phfnote@xpkgdoc@old@endtheglossary\endtheglossary
+ \renewenvironment{theglossary}{%
+ \glossary@prologue%
+ \GlossaryParms \let\item\@idxitem \ignorespaces}
+ {}
+% \end{macrocode}
+%
+%
+% \textbf{Hyperref:} No ``default'' \pkgname{hyperref} definitions, we'll use
+% \pkgname{hyperdoc} instead.
+% \begin{macrocode}
+ \phfnote@opt@hyperrefdefsfalse
+ \g@addto@macro\phfnote@hook@atendload{
+ \definecolor{docnotelinkcolor}{rgb}{0,0,0.4}%
+ \RequirePackage{url}%
+ \DeclareUrlCommand\phfnote@format@url{}%
+ \RequirePackage{hypdoc}
+ %
+ \hypersetup{bookmarks=true,backref=false,unicode=true,%
+ bookmarksnumbered=false,bookmarksopen=false,bookmarksopenlevel=1,%
+ breaklinks=true,pdfborder={0 0 0},colorlinks=true}%
+ \hypersetup{%
+ anchorcolor=docnotelinkcolor,citecolor=docnotelinkcolor,%
+ filecolor=docnotelinkcolor,linkcolor=docnotelinkcolor,%
+ menucolor=docnotelinkcolor,runcolor=docnotelinkcolor,%
+ urlcolor=docnotelinkcolor}%
+ \let\email\phfnote@email%
+ \urlstyle{noteit}
+ }
+% \end{macrocode}
+%
+% \textbf{Provide Macro:} |\pkgname|\marg{package name} to format a package
+% name. Also place it in the general index. This command is robust and
+% can be used in section titles etc.
+% \begin{macrocode}
+ \def\pkgname##1{%
+ \pkgnamefmt{##1}%
+ \index{##1=\pkgnamefmt{##1}|hyperpage}%
+ \index{packages:>##1=\pkgnamefmt{##1}|hyperpage}%
+ }
+ \robustify\pkgname
+ \def\pkgnamefmt##1{\textsf{##1}}
+ \robustify\pkgnamefmt
+% \end{macrocode}
+%
+%
+% \textbf{Provide Macros:} |\changed| and |\changedreftext|, with more
+% advanced support for displaying changes in package functionality or API.
+%
+% First, we need a counter for the x-ref system.
+% \begin{macrocode}
+ \newcounter{phfnotechanged}
+% \end{macrocode}
+%
+% Mark changes in the implementation section of the package documentation
+% with the command |\changed|\oarg{label
+% name}\marg{v1.0}\marg{2016/05/22}\marg{description}. This command
+% automatically adds the change to the package's change history list, and
+% allows you to refer to this change anywhere else in the package doc with
+% |\changedreftext|.
+% \begin{macrocode}
+ \newcommand*\changed[4][]{%
+% \end{macrocode}
+%
+% First, if no label is given as optional argument, then just display the
+% change and add it to the package changes list.
+% \begin{macrocode}
+ \if\relax\detokenize{##1}\relax%
+ \changedtextfmt{##2}{##3}{##4}%
+ \changes{##2}{##3}{##4}%
+ \else%
+% \end{macrocode}
+%
+% If a label name is provided as optional argument, then we need to write
+% some stuff to the \texttt{.aux} file to make the change visible in the
+% whole document.
+% \begin{macrocode}
+ \protected@edef\phfnotechanged@tmpa{{##2}{##3}{##4}}%
+ \immediate\write\@auxout{\string\phfnote@changed@set%
+ {##1}{\expandonce\phfnotechanged@tmpa}}%
+ \par\hspace*{0pt}\refstepcounter{phfnotechanged}\label{phfnotechanged:##1}%
+ \begingroup\let\phfnote@changedreftext@par\relax
+ \changedreftext{##1}%
+ \endgroup
+ \changes{##2}{##3}{\hyperref[phfnotechanged:##1]{##4}}%
+ \fi
+ }
+ \def\phfnote@changed@set##1{%
+ \expandafter\gdef\csname phfnote@changed@lbl@##1\endcsname%
+ }
+% \end{macrocode}
+%
+% When you document changes with the help of |\changed|, you may refer to
+% any specific change from anywhere else in the package doc with the help
+% of |\changedreftext|\marg{label name}.
+% \begin{macrocode}
+ \def\phfnote@changedreftext@par{\par}
+ \newcommand*\changedreftext[1]{%
+ \phfnote@changedreftext@par%
+ \ifcsname phfnote@changed@lbl@##1\endcsname
+ \hyperref[phfnotechanged:##1]{%
+ \expandafter\expandafter\expandafter\changedtextfmt%
+ \csname phfnote@changed@lbl@##1\endcsname
+ }
+ \else
+ \hyperref[phfnotechanged:##1]{%
+ \changedtextfmt{???}{???}{[\textbf{missing ref}]}%
+ }%
+ \fi
+ \par
+ }
+% \end{macrocode}
+%
+% The macro |\changedtextfmt|\marg{v1.0}\marg{2016/05/22}\marg{description}
+% takes care of formatting the change on the spot.
+% \begin{macrocode}
+ \newcommand*\changedtextfmt[3]{%
+ \textit{Changed in {##1\kern 0.3ex\relax[##2]}:} ##3.
+ }
+% \end{macrocode}
+%
+% \textbf{Provide environment \phfverb{pkgoptions}:} Set up an elaborate
+% environment (based on a |description| environment) to describe package
+% options.
+% \begin{macrocode}
+ \RequirePackage{enumitem}
+ \newlist{pkgoptions}{description}{1}
+ \setlist[pkgoptions]{font=\pkgoptionfmt[{\vspace*{5pt}}],style=nextline}
+% \end{macrocode}
+%
+% But patch the |pkgoptions|' |\item| command, so that it puts an additional
+% pair of braces around its argument. In this way, the |font=| attribute for
+% the list sees the full label as its next token, and can be used as a macro
+% argument. (This is not needed for newer versions of \pkgname{enumitem}.)
+% \begin{macrocode}
+ \apptocmd\pkgoptions{\let\pkgoptions@old@item\item%
+ \def\item{\@ifnextchar[\pkgoptions@item@\pkgoptions@item@@}%]
+ \def\pkgoptions@item@[##1]{\pkgoptions@old@item[{{##1}}]}%
+ \def\pkgoptions@item@@{\PackageWarning{phfnote}{{pkgoptions}: you must
+ specify label to \string\item as \string\item[label].}%
+ \pkgoptions@old@item}%
+ }{}{\PackageWarning{phfnote}{preset xpkgdoc: Failed to patch command
+ \string\pkgoptions}}
+ \def\pkgoptionscombineitem{\leavevmode\vspace{\dimexpr-\baselineskip-\parskip-\itemsep\relax}}
+% \end{macrocode}
+%
+% For convenience, also provide a |\meta|-like command for boolean arguments
+% (|true| or |false|). `|\metatruefalsearg|' typesets as `\metatruefalsearg'.
+% \begin{macrocode}
+ \def\metatruefalsearg{\meta{\phfverb{true} $\mid$ \phfverb{false}}}
+% \end{macrocode}
+%
+% Include also a command to format a package option. Puts the option in a box
+% in typewriter text style, and indexes it. The optional argument is meant to
+% be internal---it adds commands after the displayed text (use it to add, e.g.\@
+% spacing).
+%
+% When indexing the packages, make sure to remove the protective braces if any.
+% \begin{macrocode}
+ \newcommand\pkgoptionfmt[2][]{%
+ \begingroup\let\meta\pkgoptfmt@meta\fbox{\normalfont\ttfamily ##2}\endgroup%
+ \expandafter\phfnote@pkgdoc@index\expandafter{\@firstofone ##2}%
+ ##1}
+ \let\pkgopt@save@meta\meta
+ \def\pkgoptfmt@meta##1{\begingroup\normalfont\itshape\pkgopt@save@meta{##1}\endgroup}
+% \end{macrocode}
+%
+% Whenever a package option is formatted with |\pkgoptionfmt|, it is placed in
+% the index. Because package options may be of the form |key=val|, we want to
+% split keys from values and put them independently in the index. This is done
+% by entering a \TeX{} group, and using an |\lccode| trick: the code is prepared
+% to iterate over a list of comma-separated stuff, but then the ``lowercase''
+% version of that code is executed instead, where the |=|'s have been replaced
+% by |,|'s.
+% \begin{macrocode}
+ \def\phfnote@pkgdoc@index##1{%
+ \begingroup\lccode`\= = `\,\relax%
+ \def\x{\lowercase{\def\@tmpa{##1}}}%
+ \x%
+ \let\meta\@gobble%
+ \let\marg\@gobble%
+ \let\oarg\@gobble%
+ \let\parg\@gobble%
+ \let\pkgoptattrib\@firstofone%
+ \let\pkgoptattribnodots\@firstofone%
+ \let\pkgoptattribempty\@empty%
+ \def\handleitemindex####1{%
+ \edef\@tmpc{####1}%
+ \if\relax\detokenize\expandafter{\@tmpc}\relax\else%
+ \edef\@tmpb{{\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+ (\pkgoptname)|hyperpage}}%
+ \expandafter\index\@tmpb%
+ \edef\@tmpb{{\packageoptionsname:>\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+|hyperpage}}%
+ \expandafter\index\@tmpb%
+ \fi%
+ }%
+ \def\@tmpc{\forcsvlist{\handleitemindex}}%
+ \expandafter\@tmpc\expandafter{\@tmpa}%
+ \endgroup%
+ }
+ \def\pkgoptname{pkg. opt.}
+ \def\packageoptionsname{package options}
+% \end{macrocode}
+%
+% \textbf{Provide environment \phfverb{cmdoptions}:} hijack the |pkgoptions|
+% environment to do the same thing, except we place the items in the index under
+% ``command options'' instead of ``package options.''
+% \begin{macrocode}
+ \def\cmdoptions{\begingroup\setcmdnotpkgoptions
+ \pkgoptions}
+ \def\endcmdoptions{\endpkgoptions\endgroup}
+ \newcommand\cmdoptionfmt[2][]{\begingroup\setcmdnotpkgoptions
+ \pkgoptionfmt[{##1}]{##2}\endgroup}
+ \def\cmdoptname{cmd. opt.}
+ \def\commandoptionsname{command options}
+ \def\setcmdnotpkgoptions{\let\pkgoptname\cmdoptname
+ \let\packageoptionsname\commandoptionsname
+ \let\fbox\cmdoptionsfbox}
+ \def\cmdoptionsfbox##1{\ensuremath{\underline{{\text{##1}}}}}
+% \end{macrocode}
+%
+% Provide the |\pkgoptattrib| command, which typesets its argument as
+% |\{arg, ...\}|---useful to typeset attributes such as in
+% \autoref{sec:abstract-attributes}. The variant |\pkgoptattribondots{arg}|
+% typesets |\{arg\}| while |\pkgoptattribempty| expands to |{}|.
+% \begin{macrocode}
+ \def\pkgoptattrib##1{\{##1,...\}}
+ \def\pkgoptattribnodots##1{\{##1\}}
+ \def\pkgoptattribempty{\{\}}
+% \end{macrocode}
+%
+% \textbf{Colorful boxes: environments \phfverb{pkgnote},
+% \phfverb{pkgwarning}, and \phfverb{pkgtip}.} Now, load the
+% \pkgname{tcolorbox} package to provide visual ``Note,'' ``Warning,'' and
+% ``Tip'' boxes. Because \pkgname{tcolorbox} includes the
+% \pkgname{verbatim} package which messes up the |verbatim| environment in
+% latex dtx files (for which source lines all start with a |%| which needs
+% to be stripped), we save the |verbatim|-related commands, and restore
+% them after the interfering packages have been loaded.
+% \begin{macrocode}
+ \phfnoteSaveDefs{verbatimstuff}{%
+ verbatim,@verbatim,@xverbatim,@sxverbatim,endverbatim}
+ \usepackage{tcolorbox}
+ \newtcolorbox{pkgnote}{
+ colback=blue!5!white,
+ colframe=blue!5!white,
+ coltitle=blue!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={NOTE}
+ }
+ \newtcolorbox{pkgwarning}{
+ colback=red!5!white,
+ colframe=red!5!white,
+ coltitle=red!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={WARNING}
+ }
+ \newtcolorbox{pkgtip}{
+ colback=green!5!white,
+ colframe=green!5!white,
+ coltitle=green!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={TIP}
+ }
+ \phfnoteRestoreDefs{verbatimstuff}
+% \end{macrocode}
+%
+% Common title stuff:
+% \begin{macrocode}
+ \def\phfqitltxPkgTitle##1{The \pkgname{##1} package\thanks{\itshape
+ This document corresponds to \pkgname{##1}~\fileversion, dated \filedate. It
+ is part of the
+ \href{https://github.com/phfaist/phfqitltx/}{\pkgname{phfqitltx}} package
+ suite, see \url{https://github.com/phfaist/phfqitltx}.}}
+% \end{macrocode}
+%
+% Utility to parse package file date into ``|\today|''-style date: invoke as
+% |\date{\pkgfmtdate\filedate}|.
+% \begin{macrocode}
+ \def\pkgfmtdate##1{%
+ \edef\pkgfmtdate@thedate{##1}%
+ \expandafter\pkgfmtdate@next\pkgfmtdate@thedate\@nil%
+ }
+ \def\pkgfmtdate@next##1/##2/##3\@nil{% YYYY/MM/DD
+ \ifcase ##2 \or January\or February\or March\or April\or May%
+ \or June\or July\or August\or September\or October\or November\or December\fi\space ##3,%
+ \space ##1}
+ \robustify\pkgfmtdate@next
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\phfnote@preset@reset}
+% Finally, the |reset| preset:
+% \begin{macrocode}
+\def\phfnote@preset@reset{
+ \def\phfnote@opt@pkgset{none}
+ \def\phfnote@opt@title{}
+ \phfnote@opt@pagegeomdefsfalse
+ \phfnote@opt@spacingdefsfalse
+ \def\phfnote@opt@par{original}
+ \def\phfnote@opt@abstract{original}
+ \phfnote@opt@hyperrefdefsfalse
+ \phfnote@opt@fontdefsfalse
+ \def\phfnote@opt@secfmt{}
+ \phfnote@opt@bibliographydefsfalse
+ \phfnote@opt@footnotedefsfalse
+% \end{macrocode}
+%
+% \begin{pkgwarning}
+% SELF-NOTE: DO NOT FORGET TO ADD HERE RESET COMMANDS FOR ANY NEW OPTION THAT
+% WE PROVIDE IN THE FUTURE.
+% \end{pkgwarning}
+%
+% \begin{macrocode}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsubsection{Finally, Process and Execute the Package Options}
+%
+%
+%
+% Process the options:
+%
+% \begin{macrocode}
+\ProcessKeyvalOptions*
+% \end{macrocode}
+%
+%
+% Take action according to the user options.
+%
+% \begin{macrocode}
+\phfnote@do@pkgset{\phfnote@opt@pkgset}
+
+\phfnote@do@notetitle{\phfnote@opt@title}
+
+\phfnote@do@noteabstract{\phfnote@opt@abstract}
+
+\phfnote@do@secfmt{\phfnote@opt@secfmt}
+
+\ifphfnote@opt@pagegeomdefs
+ \phfnote@do@pagegeomdefs{\phfnote@opt@pagegeom}
+\fi
+
+\ifphfnote@opt@spacingdefs
+ \phfnote@do@spacing
+\fi
+
+\phfnote@do@par{\phfnote@opt@par}
+
+\ifphfnote@opt@hyperrefdefs
+ \phfnote@do@pdfhyperrefdefs
+\fi
+
+\ifphfnote@opt@fontdefs
+ \phfnote@do@fontdefs
+\fi
+
+\ifphfnote@opt@bibliographydefs
+ \phfnote@do@bibliographydefs
+\fi
+
+\ifphfnote@opt@footnotedefs
+ \phfnote@do@footnotedefs
+\fi
+% \end{macrocode}
+%
+% Finally, execute the hook we set up for definitions at the end of the package
+% loading:
+% \begin{macrocode}
+\phfnote@hook@atendload
+% \end{macrocode}
+%
+%\Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/phfnote/phfnote.ins b/Master/texmf-dist/source/latex/phfnote/phfnote.ins
new file mode 100644
index 00000000000..5c32c654a14
--- /dev/null
+++ b/Master/texmf-dist/source/latex/phfnote/phfnote.ins
@@ -0,0 +1,56 @@
+%%
+%% 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
+%% 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@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{phfnote.sty}{\from{phfnote.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{* phfnote.sty *}
+\Msg{* naturemagdoi.bst *}
+\Msg{* *}
+\Msg{* To produce the documentation run the .dtx file through *}
+\Msg{* (PdF-)LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/phfnote/phfnote.sty b/Master/texmf-dist/tex/latex/phfnote/phfnote.sty
new file mode 100644
index 00000000000..7c2590f1b9d
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/phfnote/phfnote.sty
@@ -0,0 +1,1028 @@
+%%
+%% This is file `phfnote.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% phfnote.dtx (with options: `package')
+%%
+%% This is a generated file.
+%%
+%% 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
+%% 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{phfnote}
+ [2016/08/15 v1.0 phfnote package]
+\RequirePackage{xkeyval}
+\RequirePackage{kvoptions}
+\RequirePackage{etoolbox}
+\def\phfnote@internal@execattribs#1#2#3{%
+ \@for\next:=#3\do{%
+ \ifcsname #1\next\endcsname%
+ \csname #1\next\endcsname%
+ \else%
+ \PackageWarning{phfnote}{Unknown #2: '\next'. Ignoring.}
+ \fi
+ }
+}
+\newcommand{\notetitlefont}{\sffamily\bfseries}
+\newcommand{\notetitleauthorfont}{}
+\newcommand{\notetitledatefont}{\footnotesize}
+\newcommand{\notetitlebelowspace}{4mm}
+\newcommand{\notetitletopspace}{-1.2cm}
+\newcommand{\notetitlehrule}{\hrule}
+\long\def\notetitle@title#1{\long\gdef\@title{#1}}
+\def\phfnote@title@checksetspace#1{%
+ \ifdefined\singlespace\else%
+ \PackageError{phfnote}{Note title style `#1' requires the
+ `setspace' package to be loaded! Please load it, or use a
+ pkgset which loads it automatically}%
+ \fi%
+}
+\def\phfnote@setupthanksmpfootnote{%
+ \def\thempfootnote{\arabic{mpfootnote}}%
+ \let\footnoterule\relax%
+ \let\thanks\footnote%
+ \def\phfnote@mpfootmaterial{}%
+ \long\def\@mpfootnotetext##1{%
+ \protected@edef\@currentlabel%
+ {\csname p@mpfootnote\endcsname\@thefnmark}%
+ \protected@edef\@tmpa{\protect\phfnote@mympfootnotemark{\@thefnmark}{##1}%
+ \protect\phfnote@mpfootnoteglue}%
+ \expandafter\g@addto@macro\expandafter\phfnote@mpfootmaterial%
+ \expandafter{\@tmpa}%
+ }%
+ \def\thanksmark[##1]{\phfnote@mympfootnotemark{##1}}%
+}
+\def\phfnote@finalizempfootnotes{%
+ \global\setbox\@mpfootins=\vbox{%
+ \parskip=0pt\parindent=0pt\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ \noindent\leavevmode%
+ \reset@font\footnotesize%
+ \phfnote@fmt@titlefootnotes%
+ \phfnote@mpfootmaterial}%
+}
+\def\phfnote@fmt@titlefootnotes{}
+\def\phfnote@mympfootnotemark#1{\@textsuperscript{\normalfont#1}}
+\def\phfnote@mpfootnoteglue{\hskip 1.2em plus 2em minus 0.5em\relax}
+\def\notetitle@thanksmark{\footnotemark}
+\let\phfnote@old@thanks\thanks
+\def\notetitle@thanks{\@ifnextchar[\phfnote@thanks{\phfnote@thanks[]}}%]
+\long\def\phfnote@thanks[#1]#2{%
+ \if\relax\detokenize{#1}\relax%
+ \footnotemark%
+ \protected@xdef\@thanks{\@thanks\protect\footnotetext[\the\c@footnote]{#2}}%
+ \else% argument, pass on to sub-commands:
+ \footnotemark[#1]%
+ \protected@xdef\@thanks{\@thanks\protect\footnotetext[#1]{#2}}%
+ \fi%
+}
+\newcommand{\notetitle@style@default}{%
+ \begingroup\par\raggedright%
+ \phfnote@setupthanksmpfootnote%
+ \vspace*{\notetitletopspace}%
+ \phfnote@title@checksetspace{default}%
+ \begin{minipage}{\textwidth}%
+ \begin{singlespace}%
+ \parskip=0pt\parindent=0pt\relax%
+ {\let\phfnote@old@par\par%
+ \def\par{\phfnote@old@par%
+ \parskip=1.5ex\relax\parshape 1 0pt \textwidth\relax%
+ \noindent}%
+ \par%
+ \Large {\notetitlefont \@title}\par}%
+ \vskip 2mm\relax
+ \if\relax\detokenize\expandafter{\@author}\relax\else%
+ \par\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ {\notetitleauthorfont \@author}%
+ \vskip 2mm\relax%
+ \fi
+ \if\relax\detokenize\expandafter{\@date}\relax\else%
+ \par\parshape 1 0.04\textwidth 0.96\textwidth\relax%
+ {\notetitledatefont \@date}
+ \vskip 2mm\relax%
+ \fi
+ \global\let\@thanks\@empty%
+ \phfnote@finalizempfootnotes%
+ \end{singlespace}%
+ \end{minipage}\par%
+ \vspace*{2mm}%
+ \notetitlehrule\relax%
+ \par%
+ \endgroup%
+ \vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip
+}
+\newcommand{\notetitle@style@small}{%
+ \begingroup\par\raggedright%
+ \let\footnote\thanks%
+ \vspace*{\notetitletopspace}%
+ {\notetitlefont \@title}%
+ \hfill\makebox{\fontsize{9pt}{10pt}\selectfont {\notetitleauthorfont \@author}%
+ \hspace*{2mm}--\hspace*{2mm}{\emph{\notetitledatefont \@date}}}%
+ \vspace*{1mm}\notetitlehrule\relax\vspace*{1mm}%
+ \par%
+ \endgroup%
+ \vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip
+}
+\newcommand{\notetitle@style@article}{%
+ \vspace*{-3em}%
+ \begingroup
+ \centering
+ \let\footnote\thanks%
+ {\LARGE \@title \par}%
+ \vskip 1.5em%
+ {\large%
+ \lineskip .5em%
+ \begin{tabular}[t]{c}%
+ \@author%
+ \end{tabular}\par}%
+ \vskip 1.5em%
+ {\large \@date}%
+ \par%
+ \endgroup%
+ \par%
+ \vskip 2.5em\relax%
+}
+\def\phfnote@do@notetitle#1{
+ \if\relax\detokenize\expandafter{#1}\relax
+ \else
+ \ifcsname notetitle@style@#1\endcsname
+ \def\phfnote@tmp@titsty{#1}%
+ \else
+ \PackageError{phfnote}{Unknown title style: '#1'.}{Unknown title
+ style: '#1'. Please consult the package documentation for available
+ styles.}
+ \def\phfnote@tmp@titsty{default}%
+ \fi
+ \let\title\notetitle@title
+ \let\thanks\notetitle@thanks
+ \let\thanksmark\notetitle@thanksmark
+ \def\@maketitle{\csname notetitle@style@\phfnote@tmp@titsty\endcsname}
+ \fi
+}
+\let\notedefaultabstract\abstract
+\let\endnotedefaultabstract\endabstract
+\newcommand{\noteabstracttextfont}{}
+\newcommand{\noteabstractnamefont}{\bfseries\small}
+\if@twocolumn
+ \newcommand\noteabstracttextwidth{\hsize}
+\else
+ \newcommand{\noteabstracttextwidth}{0.9\hsize}
+\fi
+\newcommand\noteabstractafterspacing{1.5em}
+\newcommand\noteabstractbeforespacing{1.5em}
+\def\noteabstract@nameline{
+ {\parskip=0pt\relax\par\centering\noteabstractnamefont%
+ \abstractname%
+ \par}\vskip 1ex\relax%
+}
+\newenvironment{noteabstract}{%
+ \removelastskip%
+ \vspace{\noteabstractbeforespacing}%
+ \begingroup%
+ \par\noindent\centering%
+ \begin{minipage}{\noteabstracttextwidth}%
+ \noteabstract@nameline%
+ \noteabstracttextfont%
+ }%
+ {%
+ \end{minipage}%
+ \par%
+ \endgroup%
+ \vspace{\noteabstractafterspacing}%
+}
+\def\noteabstract@attr@wide{%
+ \def\noteabstracttextwidth{\textwidth}%
+}
+\def\noteabstract@attr@narrow{%
+ \if@twocolumn
+ \else
+ \def\noteabstracttextwidth{0.8\textwidth}%
+ \fi
+}
+\def\noteabstract@attr@noname{%
+ \def\noteabstract@nameline{}%\vspace*{1ex}}%
+}
+\def\noteabstract@attr@original{%
+ \let\abstract\notedefaultabstract
+ \let\endabstract\endnotedefaultabstract
+}
+\def\noteabstract@attr@small{%
+ \g@addto@macro\noteabstracttextfont{\small}%
+}
+\def\noteabstract@attr@compact{%
+ \renewcommand\noteabstractafterspacing{1ex}%
+ \renewcommand\noteabstractbeforespacing{1ex}%
+}
+\def\noteabstract@attr@it{%
+ \g@addto@macro\noteabstracttextfont{\itshape}%
+}
+\def\phfnote@do@noteabstract#1{
+ \let\abstract\noteabstract
+ \let\endabstract\endnoteabstract
+ \phfnote@internal@execattribs{noteabstract@attr@}{abstract attribute}{#1}
+}
+\def\phfnote@pagegeomstyle@default{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+\def\phfnote@pagegeomstyle@narrow{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=1.5in}{geometry}%
+ \fi%
+ \fi
+}
+\def\phfnote@pagegeomstyle@wide{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=0.75in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+\def\phfnote@pagegeomstyle@xwide{
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=0.5in,vmargin=0.5in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin=0.75in,vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+\def\phfnote@pagegeomstyle@bigmargin{%
+ \if@twocolumn
+ \PassOptionsToPackage{hmargin=1.5in,vmargin=0.75in,includeheadfoot}{geometry}%
+ \else
+ % fix the margins a bit to make text wider
+ \ifcase\@ptsize% mods for 10 pt
+ \PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}%
+ \or% mods for 11 pt
+ \PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}%
+ \or% mods for 12 pt
+ \PassOptionsToPackage{hmargin={2in,1.5in},vmargin=1.25in}{geometry}%
+ \fi%
+ \fi
+}
+\newcommand{\phfnote@do@pagegeomdefs}[1]{
+ \ifcsname phfnote@pagegeomstyle@#1\endcsname
+ \csname phfnote@pagegeomstyle@#1\endcsname
+ \else
+ \PackageWarning{phfnote}{Unknown page geometry style: `#1'!}
+ \fi
+
+ \RequirePackage{geometry}%
+}
+\def\phfnote@do@spacing{
+ \@ifpackageloaded{setspace}{
+ \def\phfnote@dostretch##1{%
+ \setstretch{##1}\phfnote@docaptionstretch{##1}}
+ }{
+ \def\phfnote@dostretch##1{%
+ \renewcommand\baselinestretch{##1}\phfnote@docaptionstretch{##1}}
+ }
+ \@ifpackageloaded{caption}{
+ \def\phfnote@docaptionstretch##1{\captionsetup{font={stretch=##1}}}
+ }{
+ \def\phfnote@docaptionstretch##1{\PackageWarning{phfnote}{Can't
+ set line spacing for captions, because the package `caption'
+ is not loaded. Please load it before `phfnote', or use an
+ appropriate (e.g. `rich') pkgset which loads this package
+ automatically .}}
+ }
+ \if@twocolumn
+ \phfnote@dostretch{1.0} % leave default
+ \emergencystretch=3em\relax
+ \else
+ \ifcase\@ptsize% 10pt
+ \phfnote@dostretch{1.1}
+ \or% 11pt
+ \phfnote@dostretch{1.0} % 1.05? better 1.0...
+ \or% 12pt
+ \phfnote@dostretch{1.0} % 1.03? not really noticeable...
+ \fi
+ \emergencystretch=6em\relax
+ \fi
+}
+\def\phfnote@par@original{%
+}
+\def\phfnote@par@indent{%
+ \parindent=1.5em\relax
+ \parskip=0pt\relax
+}
+\def\phfnote@par@indentminiskip{%
+ \parindent=1.5em\relax
+ \parskip=0.3em plus 0.1em\relax
+}
+\def\phfnote@par@skip{%
+ \parindent=0pt\relax
+ \parskip=0.8em plus 0.2em minus 0.1em\relax
+}
+\def\phfnote@do@par#1{%
+ \ifcsname phfnote@par@#1\endcsname
+ \csname phfnote@par@#1\endcsname
+ \else
+ \PackageWarning{phfnote}{Bad paragraph setting: #1. Leaving original}
+ \fi
+}
+\newcommand{\notesectionallfont}{%
+ \fontfamily{\notesectionallfontfamily}\fontseries{bx}\selectfont}
+\newcommand{\notesectionallfontfamily}{ppl}
+\newcommand{\notesectionfont}{\large}
+\newcommand{\notesubsectionfont}{\normalsize}
+\newcommand{\notesubsubsectionfont}{\small}
+\newcommand{\noteparagraphfont}{\normalsize}
+\newcommand{\notesubparagraphfont}{\normalsize}
+\newcommand{\notesectionsetfonts}[3]{%
+ \renewcommand{\notesectionfont}{#1}%
+ \renewcommand{\notesubsectionfont}{#2}%
+ \renewcommand{\notesubsubsectionfont}{#3}%
+}
+\newcommand{\noteparagraphsetfonts}[2]{%
+ \renewcommand{\noteparagraphfont}{#1}%
+ \renewcommand{\notesubparagraphfont}{#2}%
+}
+\def\phfnote@do@secfmt@section{
+ \RequirePackage{sectsty}
+ \sectionfont{\notesectionallfont\notesectionfont}
+ \subsectionfont{\notesectionallfont\notesubsectionfont}
+ \subsubsectionfont{\notesectionallfont\notesubsubsectionfont}
+}
+\def\phfnote@do@secfmt@paragraph{
+ \RequirePackage{sectsty}
+ \paragraphfont{\notesectionallfont\noteparagraphfont}
+ \subparagraphfont{\notesectionallfont\notesubparagraphfont}
+}
+\def\phfnote@do@secfmt@compact{
+ \notesectionsetfonts{\normalsize}{\small}{\small}
+}
+\def\phfnote@do@secfmt@larger{
+ \notesectionsetfonts{\Large}{\large}{\normalsize}
+}
+
+\def\phfnote@do@secfmt@secsquares{
+ \RequirePackage{amssymb}
+ \let\phfnote@secsquares@old@seccntformat\@seccntformat
+ \def\@seccntformat##1{%
+ \expandafter\ifx\csname ##1\endcsname\section\relax%
+ \unexpanded{\makebox[0pt][r]{\raisebox{0.15ex}{{%
+ \notesmaller[0.6]\ensuremath{\blacksquare}}}%
+ \hspace*{1.2ex}}}%
+ \fi%
+ \phfnote@secsquares@old@seccntformat{##1}}
+}
+\def\phfnote@do@secfmt@secnummargin{
+ \let\phfnote@secnummargin@old@seccntformat\@seccntformat
+ \def\@seccntformat##1{%
+ \protect\makebox[0pt][r]{\phfnote@secnummargin@old@seccntformat{##1}}}
+}
+
+\def\phfnote@do@secfmt@rmfamily{
+ \renewcommand\notesectionallfontfamily{\rmdefault}
+}
+\def\phfnote@do@secfmt@sffamily{
+ \renewcommand\notesectionallfontfamily{\sfdefault}
+}
+\def\phfnote@do@secfmt@itpar{
+ \def\noteparagraphfont{\normalfont\normalsize\itshape}
+ \def\notesubparagraphfont{\normalfont\normalsize\itshape}
+}
+\def\phfnote@do@secfmt@blockpar{
+ \let\phfnote@old@paragraph\paragraph
+ \def\paragraph##1{%
+ \phfnote@old@paragraph{##1}%
+ \hspace*{0pt}\par\nopagebreak% ugly hack!!
+ }
+}
+\def\phfnote@do@secfmt#1{%
+ \phfnote@internal@execattribs{phfnote@do@secfmt@}{section formatting preset}{#1}
+}
+\def\phfnote@do@pkgset@none{
+}
+
+\def\phfnote@do@pkgset@minimal{
+
+ \RequirePackage{amsmath}
+ \RequirePackage{amsfonts}
+ \RequirePackage{amssymb}
+ \RequirePackage{amsthm}
+
+ \RequirePackage{xcolor}
+
+}
+
+\def\phfnote@do@pkgset@rich{
+
+ \phfnote@do@pkgset@minimal
+
+ \RequirePackage{setspace}
+ \RequirePackage{caption}
+
+ \RequirePackage{microtype}
+
+ \PassOptionsToPackage{shortlabels}{enumitem}
+ \RequirePackage{enumitem}
+
+ \RequirePackage{graphicx}
+
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+
+ \PassOptionsToPackage{utf8}{inputenc}
+ \RequirePackage{inputenc}
+}
+
+\def\phfnote@do@pkgset@extended{
+
+ \phfnote@do@pkgset@rich
+
+ \RequirePackage{float}
+
+ \RequirePackage{verbdef}
+
+ \PassOptionsToPackage{autostyle,autopunct=true}{csquotes}
+ \RequirePackage{csquotes}
+
+ \RequirePackage{dsfont}
+ \RequirePackage{bbm}
+ \RequirePackage{mathtools}
+
+}
+\def\phfnote@do@pkgset#1{
+ \phfnote@internal@execattribs{phfnote@do@pkgset@}{package set}{#1}
+}
+\newcommand{\phfnote@do@pdfhyperrefdefs}{%
+ \phfnote@requirecolorpackage%
+ \definecolor{docnotelinkcolor}{rgb}{0,0,0.4}%
+ \RequirePackage{url}%
+ \DeclareUrlCommand\phfnote@format@url{}%
+ \PassOptionsToPackage{bookmarks=true,backref=false}{hyperref}%
+ \RequirePackage{hyperref}%
+ %
+ \hypersetup{unicode=true,%
+ bookmarksnumbered=false,bookmarksopen=false,bookmarksopenlevel=1,%
+ breaklinks=true,pdfborder={0 0 0},colorlinks=true}%
+ \hypersetup{%
+ anchorcolor=docnotelinkcolor,citecolor=docnotelinkcolor,%
+ filecolor=docnotelinkcolor,linkcolor=docnotelinkcolor,%
+ menucolor=docnotelinkcolor,runcolor=docnotelinkcolor,%
+ urlcolor=docnotelinkcolor}%
+ \let\email\phfnote@email%
+ \urlstyle{notesf}%
+}
+\newcommand{\phfnotePdfLinkColor}[1]{%
+ \@ifpackageloaded{xcolor}{%
+ \colorlet{docnotelinkcolor}{#1}%
+ }{% else:
+ \PackageWarning{phfnote}{\protect\phfnotePdfLinkColor may only be
+ used if the package xcolor is loaded.}%
+ }%
+}
+\def\phfnote@sanitize@url{%
+ \catcode`\$12%
+ \catcode`\&12%
+ \catcode`\#12%
+ \catcode`\^12%
+ \catcode`\_12%
+ \catcode`\%12%
+ % \catcode`\^^J10% newline = space
+ % \catcode`\^^M10% newline = space
+ \relax%
+}%
+\providecommand\phfnote@format@url{\texttt}
+\def\phfnote@email{\begingroup\phfnote@sanitize@url\phfnote@impl@email@}%
+\def\phfnote@impl@email@#1{\endgroup\href{mailto:#1}{\phfnote@format@url{#1}}}%
+\def\phfnote@requirecolorpackage{%
+ \@ifpackageloaded{color}{%
+ }{%
+ \@ifpackageloaded{xcolor}{%
+ }{%
+ \RequirePackage{xcolor}%
+ }%
+ }%
+}
+\def\phfnote@do@fontdefs{
+
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+
+ \renewcommand\sfdefault{cmbr}
+
+}
+\newcommand{\phfnote@bibstyle}{naturemagdoi}
+\newcommand{\phfnote@bibfont}{\fontsize{9}{11}\selectfont}
+\let\phfnote@old@bibliography\bibliography
+\let\phfnote@old@bibliographystyle\bibliographystyle
+\newcommand{\phfnote@bibliography}[1]{%
+ \begingroup%
+ \phfnote@bibfont%
+ \phfnote@old@bibliographystyle{\phfnote@bibstyle}%
+ \phfnoteHackSectionStarWithTOC%
+ \catcode`\&=12\relax% normal char
+ \providecommand\eprint[2][]{\href{http://arxiv.org/abs/##2}{arXiv:##2}}
+ \phfnote@old@bibliography{#1}%
+ \endgroup%
+}
+\newcommand{\phfnote@bibliographystyle}[1]{%
+ \renewcommand{\phfnote@bibstyle}{#1}%
+}
+\def\phfnote@do@bibliographydefs{%
+ \let\bibliographystyle\phfnote@bibliographystyle%
+ \let\bibliography\phfnote@bibliography%
+}
+\def\phfnote@do@footnotedefs{
+ \let\phfnote@orig@makefnmark\@makefnmark
+%% \def\@makefnmark{\hbox{\@textsuperscript{%
+%% \normalfont\tiny\fontseries{sb}\selectfont\@thefnmark}}}
+ \def\@makefnmark{\hbox{\@textsuperscript{%
+ \normalfont\tiny\bfseries\@thefnmark}}}
+%% \def\@makefnmark{\hbox{\@textsuperscript{%
+%% \normalfont\scriptsize\bfseries\@thefnmark}}}% too large
+}
+\newcommand\notesmaller[1][\notesmallerfrac]{%
+ \fontsize{#1\dimexpr\f@size pt\relax}{#1\dimexpr\f@baselineskip pt\relax}%
+ \selectfont\ignorespaces%
+}
+\def\notesmallerfrac{0.9}
+\newcommand{\inlinetoc}{%
+ \begingroup%
+ \vspace*{2mm}%
+ \hrule%
+ \vspace*{2mm}%
+ \parskip=1pt\relax%
+ \@starttoc{toc}%
+ \vspace*{4mm}%
+ \hrule%
+ \vspace*{6mm}%
+ \endgroup%
+}
+\def\url@notettstyle{%
+ \def\UrlFont{\ttfamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesfstyle{%
+ \def\UrlFont{\sffamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesfssstyle{%
+ \def\UrlFont{\fontfamily{cmss}\selectfont\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@noteitsfstyle{%
+ \def\UrlFont{\sffamily\itshape\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notermstyle{%
+ \def\UrlFont{\rmfamily\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@noteitstyle{%
+ \def\UrlFont{\itshape\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\url@notesmlstyle{%
+ \def\UrlFont{\notesmaller}%
+ \phfnote@urlstyle@common%
+}
+\def\phfnote@url@tilde{\hbox{\fontfamily{ptm}\selectfont\textasciitilde}}
+%%\def\phfnote@url@tilde{\raise-0.8ex\hbox{%
+%% \kern-0.2ex\fontfamily{cmbr}\selectfont\textasciitilde}}
+\def\phfnote@urlstyle@common{%
+ \def\UrlTildeSpecial{\do\~{\phfnote@url@tilde}}%
+ \let\Url@force@Tilde\UrlTildeSpecial%
+}
+\def\phfnoteHackSectionStarWithTOC{%
+ \let\phfnote@old@section\section%
+ \def\section*##1{\phfnote@old@section*{##1}\addcontentsline{toc}{section}{##1}}%
+}
+\def\phfnoteHackSectionStarWithTOCInCommand#1{%
+ \expandafter\let\csname phfnote@old@\string#1\endcsname#1%
+ \gdef#1{%
+ \begingroup%
+ \phfnoteHackSectionStarWithTOC%
+ \csname phfnote@old@\string#1\endcsname%
+ \endgroup%
+ }%
+}
+\def\phfnoteSaveDefs#1#2{%
+ \csgdef{phfnote@restoredefs@#1}{}%
+ \def\@tmpa{#2}%
+ \@for\next:=\@tmpa\do{%
+ \global\csletcs{phfnote@restoredefs@#1@\next}{\next}%
+ \expandafter\xappto\csname phfnote@restoredefs@#1\endcsname{%
+ \noexpand\csletcs{\next}{phfnote@restoredefs@#1@\next}%
+ }%
+ }%
+}
+\def\phfnoteRestoreDefs#1{%
+ \ifcsname phfnote@restoredefs@#1\endcsname%
+ \csname phfnote@restoredefs@#1\endcsname%
+ \else%
+ \PackageError{phfnote}{\string\phfnoteRestoreDefs: no such
+ definitions stored (#1)}
+ \fi%
+}
+\def\phfverb#1{%
+ \ifx\protect\relax%
+ \phfverbfmt{\detokenize{#1}\unskip}%
+ \else%
+ \noexpand\phfverb{\unexpanded{#1}}%
+ \fi%
+}
+\def\phfverbfmt#1{{\normalfont\texttt{#1}}}
+\SetupKeyvalOptions{
+ family=phfnote,
+ prefix=phfnote@opt@
+}
+\DeclareStringOption[default]{title}
+\DeclareStringOption[]{abstract}
+\DeclareStringOption[rich]{pkgset}
+\DeclareBoolOption[true]{pagegeomdefs}
+\DeclareComplementaryOption{nopagegeomdefs}{pagegeomdefs}
+\DeclareStringOption[default]{pagegeom}
+\DeclareStringOption[section]{secfmt}
+\DeclareStringOption[skip]{par}
+\DeclareBoolOption[true]{spacingdefs}
+\DeclareComplementaryOption{nospacingdefs}{spacingdefs}
+\DeclareBoolOption[true]{fontdefs}
+\DeclareComplementaryOption{nofontdefs}{fontdefs}
+\DeclareBoolOption[true]{footnotedefs}
+\DeclareComplementaryOption{nofootnotedefs}{footnotedefs}
+\DeclareBoolOption[true]{hyperrefdefs}
+\DeclareComplementaryOption{nohyperrefdefs}{hyperrefdefs}
+\DeclareBoolOption[true]{bibliographydefs}
+\DeclareComplementaryOption{nobibliographydefs}{bibliographydefs}
+\define@key{phfnote}{preset}{%
+ \ifcsname phfnote@preset@#1\endcsname%
+ \csname phfnote@preset@#1\endcsname%
+ \else%
+ \PackageError{phfnote}{Unknown preset: `#1'!}{You specified the
+ option 'preset=...' with an invalid value. Please look up the
+ package documentation corresponding to your version of phfnote
+ for possible values.}
+ \fi%
+}
+\DeclareDefaultOption{%
+ \@unknownoptionerror
+}
+\def\phfnote@hook@atendload{}
+\def\phfnote@preset@article{
+ \def\phfnote@opt@title{article}
+ \def\phfnote@opt@par{indent}
+ \def\phfnote@opt@pagegeom{default}
+}
+\newcommand\phfnote@presetcommon@xnote[1][noteitsf]{
+ \def\phfnote@opt@title{default}
+ \def\phfnote@opt@par{skip}
+ \phfnote@opt@pagegeomdefstrue
+ \def\phfnote@opt@pagegeom{wide}
+ \setlength{\footnotesep}{5pt}
+ \g@addto@macro\phfnote@hook@atendload{
+ \ifdefined\urlstyle
+ \urlstyle{#1}
+ \fi
+ }
+}
+\def\phfnote@preset@sfnote{
+ \phfnote@presetcommon@xnote
+ \phfnote@opt@footnotedefstrue
+ \phfnote@opt@fontdefstrue
+ \renewcommand\familydefault{\sfdefault}
+ \renewcommand{\notesectionallfontfamily}{\sfdefault}
+}
+\def\phfnote@preset@sfssnote{
+ \phfnote@preset@sfnote
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \renewcommand\sfdefault{cmss}
+}
+\def\phfnote@preset@opensansnote{
+ \phfnote@preset@sfnote
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \PassOptionsToPackage{default,osfigures,scale=0.9}{opensans}
+ \RequirePackage{opensans}
+}
+\def\phfnote@preset@utopianote{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \RequirePackage{fourier}
+ \renewcommand{\notesectionallfontfamily}{put}
+ \renewcommand{\notetitlefont}{\bfseries}
+ \renewcommand{\sfdefault}{phv}
+}
+\def\phfnote@preset@mnmynote{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@footnotedefsfalse
+ \phfnote@opt@fontdefsfalse
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \renewcommand{\notesectionallfontfamily}{\sfdefault}
+ \g@addto@macro\phfnote@hook@atendload{
+ \RequirePackage{MnSymbol}
+ \PassOptionsToPackage{medfamily,textosf,mathlf,minionint,footnotefigures}{MinionPro}
+ \RequirePackage{MinionPro}
+ \PassOptionsToPackage{medfamily}{MyriadPro}
+ \RequirePackage{MyriadPro}
+ }
+}
+\def\phfnote@preset@pkgdoc{
+ \phfnote@presetcommon@xnote[noteit]
+ \phfnote@opt@fontdefsfalse
+ \phfnote@pkgdoc@setupfont
+ \def\phfnote@opt@secfmt{section,paragraph,itpar,blockpar,larger,secsquares,secnummargin}
+ \def\phfnote@opt@pagegeom{bigmargin}
+ \def\phfnote@opt@abstract{noname}
+}
+\providecommand\phfnote@pkgdoc@setupfont{
+ \PassOptionsToPackage{T1}{fontenc}
+ \RequirePackage{fontenc}
+ \phfnote@pkgdoc@setupmainfont
+ \renewcommand{\notesectionallfontfamily}{put}
+ \renewcommand{\notetitlefont}{\bfseries}
+ \IfFileExists{opensans.sty}{}{\PackageError{phfnote}{Font OpenSans is not
+ available (need `opensans' package)}{Please install the opensans
+ package, which provides the OpenSans font.}}
+ \def\opensans@scale{s*[0.85]}
+ \renewcommand{\sfdefault}{fosj}
+}
+\providecommand\phfnote@pkgdoc@setupmainfont{\RequirePackage{fourier}}
+\def\phfnote@preset@xpkgdoc{
+ \phfnote@preset@pkgdoc
+ \RequirePackage{verbdef}
+ \ifdefined\PrintChanges
+ \phfnoteHackSectionStarWithTOCInCommand\PrintChanges
+ \fi
+ \ifdefined\PrintIndex
+ \phfnoteHackSectionStarWithTOCInCommand\PrintIndex
+ \fi
+ \def\PrintChangesAndIndexSpacing{\vspace{3cm plus 2cm minus 2cm}}
+ \def\PrintChangesAndIndex{\PrintChangesAndIndexSpacing\PrintChanges
+ \PrintChangesAndIndexSpacing\PrintIndex}
+ \ifdefined\c@IndexColumns
+ \setcounter{IndexColumns}{2}
+ \fi
+ \let\phfnote@xpkgdoc@old@theglossary\theglossary
+ \let\phfnote@xpkgdoc@old@endtheglossary\endtheglossary
+ \renewenvironment{theglossary}{%
+ \glossary@prologue%
+ \GlossaryParms \let\item\@idxitem \ignorespaces}
+ {}
+ \phfnote@opt@hyperrefdefsfalse
+ \g@addto@macro\phfnote@hook@atendload{
+ \definecolor{docnotelinkcolor}{rgb}{0,0,0.4}%
+ \RequirePackage{url}%
+ \DeclareUrlCommand\phfnote@format@url{}%
+ \RequirePackage{hypdoc}
+ %
+ \hypersetup{bookmarks=true,backref=false,unicode=true,%
+ bookmarksnumbered=false,bookmarksopen=false,bookmarksopenlevel=1,%
+ breaklinks=true,pdfborder={0 0 0},colorlinks=true}%
+ \hypersetup{%
+ anchorcolor=docnotelinkcolor,citecolor=docnotelinkcolor,%
+ filecolor=docnotelinkcolor,linkcolor=docnotelinkcolor,%
+ menucolor=docnotelinkcolor,runcolor=docnotelinkcolor,%
+ urlcolor=docnotelinkcolor}%
+ \let\email\phfnote@email%
+ \urlstyle{noteit}
+ }
+ \def\pkgname##1{%
+ \pkgnamefmt{##1}%
+ \index{##1=\pkgnamefmt{##1}|hyperpage}%
+ \index{packages:>##1=\pkgnamefmt{##1}|hyperpage}%
+ }
+ \robustify\pkgname
+ \def\pkgnamefmt##1{\textsf{##1}}
+ \robustify\pkgnamefmt
+ \newcounter{phfnotechanged}
+ \newcommand*\changed[4][]{%
+ \if\relax\detokenize{##1}\relax%
+ \changedtextfmt{##2}{##3}{##4}%
+ \changes{##2}{##3}{##4}%
+ \else%
+ \protected@edef\phfnotechanged@tmpa{{##2}{##3}{##4}}%
+ \immediate\write\@auxout{\string\phfnote@changed@set%
+ {##1}{\expandonce\phfnotechanged@tmpa}}%
+ \par\hspace*{0pt}\refstepcounter{phfnotechanged}\label{phfnotechanged:##1}%
+ \begingroup\let\phfnote@changedreftext@par\relax
+ \changedreftext{##1}%
+ \endgroup
+ \changes{##2}{##3}{\hyperref[phfnotechanged:##1]{##4}}%
+ \fi
+ }
+ \def\phfnote@changed@set##1{%
+ \expandafter\gdef\csname phfnote@changed@lbl@##1\endcsname%
+ }
+ \def\phfnote@changedreftext@par{\par}
+ \newcommand*\changedreftext[1]{%
+ \phfnote@changedreftext@par%
+ \ifcsname phfnote@changed@lbl@##1\endcsname
+ \hyperref[phfnotechanged:##1]{%
+ \expandafter\expandafter\expandafter\changedtextfmt%
+ \csname phfnote@changed@lbl@##1\endcsname
+ }
+ \else
+ \hyperref[phfnotechanged:##1]{%
+ \changedtextfmt{???}{???}{[\textbf{missing ref}]}%
+ }%
+ \fi
+ \par
+ }
+ \newcommand*\changedtextfmt[3]{%
+ \textit{Changed in {##1\kern 0.3ex\relax[##2]}:} ##3.
+ }
+ \RequirePackage{enumitem}
+ \newlist{pkgoptions}{description}{1}
+ \setlist[pkgoptions]{font=\pkgoptionfmt[{\vspace*{5pt}}],style=nextline}
+ \apptocmd\pkgoptions{\let\pkgoptions@old@item\item%
+ \def\item{\@ifnextchar[\pkgoptions@item@\pkgoptions@item@@}%]
+ \def\pkgoptions@item@[##1]{\pkgoptions@old@item[{{##1}}]}%
+ \def\pkgoptions@item@@{\PackageWarning{phfnote}{{pkgoptions}: you must
+ specify label to \string\item as \string\item[label].}%
+ \pkgoptions@old@item}%
+ }{}{\PackageWarning{phfnote}{preset xpkgdoc: Failed to patch command
+ \string\pkgoptions}}
+ \def\pkgoptionscombineitem{\leavevmode\vspace{\dimexpr-\baselineskip-\parskip-\itemsep\relax}}
+ \def\metatruefalsearg{\meta{\phfverb{true} $\mid$ \phfverb{false}}}
+ \newcommand\pkgoptionfmt[2][]{%
+ \begingroup\let\meta\pkgoptfmt@meta\fbox{\normalfont\ttfamily ##2}\endgroup%
+ \expandafter\phfnote@pkgdoc@index\expandafter{\@firstofone ##2}%
+ ##1}
+ \let\pkgopt@save@meta\meta
+ \def\pkgoptfmt@meta##1{\begingroup\normalfont\itshape\pkgopt@save@meta{##1}\endgroup}
+ \def\phfnote@pkgdoc@index##1{%
+ \begingroup\lccode`\= = `\,\relax%
+ \def\x{\lowercase{\def\@tmpa{##1}}}%
+ \x%
+ \let\meta\@gobble%
+ \let\marg\@gobble%
+ \let\oarg\@gobble%
+ \let\parg\@gobble%
+ \let\pkgoptattrib\@firstofone%
+ \let\pkgoptattribnodots\@firstofone%
+ \let\pkgoptattribempty\@empty%
+ \def\handleitemindex####1{%
+ \edef\@tmpc{####1}%
+ \if\relax\detokenize\expandafter{\@tmpc}\relax\else%
+ \edef\@tmpb{{\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+ (\pkgoptname)|hyperpage}}%
+ \expandafter\index\@tmpb%
+ \edef\@tmpb{{\packageoptionsname:>\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+|hyperpage}}%
+ \expandafter\index\@tmpb%
+ \fi%
+ }%
+ \def\@tmpc{\forcsvlist{\handleitemindex}}%
+ \expandafter\@tmpc\expandafter{\@tmpa}%
+ \endgroup%
+ }
+ \def\pkgoptname{pkg. opt.}
+ \def\packageoptionsname{package options}
+ \def\cmdoptions{\begingroup\setcmdnotpkgoptions
+ \pkgoptions}
+ \def\endcmdoptions{\endpkgoptions\endgroup}
+ \newcommand\cmdoptionfmt[2][]{\begingroup\setcmdnotpkgoptions
+ \pkgoptionfmt[{##1}]{##2}\endgroup}
+ \def\cmdoptname{cmd. opt.}
+ \def\commandoptionsname{command options}
+ \def\setcmdnotpkgoptions{\let\pkgoptname\cmdoptname
+ \let\packageoptionsname\commandoptionsname
+ \let\fbox\cmdoptionsfbox}
+ \def\cmdoptionsfbox##1{\ensuremath{\underline{{\text{##1}}}}}
+ \def\pkgoptattrib##1{\{##1,...\}}
+ \def\pkgoptattribnodots##1{\{##1\}}
+ \def\pkgoptattribempty{\{\}}
+ \phfnoteSaveDefs{verbatimstuff}{%
+ verbatim,@verbatim,@xverbatim,@sxverbatim,endverbatim}
+ \usepackage{tcolorbox}
+ \newtcolorbox{pkgnote}{
+ colback=blue!5!white,
+ colframe=blue!5!white,
+ coltitle=blue!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={NOTE}
+ }
+ \newtcolorbox{pkgwarning}{
+ colback=red!5!white,
+ colframe=red!5!white,
+ coltitle=red!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={WARNING}
+ }
+ \newtcolorbox{pkgtip}{
+ colback=green!5!white,
+ colframe=green!5!white,
+ coltitle=green!50!black,
+ toptitle=1.5ex,
+ fonttitle=\bfseries,
+ title={TIP}
+ }
+ \phfnoteRestoreDefs{verbatimstuff}
+ \def\phfqitltxPkgTitle##1{The \pkgname{##1} package\thanks{\itshape
+ This document corresponds to \pkgname{##1}~\fileversion, dated \filedate. It
+ is part of the
+ \href{https://github.com/phfaist/phfqitltx/}{\pkgname{phfqitltx}} package
+ suite, see \url{https://github.com/phfaist/phfqitltx}.}}
+ \def\pkgfmtdate##1{%
+ \edef\pkgfmtdate@thedate{##1}%
+ \expandafter\pkgfmtdate@next\pkgfmtdate@thedate\@nil%
+ }
+ \def\pkgfmtdate@next##1/##2/##3\@nil{% YYYY/MM/DD
+ \ifcase ##2 \or January\or February\or March\or April\or May%
+ \or June\or July\or August\or September\or October\or November\or December\fi\space ##3,%
+ \space ##1}
+ \robustify\pkgfmtdate@next
+}
+\def\phfnote@preset@reset{
+ \def\phfnote@opt@pkgset{none}
+ \def\phfnote@opt@title{}
+ \phfnote@opt@pagegeomdefsfalse
+ \phfnote@opt@spacingdefsfalse
+ \def\phfnote@opt@par{original}
+ \def\phfnote@opt@abstract{original}
+ \phfnote@opt@hyperrefdefsfalse
+ \phfnote@opt@fontdefsfalse
+ \def\phfnote@opt@secfmt{}
+ \phfnote@opt@bibliographydefsfalse
+ \phfnote@opt@footnotedefsfalse
+}
+\ProcessKeyvalOptions*
+\phfnote@do@pkgset{\phfnote@opt@pkgset}
+
+\phfnote@do@notetitle{\phfnote@opt@title}
+
+\phfnote@do@noteabstract{\phfnote@opt@abstract}
+
+\phfnote@do@secfmt{\phfnote@opt@secfmt}
+
+\ifphfnote@opt@pagegeomdefs
+ \phfnote@do@pagegeomdefs{\phfnote@opt@pagegeom}
+\fi
+
+\ifphfnote@opt@spacingdefs
+ \phfnote@do@spacing
+\fi
+
+\phfnote@do@par{\phfnote@opt@par}
+
+\ifphfnote@opt@hyperrefdefs
+ \phfnote@do@pdfhyperrefdefs
+\fi
+
+\ifphfnote@opt@fontdefs
+ \phfnote@do@fontdefs
+\fi
+
+\ifphfnote@opt@bibliographydefs
+ \phfnote@do@bibliographydefs
+\fi
+
+\ifphfnote@opt@footnotedefs
+ \phfnote@do@footnotedefs
+\fi
+\phfnote@hook@atendload
+\endinput
+%%
+%% End of file `phfnote.sty'.
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index b29f91ce5e5..e373b014e93 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -450,7 +450,7 @@ my @TLP_working = qw(
pgf pgf-blur pgf-soroban pgf-spectra pgf-umlcd pgf-umlsd
pgfgantt pgfkeyx pgfmolbio
pgfopts pgfornament pgfplots
- phaistos phffullpagefigure philex philokalia philosophersimprint
+ phaistos phffullpagefigure phfnote philex philokalia philosophersimprint
phonetic phonrule photo physics piano picinpar pict2e
pictex pictex2 pictexsum piechartmp piff pigpen
pinlabel pitex pittetd pkfix pkfix-helper pkgloader pkuthss
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 0ac658b261d..afbe546df59 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -769,6 +769,7 @@ depend perltex
depend permute
depend petiteannonce
depend phffullpagefigure
+depend phfnote
depend philex
depend photo
depend piff
diff --git a/Master/tlpkg/tlpsrc/phfnote.tlpsrc b/Master/tlpkg/tlpsrc/phfnote.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/phfnote.tlpsrc