| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2019 by Philippe Faist, [email protected] |
| 4 |
% ------------------------------------------------------- |
| 5 |
% |
| 6 |
% This file may be distributed and/or modified under the |
| 7 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 8 |
% of this license or (at your option) any later version. |
| 9 |
% The latest version of this license is in: |
| 10 |
% |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% |
| 13 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 14 |
% version 2005/12/01 or later. |
| 15 |
% |
| 16 |
% \fi |
| 17 |
% |
| 18 |
% \iffalse |
| 19 |
%<*driver> |
| 20 |
\ProvidesFile{phfnote.dtx} |
| 21 |
%</driver> |
| 22 |
%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01] |
| 23 |
%<package>\ProvidesPackage{phfnote} |
| 24 |
%<*package> |
| 25 |
[2021/10/08 v4.0 phfnote package] |
| 26 |
%</package> |
| 27 |
%<phfnotepreset>%This preset file for phfnote is used when you call `\usepackage[preset=<PRESET NAME>]{phfnote}' |
| 28 |
% |
| 29 |
%<*driver> |
| 30 |
\documentclass{ltxdoc} |
| 31 |
\usepackage{xcolor} |
| 32 |
\usepackage{lipsum} |
| 33 |
\usepackage[preset=xpkgdoc]{phfnote} |
| 34 |
|
| 35 |
\usepackage{needspace} |
| 36 |
|
| 37 |
\makeatletter |
| 38 |
|
| 39 |
% the factor by which to compress macro names in the margin |
| 40 |
\def\phf@xpkgdoc@marginmacronamecompressfactor{0.9} |
| 41 |
|
| 42 |
\newsavebox\phfnoteDocVirtualPage@contents |
| 43 |
\newenvironment{phfnoteDocVirtualPage}{% |
| 44 |
\par% |
| 45 |
\begingroup% |
| 46 |
\makeatletter% |
| 47 |
\begin{lrbox}{\phfnoteDocVirtualPage@contents}% |
| 48 |
\begin{minipage}{12cm}\vspace*{0.5cm}\relax% |
| 49 |
\def\rmdefault{cmr}\def\sfdefault{cmbr}\normalfont% |
| 50 |
\def\shortlipsum{Lorem ipsum dolor sit amet, consectetuer |
| 51 |
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, |
| 52 |
adipiscing vitae, felis. Curabitur dictum gravida |
| 53 |
mauris. Nam arcu libero, nonummy eget, consectetuer id, |
| 54 |
vulputate a, magna.}% |
| 55 |
\def\@title{Notes on Lambda-Majorization}% |
| 56 |
\def\@author{Ph. Faist}% |
| 57 |
\def\@date{23.12.2011}% |
| 58 |
\let\RequirePackage\@gobble% |
| 59 |
\def\notetitletopspace{0pt}% |
| 60 |
\def\notetitlefont{\sffamily\bfseries}% |
| 61 |
\def\morepagecontents{\par\vspace{1em}\centering\ldots}% |
| 62 |
\ignorespaces% |
| 63 |
}% |
| 64 |
{% |
| 65 |
\end{minipage}% |
| 66 |
\end{lrbox}% |
| 67 |
%%\centering% |
| 68 |
\begin{tcolorbox}[text width=6cm,sharp corners,% |
| 69 |
before={\par\vspace{5pt}\centering\nopagebreak\parindent=0pt},after={\par\vspace{5pt}},% |
| 70 |
leftrule=0.4pt,toprule=0.4pt,rightrule=0.6pt,bottomrule=0.6pt,% |
| 71 |
colframe=black,colback=white]% |
| 72 |
\scalebox{0.5}{\usebox{\phfnoteDocVirtualPage@contents}}% |
| 73 |
\end{tcolorbox}% |
| 74 |
%%\par% |
| 75 |
\endgroup% |
| 76 |
} |
| 77 |
|
| 78 |
\def\eqsign@{=} |
| 79 |
\def\eqsign{\protect\eqsign@} |
| 80 |
\robustify\eqsign |
| 81 |
\makeatother |
| 82 |
|
| 83 |
\def\RevTeX{{\small R\raise-0.2ex\hbox{\textsc{ev}}}\TeX} |
| 84 |
|
| 85 |
\EnableCrossrefs |
| 86 |
\CodelineIndex |
| 87 |
\RecordChanges |
| 88 |
|
| 89 |
\begin{document} |
| 90 |
\DocInput{phfnote.dtx} |
| 91 |
\end{document} |
| 92 |
%</driver> |
| 93 |
%<*package> |
| 94 |
% \fi |
| 95 |
% |
| 96 |
% \CheckSum{0} |
| 97 |
% |
| 98 |
% \CharacterTable |
| 99 |
% {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 |
| 100 |
% 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 |
| 101 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 102 |
% Exclamation \! Double quote \" Hash (number) \# |
| 103 |
% Dollar \$ Percent \% Ampersand \& |
| 104 |
% Acute accent \' Left paren \( Right paren \) |
| 105 |
% Asterisk \* Plus \+ Comma \, |
| 106 |
% Minus \- Point \. Solidus \/ |
| 107 |
% Colon \: Semicolon \; Less than \< |
| 108 |
% Equals \= Greater than \> Question mark \? |
| 109 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 110 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 111 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 112 |
% Right brace \} Tilde \~} |
| 113 |
% |
| 114 |
% |
| 115 |
% \changes{v1.0}{2016/04/20}{Initial version} |
| 116 |
% |
| 117 |
% \GetFileInfo{phfnote.dtx} |
| 118 |
% |
| 119 |
% \iffalse Bypass indexing for following commands: \fi |
| 120 |
% \DoNotIndex{\newcommand,\newenvironment,\renewcommand,\long,\def,\edef,\gdef,\xdef,\if,\else,\fi,\par,\relax,\vspace,\vskip,\hspace,\hskip,\vbox,\hbox} |
| 121 |
% |
| 122 |
% \title{\phfqitltxPkgTitle{phfnote}} |
| 123 |
% \author{Philippe Faist\quad\email{[email protected]}} |
| 124 |
% \date{\pkgfmtdate\filedate} |
| 125 |
% \maketitle |
| 126 |
% |
| 127 |
% \begin{abstract} |
| 128 |
% \pkgname{phfnote}---A handy \LaTeX{} package for typesetting short notes and |
| 129 |
% medium-length reports, full of goodies to make it look just right. |
| 130 |
% \end{abstract} |
| 131 |
% |
| 132 |
% \phantomsection\label{sec:toc} |
| 133 |
% \inlinetoc |
| 134 |
% |
| 135 |
% \section{Introduction} |
| 136 |
% |
| 137 |
% Have you ever thought, ``let me write up these short notes using \LaTeX,'' but |
| 138 |
% then disliked the default style of the |article| class? Have you ever asked |
| 139 |
% yourself why half the page should be taken up by the title? Yes? Then |
| 140 |
% welcome to \pkgname{phfnote}. |
| 141 |
% |
| 142 |
% The package \pkgname{phfnote} provides basic formatting for short |
| 143 |
% documents, such as notes on a specific topic, short documentation, or |
| 144 |
% quick memos. It aims to cover all basic needs for such purposes: include |
| 145 |
% a standard set of relevant packages, a nice title which doesn't take up |
| 146 |
% too much space, better page margin sizes, and some basic styling to make |
| 147 |
% the note look nicer. At the same time, it is highly configurable so that |
| 148 |
% nothing is really unchangeable. And all overridden features can be |
| 149 |
% restored individually to their defaults provided by the underlying class. |
| 150 |
% |
| 151 |
% This package has been designed to work optimally along with the |article| |
| 152 |
% document class, but in principle any relatively standard \LaTeX{} class should |
| 153 |
% work. Notes can be typeset in \index{two-column} two-column mode with the |
| 154 |
% |twocolumn| option of for example the |article| class. Settings such as the |
| 155 |
% page margins and font goodies are automatically adapted to look best according |
| 156 |
% to the standard document font size (10pt, 11pt, or 12pt). |
| 157 |
% |
| 158 |
% Be aware that this package is not meant as a full-fledged formatting class for |
| 159 |
% complicated articles. For that, you should use a specialized class such as |
| 160 |
% \RevTeX.\footnote{See \url{https://journals.aps.org/revtex}} |
| 161 |
% |
| 162 |
% In the following, we detail individual features of this package, and explain |
| 163 |
% how to activate, deactivate, and customize them. |
| 164 |
% |
| 165 |
% |
| 166 |
% \section{Basic Usage} |
| 167 |
% |
| 168 |
% \subsection{Loading the Package} |
| 169 |
% |
| 170 |
% You can get started with the minimal template: |
| 171 |
% |
| 172 |
% \begin{verbatim} |
| 173 |
% \documentclass[11pt,a4paper]{article} |
| 174 |
% \usepackage{phfnote} |
| 175 |
% |
| 176 |
% \begin{document} |
| 177 |
% \title{Title of my notes} |
| 178 |
% \author{Me} |
| 179 |
% \date{\today} |
| 180 |
% \maketitle |
| 181 |
% |
| 182 |
% ... |
| 183 |
% |
| 184 |
% \end{document} |
| 185 |
% \end{verbatim} |
| 186 |
% |
| 187 |
% The package \pkgname{phfnote} introduces its default note formatting |
| 188 |
% style, with a more compact title, and some formatting adjustments in the |
| 189 |
% text and section headings. |
| 190 |
% |
| 191 |
% \subsection{Presets} |
| 192 |
% \label{sec:presets} |
| 193 |
% |
| 194 |
% There are a number of package options which can be provided to activate, |
| 195 |
% deactivate or adjust the formatting. The most straightforward way of changing |
| 196 |
% the formatting is to use \emph{presets}. |
| 197 |
% |
| 198 |
% Presets are processed immediately when given in the package option list, |
| 199 |
% meaning that their position in the list is meaningful. For example, the |
| 200 |
% option list |
| 201 |
% \begin{verbatim} |
| 202 |
% \usepackage[title=small,preset=article,par=skip]{phfnote} |
| 203 |
% \end{verbatim} |
| 204 |
% will set |title=small| only if it is not overridden by the |article| preset, |
| 205 |
% but will enforce |par=skip| in any case. You may in theory load several |
| 206 |
% presets, e.g. |preset=sfnote,preset=article|, but this is essentially useless |
| 207 |
% since presets tend to set a wide range of settings such that in any case the |
| 208 |
% last preset specified is effectively applied. |
| 209 |
% |
| 210 |
% First, there is a set of presets which are different alternative ``note'' |
| 211 |
% styles. All the following define the note to have spacing between paragraphs |
| 212 |
% and no first line indentation, use the default note title style, and use a |
| 213 |
% wider page geometry. |
| 214 |
% |
| 215 |
% \begin{pkgoptions} |
| 216 |
% \item[preset=sfnote] {\fontfamily{cmbr}\selectfont Format the note in \LaTeX' |
| 217 |
% sans-serif ``Computer Modern Bright'' font. This is a nice, light, font for |
| 218 |
% short notes, but I find it more difficult to read at smaller font sizes or |
| 219 |
% in longer paragraphs.} |
| 220 |
% \item[preset=sfssnote] {\fontfamily{cmss}\selectfont Format the note in |
| 221 |
% \LaTeX' default sans-serif font. A very nice sans serif font. It might |
| 222 |
% look heavy though, depending on your taste.} |
| 223 |
% \item[preset=opensansnote] {\opensans Format the note |
| 224 |
% in Open Sans font (using the `\pkgname{opensans}' package with some |
| 225 |
% default options). A very beautiful and readable sans serif font.} |
| 226 |
% \item[preset=utopianote] {\fontfamily{futs}\selectfont Format the note in |
| 227 |
% Utopia font (by using the \pkgname{fourier} package). Perfect to my |
| 228 |
% taste for documenting code for example, but I find it a bit heavy for |
| 229 |
% scientific documents.} |
| 230 |
% \item[preset=mnmynote] Format the note in Minion Pro font, with sans |
| 231 |
% serif text formatted with the Myriad Pro font (professional fonts by |
| 232 |
% Adobe which can be used in \LaTeX{} with the \pkgname{MinionPro} and |
| 233 |
% \pkgname{MyriadPro} packages\footnote{See |
| 234 |
% \url{https://github.com/sebschub/FontPro}; the fonts themselves ship |
| 235 |
% with some Adobe products}). These beautiful fonts can be used for any |
| 236 |
% purpose. |
| 237 |
% \end{pkgoptions} |
| 238 |
% |
| 239 |
% Based essentially on |utopianote|, the preset |pkgdoc| sets up the |
| 240 |
% document to look nice for a \LaTeX{} package documentation. The preset |
| 241 |
% |xpkgdoc| adds additional definitions to aid in documenting \LaTeX{} |
| 242 |
% packages on top of |pkgdoc|. |
| 243 |
% \begin{pkgoptions} |
| 244 |
% \item[preset=pkgdoc] Basic formatting and settings for documenting \LaTeX{} |
| 245 |
% packages. This preset was used for the current document. |
| 246 |
% \item[preset=xpkgdoc] Same as |preset=pkgdoc|, but in addition a set of useful |
| 247 |
% commands are also provided, the \pkgname{tcolorbox} package is loaded along |
| 248 |
% with some default boxes. Also some commands are patched to achieve some |
| 249 |
% fixes. This preset is used for the documentation of packages in the |
| 250 |
% \pkgname{phfqitltx} package suite. (For details see the implementation of |
| 251 |
% the |xpkgdoc| preset in \autoref{sec:impl-xpkgdoc}.) |
| 252 |
% \end{pkgoptions} |
| 253 |
% |
| 254 |
% |
| 255 |
% The following preset makes the document look more like an article. There are |
| 256 |
% some slight minor differences with respect to the default |article| class' |
| 257 |
% title in the choice of formatting the title and text. |
| 258 |
% |
| 259 |
% \begin{pkgoptions} |
| 260 |
% \item[preset=article] Sets a more title style closer to |article|'s default |
| 261 |
% title style (but slightly more compact) and sets paragraphs to indent with |
| 262 |
% no skip. |
| 263 |
% \end{pkgoptions} |
| 264 |
% |
| 265 |
% The last preset, |reset|, guarantees that including this package is |
| 266 |
% non-invasive, meaning that only new \LaTeX{} macros are made available without |
| 267 |
% altering any appearance. This is useful if you want to use a small feature |
| 268 |
% provided by this package, but you already have all the page geometry, title, |
| 269 |
% etc.\@ set up and want to make sure those aren't touched. |
| 270 |
% |
| 271 |
% \begin{pkgoptions} |
| 272 |
% \item[preset=reset] Deactivates all features of this package by default. |
| 273 |
% Individual settings can still later be switched on via specific package |
| 274 |
% options. Use this to activate only a specific set of features: |
| 275 |
% |[preset=reset,...]| will ensure that only the additional given features are |
| 276 |
% set. |
| 277 |
% |
| 278 |
% This is safer than deactivating individually all other features, because in |
| 279 |
% the future we may add new features which may be on by default. In this |
| 280 |
% case, the preset |reset| will guarantee all features to be deactivated. |
| 281 |
% \end{pkgoptions} |
| 282 |
% |
| 283 |
% |
| 284 |
% |
| 285 |
% |
| 286 |
% \section{Summary of Package Options} |
| 287 |
% \label{sec:package-options} |
| 288 |
% |
| 289 |
% \begin{pkgoptions} |
| 290 |
% \item[preset=\meta{preset name}] Load a preset specifying a predefined set of |
| 291 |
% options for the general appearance of the document. See documentation in |
| 292 |
% \autoref{sec:presets} |
| 293 |
% \item[title=\meta{title style},notitle] Set the title style. Use |
| 294 |
% \pkgoptionfmt{notitle} to disable feature and use latex default. |
| 295 |
% Documentation in \autoref{sec:title-styles} |
| 296 |
% \item[abstract=\meta{abstract attributes},noabstract] Set the abstract style by |
| 297 |
% specifying a comma-separated list of attributes. Don't forget to |
| 298 |
% put the list of attributes within braces, |
| 299 |
% |[abstract={wide,noname,it}]|. Documentation in |
| 300 |
% \autoref{sec:abstract-attributes} |
| 301 |
% \item[pkgset=\meta{package set}] Specify a standard set of \LaTeX{} |
| 302 |
% packages to load. See \autoref{sec:package-sets}. |
| 303 |
% \item[pagegeom=\meta{geom style},nopagegeom] Set a page margin style. Use |nopagegeom| |
| 304 |
% to leave page geometry unchanged. Options are documented in |
| 305 |
% \autoref{sec:pagegeomdefs}. |
| 306 |
% \item[secfmt=\meta{section formatting attributes},nosecfmt] A list of |
| 307 |
% attributes defining how section (and possibly paragraph) headings should |
| 308 |
% look like. See \autoref{sec:secfmt}. |
| 309 |
% \item[par=\meta{par style},nopar] Define how paragraphs should be spaced. |
| 310 |
% Refer to \autoref{sec:par-defs}. |
| 311 |
% \item[spacingdefs,nospacingdefs] Adjust spacing of lines and words |
| 312 |
% (\autoref{sec:spacingdefs}). |
| 313 |
% \item[fontdefs,nofontdefs] Adjust some fonts (\autoref{sec:fontdefs}). |
| 314 |
% \item[footnotedefs,nofootnotedefs] Adjust slightly the appearance of |
| 315 |
% footnotes. See \autoref{sec:footnotedefs}. |
| 316 |
% \item[hyperrefdefs=\meta{settings},nohyperrefdefs] Load the \pkgname{hyperref} |
| 317 |
% package, and set some defaults settings. See \autoref{sec:hyperrefdefs}. |
| 318 |
% \item[bibliographydefs,nobibliographydefs] Adjust the appearance and style of |
| 319 |
% the bibliography. See \autoref{sec:bibliographydefs}. |
| 320 |
% \end{pkgoptions} |
| 321 |
% |
| 322 |
% \begin{pkgtip} |
| 323 |
% To activate only a subset of features, use \pkgoptionfmt{preset=reset} and then |
| 324 |
% enable only the features required. In this way, you can ensure that only those |
| 325 |
% features which are explicitly specified are enabled. |
| 326 |
% \end{pkgtip} |
| 327 |
% |
| 328 |
% |
| 329 |
% \section{Features} |
| 330 |
% |
| 331 |
% This package provides a large collection of small features, which, put all |
| 332 |
% together, make the document look nicer (hopefully). Let's go through these |
| 333 |
% features, one by one. |
| 334 |
% |
| 335 |
% Note also that some features provided in the presets, such changing the |
| 336 |
% document font, are not provided as individual features here. This is because |
| 337 |
% they may be set and customized directly using few lines of \LaTeX{} code or |
| 338 |
% directly by including an external package. In those cases, you may have a |
| 339 |
% look at the preset's definition for inspiration (see \autoref{impl:presets}). |
| 340 |
% |
| 341 |
% For a summary of package options, see \autoref{sec:package-options}. |
| 342 |
% |
| 343 |
% |
| 344 |
% \subsection{Title Formatting} |
| 345 |
% |
| 346 |
% \subsubsection{Title Styles} |
| 347 |
% \label{sec:title-styles} |
| 348 |
% \label{sec:main-default-title-style} |
| 349 |
% |
| 350 |
% The \pkgname{phfnote} package allows a set of alternative title styles. |
| 351 |
% By default, the |default| title style is used. You may change this |
| 352 |
% setting with the |title=...| package option. |
| 353 |
% |
| 354 |
% \begin{pkgoptions} |
| 355 |
% \item[title=default] The default title style displays the title in large bold |
| 356 |
% sans serif font, left-aligned. Below the title appears the information |
| 357 |
% about author and date, indented, followed by a horizontal rule. It looks |
| 358 |
% like this: |
| 359 |
% \begin{phfnoteDocVirtualPage} |
| 360 |
% \notetitle@style@default\null \shortlipsum \morepagecontents |
| 361 |
% \end{phfnoteDocVirtualPage} |
| 362 |
% As you can see, it saves more space on the page compared to the default |
| 363 |
% article title. |
| 364 |
% |
| 365 |
% \changed[chg-title-default-spacing]{v3.0}{2018/10/25}{The default title |
| 366 |
% style was redesigned to improved spacing of the elements in all cases |
| 367 |
% including multiline titles, author and/or date not specified, and presence |
| 368 |
% or absence of thanks notes. Use \texttt{title\eqsign defaultv1} |
| 369 |
% for old behavior} |
| 370 |
% |
| 371 |
% If you would like your document to appear exactly as with \pkgname{phfnote} |
| 372 |
% version 1.0, then you can set the special title style |title=defaultv1|. |
| 373 |
% |
| 374 |
% \item[title=pretty,title=pretty2] A prettier, fancier title style. The title |
| 375 |
% is centered, with two side bars providing a visual guide. The |pretty| |
| 376 |
% style looks like this: |
| 377 |
% \begin{phfnoteDocVirtualPage} |
| 378 |
% \notetitle@stylesetup@pretty |
| 379 |
% \notetitle@style@pretty\null \shortlipsum \morepagecontents |
| 380 |
% \end{phfnoteDocVirtualPage} |
| 381 |
% And the |pretty2| style looks like this: |
| 382 |
% \begin{phfnoteDocVirtualPage} |
| 383 |
% \csname notetitle@stylesetup@pretty2\endcsname |
| 384 |
% \csname notetitle@style@pretty2\endcsname\null \shortlipsum \morepagecontents |
| 385 |
% \end{phfnoteDocVirtualPage} |
| 386 |
% |
| 387 |
% \changed[chg-title-add-style-pretty]{v3.0}{2018/10/25}{Added the |
| 388 |
% \phfverb{pretty} and \phfverb{pretty2} title styles} |
| 389 |
% |
| 390 |
% This title style is highly customizable (see below), in fact the |pretty2| |
| 391 |
% style is an alias for the |pretty| style, with adjusted settings. |
| 392 |
% |
| 393 |
% These styles require the |xcolor| package (it will be loaded automatically). |
| 394 |
% |
| 395 |
% \item[title=small] A smaller title style which displays all the relevant |
| 396 |
% information on a single line. This is useful for when even the default |
| 397 |
% title style appears too large. It looks like this: |
| 398 |
% \begin{phfnoteDocVirtualPage} |
| 399 |
% \notetitle@stylesetup@small |
| 400 |
% \notetitle@style@small\null \shortlipsum \morepagecontents |
| 401 |
% \end{phfnoteDocVirtualPage} |
| 402 |
% |
| 403 |
% \item[title=article] Mimics the default title style from the |article| class, |
| 404 |
% but saves a little more space. It looks like this: |
| 405 |
% \begin{phfnoteDocVirtualPage} |
| 406 |
% \notetitle@stylesetup@article |
| 407 |
% \notetitle@style@article\null \shortlipsum \morepagecontents |
| 408 |
% \end{phfnoteDocVirtualPage} |
| 409 |
% |
| 410 |
% \changed[chg-title-article-spacing]{v3.0}{2018/10/26}{The \phfverb{article} |
| 411 |
% title style was redesigned to use our new title engine, with improved |
| 412 |
% spacing of the elements in all cases including multiline titles, author |
| 413 |
% and/or date not specified, and presence or absence of thanks notes. |
| 414 |
% Use \texttt{title\eqsign articlev1} for old behavior} |
| 415 |
% |
| 416 |
% If you would like your document to appear exactly as with \pkgname{phfnote} |
| 417 |
% version 1.0, then you can set the special title style |title=articlev1|. |
| 418 |
% |
| 419 |
% \item[notitle] Also equivalently, |title=false|. Instructs \pkgname{phfnote} |
| 420 |
% not to override any title definition, thus preserving the default class |
| 421 |
% title style. |
| 422 |
% |
| 423 |
% Beware that some other title goodies, such as our more advanced |\thanks| |
| 424 |
% notes, or spacing adjustments for the abstract, will probably not work. |
| 425 |
% |
| 426 |
% For compatibility with previous versions of |phfnote|, you may also specify |
| 427 |
% an empty option value ``|title=|''. |
| 428 |
% \end{pkgoptions} |
| 429 |
% |
| 430 |
% \begin{pkgtip} |
| 431 |
% When using the |default| and |pretty*| title styles, the argument to |
| 432 |
% |\title| may contain blank lines. In this case, each part is typeset on a |
| 433 |
% separate line with an appropriate spacing. For instance: |
| 434 |
% \begin{verbatim} |
| 435 |
% \title{Letter of Motivation |
| 436 |
% |
| 437 |
% John Doe} |
| 438 |
% \end{verbatim} |
| 439 |
% will be typeset as |
| 440 |
% \begin{phfnoteDocVirtualPage} |
| 441 |
% \expandafter\def\csname @title\endcsname{Letter of Motivation\par John Doe} |
| 442 |
% \expandafter\def\csname @author\endcsname{} |
| 443 |
% \expandafter\def\csname @date\endcsname{} |
| 444 |
% \notetitle@style@default\null \morepagecontents |
| 445 |
% \end{phfnoteDocVirtualPage} |
| 446 |
% \end{pkgtip} |
| 447 |
% |
| 448 |
% \changed[chg-title-false-pkgoption]{v3.0}{2018/10/16}{Improved |
| 449 |
% \phfverb{title,notitle} package options syntax} |
| 450 |
% |
| 451 |
% \subsubsection{Customizing the style of the \phfverb{default}, \phfverb{pretty} |
| 452 |
% and \phfverb{small} title styles} |
| 453 |
% \label{sec:title-styles-customization} |
| 454 |
% |
| 455 |
% You may customize the appearance of the |default| and |small| title styles by |
| 456 |
% overriding some macros. |
| 457 |
% |
| 458 |
% \needspace{3\baselineskip} |
| 459 |
% \DescribeMacro{\notetitlefont}\DescribeMacro{\notetitleauthorfont} |
| 460 |
% \DescribeMacro{\notetitledatefont} The macros |
| 461 |
% |\notetitlefont|, |\notetitleauthorfont|, and |\notetitledatefont| set the |
| 462 |
% default main font title, author text and date text. You may override these |
| 463 |
% settings with, for instance: |
| 464 |
% \begin{verbatim} |
| 465 |
% \renewcommand{\notetitlefont}[1]{\sffamily\bfseries #1} |
| 466 |
% \renewcommand{\notetitleauthorfont}[1]{\itshape #1} |
| 467 |
% \renewcommand{\notetitledatefont}[1]{\footnotesize #1} |
| 468 |
% \end{verbatim} |
| 469 |
% In these macros, the parameter is expanded to the value provided by |\title|, |
| 470 |
% |\author|, and |\date|, respectively.\footnote{While you can normally define |
| 471 |
% \string\notetitlefont, \string\notetitleauthorfont\space and |
| 472 |
% \string\notetitledatefont\space without an explicit parameter, this might |
| 473 |
% produce some unexpected errors in some cases since some title styles (for |
| 474 |
% technical details see implementation of the \texttt{article} title style).} |
| 475 |
% |
| 476 |
% The spacing of the title may be adjusted with the macros |
| 477 |
% \DescribeMacro{\notetitlebelowspace} |\notetitlebelowspace| and |
| 478 |
% \DescribeMacro{\notetitletopspace} |\notetitletopspace|. Override these with |
| 479 |
% e.g.: |
| 480 |
% \begin{verbatim} |
| 481 |
% \renewcommand{\notetitlebelowspace}{4mm} |
| 482 |
% \renewcommand{\notetitletopspace}{-1.2cm} |
| 483 |
% \end{verbatim} |
| 484 |
% Finally, you may override the command \DescribeMacro{\notetitlehrule} |
| 485 |
% |\notetitlehrule| which draws the rule below the title: |
| 486 |
% \begin{verbatim} |
| 487 |
% \renewcommand{\notetitlehrule}{\hrule height 0.8pt} |
| 488 |
% \end{verbatim} |
| 489 |
% |
| 490 |
% \DescribeMacro{\notetitleusempfootnotestrue} |
| 491 |
% \DescribeMacro{\notetitleusempfootnotesfalse} The commands |
| 492 |
% |\notetitleusempfootnotestrue| and |\notetitleusempfootnotesfalse| set |
| 493 |
% respectively whether any |\thanks| commands in the title generate footnotes |
| 494 |
% inside the title area (which is drawn within a minipage), i.e., all thanks |
| 495 |
% notes are collected on an additional line below the date, or whether they |
| 496 |
% appear as regular footnotes at the bottom of the page. Simply call the |
| 497 |
% relevant command to set either setting (don't redefine these). |
| 498 |
% |
| 499 |
% |
| 500 |
% The |small| title style allows you to customize the separator between the |
| 501 |
% author and the date: |
| 502 |
% \begin{verbatim} |
| 503 |
% \renewcommand\notetitlesmallauthordatesep{\hspace*{0.5em}\cdot\hspace*{0.5em}} |
| 504 |
% \end{verbatim} |
| 505 |
% |
| 506 |
% |
| 507 |
% In addition to the above settings for the default title style, the |pretty| |
| 508 |
% and |pretty2| styles provide a few macros that you can adjust some visual |
| 509 |
% aspects to your needs: |
| 510 |
% \begin{verbatim} |
| 511 |
% \renewcommand\notetitleprettylsiderulewidth{10pt} |
| 512 |
% \renewcommand\notetitleprettylsidespacewidth{10pt} |
| 513 |
% \renewcommand\notetitleprettyrsiderulewidth{10pt} |
| 514 |
% \renewcommand\notetitleprettyrsidespacewidth{10pt} |
| 515 |
% \renewcommand\notetitleprettytopspace{10pt} |
| 516 |
% \renewcommand\notetitleprettybottomspace{10pt} |
| 517 |
% \renewcommand\notetitleprettytophrulewidth{0pt} |
| 518 |
% \renewcommand\notetitleprettybottomhrulewidth{0pt} |
| 519 |
% |
| 520 |
% \colorlet{notetitleprettylsiderulecolor}{blue!40!black} |
| 521 |
% \colorlet{notetitleprettyrsiderulecolor}{notetitleprettylsiderulecolor} |
| 522 |
% \colorlet{notetitleprettytophrulecolor}{notetitleprettylsiderulecolor} |
| 523 |
% \colorlet{notetitleprettybottomhrulecolor}{notetitleprettylsiderulecolor} |
| 524 |
% \colorlet{notetitleprettytextcolor}{blue!20!black} |
| 525 |
% \colorlet{notetitleprettybgcolor}{white!95!blue} |
| 526 |
% \end{verbatim} |
| 527 |
% |
| 528 |
% |
| 529 |
% \subsubsection{Title notes: \phfverb\thanks{} and \phfverb\thanksmark} |
| 530 |
% |
| 531 |
% \DescribeMacro{\thanks} |
| 532 |
% Notes in the title can be introduced with the |\thanks| macro. You may use |
| 533 |
% this to specify an e-mail address, an affiliation, or any other more specific |
| 534 |
% information. |\thanks| may appear in all three title, authors and date. |
| 535 |
% |
| 536 |
% The appearance of this additional information depends on the title style. In |
| 537 |
% the default note title style, such thanks-notes appear directly below the |
| 538 |
% title. For example, with |
| 539 |
% {\ttfamily|\|author\{Ph.\@ Faist|\|thanks\{|\|itshape Institute for Theoretical Physics, ETH Zurich\}\}}, you get: |
| 540 |
% \begin{phfnoteDocVirtualPage} |
| 541 |
% \author{Ph. Faist\thanks{\itshape Institute for Theoretical Physics, ETH Zurich}}\relax |
| 542 |
% \notetitle@style@default\null \morepagecontents |
| 543 |
% \end{phfnoteDocVirtualPage} |
| 544 |
% whereas with the other styles, this information is typeset as regular footnotes. |
| 545 |
% |
| 546 |
% \leavevmode\PrintMarginLabel{\string\thanks[N]}\relax |
| 547 |
% You may specify an optional argument to |\thanks|, forcing the footnote to a |
| 548 |
% specific number (it must be a number). For example, with |
| 549 |
% {\ttfamily|\|author\{Ph.\@ Faist|\|thanks[9]\{|\|itshape Institute for |
| 550 |
% Theoretical Physics, ETH Zurich\}\}}, you get: |
| 551 |
% \begin{phfnoteDocVirtualPage} |
| 552 |
% \author{Ph. Faist\thanks[9]{\itshape Institute for Theoretical Physics, ETH Zurich}}\relax |
| 553 |
% \notetitle@style@default\null \morepagecontents |
| 554 |
% \end{phfnoteDocVirtualPage} |
| 555 |
% |
| 556 |
% \DescribeMacro{\thanksmark} |\thanksmark[N]| works with |\thanks| as |
| 557 |
% |\footnotemark| works with |\footnote|. It just displays the given number as |
| 558 |
% a footnote mark. In this way, you can have for example several shared |
| 559 |
% affiliations: |
| 560 |
% \begin{phfnoteDocVirtualPage} |
| 561 |
% \title{Notes about Stuff} |
| 562 |
% \date{25.12.2015} |
| 563 |
% \author{First Author\thanks[1]{\itshape Institute ABC}, Second Author\thanks[2]{\itshape Somewhere else}, |
| 564 |
% and Third Author\thanksmark[1]}\relax |
| 565 |
% \notetitle@style@default\null \morepagecontents |
| 566 |
% \end{phfnoteDocVirtualPage} |
| 567 |
% the author code was: |
| 568 |
% \begin{verbatim} |
| 569 |
% \author{First Author\thanks[1]{\itshape Institute ABC}, |
| 570 |
% Second Author\thanks[2]{\itshape Somewhere else}, |
| 571 |
% and Third Author\thanksmark[1]} |
| 572 |
% \end{verbatim} |
| 573 |
% |
| 574 |
% Unfortunately, you still have to provide the numbering manually. On the other |
| 575 |
% hand, this package is not meant to replace \RevTeX, so if you're writing a |
| 576 |
% complicated article with many authors and affiliations, you probably shouldn't |
| 577 |
% be using \pkgname{phfnote} in the first place. |
| 578 |
% |
| 579 |
% \begin{pkgwarning} |
| 580 |
% The optional argument to |\thanks|, as well as the command |\thanksmark|, |
| 581 |
% are not made available if you don't use one of \pkgname{phfnote}'s title |
| 582 |
% styles. |
| 583 |
% |
| 584 |
% This behavior is such as to prevent interference with more advanced class |
| 585 |
% mechanisms, such as \RevTeX's. |
| 586 |
% \end{pkgwarning} |
| 587 |
% |
| 588 |
% \begin{pkgtip} |
| 589 |
% For \pkgname{phfnote}'s title styles, you can issue the commands |
| 590 |
% |\notetitleusempfootnotestrue| or |\notetitleusempfootnotesfalse| |
| 591 |
% (documentation in \autoref{sec:title-styles-customization}) to decide |
| 592 |
% whether the thanks notes are issued in a separate title line, or if they are |
| 593 |
% displayed as regular footnotes at the bottom of the page. |
| 594 |
% \end{pkgtip} |
| 595 |
% |
| 596 |
% |
| 597 |
% \subsection{Abstract} |
| 598 |
% \label{sec:abstract-attributes} |
| 599 |
% |
| 600 |
% \DescribeEnv{abstract} The |abstract| environment renders indented text aimed |
| 601 |
% to provide a short summary of the document. We might use, for example, the |
| 602 |
% following code: |
| 603 |
% \begin{verbatim} |
| 604 |
% \begin{abstract} |
| 605 |
% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus |
| 606 |
% elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 607 |
% Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, |
| 608 |
% consectetuer id, vulputate a, magna. |
| 609 |
% \end{abstract} |
| 610 |
% \end{verbatim} |
| 611 |
% |
| 612 |
% which would look like this: |
| 613 |
% \begin{phfnoteDocVirtualPage} |
| 614 |
% \title{Notes about Stuff}\relax |
| 615 |
% \date{25.12.2015}\relax |
| 616 |
% \author{Me}\relax |
| 617 |
% \notetitle@style@default |
| 618 |
% \def\noteabstract@nameline{{\parskip=0pt\relax\par\centering\noteabstractnamefont\abstractname\par}\vskip 1ex\relax}% |
| 619 |
% \def\noteabstracttextwidth{0.8\textwidth}% |
| 620 |
% \begin{abstract} |
| 621 |
% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus |
| 622 |
% elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 623 |
% Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, |
| 624 |
% consectetuer id, vulputate a, magna. |
| 625 |
% \end{abstract} |
| 626 |
% \morepagecontents |
| 627 |
% \end{phfnoteDocVirtualPage} |
| 628 |
% |
| 629 |
% The |abstract| environment should be given \emph{after} the |\maketitle| |
| 630 |
% command. (In contrast to, e.g., \RevTeX.) |
| 631 |
% |
| 632 |
% You may customize the appearance of the abstract via a list of attributes |
| 633 |
% given as argument to a package option. When you combine arguments, make sure |
| 634 |
% to put them in a braced group: |[abstract={wide,noname,it}]|. |
| 635 |
% |
| 636 |
% \begin{pkgoptions} |
| 637 |
% \item[abstract=\pkgoptattrib{wide}] The abstract should not be indented, and |
| 638 |
% should instead be aligned to the rest of the text. |
| 639 |
% \item[abstract=\pkgoptattrib{narrow}] The abstract should be indented narrower |
| 640 |
% then by default. |
| 641 |
% \item[abstract=\pkgoptattrib{noname}] The title ``Abstract.'' above the text |
| 642 |
% will not be typeset. The abstract text is typeset directly instead. |
| 643 |
% \item[abstract=\pkgoptattrib{small}] Use a smaller font for the abstract text |
| 644 |
% (|\small| font). |
| 645 |
% \item[abstract=\pkgoptattrib{compact}] Reduce spacing before and after the |
| 646 |
% abstract. If the abstract is short, this might look slightly better. |
| 647 |
% \item[abstract=\pkgoptattrib{it}] Typeset the abstract text using an italic |
| 648 |
% typeface. |
| 649 |
% \item[noabstract] Do not (re)define the |abstract| environment, do not execute |
| 650 |
% abstract definitions. This leaves the original |abstract| environment |
| 651 |
% definition of the underlying \LaTeX{} class. You can also equivalently say |
| 652 |
% |abstract=false|. |
| 653 |
% \end{pkgoptions} |
| 654 |
% |
| 655 |
% |
| 656 |
% The abstract environment's appearance can be customized more finely |
| 657 |
% by redefining some macros. (In fact, this is what the package |
| 658 |
% options |abstract=...| actually do.) The font used for the text of |
| 659 |
% the abstract is set by \DescribeMacro{\noteabstracttextfont} |
| 660 |
% |\noteabstracttextfont|. This macro should expand to font selection |
| 661 |
% commands, such as |\itshape|, |\bfseries|, |\small|, etc. The title |
| 662 |
% of the abstract (the word ``Abstract.\@'') is typeset in the font set |
| 663 |
% by \DescribeMacro\noteabstractnamefont |\noteabstractnamefont|. The |
| 664 |
% width of the whole abstract text is determined by |
| 665 |
% \DescribeMacro{\noteabstracttextwidth} |\noteabstracttextwidth|. |
| 666 |
% Observe that |\noteabstracttextwidth| is a macro, and not a proper |
| 667 |
% length, so that it can determine more dynamically the length. The |
| 668 |
% spacing below \DescribeMacro{\noteabstractafterspacing} |
| 669 |
% (|\noteabstractafterspacing|) and above |
| 670 |
% \DescribeMacro{\noteabstractbeforespacing} |
| 671 |
% (|\noteabstractbeforespacing|) the abstract can further be |
| 672 |
% specified, also as macros. |
| 673 |
% |
| 674 |
% |
| 675 |
% Obsolete options: |
| 676 |
% \begin{pkgoptions} |
| 677 |
% \item[abstract=\pkgoptattrib{original}] Revert to the original class' default |
| 678 |
% implementation of the |abstract| environment before \pkgname{phfnote} was |
| 679 |
% loaded. The original class' implementation is restored and no longer |
| 680 |
% tampered with. This option is OBSOLETE, use |noabstract| instead. |
| 681 |
% \end{pkgoptions} |
| 682 |
% |
| 683 |
% \changed[chg-noabstract-pkgoption]{v3.0}{2018/10/16}{Improved |
| 684 |
% \phfverb{abstract,noabstract} package options syntax} |
| 685 |
% |
| 686 |
% \subsection{Table of Contents} |
| 687 |
% \label{sec:inline-toc} |
| 688 |
% |
| 689 |
% \DescribeMacro{\inlinetoc} The package \pkgname{phfnote} also provides a |
| 690 |
% table of contents typeset with reduced spacing to be more compact, and |
| 691 |
% with horizontal rules before and after. You can insert the table of |
| 692 |
% contents with the command |\inlinetoc|. It looks like this: |
| 693 |
% |
| 694 |
% \begin{phfnoteDocVirtualPage} |
| 695 |
% \title{Notes about Stuff}\relax |
| 696 |
% \date{25.12.2015}\relax |
| 697 |
% \author{Me}\relax |
| 698 |
% \notetitle@style@default |
| 699 |
% \def\noteabstract@nameline{{\parskip=0pt\relax\par\centering\noteabstractnamefont\abstractname\par}\vskip 1ex\relax}% |
| 700 |
% \def\noteabstracttextwidth{0.8\textwidth}% |
| 701 |
% \begin{abstract} |
| 702 |
% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus |
| 703 |
% elit, vestibulum ut, placerat ac, adipiscing vitae, felis. |
| 704 |
% \end{abstract} |
| 705 |
% \def\@starttoc#1{\relax |
| 706 |
% \contentsline {section}{\numberline {1}Introduction}{2}{section.1} |
| 707 |
% \contentsline {section}{\numberline {2}Basic Usage}{3}{section.2} |
| 708 |
% \contentsline {subsection}{\numberline {2.1}Loading the Package}{3}{subsection.2.1} |
| 709 |
% \contentsline {subsection}{\numberline {2.2}Presets}{3}{subsection.2.2} |
| 710 |
% }\relax |
| 711 |
% \inlinetoc |
| 712 |
% \morepagecontents |
| 713 |
% \end{phfnoteDocVirtualPage} |
| 714 |
% |
| 715 |
% |
| 716 |
% \subsection{Predefined Package Sets} |
| 717 |
% \label{sec:package-sets} |
| 718 |
% |
| 719 |
% The \pkgname{phfnote} package also provides sets of standard \LaTeX{} |
| 720 |
% packages to load. You may choose between a varying degree of |
| 721 |
% ``richness'' of packages included. |
| 722 |
% |
| 723 |
% \begin{pkgoptions} |
| 724 |
% \item[pkgset=none] Do not include any package set. |
| 725 |
% |
| 726 |
% \item[pkgset=minimal] Include some basic minimal set useful for |
| 727 |
% scientific notes: the \AmS{} packages \pkgname{amsmath}, |
| 728 |
% \pkgname{amssymb}, \pkgname{amsfonts}, and \pkgname{amsthm}. The |
| 729 |
% \pkgname{xcolor} package is also loaded. |
| 730 |
% |
| 731 |
% \item[pkgset=rich] Include a fair amount of packages which may be useful. On |
| 732 |
% top of the |minimal| package set, this set includes the packages |
| 733 |
% \pkgname{enumitem}, \pkgname{graphicx}, \pkgname{microtype}, |
| 734 |
% \pkgname{caption}, \pkgname{setspace}, as well as \pkgname{inputenc} with |
| 735 |
% the |utf8| option and \pkgname{fontenc} with the |T1| option (the packages |
| 736 |
% \pkgname{fontenc} and \pkgname{inputenc} are not loaded if running Xe(La)TeX |
| 737 |
% or Lua(La)TeX, or if they are already loaded with possibly different |
| 738 |
% options). |
| 739 |
% |
| 740 |
% This package set is loaded by default. |
| 741 |
% |
| 742 |
% \changed[chg-xe-luatex-input-fontenc-pkgset]{v1.1}{2018/08/27}{If running |
| 743 |
% XeTeX or LuaTeX, then do not load \pkgname{inputenc} and \pkgname{fontenc} |
| 744 |
% as part of \texttt{rich} and \texttt{extended} package sets. Plus, do not |
| 745 |
% load \pkgname{inputenc} (resp. \pkgname{fontenc}) if the package is already |
| 746 |
% loaded} |
| 747 |
% |
| 748 |
% \item[pkgset=extended] Additionally, include packages \pkgname{float}, |
| 749 |
% \pkgname{verbdef}, \pkgname{csquotes}, \pkgname{dsfont}, \pkgname{bbm} |
| 750 |
% and \pkgname{mathtools}. |
| 751 |
% |
| 752 |
% \end{pkgoptions} |
| 753 |
% |
| 754 |
% |
| 755 |
% \subsection{Page Geometry} |
| 756 |
% \label{sec:pagegeomdefs} |
| 757 |
% |
| 758 |
% Another important aspect of \pkgname{phfnote} is the handling of page |
| 759 |
% margins. Often the default page margins of the \pkgname{article} class |
| 760 |
% are quite narrow. While it is a good typographical practice to avoid |
| 761 |
% long lines, on occasion we prefer to have notes typeset with wider text. |
| 762 |
% The general answer is the \pkgname{geometry} package, which allows to set all |
| 763 |
% margins in full detail. |
| 764 |
% |
| 765 |
% The \pkgname{phfnote} package provides some standard choices of options for the |
| 766 |
% \pkgname{geometry} package, which are adjusted according to the document font size, |
| 767 |
% and whether the document is typeset in two columns. |
| 768 |
% |
| 769 |
% If you want anything more complicated than what is provided by a default |
| 770 |
% setting here, just use the |nopagegeom| package option and invoke the |
| 771 |
% \pkgname{geometry} package directly with your preferred set of options. |
| 772 |
% |
| 773 |
% The page geometry predefined settings are the following. |
| 774 |
% |
| 775 |
% \begin{pkgoptions} |
| 776 |
% \item[pagegeom=default] Default settings. Not too wide, not too |
| 777 |
% narrow. Settings vary according to single or double column setting, and |
| 778 |
% according to default font point size. |
| 779 |
% \item[nopagegeom] Also, |pagegeom=false|. Do not change page geometry |
| 780 |
% settings, do not load the \pkgname{geometry} package. |
| 781 |
% \item[pagegeom=narrow] Narrower style. For single-column documents, this is |
| 782 |
% closer to the typographically-advertised-optimal of 50--80 characters per |
| 783 |
% line, but it might look narrow to some. |
| 784 |
% \item[pagegeom=wide] Wide, comfortable style. Wastes less paper. |
| 785 |
% \item[pagegeom=xwide] Extra wide. Use if you pity trees. |
| 786 |
% \item[pagegeom=bigmargin] Makes the margins asymmetric, so that a wide margin |
| 787 |
% note can fit. This style is used in this package documentation, for |
| 788 |
% example. |
| 789 |
% \end{pkgoptions} |
| 790 |
% |
| 791 |
% The following package options are OBSOLETE: |
| 792 |
% \begin{pkgoptions} |
| 793 |
% \item[pagegeomdefs=\meta{true or false}] Whether to care about page |
| 794 |
% margins. |nopagegeomdefs| is synonym for |pagegeomdefs=false|. This option |
| 795 |
% is OBSOLETE, please use |nopagegeom| or |pagegeom=false| instead of |
| 796 |
% |pagegeomdefs=false| and |pagegeom| (or |pagegeom=...| with setting) instead |
| 797 |
% of |pagegeomdefs=true|. |
| 798 |
% \end{pkgoptions} |
| 799 |
% |
| 800 |
% \changed[chg-pagegeom-pkgoption-onoff]{v3.0}{2018/10/16}{Changed how to turn |
| 801 |
% on/off the page geometry settings by improving the \phfverb{pagegeom} package |
| 802 |
% options, deprecated \phfverb{pagegeomdefs} option} |
| 803 |
% |
| 804 |
% \changed[chg-pagegeom-xwide]{v3.0}{2018/11/30}{Changed the \texttt{xwide} page |
| 805 |
% geometry for tighter vertical margin for single-column text (use |
| 806 |
% \texttt{pagegeom\eqsign xwidev1} instead for old behavior)} |
| 807 |
% |
| 808 |
% |
| 809 |
% \subsection{Section Headers Styling} |
| 810 |
% \label{sec:secfmt} |
| 811 |
% |
| 812 |
% The \pkgname{phfnote} package provides some limited styling of section |
| 813 |
% headers. The font, size and ``compactness'' of the headers can be adjusted |
| 814 |
% with title options. But really, these options are quite basic. You should |
| 815 |
% use \pkgname{titlesec} or \pkgname{sectsty} directly if you want anything |
| 816 |
% serious. |
| 817 |
% |
| 818 |
% The section headings are customized using the \pkgname{sectsty} package. If |
| 819 |
% this conflicts in your document, then use the |nosecfmt| package option to |
| 820 |
% indicate that section headings should NOT be styled by this package. Then |
| 821 |
% you have the full freedom to take care of section styling manually. |
| 822 |
% |
| 823 |
% Package options may be used to customize the appearance of the section |
| 824 |
% headings by specifying a list of attributes. When you combine arguments, make |
| 825 |
% sure to put them in a braced group: |[secfmt={section,compact}]|. Beware that |
| 826 |
% attributes are not merged between different occurrences of the |secfmt| |
| 827 |
% keyword in the package options; the last occurrence defines all set |
| 828 |
% attributes. If the |secfmt| package option is not given, then by default only |
| 829 |
% the |section| attribute is set. |
| 830 |
% |
| 831 |
% \begin{pkgnote} |
| 832 |
% Don't forget to include the attribute `|section|' and/or `|paragraph|' |
| 833 |
% depending on which type of heading you want your settings to apply to. For |
| 834 |
% example, \pkgoptionfmt{secfmt=\pkgoptattribnodots{sffamily}} has no effect, |
| 835 |
% you need to use e.g.\@ |
| 836 |
% \pkgoptionfmt{secfmt=\pkgoptattribnodots{section,sffamily}}. |
| 837 |
% \end{pkgnote} |
| 838 |
% |
| 839 |
% Available attributes are the following: |
| 840 |
% |
| 841 |
% \begin{pkgoptions} |
| 842 |
% \item[secfmt=\pkgoptattrib{section}] Use the |section| attribute to activate |
| 843 |
% the styling of section-level headings, that is, |\section|, |\subsection| |
| 844 |
% and |\subsubsection|. |
| 845 |
% \item[secfmt=\pkgoptattrib{paragraph}] This attribute indicates that the |
| 846 |
% styling should apply to paragraph-level headings as well (|\paragraph| and |
| 847 |
% |\subparagraph|). |
| 848 |
% \item[secfmt=\pkgoptattrib{compact}] Reduce the sizes of the section headings |
| 849 |
% (if the section-level headings are styled, i.e.\@ you need to specify the |
| 850 |
% |section| attribute), giving the document a more ``compact'' appearance. |
| 851 |
% \item[secfmt=\pkgoptattrib{larger}] Increase the sizes of the section |
| 852 |
% headings. Suitable for longer documents or for small document font sizes. |
| 853 |
% \item[secfmt=\pkgoptattrib{secsquares}] Display black squares on the left side |
| 854 |
% of |\section|-level commands, making them stand out better. This is useful |
| 855 |
% for documents (such as the present one) with several layers of sub-sections. |
| 856 |
% \item[secfmt=\pkgoptattrib{secnummargin}] Display the section, subsection, and |
| 857 |
% subsubsection numbering in the left margin and have the title occupy the |
| 858 |
% full width of the text (such as for this document). If you want both |
| 859 |
% \pkgoptionfmt{secsquares} and \pkgoptionfmt{secnummargin}, you must specify |
| 860 |
% them in that order, or the black square may end up overlapping with the |
| 861 |
% number. |
| 862 |
% \item[secfmt=\pkgoptattrib{rmfamily}] Typeset headings in the regular |
| 863 |
% roman font of the document, instead of trying to apply the |
| 864 |
% {\fontfamily{ppl}\fontseries{bx}\selectfont Palatino font}. This |
| 865 |
% applies to section-level and/or paragraph-level headings, depending on |
| 866 |
% which of the attributes |section| and/or |paragraph| have been |
| 867 |
% specified. |
| 868 |
% \item[secfmt=\pkgoptattrib{sffamily}] Typeset headings in a sans-serif font. |
| 869 |
% The default document sans serif font is used. This applies to section-level |
| 870 |
% and/or paragraph-level headings, depending on which of the attributes |
| 871 |
% |section| and/or |paragraph| have been specified. |
| 872 |
% \item[secfmt=\pkgoptattrib{itpar}] Typeset paragraph-level headings in italic. |
| 873 |
% \item[secfmt=\pkgoptattrib{blockpar}] Change the paragraph-level headings not |
| 874 |
% to be in ``run-in'' style, but to be typeset on their own line like section |
| 875 |
% headings. |
| 876 |
% \item[nosecfmt] Keep the original class styling; nothing will be overridden |
| 877 |
% and the \pkgname{sectsty} package is not loaded. (Equivalently, you may |
| 878 |
% specify |secfmt=false|.) |
| 879 |
% \end{pkgoptions} |
| 880 |
% |
| 881 |
% You can also directly modify the section heading style by redefining some |
| 882 |
% macros. Note that these macros only affect those sectioning commands which we |
| 883 |
% have decided to style, which is specified by the |section| and |paragraph| |
| 884 |
% attributes to be specified in the |secfmt={...}| package option. |
| 885 |
% |
| 886 |
% \DescribeMacro{\notesectionallfont} The macro |\notesectionallfont| is invoked |
| 887 |
% for every sectioning command (for those which are styled, see the |section| |
| 888 |
% and |paragraph| attributes). The macro |\notesectionallfont| internally |
| 889 |
% invokes \DescribeMacro{\notesectionallfontfamily} |\notesectionallfontfamily| |
| 890 |
% to select which font family to use. The family should be given as the font |
| 891 |
% code, e.g.: |pbk| = {\fontfamily{pbk}\selectfont Bookman}; |bch| = |
| 892 |
% {\fontfamily{bch}\selectfont Charter}; |ppl| = {\fontfamily{ppl}\selectfont |
| 893 |
% Palatino}; |ptm| = {\fontfamily{ptm}\selectfont Adobe Times}; |phv| = |
| 894 |
% {\fontfamily{phv}\selectfont Adobe Helvetica}; |pcr| = |
| 895 |
% {\fontfamily{pcr}\selectfont Adobe Courier}; |put| = |
| 896 |
% {\fontfamily{put}\selectfont Utopia}; |cmr| = {\fontfamily{cmr}\selectfont |
| 897 |
% Computer Modern Roman}; |cmss| = {\fontfamily{cmss}\selectfont CM Sans Serif}; |
| 898 |
% |cmbr| = {\fontfamily{cmbr}\selectfont CM Bright}; google many more or look |
| 899 |
% directly into the source of corresponding \LaTeX{} packages. |
| 900 |
% |
| 901 |
% You may customize these either via attributes or by redefining them directly. |
| 902 |
% Beware that if you redefine |\notesectionallfont| then you are responsible for |
| 903 |
% honoring, or ignoring, the value of |\notesectionallfontfamily|. |
| 904 |
% |
| 905 |
% \needspace{5\baselineskip} |
| 906 |
% \DescribeMacro{\notesectionfont} \DescribeMacro{\notesubsectionfont} |
| 907 |
% \DescribeMacro{\notesubsubsectionfont} \DescribeMacro{\noteparagraphfont} |
| 908 |
% \DescribeMacro{\notesubparagraphfont} These macros define the font commands to |
| 909 |
% apply for the section heading corresponding to the given sectioning command. |
| 910 |
% This macro is invoked after |\notesectionallfont|, which means that font |
| 911 |
% definitions in these macros take precedence over those in |
| 912 |
% |\notesectionallfont|. |
| 913 |
% |
| 914 |
% \DescribeMacro{\notesectionsetfonts} The macro |\notesectionsetfonts| is a |
| 915 |
% shorthand to set all section font definitions for the section-level commands |
| 916 |
% |\section|, |\subsection|, and |\subsubsection|. For example, |
| 917 |
% \begin{verbatim} |
| 918 |
% \notesectionsetfonts{\Large}{\large}{\normalsize} |
| 919 |
% \end{verbatim} |
| 920 |
% will set the font sizes for |\section|, |\subsection| and |\subsubsection| in |
| 921 |
% this order. |
| 922 |
% |
| 923 |
% \DescribeMacro{\noteparagraphsetfonts} The macro |\noteparagraphsetfonts| is |
| 924 |
% the corresponding shorthand for the paragraph-level commands. It takes two |
| 925 |
% arguments, the font definitions to apply for headings of level |\paragraph| |
| 926 |
% and |\subparagraph|. |
| 927 |
% |
| 928 |
% Obsolete options: |
| 929 |
% \begin{pkgoptions} |
| 930 |
% \item[secfmt=\pkgoptattribempty] Leave the argument empty to keep the original |
| 931 |
% class styling; nothing will be overridden and the \pkgname{sectsty} package |
| 932 |
% is not loaded. This option is OBSOLETE, use |nosecfmt| instead. |
| 933 |
% \end{pkgoptions} |
| 934 |
% |
| 935 |
% \changed[chg-secfmt-false-pkgoption]{v3.0}{2018/10/16}{Improved |
| 936 |
% \phfverb{secfmt,nosecfmt} package options syntax} |
| 937 |
% |
| 938 |
% |
| 939 |
% \subsection{Appearance of Paragraphs} |
| 940 |
% \label{sec:par-defs} |
| 941 |
% |
| 942 |
% Several presets may be set to define the appearance of paragraphs. |
| 943 |
% |
| 944 |
% \begin{pkgoptions} |
| 945 |
% \item[par=indent] Paragraphs are indented, bearing some |
| 946 |
% similarity to the \pkgname{article} class' default paragraph style. |
| 947 |
% \item[par=skip] Paragraphs are separated by additional spacing, |
| 948 |
% and not indented. |
| 949 |
% \item[par=indentminiskip] Paragraphs are indented, but there is also a small |
| 950 |
% space between each paragraph. |
| 951 |
% \item[nopar] Do not modify the appearance of paragraphs, and leave the |
| 952 |
% original class' default. |
| 953 |
% |
| 954 |
% You may also use |par=false|. |
| 955 |
% \end{pkgoptions} |
| 956 |
% |
| 957 |
% |
| 958 |
% Obsolete options: |
| 959 |
% \begin{pkgoptions} |
| 960 |
% \item[par=original] OBSOLETE---use |nopar| instead. |
| 961 |
% \end{pkgoptions} |
| 962 |
% |
| 963 |
% \changed[chg-par-false-pkgoption]{v3.0}{2018/10/16}{Improved |
| 964 |
% \phfverb{par,nopar} package options syntax} |
| 965 |
% |
| 966 |
% |
| 967 |
% \subsection{Adjusting Spacing of Lines and Words} |
| 968 |
% \label{sec:spacingdefs} |
| 969 |
% |
| 970 |
% The \pkgname{phfnote} package also provides definitions to adjust spacing of lines and |
| 971 |
% words. |
| 972 |
% |
| 973 |
% This includes definitions to avoid overflowing words in the margin in case of |
| 974 |
% long words. |
| 975 |
% |
| 976 |
% \begin{pkgoptions} |
| 977 |
% \item[spacingdefs] Apply adjustments to line and word spacing. |
| 978 |
% |
| 979 |
% This feature is on by default. You can also use |spacingdefs=true|. |
| 980 |
% |
| 981 |
% \item[nospacingdefs] Do not attempt any adjustments of line or word spacing. You |
| 982 |
% can also use the alias |spacingdefs=false|. |
| 983 |
% \end{pkgoptions} |
| 984 |
% |
| 985 |
% |
| 986 |
% |
| 987 |
% \subsection{Adjustments for Fonts} |
| 988 |
% \label{sec:fontdefs} |
| 989 |
% |
| 990 |
% The \pkgname{phfnote} package provides as well some adjustments for fonts to make some |
| 991 |
% fonts look nicer. |
| 992 |
% |
| 993 |
% Concretely, the {\fontfamily{cmbr}\selectfont Computer Modern Bright} font is |
| 994 |
% used as sans serif font instead of {\fontfamily{cmss}\selectfont \LaTeX's |
| 995 |
% default sans serif font}, and the more universal |T1| font encoding is used |
| 996 |
% instead of the default |OT1|. |
| 997 |
% |
| 998 |
% \begin{pkgoptions} |
| 999 |
% \item[fontdefs] Apply adjustments to fonts. This is on by default, except on |
| 1000 |
% Xe\TeX{} and Lua\TeX{}. |
| 1001 |
% |
| 1002 |
% You can also use |fontdefs=true|. |
| 1003 |
% |
| 1004 |
% \item[nofontdefs] Do not apply adjustments to fonts. You can also set |
| 1005 |
% |fontdefs=false|. |
| 1006 |
% |
| 1007 |
% \end{pkgoptions} |
| 1008 |
% |
| 1009 |
% |
| 1010 |
% \subsection{Footnote Style} |
| 1011 |
% \label{sec:footnotedefs} |
| 1012 |
% |
| 1013 |
% The footnotes' appearance can also be slightly enhanced. |
| 1014 |
% |
| 1015 |
% \begin{pkgoptions} |
| 1016 |
% \item[footnotedefs] Changes the symbol appearance a little bit---the |
| 1017 |
% footnote number is smaller and typeset in boldface. |
| 1018 |
% |
| 1019 |
% You can also use |footnotedefs=true|. This feature is on by default. |
| 1020 |
% |
| 1021 |
% \item[nofootnotedefs] Do not change the footnote appearance. You can also set |
| 1022 |
% |footnotedefs=false|. |
| 1023 |
% \end{pkgoptions} |
| 1024 |
% |
| 1025 |
% |
| 1026 |
% \subsection{Hyperref Loading} |
| 1027 |
% \label{sec:hyperrefdefs} |
| 1028 |
% |
| 1029 |
% There are many options for setting up the \pkgname{hyperref} package, and often, the |
| 1030 |
% defaults (with boxed links) are pretty ugly in my opinion. Enable the |
| 1031 |
% |hyperrefdefs| feature of \pkgname{phfnote} to alter the defaults to something I |
| 1032 |
% personally like better (dark blue links as in this document). |
| 1033 |
% |
| 1034 |
% \begin{pkgoptions} |
| 1035 |
% \item[hyperrefdefs] Load the \pkgname{hyperref} package, and |
| 1036 |
% set some sensible default settings. Also ensures the |\email| and |\url| commands |
| 1037 |
% are made available. |
| 1038 |
% |
| 1039 |
% You can also use |hyperrefdefs=true|. This feature is on by default. |
| 1040 |
% |
| 1041 |
% \item[nohyperrefdefs] Do not load the \pkgname{hyperref} package. Do not set |
| 1042 |
% any settings. Do not care to provide |\email| or |\url|. Same as |
| 1043 |
% |hyperrefdefs=false|. |
| 1044 |
% |
| 1045 |
% Depending on the situation, you might prefer to specify |hyperrefdefs=defer| |
| 1046 |
% or |hyperrefdefs=noload|, so that some basic setup (e.g. |\url|/|\email| |
| 1047 |
% commands) can still be provided. See below. |
| 1048 |
% |
| 1049 |
% \item[hyperrefdefs=\pkgoptattrib{defer}] Prepare the document for hyperlinks, |
| 1050 |
% schedule settings for \pkgname{hyperref}, but do not actually load the |
| 1051 |
% \pkgname{hyperref} package. |
| 1052 |
% |
| 1053 |
% This is useful if you would like to load more packages that need to be |
| 1054 |
% loaded before loading \pkgname{hyperref}. A lot of packages need to be |
| 1055 |
% loaded before \pkgname{hyperref} so if you load several other packages, |
| 1056 |
% you're probably better off using this option and calling |
| 1057 |
% |\usepackage{hyperref}| at the end of your preamble, i.e.\@ right before |
| 1058 |
% |\begin{document}|, rather than chasing mysterious errors. |
| 1059 |
% \iffalse \end{document} -- [...emacs indentation gets fooled easily...] \fi |
| 1060 |
% |
| 1061 |
% When using this option it is the user's responsibility to load the load the |
| 1062 |
% package with |\usepackage{hyperref}| somewhere in the preamble. You will |
| 1063 |
% get an error if you don't do this. |
| 1064 |
% |
| 1065 |
% \item[hyperrefdefs=\pkgoptattrib{noemail}] Do not override any existing |
| 1066 |
% |\email| command. Use this for instance in Rev\TeX{}, where our |
| 1067 |
% implementation of |\email| clashes with Rev\TeX{}'s |\email| command which |
| 1068 |
% is used to specify e-mail addresses for authors. |
| 1069 |
% |
| 1070 |
% The version of this command by \pkgname{phfnote} is still available as |
| 1071 |
% |\phfnoteEmail|. |
| 1072 |
% |
| 1073 |
% \item[hyperrefdefs=\pkgoptattrib{noeqref}] Do not redefine the |\eqref| |
| 1074 |
% command to include the parenthesis in the hyperlink. |
| 1075 |
% |
| 1076 |
% \changed[chg-hyperref-redefeqref]{v3.2}{2021/07/29}{We now redefine |
| 1077 |
% \phfverb{\eqref} by default to include the parentheses inside the hyperlink. |
| 1078 |
% Use the \texttt{hyperrefdefs\eqsign noeqref} package option to disable this |
| 1079 |
% feature} |
| 1080 |
% |
| 1081 |
% \item[hyperrefdefs=\pkgoptattrib{noload}] Do not load the \pkgname{hyperref} |
| 1082 |
% package, and don't bother to set any related settings. However, |
| 1083 |
% \pkgname{url} package is loaded, and the commands |\url| and |\email| are |
| 1084 |
% provided (they output the same visual text but don't produce a clickable |
| 1085 |
% color link). |
| 1086 |
% |
| 1087 |
% \item[hyperrefdefs=\pkgoptattrib{clearoptions}] Do not attempt to set any |
| 1088 |
% options via |\hypersetup| (and don't schedule setting any such options |
| 1089 |
% later). You'll get \pkgname{hyperref}'s default settings, so it's up to you |
| 1090 |
% to call |\hypersetup| with however you'd like to see your links look like. |
| 1091 |
% |
| 1092 |
% \end{pkgoptions} |
| 1093 |
% |
| 1094 |
% Attributes may be combined, as in |hyperrefdefs={noemail,noload}|. In this |
| 1095 |
% case make sure you put them in a braced group. Also, beware that attributes |
| 1096 |
% are not merged between different occurrences of the |hyperrefdefs| keyword in |
| 1097 |
% the package options; the last occurrence defines all set attributes. |
| 1098 |
% |
| 1099 |
% When the |hyperref| package is loaded, it is done so with the |unicode=true| |
| 1100 |
% package option. In case you need, you can specify your own package options |
| 1101 |
% with |hyperrefdefs=defer| and then calling |\usepackage[...]{hyperref}|. For |
| 1102 |
% most options though it's simpler to use |\hypersetup{...}|. |
| 1103 |
% |
| 1104 |
% |
| 1105 |
% \DescribeMacro{\url} In order to typeset URLs, the |\url| command is made |
| 1106 |
% available from the package \pkgname{url} (which is then linkified by |
| 1107 |
% \pkgname{hyperref}). For example, you can type |
| 1108 |
% |\url{https://github.com/phfaist/}|. |
| 1109 |
% |
| 1110 |
% \DescribeMacro{\email} \DescribeMacro{\phfnoteEmail} A similar command allows |
| 1111 |
% to typeset e-mail addresses. The text is displayed as a hyperlink, which when |
| 1112 |
% clicked opens a e-mail composer to that address (via a |mailto:XXX| link). |
| 1113 |
% For example, try |\email{[email protected]}|. The command |
| 1114 |
% |\phfnoteEmail| is an alias for this, which is defined even if the |noemail| |
| 1115 |
% attribute is given. |
| 1116 |
% |
| 1117 |
% The commands |\url| and |\email| (along with |\phfnoteEmail|) are defined |
| 1118 |
% unless |nohyperrefs| (or |hyperrefdefs=false|) is specified. If you would |
| 1119 |
% like to use these commands but not load the |hyperref| package, consider using |
| 1120 |
% |hyperrefdefs=noload|. |
| 1121 |
% |
| 1122 |
% |
| 1123 |
% \DescribeMacro{\phfnotePdfLinkColor} The command |\phfnotePdfLinkColor| may by |
| 1124 |
% used to set the color of the links. It takes one argument, a color |
| 1125 |
% specification understood by the \pkgname{xcolor} package. For example: |
| 1126 |
% \begin{verbatim} |
| 1127 |
% \phfnotePdfLinkColor{green!50!black} |
| 1128 |
% \end{verbatim} |
| 1129 |
% |
| 1130 |
% \begin{pkgnote} |
| 1131 |
% The package \pkgname{xcolor} must be loaded for |\phfnotePdfLinkColor| |
| 1132 |
% to work. (The \pkgname{xcolor} package is automatically loaded as part |
| 1133 |
% of a package set as long as you're not using the option |pkgset=none|; |
| 1134 |
% see \autoref{sec:package-sets}.) |
| 1135 |
% \end{pkgnote} |
| 1136 |
% |
| 1137 |
% The internal name for the link color is |docnotelinkcolor|. (This name is |
| 1138 |
% historical, and I'm not really willing to change it.) |
| 1139 |
% |
| 1140 |
% |
| 1141 |
% \subsection{Bibliography Definitions} |
| 1142 |
% \label{sec:bibliographydefs} |
| 1143 |
% |
| 1144 |
% This package also provides some definitions for the bibliography. |
| 1145 |
% |
| 1146 |
% It sets the |naturemagdoi| style by default, which is a hacked (by yours |
| 1147 |
% truly) version of the |naturemag| style to include the journal name as a |
| 1148 |
% hyperlink (as in APS bibliography styles). |
| 1149 |
% |
| 1150 |
% The bibliography is also typeset in a smaller font. |
| 1151 |
% |
| 1152 |
% Finally, an entry in the table of contents is generated. |
| 1153 |
% |
| 1154 |
% \begin{pkgoptions} |
| 1155 |
% \item[bibliographydefs] Set some default bibliography settings. |
| 1156 |
% |
| 1157 |
% This feature is on by default. You can also use |bibliographydefs=true|. |
| 1158 |
% |
| 1159 |
% \item[nobibliographydefs] Do not set some bibliography settings. You may also |
| 1160 |
% use |bibliographydefs=false|. |
| 1161 |
% \end{pkgoptions} |
| 1162 |
% |
| 1163 |
% \DescribeMacro{\bibliography} \DescribeMacro{\bibliographystyle} The |
| 1164 |
% |\bibliographystyle| and |\bibliography| macros can be used as usual, for |
| 1165 |
% example: |
| 1166 |
% \begin{verbatim} |
| 1167 |
% \bibliographystyle{apsrmp4-1} % optional |
| 1168 |
% \bibliography{mybibfile} |
| 1169 |
% \end{verbatim} |
| 1170 |
% bearing in mind that if the |\bibliographystyle| command is not present, our |
| 1171 |
% custom |naturemagdoi| bibliography style is used. |
| 1172 |
% |
| 1173 |
% |
| 1174 |
% \subsection{Inline Commenting in Documents} |
| 1175 |
% \label{sec:inline-commenting} |
| 1176 |
% |
| 1177 |
% Inline commenting features (|\phfMakeCommentingCommand|) have been moved to |
| 1178 |
% the separate dedicated package \pkgname{phfcc}. If you were using these |
| 1179 |
% features in your document, simply do |
| 1180 |
% \begin{verbatim} |
| 1181 |
% \usepackage{phfcc} |
| 1182 |
% \end{verbatim} |
| 1183 |
% and everything should work as expected. |
| 1184 |
% |
| 1185 |
% \changed[chg-inline-commenting]{v3.0}{2018/10/03}{Added support for inline |
| 1186 |
% commenting using \phfverb\phfMakeCommentingCommand} |
| 1187 |
% |
| 1188 |
% \changed[chg-inline-commenting-moved]{v3.1}{2020/04/02}{Moved support for |
| 1189 |
% inline commenting to the separate dedicated package \pkgname{phfcc}} |
| 1190 |
% |
| 1191 |
% |
| 1192 |
% |
| 1193 |
% \subsection{URL Styles} |
| 1194 |
% \label{sec:url-styles} |
| 1195 |
% |
| 1196 |
% As a bonus, the \pkgname{phfnote} package provides an alternative set of URL styles to |
| 1197 |
% use with the |\url| and |\email| commands (see \autoref{sec:hyperrefdefs}). |
| 1198 |
% |
| 1199 |
% All the styles described below typeset the URL in a slightly smaller size, so |
| 1200 |
% as to avoid a common issue with URLs that they tend to appear too large. |
| 1201 |
% Also, the tilde character is fixed so that it appears nicely, as in:\\ |
| 1202 |
% \url{https://people.phys.ethz.ch/~pfaist/}. |
| 1203 |
% |
| 1204 |
% The URL style can be set with the command |\urlstyle|\marg{name of style}. |
| 1205 |
% |
| 1206 |
% \begin{description}[font=\ttfamily,labelwidth=8em] |
| 1207 |
% \item[notett] typewriter font |
| 1208 |
% \item[notesf] default sans serif font |
| 1209 |
% \item[notesfss] Computer Modern Sans Serif font |
| 1210 |
% \item[noteitsf] italic using default sans serif font |
| 1211 |
% \item[noterm] normal roman typeface |
| 1212 |
% \item[noteit] just italic typeface |
| 1213 |
% \item[notesml] just smaller than surrounding text |
| 1214 |
% \end{description} |
| 1215 |
% |
| 1216 |
% |
| 1217 |
% \subsection{A \phfverb{\notesmaller} Command} |
| 1218 |
% |
| 1219 |
% This general-purpose command is handy to typeset text smaller than its |
| 1220 |
% surrounding text, for when you don't know what size the surrounding text is |
| 1221 |
% typeset at. In some sense, this is a very very lightweight analogue of what |
| 1222 |
% the \pkgname{relsize} package does. (This is used, for example, in our implementation |
| 1223 |
% of URL styles introduced in \autoref{sec:url-styles}.) |
| 1224 |
% |
| 1225 |
% \DescribeMacro{\notesmaller}\DescribeMacro{\notesmaller[0.8]} Set the font |
| 1226 |
% size to a fraction of the surrounding font size. The fraction may be |
| 1227 |
% specified as an optional argument. A fraction of 0.8 makes the text size 0.8 |
| 1228 |
% times that of the surrounding text, that is, smaller than the surrounding |
| 1229 |
% text. A value of~1 does not change the font size. If the fraction is not |
| 1230 |
% specified, the value stored in |\notesmallerfrac| is used. |
| 1231 |
% |
| 1232 |
% \DescribeMacro{\notesmallerfrac} The fraction by which |\notesmaller| typesets |
| 1233 |
% smaller text when no optional argument is given. You may redefine this |
| 1234 |
% command to set the default ``smaller'' size fraction. |
| 1235 |
% |
| 1236 |
% \subsection{Tools Mostly for Hackers} |
| 1237 |
% |
| 1238 |
% The \pkgname{phfnote} package also provides some small hacks. They are documented |
| 1239 |
% further in \autoref{sec:impl-other-stand-alone-defs}. These are: |
| 1240 |
% \DescribeMacro{\phfnoteHackSectionStarWithTOC} a macro |
| 1241 |
% |\phfnoteHackSectionStarWithTOC| to hack into a command which generates a |
| 1242 |
% |\section*|, in order for that command to also generate a corresponding entry |
| 1243 |
% in the table of contents; and |
| 1244 |
% \DescribeMacro{\phfnoteSaveDefs}\DescribeMacro{\phfnoteRestoreDefs} a pair of |
| 1245 |
% commands to save and restore \LaTeX{} definitions. |
| 1246 |
% |
| 1247 |
% |
| 1248 |
% |
| 1249 |
% |
| 1250 |
% |
| 1251 |
% |
| 1252 |
% |
| 1253 |
% \StopEventually{\PrintChangesAndIndex} |
| 1254 |
% |
| 1255 |
% \section{Implementation} |
| 1256 |
% |
| 1257 |
% Here comes the gory code. |
| 1258 |
% |
| 1259 |
% Let's start by loading the \pkgname{kvoptions} package, which we need to |
| 1260 |
% parse the package options. It's better to use \pkgname{xkeyval} as |
| 1261 |
% backend, because the |\setkeys| by \pkgname{keyval} is a little fragile: |
| 1262 |
% for example, it gets confused if, within a preset, we include a package |
| 1263 |
% or run a command which itself parses key-vals. |
| 1264 |
% |
| 1265 |
% \begin{macrocode} |
| 1266 |
\RequirePackage{xkeyval} |
| 1267 |
\RequirePackage{kvoptions} |
| 1268 |
% \end{macrocode} |
| 1269 |
% |
| 1270 |
% Also load \pkgname{etoolbox}, for various utilities and \pkgname{xparse} |
| 1271 |
% (for parsing optional arguments with recursive matching open/close brackets). |
| 1272 |
% \begin{macrocode} |
| 1273 |
\RequirePackage{etoolbox} |
| 1274 |
\RequirePackage{xparse} |
| 1275 |
% \end{macrocode} |
| 1276 |
% |
| 1277 |
% \subsection{Internal Generic Code} |
| 1278 |
% |
| 1279 |
% \begin{macro}{\phfnote@internal@execattribbs} |
| 1280 |
% An internal general-purpose macro to execute all definitions given in list of |
| 1281 |
% attributes. |
| 1282 |
% |
| 1283 |
% Often, a list of attributes are given via a package option (e.g.\@ for the abstract), |
| 1284 |
% and these attributes need to be executed, or implemented, in the order they are given. |
| 1285 |
% This macro takes care of that. Each possible attribute must be defined as a macro |
| 1286 |
% with a common prefix, to which the attribute is appended. |
| 1287 |
% |
| 1288 |
% The arguments are: |
| 1289 |
% \begin{itemize} |
| 1290 |
% \item |#1| = prefix to look for attributes (e.g.\@ |noteabstract@attr@|); |
| 1291 |
% \item |#2| = a human-readable name of what |#1| represents, which is used in an error |
| 1292 |
% message in case the required attribute is not found (e.g.\@ |{abstract attribute}|); |
| 1293 |
% \item |#3| = the list of attributes specified by the user. |
| 1294 |
% \end{itemize} |
| 1295 |
% |
| 1296 |
% For example, |\phfnote@internal@execattribs{noteabstract@attr@}|\hskip0pt\relax |
| 1297 |
% |{abstract attribute}|\hskip0pt\relax |{noname,small}| causes the commands |
| 1298 |
% |\noteabstract@attr@noname| and |\noteabstract@attr@small| to be invoked, in this |
| 1299 |
% order. |
| 1300 |
% |
| 1301 |
% \begin{macrocode} |
| 1302 |
\def\phfnote@internal@execattribs#1#2#3{% |
| 1303 |
\@for\next:=#3\do{% |
| 1304 |
\ifcsname #1\next\endcsname% |
| 1305 |
\csname #1\next\endcsname% |
| 1306 |
\else% |
| 1307 |
\PackageError{phfnote}{Unknown #2: '\next'. Ignoring.}{The given #2 '\next' |
| 1308 |
is invalid. Consult the package documentation for information about |
| 1309 |
valid attributes.} |
| 1310 |
\fi |
| 1311 |
} |
| 1312 |
} |
| 1313 |
% \end{macrocode} |
| 1314 |
% \end{macro} |
| 1315 |
% |
| 1316 |
% \subsection{Title Styling} |
| 1317 |
% |
| 1318 |
% See \autoref{sec:title-styles} for a description of the styles and which |
| 1319 |
% features are available. |
| 1320 |
% |
| 1321 |
% \subsubsection{First, some common simple definitions for our different styles} |
| 1322 |
% |
| 1323 |
% \needspace{3\baselineskip} |
| 1324 |
% \begin{macro}{\notetitlefont} |
| 1325 |
% \begin{macro}{\notetitleauthorfont} |
| 1326 |
% \begin{macro}{\notetitledatefont} |
| 1327 |
% These may be redefined to adapt the font of the title, author and date. |
| 1328 |
% |
| 1329 |
% \begin{macrocode} |
| 1330 |
\newcommand{\notetitlefont}[1]{\sffamily\bfseries #1} |
| 1331 |
\newcommand{\notetitleauthorfont}[1]{#1} |
| 1332 |
\newcommand{\notetitledatefont}[1]{\footnotesize #1} |
| 1333 |
% \end{macrocode} |
| 1334 |
% \end{macro} |
| 1335 |
% \end{macro} |
| 1336 |
% \end{macro} |
| 1337 |
% |
| 1338 |
% \begin{macro}{\notetitlebelowspace} |
| 1339 |
% \begin{macro}{\notetitletopspace} |
| 1340 |
% These macros may be redefined to adjust spacing above and after the title. They are |
| 1341 |
% macros, not lengths, so they can be adjusted dynamically on the spot. |
| 1342 |
% \begin{macrocode} |
| 1343 |
\newcommand{\notetitlebelowspace}{4mm} |
| 1344 |
\newcommand{\notetitletopspace}{-1.2cm} |
| 1345 |
% \end{macrocode} |
| 1346 |
% \end{macro} |
| 1347 |
% \end{macro} |
| 1348 |
% |
| 1349 |
% \begin{macro}{\notetitlehrule} |
| 1350 |
% Allow customization of the horizontal rule below the title. The macro |
| 1351 |
% |\notetitlehrule| expands to commands which generate the rule, such as |
| 1352 |
% ``|\hrule height 1pt|''. |
| 1353 |
% \begin{macrocode} |
| 1354 |
\newcommand{\notetitlehrule}{\hrule} |
| 1355 |
% \end{macrocode} |
| 1356 |
% \end{macro} |
| 1357 |
% |
| 1358 |
% \begin{macro}{\notetitle@title} |
| 1359 |
% Provide a ``long'' definition for |\title|, so that the title can have several |
| 1360 |
% paragraphs. Our style handles this by putting the title on several lines, and it can |
| 1361 |
% be useful depending on how you want to format the title. |
| 1362 |
% |
| 1363 |
% This macro will replace |\title| when a title style is actually selected in |
| 1364 |
% |\phfnote@do@notetitle|. |
| 1365 |
% \begin{macrocode} |
| 1366 |
\long\def\notetitle@title#1{\long\gdef\@title{#1}} |
| 1367 |
% \end{macrocode} |
| 1368 |
% \end{macro} |
| 1369 |
% |
| 1370 |
% |
| 1371 |
% \subsubsection{Implementation of \phfverb\thanks{} and \phfverb\thanksmark} |
| 1372 |
% |
| 1373 |
% Here we provide a few fixes for the implementation of |\thanks|, both for our main |
| 1374 |
% `default' title style as well as for other simpler styles. Our implementation supports |
| 1375 |
% |\thanks[N]{...}| and |\thanksmark[N]| as for footnotes. |
| 1376 |
% |
| 1377 |
% These newer implementations are only applied if one of our title styles is |
| 1378 |
% set. Otherwise, the class defaults are left untouched (which may be needed, |
| 1379 |
% e.g., for \RevTeX). |
| 1380 |
% |
| 1381 |
% \paragraph{Implementation of \phfverb{\thanks} and friends for our main |
| 1382 |
% `default' title style} |
| 1383 |
% |
| 1384 |
% \begin{macro}{\phfnote@setupthanksmpfootnote} |
| 1385 |
% Internal---called at the beginning of a |minipage| environment, it sets up necessary |
| 1386 |
% stuff to support |\thanks| notes within the minipage, in a single paragraph. |
| 1387 |
% |
| 1388 |
% Some of this code was taken or really inspired directly from |latex.ltx|. |
| 1389 |
% \begin{macrocode} |
| 1390 |
\def\phfnote@setupthanksmpfootnote{% |
| 1391 |
% \end{macrocode} |
| 1392 |
% |
| 1393 |
% The |\thanks| macro is implemented as a |\footnote| in a minipage. So we hack into the |
| 1394 |
% `mpfootnote' mechanism. |
| 1395 |
% \begin{macrocode} |
| 1396 |
\def\thempfootnote{\arabic{mpfootnote}}% |
| 1397 |
\let\footnoterule\relax% |
| 1398 |
\let\thanks\footnote% |
| 1399 |
% \end{macrocode} |
| 1400 |
% |
| 1401 |
% All footnote material is stored in a macro |\phfnote@mpfootmaterial|, initially |
| 1402 |
% empty:\footnote{NOTE: this differs from how footnotes are usually treated (directly |
| 1403 |
% typeset into a vbox I think). Not sure what the side-effects might be. Because this is |
| 1404 |
% just for simple email/institute info/etc. in the title, hopefully this shouldn't have |
| 1405 |
% any serious consequences.} |
| 1406 |
% \begin{macrocode} |
| 1407 |
\def\phfnote@mpfootmaterial{}% |
| 1408 |
% \end{macrocode} |
| 1409 |
% and locally define |\@mpfootnotetext| to store the footnote content into that buffer, |
| 1410 |
% \begin{macrocode} |
| 1411 |
\long\def\@mpfootnotetext##1{% |
| 1412 |
\protected@edef\@currentlabel% |
| 1413 |
{\csname p@mpfootnote\endcsname\@thefnmark}% |
| 1414 |
\protected@edef\@tmpa{\protect\phfnote@mympfootnotemark{\@thefnmark}{##1}% |
| 1415 |
\protect\phfnote@mpfootnoteglue}% |
| 1416 |
\expandafter\g@addto@macro\expandafter\phfnote@mpfootmaterial% |
| 1417 |
\expandafter{\@tmpa}% |
| 1418 |
}% |
| 1419 |
% \end{macrocode} |
| 1420 |
% |
| 1421 |
% Also provide |\thanksmark|, so that we can refer to other thanks/footnote-marks. |
| 1422 |
% \begin{macrocode} |
| 1423 |
\def\thanksmark[##1]{\phfnote@mympfootnotemark{##1}}% |
| 1424 |
} |
| 1425 |
% \end{macrocode} |
| 1426 |
% \end{macro} |
| 1427 |
% |
| 1428 |
% \begin{macro}{\phfnote@finalizempfootnotes} |
| 1429 |
% Macro to call at the end of a |minipage| environment, to ensure that all |\footnote|'s |
| 1430 |
% (and thus |\thanks|'s) are properly formatted. |
| 1431 |
% |
| 1432 |
% This simply takes all the tokens collected in |\phfnote@mpfootmaterial| (see just |
| 1433 |
% above), and typesets it in the |\@mpfootins| box. The latter is automatically typeset |
| 1434 |
% by the minipage in |\end{minipage}|. |
| 1435 |
% |
| 1436 |
% The argument |#1| is the skip length between the text and the footnotes. |
| 1437 |
% \begin{macrocode} |
| 1438 |
\def\phfnote@finalizempfootnotes#1{% |
| 1439 |
\if\relax\detokenize\expandafter{\phfnote@mpfootmaterial}\relax |
| 1440 |
\else |
| 1441 |
\global\skip\@mpfootins=#1\relax |
| 1442 |
\global\setbox\@mpfootins=\vbox{% |
| 1443 |
\parskip=\z@\relax |
| 1444 |
\parindent=\z@\relax |
| 1445 |
\phfnote@mpfootnotes@fontparsetup |
| 1446 |
\noindent\leavevmode% |
| 1447 |
\reset@font\footnotesize% |
| 1448 |
\phfnote@fmt@titlefootnotes% |
| 1449 |
\phfnote@mpfootmaterial}% |
| 1450 |
\fi |
| 1451 |
} |
| 1452 |
% \end{macrocode} |
| 1453 |
% \end{macro} |
| 1454 |
% |
| 1455 |
% \needspace{3\baselineskip} |
| 1456 |
% \begin{macro}{\phfnote@fmt@titlefootnotes} |
| 1457 |
% \begin{macro}{\phfnote@mympfootnotemark} |
| 1458 |
% \begin{macro}{\phfnote@mpfootnoteglue} |
| 1459 |
% Some formatting utilities which can be overridden if you know what you're doing. |
| 1460 |
% |\phfnote@fmt@titlefootnotes| allows you to override the font in which the |
| 1461 |
% title-footnotes/thanks are typeset. |\phfnote@mympfootnotemark| is responsible for |
| 1462 |
% formatting its argument as a footnote mark, usually in superscript. |
| 1463 |
% |\phfnote@mpfootnoteglue| is the glue which is used between two footnote texts (as |
| 1464 |
% they are typeset in a single paragraph). |
| 1465 |
% \begin{macrocode} |
| 1466 |
\def\phfnote@mpfootnotes@fontparsetup{% |
| 1467 |
\parshape 1 0.04\textwidth 0.96\textwidth\relax} |
| 1468 |
\def\phfnote@fmt@titlefootnotes{} |
| 1469 |
\def\phfnote@mympfootnotemark#1{\@textsuperscript{\normalfont#1}} |
| 1470 |
\def\phfnote@mpfootnoteglue{\hskip 1.2em plus 2em minus 0.5em\relax} |
| 1471 |
% \end{macrocode} |
| 1472 |
% \end{macro} |
| 1473 |
% \end{macro} |
| 1474 |
% \end{macro} |
| 1475 |
% |
| 1476 |
% |
| 1477 |
% \paragraph{For those not using the main `default' title style} |
| 1478 |
% |
| 1479 |
% We use \LaTeX's own |\thanks| mechanism, however we patch on the possibility for using |
| 1480 |
% |\thanks[N]{text}| and |\thanksmark[N]| for overriding the number which is used. |
| 1481 |
% |
| 1482 |
% \begin{macro}{\notetitle@thanksmark} |
| 1483 |
% The |\thanksmark| is trivially implemented by |\footnotemark|. Very handy indeed. |
| 1484 |
% |
| 1485 |
% Again, this macro is only made available as |\thanksmark| when a title style is set in |
| 1486 |
% |\phfnote@do@notetitle|. |
| 1487 |
% \begin{macrocode} |
| 1488 |
\def\notetitle@thanksmark{\footnotemark} |
| 1489 |
% \end{macrocode} |
| 1490 |
% \end{macro} |
| 1491 |
% |
| 1492 |
% Start by saving the old |\thanks| macro, just in case. |
| 1493 |
% \begin{macrocode} |
| 1494 |
\let\phfnote@old@thanks\thanks |
| 1495 |
% \end{macrocode} |
| 1496 |
% |
| 1497 |
% \begin{macro}{\notetitle@thanks} |
| 1498 |
% Now, we need to extend \LaTeX's |\thanks| to allow an optional argument as for |
| 1499 |
% footnotes. This macro will be renamed |\thanks| in |\phfnote@do@notetitle|. |
| 1500 |
% |
| 1501 |
% Check whether there is an optional argument; if there is none we execute \LaTeX's |
| 1502 |
% original thanks code (replicated here), otherwise, we specify the optional argument |
| 1503 |
% explicitly at the relevant location in \LaTeX's implementation: |
| 1504 |
% \begin{macrocode} |
| 1505 |
\def\notetitle@thanks{\@ifnextchar[\phfnote@thanks{\phfnote@thanks[]}}%] |
| 1506 |
\long\def\phfnote@thanks[#1]#2{% |
| 1507 |
\if\relax\detokenize{#1}\relax% |
| 1508 |
% \end{macrocode} |
| 1509 |
% |
| 1510 |
% The optional argument is empty---just execute \LaTeX's original |\thanks| code, |
| 1511 |
% replicated here: |
| 1512 |
% \begin{macrocode} |
| 1513 |
\footnotemark% |
| 1514 |
\protected@xdef\@thanks{\@thanks\protect\footnotetext[\the\c@footnote]{#2}}% |
| 1515 |
% \end{macrocode} |
| 1516 |
% |
| 1517 |
% Otherwise, execute \LaTeX's original |\thanks| code, but with the optional argument |
| 1518 |
% inserted wherever needed: |
| 1519 |
% \begin{macrocode} |
| 1520 |
\else% argument, pass on to sub-commands: |
| 1521 |
\footnotemark[#1]% |
| 1522 |
\protected@xdef\@thanks{\@thanks\protect\footnotetext[#1]{#2}}% |
| 1523 |
\fi% |
| 1524 |
} |
| 1525 |
% \end{macrocode} |
| 1526 |
% \end{macro} |
| 1527 |
% |
| 1528 |
% |
| 1529 |
% \subsubsection{Title Styles Definition} |
| 1530 |
% |
| 1531 |
% The title styles are documented in \autoref{sec:title-styles}. |
| 1532 |
% |
| 1533 |
% |
| 1534 |
% \paragraph{Title style: `default'} |
| 1535 |
% |
| 1536 |
% Implementation our main `default' title style. See |
| 1537 |
% \autoref{sec:main-default-title-style}. |
| 1538 |
% |
| 1539 |
% \begin{macro}{\notetitleinnervsep} |
| 1540 |
% Controls the vertical spacing between individual elements of the title. |
| 1541 |
% \begin{macrocode} |
| 1542 |
\newcommand\notetitleinnervsep{1.15ex} |
| 1543 |
% \end{macrocode} |
| 1544 |
% \end{macro} |
| 1545 |
% |
| 1546 |
% \begin{macro}{\notetitlewidth} |
| 1547 |
% Controls the width of the area in which the title content is typeset. For |
| 1548 |
% more complex titles (e.g., |pretty| style, the title is typeset in a smaller |
| 1549 |
% width than the text width to allow room for decorations). |
| 1550 |
% \begin{macrocode} |
| 1551 |
\def\notetitlewidth{\textwidth} |
| 1552 |
% \end{macrocode} |
| 1553 |
% \end{macro} |
| 1554 |
% |
| 1555 |
% \begin{macro}{\notetitleparskip} |
| 1556 |
% The paragraph skip that is used if the title contains multiple paragraphs. |
| 1557 |
% \begin{macrocode} |
| 1558 |
\def\notetitleparskip{1.4ex}% parskip for multiple pars in main title |
| 1559 |
% \end{macrocode} |
| 1560 |
% \end{macro} |
| 1561 |
% |
| 1562 |
% \begin{macro}{\notetitlefontparsetup} |
| 1563 |
% \begin{macro}{\notetitleaftertitleskip} |
| 1564 |
% |\notetitlefontparsetup| sets up any necessary \LaTeX{} commands to typeset |
| 1565 |
% the main title. This should set the font size, and then maybe |\centering|, |
| 1566 |
% a |\parshape|, or a text color. |
| 1567 |
% \begin{macrocode} |
| 1568 |
\def\notetitlefontparsetup{\raggedright\setstretch{1.05}\Large} |
| 1569 |
% \end{macrocode} |
| 1570 |
% |\notetitleaftertitleskip| generates the spacing after the main title. The |
| 1571 |
% default implementation behaves differently whether the title was |
| 1572 |
% multi-paragraph or not. |
| 1573 |
% \begin{macrocode} |
| 1574 |
\def\notetitleaftertitleskip{% |
| 1575 |
\ifnotetitle@default@ismultipar |
| 1576 |
\vspace{\parskip}% |
| 1577 |
%\gdef\phfnote@tmp@nextskip{\z@}% |
| 1578 |
\gdef\phfnote@tmp@nextskip{0.5\dimexpr\notetitleinnervsep\relax}% |
| 1579 |
\else |
| 1580 |
\gdef\phfnote@tmp@nextskip{\notetitleinnervsep}% |
| 1581 |
\fi |
| 1582 |
} |
| 1583 |
% \end{macrocode} |
| 1584 |
% \end{macro} |
| 1585 |
% \end{macro} |
| 1586 |
% |
| 1587 |
% \begin{macro}{\notetitleauthorfontparsetup} |
| 1588 |
% \begin{macro}{\notetitledatefontparsetup} |
| 1589 |
% These macros set up any necessary \LaTeX{} commands to typeset the author |
| 1590 |
% and the date. This should set the font size, and then maybe |\centering|, a |
| 1591 |
% |\parshape|, or a text color. These should use calls to |
| 1592 |
% |\notetitledontextvskip| to adjust vertical spacing between the title items. |
| 1593 |
% \begin{macrocode} |
| 1594 |
\def\notetitleauthorfontparsetup{% |
| 1595 |
\notetitledonextvskip[2]% |
| 1596 |
\parshape 1 0.04\textwidth 0.96\textwidth\relax |
| 1597 |
\strut |
| 1598 |
} |
| 1599 |
\def\notetitledatefontparsetup{% |
| 1600 |
\notetitledonextvskip |
| 1601 |
\parshape 1 0.04\textwidth 0.96\textwidth\relax |
| 1602 |
\strut |
| 1603 |
} |
| 1604 |
% \end{macrocode} |
| 1605 |
% \end{macro} |
| 1606 |
% \end{macro} |
| 1607 |
% |
| 1608 |
% \begin{macro}{\notetitledonextvskip} |
| 1609 |
% This helper macro is not meant to be redefined, but rather invoked from |
| 1610 |
% |\notetitleauthorfontparsetup| and |\notetitledatefontparsetup|. It adds |
| 1611 |
% the vertical space that was stored in |\phfnote@tmp@nextskip|. |
| 1612 |
% \begin{macrocode} |
| 1613 |
\newcommand\notetitledonextvskip[1][]{% |
| 1614 |
\vspace{#1\dimexpr\phfnote@tmp@nextskip\relax}% |
| 1615 |
\gdef\phfnote@tmp@nextskip{\notetitleinnervsep}% |
| 1616 |
} |
| 1617 |
% \end{macrocode} |
| 1618 |
% \end{macro} |
| 1619 |
% |
| 1620 |
% \begin{macro}{\notetitlemakecontents} |
| 1621 |
% Helper command that produces the content of the title. The default |
| 1622 |
% implementation uses the set |\title|, |\author|, and |\date| to render |
| 1623 |
% everything nicely. Note that if you redefine this, then it's up to you to |
| 1624 |
% honor what to do with |\notetitlefontparsetup|, |\notetitlefont|, |
| 1625 |
% |\notetitleauthorfont|, etc. |
| 1626 |
% |
| 1627 |
% The default implementation of |\notetitlemakecontents| allows |
| 1628 |
% |\notetitle*fontparsetup| to take a single argument, the whole |
| 1629 |
% title/author/date including necessary formatting. In that case make sure to |
| 1630 |
% enclose that argument in a group. |
| 1631 |
% \begin{macrocode} |
| 1632 |
\newcommand\notetitlemakecontents{ |
| 1633 |
\notetitlemakecontentstop |
| 1634 |
{\par |
| 1635 |
\let\phfnote@old@par\par |
| 1636 |
\notetitle@titledefault@preparetitle |
| 1637 |
\expandafter\notetitlefontparsetup\expandafter{% |
| 1638 |
\expandafter\notetitlefont\expandafter{\@title}}% |
| 1639 |
\phfnote@old@par |
| 1640 |
\notetitleaftertitleskip |
| 1641 |
}% |
| 1642 |
\if\relax\detokenize\expandafter{\@author}\relax\else |
| 1643 |
\expandafter\notetitleauthorfontparsetup\expandafter{% |
| 1644 |
\expandafter\notetitleauthorfont\expandafter{\@author}}\par |
| 1645 |
\fi |
| 1646 |
\if\relax\detokenize\expandafter{\@date}\relax\else |
| 1647 |
\expandafter\notetitledatefontparsetup\expandafter{% |
| 1648 |
\expandafter\notetitledatefont\expandafter{\@date}}\par |
| 1649 |
\fi |
| 1650 |
\notetitlemakecontentsbottom |
| 1651 |
} |
| 1652 |
% \end{macrocode} |
| 1653 |
% \end{macro} |
| 1654 |
% |
| 1655 |
% \begin{macro}{\notetitlemakecontentstop} |
| 1656 |
% \begin{macro}{\notetitlemakecontentsbottom} |
| 1657 |
% If you just want to insert stuff before/after in the title box, then you |
| 1658 |
% don't have to redefine all of |\notetitlemakecontents|, you can simply |
| 1659 |
% redefine these macros to whatever you like. |
| 1660 |
% \begin{macrocode} |
| 1661 |
\def\notetitlemakecontentstop{} |
| 1662 |
\def\notetitlemakecontentsbottom{} |
| 1663 |
% \end{macrocode} |
| 1664 |
% \end{macro} |
| 1665 |
% \end{macro} |
| 1666 |
% |
| 1667 |
% \begin{macro}{\notetitlebeginrender} |
| 1668 |
% \begin{macro}{\notetitleendrender} |
| 1669 |
% The title is rendered enclosed by calls to these macros. By default, render |
| 1670 |
% the title in a minipage. |
| 1671 |
% |
| 1672 |
% WARNING: An important thing to note is that if you use |
| 1673 |
% |\notetitle@default@usesavebox|, then the saved box is an |\hbox|, not a |
| 1674 |
% |\vbox| (more flexibility). That means that the |\notetitlebeginrender| and |
| 1675 |
% |\notetitleendrender| commands must open and close some environment (or a |
| 1676 |
% |\vbox| or something like that) so that the whole |
| 1677 |
% |\notetitlebeginrender...\notetitleendrender| construction results in |
| 1678 |
% something that can be placed in an |\hbox|. |
| 1679 |
% \begin{macrocode} |
| 1680 |
\def\notetitlebeginrender{\begin{minipage}{\notetitlewidth}} |
| 1681 |
\def\notetitleendrender{\end{minipage}} |
| 1682 |
% \end{macrocode} |
| 1683 |
% \end{macro} |
| 1684 |
% \end{macro} |
| 1685 |
% |
| 1686 |
% |
| 1687 |
% \begin{macro}{\notetitleusemainbox} |
| 1688 |
% This macro is the main formatting command for the title's global appearance. |
| 1689 |
% After the title is typeset in a \TeX{} box register, this macro is invoked |
| 1690 |
% to actually display it. The default title style simply displays it with a |
| 1691 |
% rule below, but the |pretty| title style does fancier things. Note this is |
| 1692 |
% only used if |\ifnotetitle@default@usesavebox| is true. |
| 1693 |
% \begin{macrocode} |
| 1694 |
\newcommand\notetitleusemainbox[1]{% |
| 1695 |
\par |
| 1696 |
\box#1% |
| 1697 |
\vspace*{\notetitleinnervsep}% |
| 1698 |
\notetitlehrule\relax |
| 1699 |
} |
| 1700 |
% \end{macrocode} |
| 1701 |
% \end{macro} |
| 1702 |
% |
| 1703 |
% \begin{macro}{\notetitle@default@mainbox} |
| 1704 |
% The main box register in which the title contents is saved. |
| 1705 |
% \begin{macrocode} |
| 1706 |
\newsavebox\notetitle@default@mainbox |
| 1707 |
% \end{macrocode} |
| 1708 |
% \end{macro} |
| 1709 |
% |
| 1710 |
% \begin{macro}{\ifnotetitle@default@usesavebox} |
| 1711 |
% This |if| controls whether or not we set up the title in a temporary \TeX{} |
| 1712 |
% box register first, before displaying it. This allows to play around with |
| 1713 |
% the box, measure its height/width, place it into graphics, etc. But if we |
| 1714 |
% want a simple title, this is not necessary, and it might break some more |
| 1715 |
% fragile constructions (footnotes, etc). |
| 1716 |
% |
| 1717 |
% If this is true, then the macro |\notetitleusemainbox| is called to render |
| 1718 |
% the box. Otherwise, |\notetitleusemainbox| is not called and the title is |
| 1719 |
% rendered directly. |
| 1720 |
% \begin{macrocode} |
| 1721 |
\newif\ifnotetitle@default@usesavebox |
| 1722 |
\notetitle@default@usesaveboxtrue |
| 1723 |
% \end{macrocode} |
| 1724 |
% \end{macro} |
| 1725 |
% |
| 1726 |
% \begin{macro}{\ifnotetitleusempfootnotes} |
| 1727 |
% Whether any |\thanks| commands in the title generate footnotes inside the |
| 1728 |
% minipage (i.e., a line at the bottom with e.g.\ affiliations), or whether |
| 1729 |
% they appear as regular footnotes at the bottom of the page. |
| 1730 |
% |
| 1731 |
% This conditional may only be set to true if the rendering happens in a |
| 1732 |
% minipage. The minipage must be opened in |\notetitlebeginrender| and closed |
| 1733 |
% in |\notetitleendrender|. |
| 1734 |
% \begin{macrocode} |
| 1735 |
\newif\ifnotetitleusempfootnotes |
| 1736 |
\notetitleusempfootnotestrue |
| 1737 |
% \end{macrocode} |
| 1738 |
% \end{macro} |
| 1739 |
% |
| 1740 |
% \begin{macro}{\notetitle@default@setup} |
| 1741 |
% Any additional setup to be done at the beginning. |
| 1742 |
% \begin{macrocode} |
| 1743 |
\def\notetitle@default@setup{% |
| 1744 |
\notetitle@default@ismultiparfalse |
| 1745 |
\gdef\phfnote@tmp@nextskip{\z@}% |
| 1746 |
\par\raggedright} |
| 1747 |
% \end{macrocode} |
| 1748 |
% \end{macro} |
| 1749 |
% |
| 1750 |
% Now we have the main implementation of the default title style. |
| 1751 |
% |
| 1752 |
% \begin{macro}{\notetitle@style@default} |
| 1753 |
% A default title style, providing a flexible engine with powerful |
| 1754 |
% customization features (the same engine is used for the |pretty| title |
| 1755 |
% style). |
| 1756 |
% |
| 1757 |
% The strategy goes like this: First typeset everything in a minipage enclosed |
| 1758 |
% in a box register, and then display that box register using |
| 1759 |
% |\notetitleusemainbox|. |
| 1760 |
% \begin{macrocode} |
| 1761 |
\newcommand{\notetitle@style@default}{% |
| 1762 |
\begingroup |
| 1763 |
\parskip=\z@\relax |
| 1764 |
\parindent=\z@\relax |
| 1765 |
\providecommand\singlespace{}% |
| 1766 |
\notetitle@default@setup |
| 1767 |
\ifnotetitleusempfootnotes |
| 1768 |
\phfnote@setupthanksmpfootnote |
| 1769 |
\fi |
| 1770 |
\vspace*{\notetitletopspace}% |
| 1771 |
\def\x{}% |
| 1772 |
% \end{macrocode} |
| 1773 |
% |
| 1774 |
% Now, draw the title (either in a box, or directly). If we save in a box, use |
| 1775 |
% an |\hbox|, not a |\vbox|, because we get size problems otherwise. See |
| 1776 |
% |\notetitlebeginrender| and |\notetitleendrender|. |
| 1777 |
% \begin{macrocode} |
| 1778 |
\ifnotetitle@default@usesavebox |
| 1779 |
\def\x{\setbox\notetitle@default@mainbox=\hbox\bgroup} |
| 1780 |
\fi |
| 1781 |
\x\notetitlebeginrender |
| 1782 |
\begingroup |
| 1783 |
\singlespace% |
| 1784 |
\notetitlemakecontents\par |
| 1785 |
\ifnotetitleusempfootnotes |
| 1786 |
\expandafter\ifstrequal\expandafter{\@mpfn}{mpfootnote}{}{% |
| 1787 |
\PackageError{phfnote}{phfnote title: can only have |
| 1788 |
'usempfootnotes' in a minipage}{Make sure you open a |
| 1789 |
\string\begin{minipage} in the definition of |
| 1790 |
\string\notetitlebeginrender \space and correspondingly close |
| 1791 |
it with \string\end{minipage} in \string\notetitleendrender}% |
| 1792 |
} |
| 1793 |
\global\let\@thanks\@empty |
| 1794 |
\phfnote@finalizempfootnotes{\phfnote@tmp@nextskip}% |
| 1795 |
\fi |
| 1796 |
\endgroup |
| 1797 |
\notetitleendrender |
| 1798 |
\def\x{}% |
| 1799 |
\ifnotetitle@default@usesavebox |
| 1800 |
\def\x{\egroup |
| 1801 |
\notetitleusemainbox{\notetitle@default@mainbox}}% |
| 1802 |
\fi |
| 1803 |
\x |
| 1804 |
\par |
| 1805 |
\endgroup |
| 1806 |
\vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip |
| 1807 |
} |
| 1808 |
% \end{macrocode} |
| 1809 |
% \end{macro} |
| 1810 |
% |
| 1811 |
% |
| 1812 |
% Some helpers for the default title style. |
| 1813 |
% |
| 1814 |
% \begin{macro}{\ifnotetitle@default@ismultipar} |
| 1815 |
% This flag registers whether or not the title has multiple paragraphs (and |
| 1816 |
% thus renders on several spaced lines). It is set to |true| by redefining |
| 1817 |
% the |\par| command in the title (see |\notetitle@titledefault@preparetitle| |
| 1818 |
% below). |
| 1819 |
% \begin{macrocode} |
| 1820 |
\newif\ifnotetitle@default@ismultipar |
| 1821 |
% \end{macrocode} |
| 1822 |
% \end{macro} |
| 1823 |
% |
| 1824 |
% \begin{macro}{\notetitle@titledefault@preparetitle} |
| 1825 |
% This helper sets everything up to display the title. It redefines |\par| to |
| 1826 |
% register that the title has several paragraphs. Also, note that |\parskip| |
| 1827 |
% is inserted in |\leavevmode|, so that setting |\parskip| as below only |
| 1828 |
% affects subsequent paragraphs. |
| 1829 |
% |
| 1830 |
% To change the parskip amount, you may simply patch this command, e.g., as |
| 1831 |
% |\appto\notetitle@titledefault@preparetitle{\parskip=1.2ex\relax}|. |
| 1832 |
% \begin{macrocode} |
| 1833 |
\newcommand\notetitle@titledefault@preparetitle{% |
| 1834 |
\def\par{\phfnote@old@par\global\notetitle@default@ismultipartrue}% |
| 1835 |
\leavevmode\parskip=\notetitleparskip\relax} |
| 1836 |
% \end{macrocode} |
| 1837 |
% \end{macro} |
| 1838 |
% |
| 1839 |
% |
| 1840 |
% |
| 1841 |
% \paragraph{Title style: `defaultv1'} |
| 1842 |
% |
| 1843 |
% \begin{macro}{\notetitle@style@defaultv1} |
| 1844 |
% The default title style, copied from \pkgname{phfnote} v1.0. DO NOT |
| 1845 |
% CHANGE. Kept only for backwards compatibility, in case someone had spent |
| 1846 |
% lots of time fine-tuning their title and patching the v1 of this package, or |
| 1847 |
% if they want the document to appear exactly as the v1 of the package. |
| 1848 |
% |
| 1849 |
% [We need to use |\csdef| because of the ``1'' in the title name, which is |
| 1850 |
% not valid in an \TeX{} usual escape sequence (!!)] |
| 1851 |
% \begin{macrocode} |
| 1852 |
\csdef{notetitle@style@defaultv1}{% |
| 1853 |
\begingroup\par\raggedright% |
| 1854 |
\phfnote@setupthanksmpfootnote% |
| 1855 |
\vspace*{\notetitletopspace}% |
| 1856 |
\phfnote@title@checksetspace{defaultv1}% |
| 1857 |
\begin{minipage}{\textwidth}% |
| 1858 |
\begin{singlespace}% |
| 1859 |
\parskip=0pt\parindent=0pt\relax% |
| 1860 |
{\let\phfnote@old@par\par% |
| 1861 |
\def\par{\phfnote@old@par% |
| 1862 |
\parskip=1.5ex\relax\parshape 1 0pt \textwidth\relax% |
| 1863 |
\noindent}% |
| 1864 |
\par% |
| 1865 |
\Large {\notetitlefont \@title}\par}% |
| 1866 |
\vskip 2mm\relax |
| 1867 |
\if\relax\detokenize\expandafter{\@author}\relax\else% |
| 1868 |
\par\parshape 1 0.04\textwidth 0.96\textwidth\relax% |
| 1869 |
{\notetitleauthorfont \@author}% |
| 1870 |
\vskip 2mm\relax% |
| 1871 |
\fi |
| 1872 |
\if\relax\detokenize\expandafter{\@date}\relax\else% |
| 1873 |
\par\parshape 1 0.04\textwidth 0.96\textwidth\relax% |
| 1874 |
{\notetitledatefont \@date} |
| 1875 |
\vskip 2mm\relax% |
| 1876 |
\fi |
| 1877 |
\global\let\@thanks\@empty% |
| 1878 |
\csname phfnote@finalizempfootnotes@v1\endcsname% |
| 1879 |
\end{singlespace}% |
| 1880 |
\end{minipage}\par% |
| 1881 |
\vspace*{2mm}% |
| 1882 |
\notetitlehrule\relax% |
| 1883 |
\par% |
| 1884 |
\endgroup% |
| 1885 |
\vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip |
| 1886 |
} |
| 1887 |
\csdef{phfnote@finalizempfootnotes@v1}{% |
| 1888 |
\global\setbox\@mpfootins=\vbox{% |
| 1889 |
\parskip=0pt\parindent=0pt\parshape 1 0.04\textwidth 0.96\textwidth\relax% |
| 1890 |
\noindent\leavevmode% |
| 1891 |
\reset@font\footnotesize% |
| 1892 |
\phfnote@fmt@titlefootnotes% |
| 1893 |
\phfnote@mpfootmaterial}% |
| 1894 |
} |
| 1895 |
\def\phfnote@title@checksetspace#1{% |
| 1896 |
\ifdefined\singlespace\else% |
| 1897 |
\PackageError{phfnote}{Note title style `#1' requires the |
| 1898 |
`setspace' package to be loaded! Please load it, or use a |
| 1899 |
pkgset which loads it automatically}{}% |
| 1900 |
\fi% |
| 1901 |
} |
| 1902 |
% \end{macrocode} |
| 1903 |
% \end{macro} |
| 1904 |
% |
| 1905 |
% |
| 1906 |
% \paragraph{Title style: `pretty' and `pretty2'} |
| 1907 |
% |
| 1908 |
% The |pretty| \& |pretty2| styles uses the same engine as the default, with |
| 1909 |
% different settings. |
| 1910 |
% |
| 1911 |
% \begin{macro}{\notetitle@style@pretty} |
| 1912 |
% \begin{macro}{\notetitle@style@pretty2} |
| 1913 |
% Alias the main maketitle engine to the default one. |
| 1914 |
% \begin{macrocode} |
| 1915 |
\let\notetitle@style@pretty\notetitle@style@default |
| 1916 |
\cslet{notetitle@style@pretty2}\notetitle@style@default |
| 1917 |
% \end{macrocode} |
| 1918 |
% \end{macro} |
| 1919 |
% \end{macro} |
| 1920 |
% |
| 1921 |
% \begin{macro}{\notetitle@stylesetup@pretty} |
| 1922 |
% Setup macro that makes everything nice. Do all these defs in the macro |
| 1923 |
% definition, and not directly in the global space, to avoid polluting the |
| 1924 |
% \LaTeX{} environment with useless definitions if we don't use this title |
| 1925 |
% style. |
| 1926 |
% \begin{macrocode} |
| 1927 |
\def\notetitle@stylesetup@pretty{% |
| 1928 |
\RequirePackage{xcolor} |
| 1929 |
\long\def\notetitlefont##1{\bfseries ##1} |
| 1930 |
\def\notetitlefontparsetup{% |
| 1931 |
\color{notetitleprettytextcolor}\centering} |
| 1932 |
\def\notetitleauthorfontparsetup{% |
| 1933 |
\notetitledonextvskip[2]% |
| 1934 |
\color{notetitleprettytextcolor}\centering} |
| 1935 |
\def\notetitledatefontparsetup{% |
| 1936 |
\notetitledonextvskip |
| 1937 |
\color{notetitleprettytextcolor}\centering} |
| 1938 |
\def\phfnote@mpfootnotes@fontparsetup{\color{notetitleprettytextcolor}} |
| 1939 |
% |
| 1940 |
\def\notetitlewidth{\dimexpr\textwidth |
| 1941 |
-\notetitleprettylsiderulewidth |
| 1942 |
-\notetitleprettyrsiderulewidth |
| 1943 |
-\notetitleprettylsidespacewidth |
| 1944 |
-\notetitleprettyrsidespacewidth\relax} |
| 1945 |
\let\notetitleusemainbox\notetitle@pretty@usemainbox |
| 1946 |
% |
| 1947 |
\def\notetitleprettylsiderulewidth{10pt} |
| 1948 |
\def\notetitleprettylsidespacewidth{10pt} |
| 1949 |
\def\notetitleprettyrsiderulewidth{10pt} |
| 1950 |
\def\notetitleprettyrsidespacewidth{10pt} |
| 1951 |
\def\notetitleprettytopspace{10pt} |
| 1952 |
\def\notetitleprettybottomspace{10pt} |
| 1953 |
\def\notetitleprettytophrulewidth{0pt} |
| 1954 |
\def\notetitleprettybottomhrulewidth{0pt} |
| 1955 |
% |
| 1956 |
\definecolor{notetitleprettylsiderulecolor}{RGB}{0,68,126} |
| 1957 |
\colorlet{notetitleprettyrsiderulecolor}{notetitleprettylsiderulecolor} |
| 1958 |
\colorlet{notetitleprettytophrulecolor}{notetitleprettylsiderulecolor} |
| 1959 |
\colorlet{notetitleprettybottomhrulecolor}{notetitleprettylsiderulecolor} |
| 1960 |
\definecolor{notetitleprettytextcolor}{RGB}{25,25,38} |
| 1961 |
\colorlet{notetitleprettybgcolor}{white} |
| 1962 |
} |
| 1963 |
\newlength\notetitle@pretty@tmplenht |
| 1964 |
\newlength\notetitle@pretty@tmplendp |
| 1965 |
\def\notetitle@pretty@usemainbox#1{% |
| 1966 |
\parskip=\z@\relax |
| 1967 |
\parindent=\z@\relax |
| 1968 |
\notetitle@pretty@tmplenht=\ht#1\relax% |
| 1969 |
\notetitle@pretty@tmplendp=\dp#1\relax% |
| 1970 |
\edef\tmp@dorule##1##2{% |
| 1971 |
{\noexpand\color{notetitlepretty##1siderulecolor}% |
| 1972 |
\noexpand\rule{##2}{% |
| 1973 |
\dimexpr \notetitleprettytopspace+ |
| 1974 |
\notetitleprettybottomspace+ |
| 1975 |
\notetitleprettytophrulewidth+ |
| 1976 |
\notetitleprettybottomhrulewidth+ |
| 1977 |
\notetitle@pretty@tmplendp+ |
| 1978 |
\notetitle@pretty@tmplenht\relax}}}% |
| 1979 |
\fboxsep=0pt% for \colorbox |
| 1980 |
\par\hbox to \textwidth{% |
| 1981 |
\hskip 0pt plus 0.1fil minus 0.1fil\relax% |
| 1982 |
\tmp@dorule{l}{\notetitleprettylsiderulewidth}% |
| 1983 |
\colorbox{notetitleprettybgcolor}{% |
| 1984 |
\vbox{% |
| 1985 |
{\color{notetitleprettytophrulecolor}% |
| 1986 |
\hrule height \notetitleprettytophrulewidth\relax}% |
| 1987 |
\hbox{% |
| 1988 |
\hskip \notetitleprettylsidespacewidth\relax |
| 1989 |
% \fbox% DEBUG |
| 1990 |
{\vbox{\vskip \notetitleprettytopspace\relax |
| 1991 |
\box#1% |
| 1992 |
\vskip \notetitleprettybottomspace\relax}}% |
| 1993 |
\hskip \notetitleprettyrsidespacewidth\relax |
| 1994 |
}% |
| 1995 |
{\color{notetitleprettybottomhrulecolor}% |
| 1996 |
\hrule height \notetitleprettybottomhrulewidth\relax}% |
| 1997 |
}}% |
| 1998 |
\tmp@dorule{r}{\notetitleprettyrsiderulewidth}% |
| 1999 |
\hskip 0pt plus 0.1fil minus 0.1fil\relax}% |
| 2000 |
\par% |
| 2001 |
} |
| 2002 |
% \end{macrocode} |
| 2003 |
% \end{macro} |
| 2004 |
% |
| 2005 |
% \begin{macro}{\notetitle@stylesetup@pretty2} |
| 2006 |
% The |pretty2| style simply loads the |pretty| style, and ajusts some |
| 2007 |
% settings. |
| 2008 |
% \begin{macrocode} |
| 2009 |
\csdef{notetitle@stylesetup@pretty2}{% |
| 2010 |
\notetitle@stylesetup@pretty |
| 2011 |
% |
| 2012 |
\definecolor{notetitleprettylsiderulecolor}{RGB}{0,68,126} |
| 2013 |
\colorlet{notetitleprettyrsiderulecolor}{notetitleprettylsiderulecolor} |
| 2014 |
\colorlet{notetitleprettytophrulecolor}{notetitleprettylsiderulecolor} |
| 2015 |
\colorlet{notetitleprettybottomhrulecolor}{notetitleprettylsiderulecolor} |
| 2016 |
\colorlet{notetitleprettytextcolor}{notetitleprettylsiderulecolor!50!black} |
| 2017 |
\colorlet{notetitleprettybgcolor}{white!95!notetitleprettytextcolor} |
| 2018 |
% |
| 2019 |
\def\notetitleprettytophrulewidth{.4pt} |
| 2020 |
\def\notetitleprettybottomhrulewidth{.4pt} |
| 2021 |
} |
| 2022 |
% \end{macrocode} |
| 2023 |
% \end{macro} |
| 2024 |
% |
| 2025 |
% |
| 2026 |
% |
| 2027 |
% \paragraph{Title style: `small'} |
| 2028 |
% |
| 2029 |
% Implementation an alternate `small' title style. |
| 2030 |
% |
| 2031 |
% \begin{macro}{\notetitle@style@small} |
| 2032 |
% The small title style. Again, use the main title engine, but customize the settings. |
| 2033 |
% \begin{macrocode} |
| 2034 |
\let\notetitle@style@small\notetitle@style@default |
| 2035 |
\newcommand\notetitle@stylesetup@small{% |
| 2036 |
\notetitleusempfootnotesfalse |
| 2037 |
% |
| 2038 |
\def\notetitlemakecontents{% |
| 2039 |
{\expandafter\notetitlefont\expandafter{\@title}}% |
| 2040 |
\hfill\makebox{\fontsize{9pt}{10pt}\selectfont |
| 2041 |
\notetitle@small@renderauthordate}% |
| 2042 |
} |
| 2043 |
%\notetitle@default@usesaveboxfalse |
| 2044 |
%\def\notetitlebeginrender{\par} |
| 2045 |
%\def\notetitleendrender{% |
| 2046 |
% \vspace*{\notetitleinnervsep}\notetitlehrule\relax\vspace*{\notetitleinnervsep}} |
| 2047 |
\def\notetitleusemainbox##1{% |
| 2048 |
\par\box##1% |
| 2049 |
\vspace*{\notetitleinnervsep}\notetitlehrule\relax\vspace*{\notetitleinnervsep}} |
| 2050 |
\def\notetitle@small@renderauthordate{% |
| 2051 |
\expandafter\notblank\expandafter{\@author}{% |
| 2052 |
\expandafter\notblank\expandafter{\@date}{% both not blank |
| 2053 |
{\expandafter\notetitleauthorfont\expandafter{\@author}}% |
| 2054 |
\notetitlesmallauthordatesep |
| 2055 |
{\emph{\expandafter\notetitledatefont\expandafter{\@date}}}% |
| 2056 |
}{% only author |
| 2057 |
{\expandafter\notetitleauthorfont\expandafter{\@author}}% |
| 2058 |
}% |
| 2059 |
}{% only date |
| 2060 |
{\emph{\expandafter\notetitledatefont\expandafter{\@date}}}% |
| 2061 |
}} |
| 2062 |
% |
| 2063 |
\def\notetitleinnervsep{1mm} |
| 2064 |
\def\notetitlesmallauthordatesep{\hspace*{2mm}--\hspace*{2mm}} |
| 2065 |
} |
| 2066 |
% \end{macrocode} |
| 2067 |
% \end{macro} |
| 2068 |
% |
| 2069 |
% Style |smallv1| provided for backwards compatibility, to make sure that all |
| 2070 |
% spacing and formatting is exactly the same as for \pkgname{phfnote} version |
| 2071 |
% 1.0. |
| 2072 |
% \begin{macrocode} |
| 2073 |
\csdef{notetitle@style@smallv1}{% |
| 2074 |
\begingroup\par\raggedright% |
| 2075 |
\let\footnote\thanks% |
| 2076 |
\vspace*{\notetitletopspace}% |
| 2077 |
{\expandafter\notetitlefont\expandafter{\@title}}% |
| 2078 |
\hfill\makebox{\fontsize{9pt}{10pt}\selectfont |
| 2079 |
{\expandafter\notetitleauthorfont\expandafter{\@author}}% |
| 2080 |
\hspace*{2mm}--\hspace*{2mm}{\emph{\expandafter\notetitledatefont\expandafter{\@date}}}}% |
| 2081 |
\vspace*{1mm}\notetitlehrule\relax\vspace*{1mm}% |
| 2082 |
\par% |
| 2083 |
\endgroup% |
| 2084 |
\vskip\notetitlebelowspace\relax% don't change this, abstract needs to \removelastskip |
| 2085 |
} |
| 2086 |
% \end{macrocode} |
| 2087 |
% |
| 2088 |
% |
| 2089 |
% \paragraph{Title style: `article'} |
| 2090 |
% |
| 2091 |
% Implementation the `article' title style. |
| 2092 |
% |
| 2093 |
% \begin{macro}{\notetitle@style@article} |
| 2094 |
% \begin{macro}{\notetitle@stylesetup@article} |
| 2095 |
% Technical note. Here, by using a |tabular| environment for authors, we need |
| 2096 |
% to assume that the macro |\notetitleauthorfont| takes one argument and does |
| 2097 |
% not leave the author contents surrounded with full braces. This would cause |
| 2098 |
% `|\\|' tokens enclosed in the protective braces to cause errors in the |
| 2099 |
% tabular environment. |
| 2100 |
% |
| 2101 |
% \begin{macrocode} |
| 2102 |
\let\notetitle@style@article\notetitle@style@default |
| 2103 |
\newcommand{\notetitle@stylesetup@article}{ |
| 2104 |
%\def\notetitletopspace{-3em} |
| 2105 |
\def\notetitlebottomspace{2.5em} |
| 2106 |
\def\notetitleinnervsep{1.5em} |
| 2107 |
\def\notetitlefont{} |
| 2108 |
\def\notetitlefontparsetup{% |
| 2109 |
\LARGE\centering} |
| 2110 |
\long\def\notetitleauthorfontparsetup##1{% |
| 2111 |
\notetitledonextvskip% |
| 2112 |
{\large\centering |
| 2113 |
\lineskip .5em\relax% |
| 2114 |
\begin{tabular}[t]{c}% |
| 2115 |
##1% |
| 2116 |
\end{tabular}\par}} |
| 2117 |
\long\def\notetitleauthorfont##1{\large ##1} |
| 2118 |
\def\notetitledatefontparsetup{% |
| 2119 |
\notetitledonextvskip |
| 2120 |
\centering} |
| 2121 |
\def\phfnote@mpfootnotes@fontparsetup{} |
| 2122 |
\def\notetitleusemainbox##1{% |
| 2123 |
\par |
| 2124 |
\box##1% |
| 2125 |
} |
| 2126 |
\appto\notetitle@default@setup{% |
| 2127 |
%\def\singlespace{}% |
| 2128 |
} |
| 2129 |
% |
| 2130 |
\notetitleusempfootnotesfalse |
| 2131 |
} |
| 2132 |
% \end{macrocode} |
| 2133 |
% \end{macro} |
| 2134 |
% \end{macro} |
| 2135 |
% |
| 2136 |
% |
| 2137 |
% \begin{macro}{\notetitle@style@articlev1} |
| 2138 |
% Backwards compatibility style |articlev1|. |
| 2139 |
% \begin{macrocode} |
| 2140 |
\csdef{notetitle@style@articlev1}{% |
| 2141 |
\vspace*{-3em}% |
| 2142 |
\begingroup |
| 2143 |
\centering |
| 2144 |
\let\footnote\thanks% |
| 2145 |
{\LARGE \@title \par}% |
| 2146 |
\vskip 1.5em% |
| 2147 |
{\large% |
| 2148 |
\lineskip .5em% |
| 2149 |
\begin{tabular}[t]{c}% |
| 2150 |
\@author% |
| 2151 |
\end{tabular}\par}% |
| 2152 |
\vskip 1.5em% |
| 2153 |
{\large \@date}% |
| 2154 |
\par% |
| 2155 |
\endgroup% |
| 2156 |
\par% |
| 2157 |
\vskip 2.5em\relax% |
| 2158 |
} |
| 2159 |
% \end{macrocode} |
| 2160 |
% \end{macro} |
| 2161 |
% |
| 2162 |
% \subsubsection{Plugging into \phfverb{\maketitle}} |
| 2163 |
% |
| 2164 |
% Actually perform the definitions to make |\maketitle| produce the title with |
| 2165 |
% the given style. Specifically, we override |\@maketitle|. The latter is |
| 2166 |
% called internally by |\maketitle|, and the advantage of overriding |
| 2167 |
% |\@maketitle| only is that we inherit the mechanism provided by the original |
| 2168 |
% class (e.g., |article|) to deal with two-column layouts. |
| 2169 |
% |
| 2170 |
% \begin{macro}{\phfnote@do@notetitle} |
| 2171 |
% This macro takes care of installing the correct title into the |
| 2172 |
% document, by overriding |\@maketitle|. |
| 2173 |
% |
| 2174 |
% This macro is called later after processing the package options. |
| 2175 |
% Its argument |#1| is the style name, e.g., |default|. |
| 2176 |
% |
| 2177 |
% \begin{macrocode} |
| 2178 |
\def\phfnote@do@notetitle#1{ |
| 2179 |
% \end{macrocode} |
| 2180 |
% If we have the title style |false|, or an empty title style, then we leave |
| 2181 |
% default title provided by the class. |
| 2182 |
% \begin{macrocode} |
| 2183 |
\ifstrequal{#1}{false}{}{% |
| 2184 |
\if\relax\detokenize\expandafter{#1}\relax |
| 2185 |
\else |
| 2186 |
% \end{macrocode} |
| 2187 |
% Otherwise, we have a title style to set. Do some checks that the given style is indeed |
| 2188 |
% defined. |
| 2189 |
% \begin{macrocode} |
| 2190 |
\ifcsname notetitle@style@#1\endcsname |
| 2191 |
\def\phfnote@tmp@titsty{#1}% |
| 2192 |
\else |
| 2193 |
\PackageError{phfnote}{Unknown title style: '#1'.}{Unknown title |
| 2194 |
style: '#1'. Please consult the package documentation for available |
| 2195 |
styles.} |
| 2196 |
\def\phfnote@tmp@titsty{default}% |
| 2197 |
\fi |
| 2198 |
% \end{macrocode} |
| 2199 |
% Apply new (default) definitions of |\thanks|, |\thanksmark| and |\title|. Do this here |
| 2200 |
% only, because this can clash with more complicated versions from, e.g., \RevTeX. |
| 2201 |
% \begin{macrocode} |
| 2202 |
\let\title\notetitle@title |
| 2203 |
\let\thanks\notetitle@thanks |
| 2204 |
\let\thanksmark\notetitle@thanksmark |
| 2205 |
% \end{macrocode} |
| 2206 |
% Also, LaTeX initializes |\@author| with code that generates a warning that no |
| 2207 |
% author is given. We don't want that. It's perfectly fine not to have an |
| 2208 |
% author, and in this case this must be empty so that our title routines can |
| 2209 |
% properly handle this case. |
| 2210 |
% \begin{macrocode} |
| 2211 |
\def\@author{}% |
| 2212 |
% \end{macrocode} |
| 2213 |
% Now, actually overload the title style by redefining |\@maketitle|. Also, if |
| 2214 |
% the style defines a ``setup'' macro |\notetitle@stylesetup@...|, then we |
| 2215 |
% invoke it. |
| 2216 |
% \begin{macrocode} |
| 2217 |
\ifcsname notetitle@stylesetup@\phfnote@tmp@titsty\endcsname |
| 2218 |
\csname notetitle@stylesetup@\phfnote@tmp@titsty\endcsname |
| 2219 |
\fi |
| 2220 |
\def\@maketitle{\csname notetitle@style@\phfnote@tmp@titsty\endcsname}% |
| 2221 |
\fi |
| 2222 |
}% |
| 2223 |
} |
| 2224 |
% \end{macrocode} |
| 2225 |
% \end{macro} |
| 2226 |
% |
| 2227 |
% |
| 2228 |
% |
| 2229 |
% \subsection{Abstract} |
| 2230 |
% |
| 2231 |
% Now we can take care of the abstract. Unlike the title styles, the abstract has a base |
| 2232 |
% implementation. Then, we may have attributes which change some parameters. |
| 2233 |
% |
| 2234 |
% |
| 2235 |
% \begin{environment}{notedefaultabstract} |
| 2236 |
% First, save the old environment |\begin{abstract}...\end{abstract}| provided by the |
| 2237 |
% class (if any). |
| 2238 |
% \begin{macrocode} |
| 2239 |
\let\notedefaultabstract\abstract |
| 2240 |
\let\endnotedefaultabstract\endabstract |
| 2241 |
% \end{macrocode} |
| 2242 |
% \end{environment} |
| 2243 |
% |
| 2244 |
% \begin{macro}{\noteabstracttextfont} |
| 2245 |
% \begin{macro}{\noteabstractnamefont} |
| 2246 |
% \begin{macro}{\noteabstracttextwidth} |
| 2247 |
% \begin{macro}{\noteabstractafterspacing} |
| 2248 |
% \begin{macro}{\noteabstractbeforepacing} |
| 2249 |
% Macros which can be overridden to customize the abstract. See |
| 2250 |
% \autoref{sec:abstract-attributes}. |
| 2251 |
% \begin{macrocode} |
| 2252 |
\newcommand{\noteabstracttextfont}{} |
| 2253 |
\newcommand{\noteabstractnamefont}{\bfseries\small} |
| 2254 |
\if@twocolumn |
| 2255 |
\newcommand\noteabstracttextwidth{\hsize} |
| 2256 |
\else |
| 2257 |
\newcommand{\noteabstracttextwidth}{0.9\hsize} |
| 2258 |
\fi |
| 2259 |
\newcommand\noteabstractafterspacing{1.5em} |
| 2260 |
\newcommand\noteabstractbeforespacing{1.5em} |
| 2261 |
% \end{macrocode} |
| 2262 |
% \end{macro} |
| 2263 |
% \end{macro} |
| 2264 |
% \end{macro} |
| 2265 |
% \end{macro} |
| 2266 |
% \end{macro} |
| 2267 |
% |
| 2268 |
% \begin{macro}{\noteabstract@nameline} |
| 2269 |
% Create the line which contains the title of the abstract, that is, the word |
| 2270 |
% ``Abstract.'' This can be overloaded, of course, for customization. |
| 2271 |
% \begin{macrocode} |
| 2272 |
\def\noteabstract@nameline{ |
| 2273 |
{\parskip=0pt\relax\par\centering\noteabstractnamefont% |
| 2274 |
\abstractname% |
| 2275 |
\par}\vskip 1ex\relax% |
| 2276 |
} |
| 2277 |
% \end{macrocode} |
| 2278 |
% \end{macro} |
| 2279 |
% |
| 2280 |
% \begin{environment}{noteabstract} |
| 2281 |
% The proper |noteabstract| environment. |
| 2282 |
% |
| 2283 |
% \begin{macrocode} |
| 2284 |
\newenvironment{noteabstract}{% |
| 2285 |
\removelastskip% |
| 2286 |
\vspace{\noteabstractbeforespacing}% |
| 2287 |
\begingroup% |
| 2288 |
\par\noindent\centering% |
| 2289 |
\begin{minipage}{\noteabstracttextwidth}% |
| 2290 |
\noteabstract@nameline% |
| 2291 |
\noteabstracttextfont% |
| 2292 |
}% |
| 2293 |
{% |
| 2294 |
\end{minipage}% |
| 2295 |
\par% |
| 2296 |
\endgroup% |
| 2297 |
\vspace{\noteabstractafterspacing}% |
| 2298 |
} |
| 2299 |
% \end{macrocode} |
| 2300 |
% \end{environment} |
| 2301 |
% |
| 2302 |
% The abstract can be customized by the attributes. Here we define them: |
| 2303 |
% \begin{macrocode} |
| 2304 |
\def\noteabstract@attr@wide{% |
| 2305 |
\def\noteabstracttextwidth{\textwidth}% |
| 2306 |
} |
| 2307 |
\def\noteabstract@attr@narrow{% |
| 2308 |
\if@twocolumn |
| 2309 |
\else |
| 2310 |
\def\noteabstracttextwidth{0.8\textwidth}% |
| 2311 |
\fi |
| 2312 |
} |
| 2313 |
\def\noteabstract@attr@noname{% |
| 2314 |
\def\noteabstract@nameline{}%\vspace*{1ex}}% |
| 2315 |
} |
| 2316 |
\def\noteabstract@attr@original{% |
| 2317 |
\let\abstract\notedefaultabstract |
| 2318 |
\let\endabstract\endnotedefaultabstract |
| 2319 |
} |
| 2320 |
\def\noteabstract@attr@small{% |
| 2321 |
\g@addto@macro\noteabstracttextfont{\small}% |
| 2322 |
} |
| 2323 |
\def\noteabstract@attr@compact{% |
| 2324 |
\renewcommand\noteabstractafterspacing{1ex}% |
| 2325 |
\renewcommand\noteabstractbeforespacing{1ex}% |
| 2326 |
} |
| 2327 |
\def\noteabstract@attr@it{% |
| 2328 |
\g@addto@macro\noteabstracttextfont{\itshape}% |
| 2329 |
} |
| 2330 |
% \end{macrocode} |
| 2331 |
% |
| 2332 |
% \begin{macro}{\phfnote@do@noteabstract} |
| 2333 |
% This helper both defines the |abstract| environment, and also sets the abstract |
| 2334 |
% attributes. This macro will be called according to the package options. |
| 2335 |
% |
| 2336 |
% |#1| = a comma-separated list of attributes, or the string |false|. |
| 2337 |
% \begin{macrocode} |
| 2338 |
\def\phfnote@do@noteabstract#1{% |
| 2339 |
\ifstrequal{#1}{false}{}{% |
| 2340 |
\let\abstract\noteabstract |
| 2341 |
\let\endabstract\endnoteabstract |
| 2342 |
\phfnote@internal@execattribs{noteabstract@attr@}{abstract attribute}{#1} |
| 2343 |
}% |
| 2344 |
} |
| 2345 |
% \end{macrocode} |
| 2346 |
% \end{macro} |
| 2347 |
% |
| 2348 |
% |
| 2349 |
% |
| 2350 |
% \subsection{Page Geometry Settings} |
| 2351 |
% |
| 2352 |
% For the page geometry settings, we just have a bunch of styles which we define as |
| 2353 |
% macros. The macros just set up |\PassOptionsToPackage| for the \pkgname{geometry} package. |
| 2354 |
% Then the correct macro will be selected according to the current \pkgname{phfnote} package |
| 2355 |
% options. |
| 2356 |
% |
| 2357 |
% The description of these settings are given in \autoref{sec:pagegeomdefs}. |
| 2358 |
% |
| 2359 |
% \begin{macro}{\phfnote@pagegeomstyle@default} |
| 2360 |
% Default setting. |
| 2361 |
% \begin{macrocode} |
| 2362 |
\def\phfnote@pagegeomstyle@default{ |
| 2363 |
\if@twocolumn |
| 2364 |
\PassOptionsToPackage{hmargin=1in,vmargin=0.75in,includeheadfoot}{geometry}% |
| 2365 |
\else |
| 2366 |
% fix the margins a bit to make text wider |
| 2367 |
\ifcase\@ptsize% mods for 10 pt |
| 2368 |
\PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}% |
| 2369 |
\or% mods for 11 pt |
| 2370 |
\PassOptionsToPackage{hmargin=1.5in,vmargin=1.25in}{geometry}% |
| 2371 |
\or% mods for 12 pt |
| 2372 |
\PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}% |
| 2373 |
\fi% |
| 2374 |
\fi |
| 2375 |
} |
| 2376 |
% \end{macrocode} |
| 2377 |
% \end{macro} |
| 2378 |
% |
| 2379 |
% \begin{macro}{\phfnote@pagegeomstyle@narrow} |
| 2380 |
% Narrow style. |
| 2381 |
% \begin{macrocode} |
| 2382 |
\def\phfnote@pagegeomstyle@narrow{ |
| 2383 |
\if@twocolumn |
| 2384 |
\PassOptionsToPackage{hmargin=1.25in,vmargin=0.75in,includeheadfoot}{geometry}% |
| 2385 |
\else |
| 2386 |
% fix the margins a bit to make text wider |
| 2387 |
\ifcase\@ptsize% mods for 10 pt |
| 2388 |
\PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}% |
| 2389 |
\or% mods for 11 pt |
| 2390 |
\PassOptionsToPackage{hmargin=1.75in,vmargin=1.5in}{geometry}% |
| 2391 |
\or% mods for 12 pt |
| 2392 |
\PassOptionsToPackage{hmargin=1.5in,vmargin=1.5in}{geometry}% |
| 2393 |
\fi% |
| 2394 |
\fi |
| 2395 |
} |
| 2396 |
% \end{macrocode} |
| 2397 |
% \end{macro} |
| 2398 |
% |
| 2399 |
% \begin{macro}{\phfnote@pagegeomstyle@wide} |
| 2400 |
% Wide style. |
| 2401 |
% \begin{macrocode} |
| 2402 |
\def\phfnote@pagegeomstyle@wide{ |
| 2403 |
\if@twocolumn |
| 2404 |
\PassOptionsToPackage{hmargin=0.75in,vmargin=0.75in,includeheadfoot}{geometry}% |
| 2405 |
\else |
| 2406 |
% fix the margins a bit to make text wider |
| 2407 |
\ifcase\@ptsize% mods for 10 pt |
| 2408 |
\PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}% |
| 2409 |
\or% mods for 11 pt |
| 2410 |
\PassOptionsToPackage{hmargin=1.25in,vmargin=1.25in}{geometry}% |
| 2411 |
\or% mods for 12 pt |
| 2412 |
\PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}% |
| 2413 |
\fi% |
| 2414 |
\fi |
| 2415 |
} |
| 2416 |
% \end{macrocode} |
| 2417 |
% \end{macro} |
| 2418 |
% |
| 2419 |
% \begin{macro}{\phfnote@pagegeomstyle@xwide} |
| 2420 |
% Extra wide. |
| 2421 |
% |
| 2422 |
% \changedreftext{chg-pagegeom-xwide} |
| 2423 |
% \begin{macrocode} |
| 2424 |
\def\phfnote@pagegeomstyle@xwide{ |
| 2425 |
\if@twocolumn |
| 2426 |
\PassOptionsToPackage{hmargin=0.5in,vmargin=0.5in,includeheadfoot}{geometry}% |
| 2427 |
\else |
| 2428 |
% fix the margins a bit to make text wider |
| 2429 |
\ifcase\@ptsize% mods for 10 pt |
| 2430 |
\PassOptionsToPackage{hmargin=1in,vmargin=1in}{geometry}% |
| 2431 |
\or% mods for 11 pt |
| 2432 |
\PassOptionsToPackage{hmargin=1in,vmargin=1in}{geometry}% |
| 2433 |
\or% mods for 12 pt |
| 2434 |
\PassOptionsToPackage{hmargin=0.75in,vmargin=1in}{geometry}% |
| 2435 |
\fi% |
| 2436 |
\fi |
| 2437 |
} |
| 2438 |
\csdef{phfnote@pagegeomstyle@xwidev1}{ |
| 2439 |
\if@twocolumn |
| 2440 |
\PassOptionsToPackage{hmargin=0.5in,vmargin=0.5in,includeheadfoot}{geometry}% |
| 2441 |
\else |
| 2442 |
% fix the margins a bit to make text wider |
| 2443 |
\ifcase\@ptsize% mods for 10 pt |
| 2444 |
\PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}% |
| 2445 |
\or% mods for 11 pt |
| 2446 |
\PassOptionsToPackage{hmargin=1in,vmargin=1.25in}{geometry}% |
| 2447 |
\or% mods for 12 pt |
| 2448 |
\PassOptionsToPackage{hmargin=0.75in,vmargin=1.25in}{geometry}% |
| 2449 |
\fi% |
| 2450 |
\fi |
| 2451 |
} |
| 2452 |
% \end{macrocode} |
| 2453 |
% \end{macro} |
| 2454 |
% |
| 2455 |
% |
| 2456 |
% \begin{macro}{\phfnote@pagegeomstyle@bigmargin} |
| 2457 |
% |bigmargin| style. |
| 2458 |
% \begin{macrocode} |
| 2459 |
\def\phfnote@pagegeomstyle@bigmargin{% |
| 2460 |
\if@twocolumn |
| 2461 |
\PassOptionsToPackage{hmargin=1.5in,vmargin=0.75in,includeheadfoot}{geometry}% |
| 2462 |
\else |
| 2463 |
% fix the margins a bit to make text wider |
| 2464 |
\ifcase\@ptsize% mods for 10 pt |
| 2465 |
\PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}% |
| 2466 |
\or% mods for 11 pt |
| 2467 |
\PassOptionsToPackage{hmargin={2.25in,1.75in},vmargin=1.25in}{geometry}% |
| 2468 |
\or% mods for 12 pt |
| 2469 |
\PassOptionsToPackage{hmargin={2in,1.5in},vmargin=1.25in}{geometry}% |
| 2470 |
\fi% |
| 2471 |
\fi |
| 2472 |
} |
| 2473 |
% \end{macrocode} |
| 2474 |
% \end{macro} |
| 2475 |
% |
| 2476 |
% |
| 2477 |
% \begin{macro}{\phfnote@do@pagegeom} |
| 2478 |
% Finally, provide a helper to set the page geometry. Just call the right |
| 2479 |
% macro. If the argument is |false|, don't do anything. |
| 2480 |
% \begin{macrocode} |
| 2481 |
\newcommand{\phfnote@do@pagegeom}[1]{ |
| 2482 |
\ifstrequal{#1}{false}{}{% |
| 2483 |
\message{phfnote: Setting page geometry style #1}% |
| 2484 |
\ifcsname phfnote@pagegeomstyle@#1\endcsname |
| 2485 |
\csname phfnote@pagegeomstyle@#1\endcsname |
| 2486 |
\else |
| 2487 |
\PackageWarning{phfnote}{Unknown page geometry style: `#1'!}% |
| 2488 |
\fi |
| 2489 |
% |
| 2490 |
\RequirePackage{geometry}% |
| 2491 |
}% |
| 2492 |
} |
| 2493 |
% \end{macrocode} |
| 2494 |
% \end{macro} |
| 2495 |
% |
| 2496 |
% |
| 2497 |
% \subsection{Text, Paragraph and Line Spacing} |
| 2498 |
% |
| 2499 |
% \paragraph{Text \& Line Spacing} |
| 2500 |
% |
| 2501 |
% \begin{macro}{\phfnote@do@spacing} |
| 2502 |
% Some cosmetic definitions to adjust line spacing. The line spacing is slightly |
| 2503 |
% adjusted according to font size to make the document more readable. Depending on |
| 2504 |
% whether the \pkgname{setspace} package is loaded, we use it or go low-level with a |
| 2505 |
% redefinition of \LaTeX{}' |\baselinestretch|. If the \pkgname{captions} package is loaded, |
| 2506 |
% the figure captions' line spacing is also adjusted. |
| 2507 |
% |
| 2508 |
% Also set an |\emergencystretch| so that lines get spaced out for underfull boxes, |
| 2509 |
% rather than overflowing far into the margin. |
| 2510 |
% \begin{macrocode} |
| 2511 |
\def\phfnote@do@spacingdefs#1{ |
| 2512 |
\ifstrequal{#1}{false}{}{% |
| 2513 |
\@ifpackageloaded{setspace}{ |
| 2514 |
\def\phfnote@dostretch##1{% |
| 2515 |
\setstretch{##1}\phfnote@docaptionstretch{##1}} |
| 2516 |
}{ |
| 2517 |
\def\phfnote@dostretch##1{% |
| 2518 |
\renewcommand\baselinestretch{##1}\phfnote@docaptionstretch{##1}} |
| 2519 |
} |
| 2520 |
\@ifpackageloaded{caption}{ |
| 2521 |
\def\phfnote@docaptionstretch##1{\captionsetup{font={stretch=##1}}} |
| 2522 |
}{ |
| 2523 |
\def\phfnote@docaptionstretch##1{\PackageWarning{phfnote}{Can't |
| 2524 |
set line spacing for captions, because the package `caption' |
| 2525 |
is not loaded. Please load it before `phfnote', or use an |
| 2526 |
appropriate pkgset (e.g. `rich') which loads this package |
| 2527 |
automatically.}} |
| 2528 |
} |
| 2529 |
\if@twocolumn |
| 2530 |
\phfnote@dostretch{1.0} % leave default |
| 2531 |
\emergencystretch=3em\relax |
| 2532 |
\else |
| 2533 |
\ifcase\@ptsize% 10pt |
| 2534 |
\phfnote@dostretch{1.1} |
| 2535 |
\or% 11pt |
| 2536 |
\phfnote@dostretch{1.0} % 1.05? better 1.0... |
| 2537 |
\or% 12pt |
| 2538 |
\phfnote@dostretch{1.0} % 1.03? not really noticeable... |
| 2539 |
\fi |
| 2540 |
\emergencystretch=6em\relax |
| 2541 |
\fi |
| 2542 |
} |
| 2543 |
} |
| 2544 |
% \end{macrocode} |
| 2545 |
% \end{macro} |
| 2546 |
% |
| 2547 |
% |
| 2548 |
% \paragraph{Paragraph Spacing Presets} |
| 2549 |
% |
| 2550 |
% Here again, we define several possibilities for paragraph settings as |
| 2551 |
% individual macros (see \autoref{sec:par-defs}). Depending on the package |
| 2552 |
% option, we execute the corresponding macro. |
| 2553 |
% |
| 2554 |
% \begin{macrocode} |
| 2555 |
\def\phfnote@par@original{% |
| 2556 |
} |
| 2557 |
\def\phfnote@par@indent{% |
| 2558 |
\parindent=1.5em\relax |
| 2559 |
\parskip=0pt\relax |
| 2560 |
} |
| 2561 |
\def\phfnote@par@indentminiskip{% |
| 2562 |
\parindent=1.5em\relax |
| 2563 |
\parskip=0.3em plus 0.1em\relax |
| 2564 |
} |
| 2565 |
\def\phfnote@par@skip{% |
| 2566 |
\parindent=0pt\relax |
| 2567 |
\parskip=0.8em plus 0.2em minus 0.1em\relax |
| 2568 |
} |
| 2569 |
% \end{macrocode} |
| 2570 |
% |
| 2571 |
% \begin{macro}{\phfnote@do@par} |
| 2572 |
% Execute the given paragraph setting. The argument |#1| is the setting, for example, |
| 2573 |
% |skip|. |
| 2574 |
% \begin{macrocode} |
| 2575 |
\def\phfnote@do@par#1{% |
| 2576 |
\ifstrequal{#1}{false}{}{% |
| 2577 |
\ifcsname phfnote@par@#1\endcsname |
| 2578 |
\csname phfnote@par@#1\endcsname |
| 2579 |
\else |
| 2580 |
\PackageWarning{phfnote}{Bad paragraph setting: #1. Leaving original} |
| 2581 |
\fi |
| 2582 |
} |
| 2583 |
} |
| 2584 |
% \end{macrocode} |
| 2585 |
% \end{macro} |
| 2586 |
% |
| 2587 |
% |
| 2588 |
% |
| 2589 |
% |
| 2590 |
% \subsection{Section Styling} |
| 2591 |
% |
| 2592 |
% Very limited support for styling section and paragraph headers |
| 2593 |
% (\autoref{sec:secfmt}). If you want anything serious, use \pkgname{sectsty} or |
| 2594 |
% \pkgname{titlesec} directly. |
| 2595 |
% |
| 2596 |
% \begin{macro}{\notesectionallfont} |
| 2597 |
% \begin{macro}{\notesectionallfontfamily} |
| 2598 |
% Define the |\notesectionallfont| and |\notesectionallfontfamily|, which |
| 2599 |
% control the general font used in section headings. |
| 2600 |
% \begin{macrocode} |
| 2601 |
\newcommand{\notesectionallfont}{% |
| 2602 |
\fontfamily{\notesectionallfontfamily}\fontseries{bx}\selectfont} |
| 2603 |
\newcommand{\notesectionallfontfamily}{ppl} |
| 2604 |
% \end{macrocode} |
| 2605 |
% \end{macro} |
| 2606 |
% \end{macro} |
| 2607 |
% |
| 2608 |
% |
| 2609 |
% \begin{macro}{\notesectionfont} |
| 2610 |
% \begin{macro}{\notesubsectionfont} |
| 2611 |
% \begin{macro}{\notesubsubsectionfont} |
| 2612 |
% \begin{macro}{\noteparagraphfont} |
| 2613 |
% \begin{macro}{\notesubparagraphfont} |
| 2614 |
% These macros are called for their respective sectioning command, |
| 2615 |
% after |\notesectionallfont| has been invoked. (Again, only for |
| 2616 |
% those sectioning commands which are styled by us.) |
| 2617 |
% |
| 2618 |
% \begin{macrocode} |
| 2619 |
\newcommand{\notesectionfont}{\large} |
| 2620 |
\newcommand{\notesubsectionfont}{\normalsize} |
| 2621 |
\newcommand{\notesubsubsectionfont}{\small} |
| 2622 |
\newcommand{\noteparagraphfont}{\normalsize} |
| 2623 |
\newcommand{\notesubparagraphfont}{\normalsize} |
| 2624 |
% \end{macrocode} |
| 2625 |
% \end{macro} |
| 2626 |
% \end{macro} |
| 2627 |
% \end{macro} |
| 2628 |
% \end{macro} |
| 2629 |
% \end{macro} |
| 2630 |
% |
| 2631 |
% |
| 2632 |
% \begin{macro}{\notesectionsetfonts} |
| 2633 |
% \begin{macro}{\noteparagraphsetfonts} |
| 2634 |
% Helpers to directly set the font commands for |\section|, |
| 2635 |
% |\subsection| and |\subsubsection| (with |\notesectionsetfonts|), |
| 2636 |
% and for |\paragraph| and |\subparagraph| (with |\noteparagraphsetfonts|). |
| 2637 |
% \begin{macrocode} |
| 2638 |
\newcommand{\notesectionsetfonts}[3]{% |
| 2639 |
\renewcommand{\notesectionfont}{#1}% |
| 2640 |
\renewcommand{\notesubsectionfont}{#2}% |
| 2641 |
\renewcommand{\notesubsubsectionfont}{#3}% |
| 2642 |
} |
| 2643 |
\newcommand{\noteparagraphsetfonts}[2]{% |
| 2644 |
\renewcommand{\noteparagraphfont}{#1}% |
| 2645 |
\renewcommand{\notesubparagraphfont}{#2}% |
| 2646 |
} |
| 2647 |
% \end{macrocode} |
| 2648 |
% \end{macro} |
| 2649 |
% \end{macro} |
| 2650 |
% |
| 2651 |
% |
| 2652 |
% Define the attributes which the user can set. See |
| 2653 |
% \autoref{sec:secfmt}. |
| 2654 |
% |
| 2655 |
% \begin{macrocode} |
| 2656 |
\def\phfnote@do@secfmt@section{ |
| 2657 |
\RequirePackage{sectsty} |
| 2658 |
\sectionfont{\notesectionallfont\notesectionfont} |
| 2659 |
\subsectionfont{\notesectionallfont\notesubsectionfont} |
| 2660 |
\subsubsectionfont{\notesectionallfont\notesubsubsectionfont} |
| 2661 |
} |
| 2662 |
\def\phfnote@do@secfmt@paragraph{ |
| 2663 |
\RequirePackage{sectsty} |
| 2664 |
\paragraphfont{\notesectionallfont\noteparagraphfont} |
| 2665 |
\subparagraphfont{\notesectionallfont\notesubparagraphfont} |
| 2666 |
} |
| 2667 |
\def\phfnote@do@secfmt@compact{ |
| 2668 |
\notesectionsetfonts{\normalsize}{\small}{\small} |
| 2669 |
} |
| 2670 |
\def\phfnote@do@secfmt@larger{ |
| 2671 |
\notesectionsetfonts{\Large}{\large}{\normalsize} |
| 2672 |
} |
| 2673 |
|
| 2674 |
\def\phfnote@do@secfmt@secsquares{ |
| 2675 |
\RequirePackage{amssymb} |
| 2676 |
\let\phfnote@secsquares@old@seccntformat\@seccntformat |
| 2677 |
\def\@seccntformat##1{% |
| 2678 |
\expandafter\ifx\csname ##1\endcsname\section\relax% |
| 2679 |
\unexpanded{\makebox[0pt][r]{\raisebox{0.15ex}{{% |
| 2680 |
\notesmaller[0.6]\ensuremath{\blacksquare}}}% |
| 2681 |
\hspace*{1.2ex}}}% |
| 2682 |
\fi% |
| 2683 |
\phfnote@secsquares@old@seccntformat{##1}} |
| 2684 |
} |
| 2685 |
\def\phfnote@do@secfmt@secnummargin{ |
| 2686 |
\let\phfnote@secnummargin@old@seccntformat\@seccntformat |
| 2687 |
\def\@seccntformat##1{% |
| 2688 |
\protect\makebox[0pt][r]{\phfnote@secnummargin@old@seccntformat{##1}}} |
| 2689 |
} |
| 2690 |
|
| 2691 |
\def\phfnote@do@secfmt@rmfamily{ |
| 2692 |
\renewcommand\notesectionallfontfamily{\rmdefault} |
| 2693 |
} |
| 2694 |
\def\phfnote@do@secfmt@sffamily{ |
| 2695 |
\renewcommand\notesectionallfontfamily{\sfdefault} |
| 2696 |
} |
| 2697 |
\def\phfnote@do@secfmt@itpar{ |
| 2698 |
\def\noteparagraphfont{\normalfont\normalsize\itshape} |
| 2699 |
\def\notesubparagraphfont{\normalfont\normalsize\itshape} |
| 2700 |
} |
| 2701 |
\def\phfnote@do@secfmt@blockpar{ |
| 2702 |
\let\phfnote@old@paragraph\paragraph |
| 2703 |
\def\paragraph##1{% |
| 2704 |
\phfnote@old@paragraph{##1}% |
| 2705 |
\hspace*{0pt}\par\nopagebreak% ugly hack!! |
| 2706 |
} |
| 2707 |
} |
| 2708 |
% \end{macrocode} |
| 2709 |
% |
| 2710 |
% |
| 2711 |
% \begin{macro}{\phfnote@do@secfmt} |
| 2712 |
% Actually perform the required styling, according to the package options |
| 2713 |
% given as argument. The argument is a comma-separated list of attributes |
| 2714 |
% specified by the user, or the string |false|. |
| 2715 |
% \begin{macrocode} |
| 2716 |
\def\phfnote@do@secfmt#1{% |
| 2717 |
\ifstrequal{#1}{false}{}{% |
| 2718 |
\phfnote@internal@execattribs{phfnote@do@secfmt@}{section formatting preset}{#1}% |
| 2719 |
} |
| 2720 |
} |
| 2721 |
% \end{macrocode} |
| 2722 |
% \end{macro} |
| 2723 |
% |
| 2724 |
% |
| 2725 |
% |
| 2726 |
% \subsection{\LaTeX{} Package Sets} |
| 2727 |
% |
| 2728 |
% Define the package sets as macros. Depending on the user-specified |
| 2729 |
% options we load the corresponding one(s) (several may be specified). |
| 2730 |
% |
| 2731 |
% See \autoref{sec:package-sets} for a description of what these |
| 2732 |
% package sets do. |
| 2733 |
% |
| 2734 |
% \begin{macro}{\phfnote@do@pkgset@none} |
| 2735 |
% \begin{macro}{\phfnote@do@pkgset@minimal} |
| 2736 |
% \begin{macro}{\phfnote@do@pkgset@rich} |
| 2737 |
% \begin{macro}{\phfnote@do@pkgset@extended} |
| 2738 |
% Macros which implement the package sets. Each macro invokes |\RequirePackage| |
| 2739 |
% for the appropriate packages. |
| 2740 |
% \begin{macrocode} |
| 2741 |
\def\phfnote@do@pkgset@none{ |
| 2742 |
} |
| 2743 |
|
| 2744 |
\def\phfnote@do@pkgset@minimal{ |
| 2745 |
|
| 2746 |
\RequirePackage{amsmath} |
| 2747 |
\RequirePackage{amsfonts} |
| 2748 |
\RequirePackage{amssymb} |
| 2749 |
\RequirePackage{amsthm} |
| 2750 |
|
| 2751 |
\RequirePackage{xcolor} |
| 2752 |
|
| 2753 |
} |
| 2754 |
|
| 2755 |
|
| 2756 |
\def\phfnote@internal@setifxeorlua#1#2{% |
| 2757 |
\ifXeTeX\let#1#2\fi |
| 2758 |
\ifLuaTeX\let#1#2\fi |
| 2759 |
} |
| 2760 |
|
| 2761 |
\def\phfnote@do@pkgset@rich{ |
| 2762 |
|
| 2763 |
\phfnote@do@pkgset@minimal |
| 2764 |
|
| 2765 |
\RequirePackage{setspace} |
| 2766 |
\RequirePackage{caption} |
| 2767 |
|
| 2768 |
\PassOptionsToPackage{shortlabels}{enumitem} |
| 2769 |
\RequirePackage{enumitem} |
| 2770 |
|
| 2771 |
\RequirePackage{graphicx} |
| 2772 |
|
| 2773 |
% \end{macrocode} |
| 2774 |
% For this bit, use the \pkgname{iftex} package to determine if we're running |
| 2775 |
% XeTeX or LuaTeX; if that's the case then we inhibit the loading of |
| 2776 |
% \pkgname{inputenc} and \pkgname{fontenc}. The |\IfFileExists| is to ensure |
| 2777 |
% the package runs on older LaTeX distributions without \pkgname{iftex}. |
| 2778 |
% |
| 2779 |
% Plus, load \pkgname{inputenc}, resp. \pkgname{fontenc}, only if it isn't |
| 2780 |
% already loaded. |
| 2781 |
% |
| 2782 |
% \changedreftext{chg-xe-luatex-input-fontenc-pkgset} |
| 2783 |
% \begin{macrocode} |
| 2784 |
\def\phfnote@tmp@requireinputencfontenc{ |
| 2785 |
\@ifpackageloaded{fontenc}{}{ |
| 2786 |
\PassOptionsToPackage{T1}{fontenc} |
| 2787 |
\RequirePackage{fontenc} |
| 2788 |
} |
| 2789 |
\@ifpackageloaded{inputenc}{}{ |
| 2790 |
\PassOptionsToPackage{utf8}{inputenc} |
| 2791 |
\RequirePackage{inputenc} |
| 2792 |
} |
| 2793 |
} |
| 2794 |
\IfFileExists{iftex.sty}{ |
| 2795 |
\RequirePackage{iftex} |
| 2796 |
\phfnote@internal@setifxeorlua\phfnote@tmp@requireinputencfontenc\relax |
| 2797 |
}{} |
| 2798 |
\phfnote@tmp@requireinputencfontenc |
| 2799 |
|
| 2800 |
% \end{macrocode} |
| 2801 |
% |
| 2802 |
% Load \pkgname{microtype} after \pkgname{fontenc} (just in case). |
| 2803 |
% \begin{macrocode} |
| 2804 |
\RequirePackage{microtype} |
| 2805 |
} |
| 2806 |
|
| 2807 |
\def\phfnote@do@pkgset@extended{ |
| 2808 |
|
| 2809 |
\phfnote@do@pkgset@rich |
| 2810 |
|
| 2811 |
\RequirePackage{float} |
| 2812 |
|
| 2813 |
\RequirePackage{verbdef} |
| 2814 |
|
| 2815 |
\PassOptionsToPackage{autostyle,autopunct=true}{csquotes} |
| 2816 |
\RequirePackage{csquotes} |
| 2817 |
|
| 2818 |
\RequirePackage{dsfont} |
| 2819 |
\RequirePackage{bbm} |
| 2820 |
\RequirePackage{mathtools} |
| 2821 |
|
| 2822 |
} |
| 2823 |
% \end{macrocode} |
| 2824 |
% \end{macro} |
| 2825 |
% \end{macro} |
| 2826 |
% \end{macro} |
| 2827 |
% \end{macro} |
| 2828 |
% |
| 2829 |
% |
| 2830 |
% \begin{macro}{\phfnote@do@pkgset} |
| 2831 |
% Finally, define the helper which will load the required package sets. |
| 2832 |
% \begin{macrocode} |
| 2833 |
\def\phfnote@do@pkgset#1{ |
| 2834 |
\phfnote@internal@execattribs{phfnote@do@pkgset@}{package set}{#1} |
| 2835 |
} |
| 2836 |
% \end{macrocode} |
| 2837 |
% \end{macro} |
| 2838 |
% |
| 2839 |
% |
| 2840 |
% \subsection{Hyperref Support and Hyperlinks} |
| 2841 |
% |
| 2842 |
% \begin{pkgnote} |
| 2843 |
% The name `|docnotelinkcolor|' is historical and hard-coded in many |
| 2844 |
% other files I've used, so I'm DEFINITELY NOT changing it. |
| 2845 |
% \end{pkgnote} |
| 2846 |
% |
| 2847 |
% |
| 2848 |
% |
| 2849 |
% Helpers---default set of hyperref options, and other helper macros. |
| 2850 |
% \begin{macrocode} |
| 2851 |
\def\phfnote@hyperrefdefs@val@options{% |
| 2852 |
bookmarksnumbered=false,bookmarksopen=false,bookmarksopenlevel=1,% |
| 2853 |
breaklinks=true,pdfborder={0 0 0},colorlinks=true,% |
| 2854 |
anchorcolor=docnotelinkcolor,citecolor=docnotelinkcolor,% |
| 2855 |
filecolor=docnotelinkcolor,linkcolor=docnotelinkcolor,% |
| 2856 |
menucolor=docnotelinkcolor,runcolor=docnotelinkcolor,% |
| 2857 |
urlcolor=docnotelinkcolor% |
| 2858 |
}% |
| 2859 |
\def\phfnote@hyperrefdefs@deferredhypersetup#1{% |
| 2860 |
\AtBeginDocument{% |
| 2861 |
\@ifpackageloaded{hyperref}{% |
| 2862 |
\hypersetup{#1}% |
| 2863 |
}{% |
| 2864 |
\PackageWarning{phfnote}{\MessageBreak\MessageBreak |
| 2865 |
*** package `hyperref` was not loaded ***\MessageBreak |
| 2866 |
Since you specified `hyperrefdefs=defer`, I was expecting you would call |
| 2867 |
`\string\usepackage{hyperref}` at some point later in your preamble, but |
| 2868 |
it does not appear you did so. Your document might look weird.}% |
| 2869 |
}% |
| 2870 |
}% |
| 2871 |
} |
| 2872 |
\providecommand\phfnote@hyperrefdefs@dopkgoptions{% |
| 2873 |
\PassOptionsToPackage{unicode=true}{hyperref} |
| 2874 |
} |
| 2875 |
\def\phfnote@hyperrefdefs@loadhyperref{% |
| 2876 |
\phfnote@hyperrefdefs@dopkgoptions |
| 2877 |
\RequirePackage{hyperref}} |
| 2878 |
\def\phfnote@hyperrefdefs@provideemail{\let\email\phfnote@email} |
| 2879 |
\def\phfnote@eqref#1{% |
| 2880 |
\hyperref[{#1}]{\textup{\tagform@{\ref*{#1}}}}% |
| 2881 |
} |
| 2882 |
\def\phfnote@hyperrefdefs@redefeqref{% |
| 2883 |
\let\eqref\phfnote@eqref |
| 2884 |
} |
| 2885 |
\def\phfnote@hyperrefdefs@afterhook{} |
| 2886 |
% \end{macrocode} |
| 2887 |
% |
| 2888 |
% Define the attributes that can be set for hyperref-related options. See |
| 2889 |
% \autoref{sec:hyperrefdefs}. |
| 2890 |
% |
| 2891 |
% \begin{macrocode} |
| 2892 |
\def\phfnote@do@hyperrefdefs@attr@true{}% for explicit value "hyperrefdefs=true" |
| 2893 |
\def\phfnote@do@hyperrefdefs@attr@defer{ |
| 2894 |
\def\phfnote@hyperrefdefs@loadhyperref{% |
| 2895 |
\phfnote@hyperrefdefs@dopkgoptions |
| 2896 |
\let\hypersetup\phfnote@hyperrefdefs@deferredhypersetup} |
| 2897 |
} |
| 2898 |
\def\phfnote@do@hyperrefdefs@attr@clearoptions{ |
| 2899 |
\def\phfnote@hyperrefdefs@val@options{} |
| 2900 |
} |
| 2901 |
\def\phfnote@do@hyperrefdefs@attr@noemail{ |
| 2902 |
\def\phfnote@hyperrefdefs@provideemail{} |
| 2903 |
} |
| 2904 |
\def\phfnote@do@hyperrefdefs@attr@noeqref{ |
| 2905 |
\def\phfnote@hyperrefdefs@redefeqref{} |
| 2906 |
} |
| 2907 |
\def\phfnote@do@hyperrefdefs@attr@noload{ |
| 2908 |
\def\phfnote@hyperrefdefs@loadhyperref{} |
| 2909 |
\def\phfnote@hyperrefdefs@redefeqref{} |
| 2910 |
\let\hypersetup\@gobble |
| 2911 |
} |
| 2912 |
% \end{macrocode} |
| 2913 |
% |
| 2914 |
% |
| 2915 |
% \begin{macro}{\phfnote@do@hyperrefdefs} |
| 2916 |
% \begin{macro}{\email} |
| 2917 |
% \begin{macro}{\url} |
| 2918 |
% Do all stuff related to hyperref. |
| 2919 |
% \begin{macrocode} |
| 2920 |
\def\phfnote@do@hyperrefdefs#1{% |
| 2921 |
\ifstrequal{#1}{false}{}{% |
| 2922 |
% \end{macrocode} |
| 2923 |
% Make sure a color-managing package is loaded, {color} or {xcolor}, and define |
| 2924 |
% our default link color: |
| 2925 |
% \begin{macrocode} |
| 2926 |
\phfnote@requirecolorpackage% |
| 2927 |
\definecolor{docnotelinkcolor}{rgb}{0,0,0.4}% |
| 2928 |
% \end{macrocode} |
| 2929 |
% Load the \pkgname{url} package, and save a version of |\url| which is not |
| 2930 |
% patched by \pkgname{hyperref} to format URLs, and provide |\phfnoteEmail| for |
| 2931 |
% emails (not |\email| right away because it might conflict with RevTeX. Provide |
| 2932 |
% |\email| later after parsing attribs): |
| 2933 |
% \begin{macrocode} |
| 2934 |
\RequirePackage{url}% |
| 2935 |
\DeclareUrlCommand\phfnote@format@url{}% |
| 2936 |
\let\phfnoteEmail\phfnote@email |
| 2937 |
% \end{macrocode} |
| 2938 |
% |
| 2939 |
% Set up everything according to the user's selected attributes. |
| 2940 |
% \begin{macrocode} |
| 2941 |
\phfnote@internal@execattribs{phfnote@do@hyperrefdefs@attr@}{% |
| 2942 |
phfnote hyperref-related option}{#1}% |
| 2943 |
% \end{macrocode} |
| 2944 |
% |
| 2945 |
% And now, load the hyperref package (or don't, if it's deferred), and set some |
| 2946 |
% options. |
| 2947 |
% \begin{macrocode} |
| 2948 |
\phfnote@hyperrefdefs@loadhyperref |
| 2949 |
\expandafter\hypersetup\expandafter{\phfnote@hyperrefdefs@val@options} |
| 2950 |
\phfnote@hyperrefdefs@provideemail |
| 2951 |
\phfnote@hyperrefdefs@redefeqref |
| 2952 |
\urlstyle{notesf} |
| 2953 |
\phfnote@hyperrefdefs@afterhook |
| 2954 |
} |
| 2955 |
} |
| 2956 |
% \end{macrocode} |
| 2957 |
% \end{macro} |
| 2958 |
% \end{macro} |
| 2959 |
% \end{macro} |
| 2960 |
% |
| 2961 |
% \begin{macro}{\phfnotePdfLinkColor} |
| 2962 |
% Set links color. Use as |\phfnotePdfLinkColor|\marg{color}. |
| 2963 |
% Color may be any color name or specification recognized by the |
| 2964 |
% \pkgname{xcolor} package. |
| 2965 |
% |
| 2966 |
% \begin{macrocode} |
| 2967 |
\newcommand{\phfnotePdfLinkColor}[1]{% |
| 2968 |
\@ifpackageloaded{xcolor}{% |
| 2969 |
\colorlet{docnotelinkcolor}{#1}% |
| 2970 |
}{% else: |
| 2971 |
\PackageError{phfnote}{\protect\phfnotePdfLinkColor may only be |
| 2972 |
used if the package xcolor is loaded.}{}% |
| 2973 |
}% |
| 2974 |
} |
| 2975 |
% \end{macrocode} |
| 2976 |
% \end{macro} |
| 2977 |
% |
| 2978 |
% |
| 2979 |
% \needspace{3\baselineskip} |
| 2980 |
% \begin{macro}{\phfnote@sanitize@url} |
| 2981 |
% \begin{macro}{\phfnote@format@url} |
| 2982 |
% \begin{macro}{\phfnote@email} |
| 2983 |
% Provide base macros to be able to build up |\email| command for emails and other |
| 2984 |
% URL-like commands which should sanitize their arguments. |
| 2985 |
% |
| 2986 |
% Also prepare the command |\phfnoteEmail| which will be renamed |\email| in our |
| 2987 |
% \pkgname{hyperref} package setup (see above). |
| 2988 |
% |
| 2989 |
% NOTE: The commands |\phfnote@email| and |\phfnote@format@url| will only work |
| 2990 |
% if you don't have |hyperrefdefs=false|. They will work with |
| 2991 |
% |hyperrefdefs=noload| if you don't want to load the |hyperref| package. |
| 2992 |
% \begin{macrocode} |
| 2993 |
\def\phfnote@sanitize@url{% |
| 2994 |
\catcode`\$12% |
| 2995 |
\catcode`\&12% |
| 2996 |
\catcode`\#12% |
| 2997 |
\catcode`\^12% |
| 2998 |
\catcode`\_12% |
| 2999 |
\catcode`\%12% |
| 3000 |
% \catcode`\^^J10% newline = space |
| 3001 |
% \catcode`\^^M10% newline = space |
| 3002 |
\relax% |
| 3003 |
}% |
| 3004 |
\def\phfnote@email{\begingroup\phfnote@sanitize@url\phfnote@impl@email@}% |
| 3005 |
\def\phfnote@impl@email@#1{\endgroup\href{mailto:#1}{\phfnote@format@url{#1}}}% |
| 3006 |
% \end{macrocode} |
| 3007 |
% \end{macro} |
| 3008 |
% \end{macro} |
| 3009 |
% \end{macro} |
| 3010 |
% |
| 3011 |
% |
| 3012 |
% |
| 3013 |
% \begin{macro}{\phfnote@requirecolorpackage} |
| 3014 |
% And finally define an internal utility to make sure that a color package |
| 3015 |
% (either \pkgname{color} or \pkgname{xcolor}) is loaded. If none are loaded, |
| 3016 |
% the \pkgname{xcolor} package is loaded. |
| 3017 |
% \begin{macrocode} |
| 3018 |
\def\phfnote@requirecolorpackage{% |
| 3019 |
\@ifpackageloaded{color}{% |
| 3020 |
}{% |
| 3021 |
\@ifpackageloaded{xcolor}{% |
| 3022 |
}{% |
| 3023 |
\RequirePackage{xcolor}% |
| 3024 |
}% |
| 3025 |
}% |
| 3026 |
} |
| 3027 |
% \end{macrocode} |
| 3028 |
% \end{macro} |
| 3029 |
% |
| 3030 |
% |
| 3031 |
% \subsection{Cosmetic Font Definitions} |
| 3032 |
% |
| 3033 |
% \begin{macro}{\phfnote@do@fontdefs} |
| 3034 |
% Minimalist cosmetic definition for fonts: load the |T1| font |
| 3035 |
% encoding which is better. Also, use Computer Modern Bright as |
| 3036 |
% sans-serif font by default instead of Computer Modern Sans Serif. |
| 3037 |
% |
| 3038 |
% If on Xe\TeX{} or Lua\TeX{}, don't do anything. |
| 3039 |
% |
| 3040 |
% \begin{macrocode} |
| 3041 |
\def\phfnote@do@fontdefs#1{ |
| 3042 |
\ifstrequal{#1}{false}{}{% |
| 3043 |
\let\phfnote@tmp@do\@firstofone |
| 3044 |
\IfFileExists{iftex.sty}{% |
| 3045 |
\RequirePackage{iftex}% |
| 3046 |
\phfnote@internal@setifxeorlua\phfnote@tmp@do\@gobble |
| 3047 |
}{} |
| 3048 |
\phfnote@tmp@do{ |
| 3049 |
\PassOptionsToPackage{T1}{fontenc} |
| 3050 |
\RequirePackage{fontenc} |
| 3051 |
\renewcommand\sfdefault{cmbr} |
| 3052 |
} |
| 3053 |
} |
| 3054 |
} |
| 3055 |
% \end{macrocode} |
| 3056 |
% \end{macro} |
| 3057 |
% |
| 3058 |
% |
| 3059 |
% \subsection{Bibliography Stuff} |
| 3060 |
% |
| 3061 |
% Provide some fixes for the bibliography. |
| 3062 |
% |
| 3063 |
% \begin{macro}{\phfnote@bibstyle} |
| 3064 |
% \begin{macro}{\phfnote@bibfont} |
| 3065 |
% Our default bibliography style is stored in |\phfnote@bibstyle|. |
| 3066 |
% By default, it's our own hacked version of the |naturemag| style. |
| 3067 |
% The font in which to typeset the bibliography is stored in |
| 3068 |
% |\phfnote@bibfont|. By default, it's a little smaller than the |
| 3069 |
% main text. |
| 3070 |
% \begin{macrocode} |
| 3071 |
\newcommand{\phfnote@bibstyle}{naturemagdoi} |
| 3072 |
\newcommand{\phfnote@bibfont}{\fontsize{9}{11}\selectfont} |
| 3073 |
% \end{macrocode} |
| 3074 |
% \end{macro} |
| 3075 |
% \end{macro} |
| 3076 |
% |
| 3077 |
% |
| 3078 |
% \begin{macro}{\phfnote@bibliography} |
| 3079 |
% These are a tentative implementation for |\bibliography|. The latter will be set to |
| 3080 |
% this implementation according to the user's package options. |
| 3081 |
% \begin{macrocode} |
| 3082 |
\let\phfnote@old@bibliography\bibliography |
| 3083 |
\let\phfnote@old@bibliographystyle\bibliographystyle |
| 3084 |
\newcommand{\phfnote@bibliography}[1]{% |
| 3085 |
\begingroup% |
| 3086 |
\phfnote@bibfont% |
| 3087 |
\phfnote@old@bibliographystyle{\phfnote@bibstyle}% |
| 3088 |
% \end{macrocode} |
| 3089 |
% |
| 3090 |
% Our hack: make sure that the next instance of |\section*| will generate a TOC |
| 3091 |
% entry. (See |\phfnoteHackSectionStarWithTOC|.) |
| 3092 |
% \begin{macrocode} |
| 3093 |
\phfnoteHackSectionStarWithTOC% |
| 3094 |
% \end{macrocode} |
| 3095 |
% |
| 3096 |
% Some special chars may appear in output of some ill-advised bibliography |
| 3097 |
% managers. Mostly the |&| symbol, such as in |Taylor & Francis|. We won't be needing a |
| 3098 |
% \LaTeX{} alignment operator here, so just make |&| a normal printable character |
| 3099 |
% (``other'' catcode). |
| 3100 |
% \begin{macrocode} |
| 3101 |
\catcode`\&=12\relax% normal char |
| 3102 |
% \end{macrocode} |
| 3103 |
% |
| 3104 |
% Adjust the appearance of e-prints. We assume e-prints refer to the arXiv; here we |
| 3105 |
% generate a hyperlink and format them better. |
| 3106 |
% |
| 3107 |
% \begin{macrocode} |
| 3108 |
\providecommand\eprint[2][]{\href{http://arxiv.org/abs/##2}{arXiv:##2}} |
| 3109 |
% \end{macrocode} |
| 3110 |
% |
| 3111 |
% Fix for RevTeX styles that use |\doibase| with a newline following them --- |
| 3112 |
% \begin{macrocode} |
| 3113 |
\providecommand\doibase{\phfnote@doibasefix} |
| 3114 |
% \end{macrocode} |
| 3115 |
% |
| 3116 |
% Relay the call to the ``old'' |\bibliography| command to actually implement the |
| 3117 |
% bibliography. |
| 3118 |
% \begin{macrocode} |
| 3119 |
\phfnote@old@bibliography{#1}% |
| 3120 |
\endgroup% |
| 3121 |
} |
| 3122 |
\def\phfnote@doibasefix#110.{https://doi.org/10.} |
| 3123 |
% \end{macrocode} |
| 3124 |
% \end{macro} |
| 3125 |
% \begin{macro}{\phfnote@bibliographystyle} |
| 3126 |
% Tentative implementation of |\bibliographystyle|. Just register the new style in an |
| 3127 |
% internal variable, so that the style is actually loaded in |\phfnote@bibliography|. |
| 3128 |
% |
| 3129 |
% This will be renamed to replace |\bibliographystyle| later, according to package |
| 3130 |
% options. |
| 3131 |
% \begin{macrocode} |
| 3132 |
\newcommand{\phfnote@bibliographystyle}[1]{% |
| 3133 |
\renewcommand{\phfnote@bibstyle}{#1}% |
| 3134 |
} |
| 3135 |
% \end{macrocode} |
| 3136 |
% \end{macro} |
| 3137 |
% |
| 3138 |
% |
| 3139 |
% \begin{macro}{\phfnote@do@bibliographydefs} |
| 3140 |
% Make our changes live. Will be called later according to package options. |
| 3141 |
% \begin{macrocode} |
| 3142 |
\def\phfnote@do@bibliographydefs#1{% |
| 3143 |
\ifstrequal{#1}{false}{}{% |
| 3144 |
\let\bibliographystyle\phfnote@bibliographystyle% |
| 3145 |
\let\bibliography\phfnote@bibliography% |
| 3146 |
} |
| 3147 |
} |
| 3148 |
% \end{macrocode} |
| 3149 |
% \end{macro} |
| 3150 |
% |
| 3151 |
% |
| 3152 |
% |
| 3153 |
% \subsection{Better Footnote Style} |
| 3154 |
% |
| 3155 |
% \begin{macro}{\phfnote@do@footnotedefs} |
| 3156 |
% Adjust the formatting of footnotes so they look better. Again, |
| 3157 |
% this is called later according to the package options. |
| 3158 |
% \begin{macrocode} |
| 3159 |
\def\phfnote@do@footnotedefs#1{ |
| 3160 |
\ifstrequal{#1}{false}{}{% |
| 3161 |
\let\phfnote@orig@makefnmark\@makefnmark |
| 3162 |
%% \def\@makefnmark{\hbox{\@textsuperscript{% |
| 3163 |
%% \normalfont\tiny\fontseries{sb}\selectfont\@thefnmark}}} |
| 3164 |
\def\@makefnmark{\hbox{\@textsuperscript{% |
| 3165 |
\normalfont\tiny\bfseries\@thefnmark}}} |
| 3166 |
%% \def\@makefnmark{\hbox{\@textsuperscript{% |
| 3167 |
%% \normalfont\scriptsize\bfseries\@thefnmark}}}% too large |
| 3168 |
} |
| 3169 |
} |
| 3170 |
% \end{macrocode} |
| 3171 |
% \end{macro} |
| 3172 |
% |
| 3173 |
% |
| 3174 |
% |
| 3175 |
% |
| 3176 |
% \subsection{Other Stand-Alone Definitions and Helpers} |
| 3177 |
% \label{sec:impl-other-stand-alone-defs} |
| 3178 |
% |
| 3179 |
% \subsubsection{A \phfverb{\notesmaller} command} |
| 3180 |
% |
| 3181 |
% |
| 3182 |
% \begin{macro}{\notesmaller} |
| 3183 |
% Relative font size command. Makes the text a fraction smaller |
| 3184 |
% than its surroundings. The fraction is either given explicitly as |
| 3185 |
% optional argument (1.0=same size) or is by default set by |
| 3186 |
% |\notesmallerfrac|. |
| 3187 |
% |
| 3188 |
% To impalement this, we exploit the fact that \LaTeX{} saves the |
| 3189 |
% current font size in the macro |\f@size|. |
| 3190 |
% \begin{macrocode} |
| 3191 |
\newcommand\notesmaller[1][\notesmallerfrac]{% |
| 3192 |
\fontsize{#1\dimexpr\f@size pt\relax}{#1\dimexpr\f@baselineskip pt\relax}% |
| 3193 |
\selectfont\ignorespaces% |
| 3194 |
} |
| 3195 |
% \end{macrocode} |
| 3196 |
% \end{macro} |
| 3197 |
% \begin{macro}{\notesmallerfrac} |
| 3198 |
% Default fraction by which |\notesmaller| acts. Redefine to change defaults. |
| 3199 |
% \begin{macrocode} |
| 3200 |
\def\notesmallerfrac{0.9} |
| 3201 |
% \end{macrocode} |
| 3202 |
% \end{macro} |
| 3203 |
% |
| 3204 |
% |
| 3205 |
% \subsubsection{Customized, ``Inline,'' Table of Contents} |
| 3206 |
% |
| 3207 |
% \begin{macro}{\inlinetoc} |
| 3208 |
% Just a customized table of contents. Horizontal rules before and |
| 3209 |
% after, and spacing is adjusted, and no ``Contents'' title. The |
| 3210 |
% table of contents looks just like at the \hyperref[sec:toc]{top of |
| 3211 |
% this document}. The command is described in |
| 3212 |
% \autoref{sec:inline-toc}. |
| 3213 |
% |
| 3214 |
% We call |\@starttoc| directly, bypassing the |\section*| included by |
| 3215 |
% |\tableofcontents| (see definition |\tableofcontents| in latex sources). |
| 3216 |
% \begin{macrocode} |
| 3217 |
\newcommand{\inlinetoc}{% |
| 3218 |
\begingroup% |
| 3219 |
\vspace*{2mm}% |
| 3220 |
\hrule% |
| 3221 |
\vspace*{2mm}% |
| 3222 |
\parskip=1pt\relax% |
| 3223 |
\@starttoc{toc}% |
| 3224 |
\vspace*{4mm}% |
| 3225 |
\hrule% |
| 3226 |
\vspace*{6mm}% |
| 3227 |
\endgroup% |
| 3228 |
} |
| 3229 |
% \end{macrocode} |
| 3230 |
% |
| 3231 |
% \end{macro} |
| 3232 |
% |
| 3233 |
% \subsubsection{Inline commenting in documents} |
| 3234 |
% |
| 3235 |
% The code that was initially here was moved into a separate package: |
| 3236 |
% \pkgname{phfcc}. |
| 3237 |
% |
| 3238 |
% \subsubsection{URL Styles} |
| 3239 |
% |
| 3240 |
% \needspace{7\baselineskip} |
| 3241 |
% \begin{macro}{\url@notettstyle} |
| 3242 |
% \begin{macro}{\url@notesfstyle} |
| 3243 |
% \begin{macro}{\url@notesfssstyle} |
| 3244 |
% \begin{macro}{\url@noteitsfstyle} |
| 3245 |
% \begin{macro}{\url@notermstyle} |
| 3246 |
% \begin{macro}{\url@noteitstyle} |
| 3247 |
% \begin{macro}{\url@notesmlstyle} |
| 3248 |
% We also provide some URL styles. These can directly set with |
| 3249 |
% |\urlstyle|\marg{style-name}. |
| 3250 |
% |
| 3251 |
% \begin{macrocode} |
| 3252 |
\def\url@notettstyle{% |
| 3253 |
\def\UrlFont{\ttfamily\notesmaller}% |
| 3254 |
\phfnote@urlstyle@common% |
| 3255 |
} |
| 3256 |
\def\url@notesfstyle{% |
| 3257 |
\def\UrlFont{\sffamily\notesmaller}% |
| 3258 |
\phfnote@urlstyle@common% |
| 3259 |
} |
| 3260 |
\def\url@notesfssstyle{% |
| 3261 |
\def\UrlFont{\fontfamily{cmss}\selectfont\notesmaller}% |
| 3262 |
\phfnote@urlstyle@common% |
| 3263 |
} |
| 3264 |
\def\url@noteitsfstyle{% |
| 3265 |
\def\UrlFont{\sffamily\itshape\notesmaller}% |
| 3266 |
\phfnote@urlstyle@common% |
| 3267 |
} |
| 3268 |
\def\url@notermstyle{% |
| 3269 |
\def\UrlFont{\rmfamily\notesmaller}% |
| 3270 |
\phfnote@urlstyle@common% |
| 3271 |
} |
| 3272 |
\def\url@noteitstyle{% |
| 3273 |
\def\UrlFont{\itshape\notesmaller}% |
| 3274 |
\phfnote@urlstyle@common% |
| 3275 |
} |
| 3276 |
\def\url@notesmlstyle{% |
| 3277 |
\def\UrlFont{\notesmaller}% |
| 3278 |
\phfnote@urlstyle@common% |
| 3279 |
} |
| 3280 |
% \end{macrocode} |
| 3281 |
% \end{macro} |
| 3282 |
% \end{macro} |
| 3283 |
% \end{macro} |
| 3284 |
% \end{macro} |
| 3285 |
% \end{macro} |
| 3286 |
% \end{macro} |
| 3287 |
% \end{macro} |
| 3288 |
% |
| 3289 |
% \begin{macro}{\phfnote@urlstyle@common} |
| 3290 |
% The following code is common to all our styles. We do an ugly hack |
| 3291 |
% in which the tilde character (`\textasciitilde') is fixed to the |
| 3292 |
% tilde char in the Adobe Times font (|ptm| code), so that it looks |
| 3293 |
% nicer and its alignment is correct. |
| 3294 |
% \begin{macrocode} |
| 3295 |
\def\phfnote@url@tilde{\hbox{\fontfamily{ptm}\selectfont\textasciitilde}} |
| 3296 |
%%\def\phfnote@url@tilde{\raise-0.8ex\hbox{% |
| 3297 |
%% \kern-0.2ex\fontfamily{cmbr}\selectfont\textasciitilde}} |
| 3298 |
\def\phfnote@urlstyle@common{% |
| 3299 |
\def\UrlTildeSpecial{\do\~{\phfnote@url@tilde}}% |
| 3300 |
\let\Url@force@Tilde\UrlTildeSpecial% |
| 3301 |
} |
| 3302 |
% \end{macrocode} |
| 3303 |
% \end{macro} |
| 3304 |
% |
| 3305 |
% |
| 3306 |
% \subsubsection{Utility to Add TOC Entry For Starred Section } |
| 3307 |
% |
| 3308 |
% Here we provide an ugly hack which introduces an entry in the table |
| 3309 |
% of contents for |\section*| commands. |
| 3310 |
% |
| 3311 |
% [Note: An existing way of adding the toc entry in these cases is to issue |
| 3312 |
% a |\addcontentsline| command before the relevant command |
| 3313 |
% (say |\bibliography|). However this is unreliable, because on page |
| 3314 |
% boundaries the |\addcontentsline| will pick up the previous page. This |
| 3315 |
% is why |\addcontentsline| should be issued right \emph{after} the |
| 3316 |
% |\section*| command.] |
| 3317 |
% |
| 3318 |
% \begin{pkgwarning} |
| 3319 |
% This command is truly a hack, don't apply it globally! It forces |
| 3320 |
% (locally) the |\section| command to be followed by a `|*|' ! Do this |
| 3321 |
% within a group, just before a command which you are sure is |
| 3322 |
% invoking |\section*| (such as |\bibliography| in the \pkgname{article} |
| 3323 |
% class). |
| 3324 |
% \end{pkgwarning} |
| 3325 |
% |
| 3326 |
% \begin{macro}{\phfnoteHackSectionStarWithTOC} |
| 3327 |
% Locally force |\section| to be followed by |*| and introduce an |
| 3328 |
% entry in the table of contents. |
| 3329 |
% \begin{macrocode} |
| 3330 |
\def\phfnoteHackSectionStarWithTOC{% |
| 3331 |
\let\phfnote@old@section\section% |
| 3332 |
\def\section*##1{\phfnote@old@section*{##1}\addcontentsline{toc}{section}{##1}}% |
| 3333 |
} |
| 3334 |
% \end{macrocode} |
| 3335 |
% \end{macro} |
| 3336 |
% |
| 3337 |
% \begin{macro}{\phfnoteHackSectionStarWithTOCInCommand} |
| 3338 |
% Patches the given command (|#1|), which is known to invoke |
| 3339 |
% |\section*|, to locally first invoke |
| 3340 |
% |\phfnoteHackSectionStarWithTOC| and thus generate a TOC entry. |
| 3341 |
% |
| 3342 |
% \begin{macrocode} |
| 3343 |
\def\phfnoteHackSectionStarWithTOCInCommand#1{% |
| 3344 |
\expandafter\let\csname phfnote@old@\string#1\endcsname#1% |
| 3345 |
\gdef#1{% |
| 3346 |
\begingroup% |
| 3347 |
\phfnoteHackSectionStarWithTOC% |
| 3348 |
\csname phfnote@old@\string#1\endcsname% |
| 3349 |
\endgroup% |
| 3350 |
}% |
| 3351 |
} |
| 3352 |
% \end{macrocode} |
| 3353 |
% \end{macro} |
| 3354 |
% |
| 3355 |
% |
| 3356 |
% \subsubsection{Hack to save \& restore a set of commands} |
| 3357 |
% |
| 3358 |
% Exactly what it sounds like. You can store a set of commands, specified by |
| 3359 |
% their name, by specifying an identifier. The commands corresponding to a |
| 3360 |
% given identifier can then later be restored. |
| 3361 |
% |
| 3362 |
% \begin{macro}{\phfnoteSaveDefs} |
| 3363 |
% The command |\phfnoteSaveDefs|\marg{identifier}\marg{list of macro names} |
| 3364 |
% saves the current definitions of the given list of macro and associates them |
| 3365 |
% to the given identifier. |
| 3366 |
% The list of macros is specified as a comma-separated list of macro names. |
| 3367 |
% \begin{macrocode} |
| 3368 |
\def\phfnoteSaveDefs#1#2{% |
| 3369 |
% \end{macrocode} |
| 3370 |
% |
| 3371 |
% The macro |\phfnote@restoredefs@<identifier>| will store the code necessary to |
| 3372 |
% restore the macros. |
| 3373 |
% \begin{macrocode} |
| 3374 |
\csgdef{phfnote@restoredefs@#1}{}% |
| 3375 |
% \end{macrocode} |
| 3376 |
% |
| 3377 |
% Iterate over the macros we are supposed to store. |
| 3378 |
% \begin{macrocode} |
| 3379 |
\def\@tmpa{#2}% |
| 3380 |
\@for\next:=\@tmpa\do{% |
| 3381 |
% \end{macrocode} |
| 3382 |
% |
| 3383 |
% For each macro we are supposed to store (whose name is given in |\next|), we |
| 3384 |
% |\let| |\phfnote@restoredefs@<identifier>@<macro-name>| store the current value |
| 3385 |
% of the macro. |
| 3386 |
% \begin{macrocode} |
| 3387 |
\global\csletcs{phfnote@restoredefs@#1@\next}{\next}% |
| 3388 |
% \end{macrocode} |
| 3389 |
% |
| 3390 |
% Then, we append to |\phfnote@restoredefs@<identifier>| the code necessary to |
| 3391 |
% restore this macro. That code is simply a |\cslet| instruction. |
| 3392 |
% |
| 3393 |
% Recall that |\xappto| expands its second argument (as |\xdef| does), allowing |
| 3394 |
% us to expand the value of |\next|. |
| 3395 |
% \begin{macrocode} |
| 3396 |
\expandafter\xappto\csname phfnote@restoredefs@#1\endcsname{% |
| 3397 |
\noexpand\csletcs{\next}{phfnote@restoredefs@#1@\next}% |
| 3398 |
}% |
| 3399 |
}% |
| 3400 |
} |
| 3401 |
% \end{macrocode} |
| 3402 |
% \end{macro} |
| 3403 |
% |
| 3404 |
% \begin{macro}{\phfnoteRestoreDefs} |
| 3405 |
% Restores the macro saved by |\phfnoteSaveDefs|. We simply execute the macro |
| 3406 |
% |\phfnote@restoredefs@<identifier>|, in which we duly stored the code |
| 3407 |
% necessary to restore all the saved macros. |
| 3408 |
% \begin{macrocode} |
| 3409 |
\def\phfnoteRestoreDefs#1{% |
| 3410 |
\ifcsname phfnote@restoredefs@#1\endcsname% |
| 3411 |
\csname phfnote@restoredefs@#1\endcsname% |
| 3412 |
\else% |
| 3413 |
\PackageError{phfnote}{\string\phfnoteRestoreDefs: no such |
| 3414 |
definitions stored (#1)}{} |
| 3415 |
\fi% |
| 3416 |
} |
| 3417 |
% \end{macrocode} |
| 3418 |
% \end{macro} |
| 3419 |
% |
| 3420 |
% |
| 3421 |
% \subsubsection{A utility for verbatim stuff in arguments of other macros} |
| 3422 |
% |
| 3423 |
% FIXME: DOCUMENT ME! |
| 3424 |
% |
| 3425 |
% A utility for using verbatim stuff in arguments of other macros---exploit |
| 3426 |
% |\detokenize| |
| 3427 |
% |
| 3428 |
% \begin{macrocode} |
| 3429 |
\def\phfverb#1{% |
| 3430 |
\ifx\protect\relax% |
| 3431 |
\phfverbfmt{\detokenize{#1}\unskip}% |
| 3432 |
\else% |
| 3433 |
\noexpand\phfverb{\unexpanded{#1}}% |
| 3434 |
\fi% |
| 3435 |
} |
| 3436 |
\def\phfverbfmt#1{{\normalfont\texttt{#1}}} |
| 3437 |
% \end{macrocode} |
| 3438 |
% |
| 3439 |
% \subsection{Handle Package Options} |
| 3440 |
% |
| 3441 |
% \subsubsection{Define and Parse Package Options} |
| 3442 |
% |
| 3443 |
% Initialization code for \pkgname{kvoptions} for our package options. See \autoref{sec:package-options}. |
| 3444 |
% |
| 3445 |
% \begin{macrocode} |
| 3446 |
\SetupKeyvalOptions{ |
| 3447 |
family=phfnote, |
| 3448 |
prefix=phfnote@opt@ |
| 3449 |
} |
| 3450 |
% \end{macrocode} |
| 3451 |
% |
| 3452 |
% |
| 3453 |
% The title style to use. \PrintMarginLabel{[title=...]} |
| 3454 |
% See \autoref{sec:title-styles}. |
| 3455 |
% \begin{macrocode} |
| 3456 |
\DeclareStringOption[default]{title} |
| 3457 |
\DeclareVoidOption{notitle}{\def\phfnote@opt@title{false}} |
| 3458 |
% \end{macrocode} |
| 3459 |
% |
| 3460 |
% |
| 3461 |
% Option for abstract attributes \PrintMarginLabel{[abstract=...]} |
| 3462 |
% (\autoref{sec:abstract-attributes}). |
| 3463 |
% \begin{macrocode} |
| 3464 |
\DeclareStringOption[]{abstract} |
| 3465 |
\DeclareVoidOption{noabstract}{\def\phfnote@opt@abstract{false}} |
| 3466 |
% \end{macrocode} |
| 3467 |
% |
| 3468 |
% Option for Package sets \PrintMarginLabel{[pkgset=...]} |
| 3469 |
% (\autoref{sec:package-sets}) |
| 3470 |
% \begin{macrocode} |
| 3471 |
\DeclareStringOption[rich]{pkgset} |
| 3472 |
% \end{macrocode} |
| 3473 |
% |
| 3474 |
% Define the page geometry. \PrintMarginLabel{[pagegeomdefs=...]} |
| 3475 |
% \PrintMarginLabel{[pagegeom=...]} See \autoref{sec:pagegeomdefs}. |
| 3476 |
% \begin{macrocode} |
| 3477 |
\DeclareStringOption[default]{pagegeom} |
| 3478 |
\DeclareVoidOption{nopagegeom}{\def\phfnote@opt@pagegeom{false}} |
| 3479 |
% \end{macrocode} |
| 3480 |
% |
| 3481 |
% Obsolete options--- |
| 3482 |
% \begin{macrocode} |
| 3483 |
\DeclareBoolOption[true]{pagegeomdefs} |
| 3484 |
\DeclareComplementaryOption{nopagegeomdefs}{pagegeomdefs} |
| 3485 |
% \end{macrocode} |
| 3486 |
% ---we handle these as follows. By default, |\ifphfnote@opt@pagegeomdefs| is |
| 3487 |
% true. If it isn't, that means it was overridden and we need to respect that. |
| 3488 |
% |
| 3489 |
% |
| 3490 |
% Styling of section headings. \PrintMarginLabel{[secfmt=...]} |
| 3491 |
% See \autoref{sec:secfmt}. |
| 3492 |
% \begin{macrocode} |
| 3493 |
\DeclareStringOption[section]{secfmt} |
| 3494 |
\DeclareVoidOption{nosecfmt}{\def\phfnote@opt@secfmt{false}} |
| 3495 |
% \end{macrocode} |
| 3496 |
% |
| 3497 |
% How to treat paragraphs. \PrintMarginLabel{[par=...]} See |
| 3498 |
% \autoref{sec:par-defs}. |
| 3499 |
% \begin{macrocode} |
| 3500 |
\DeclareStringOption[skip]{par} |
| 3501 |
\DeclareVoidOption{nopar}{\def\phfnote@opt@par{false}} |
| 3502 |
% \end{macrocode} |
| 3503 |
% |
| 3504 |
% Add definitions to adjust spacing of lines and |
| 3505 |
% words. \PrintMarginLabel{[spacingdefs=...]} See \autoref{sec:spacingdefs}. |
| 3506 |
% \begin{macrocode} |
| 3507 |
\DeclareStringOption[true]{spacingdefs}[true] |
| 3508 |
\DeclareVoidOption{nospacingdefs}{\def\phfnote@opt@spacingdefs{false}} |
| 3509 |
% \end{macrocode} |
| 3510 |
% |
| 3511 |
% |
| 3512 |
% Do some adjustments to the fonts. \PrintMarginLabel{[fontdefs=...]} See |
| 3513 |
% \autoref{sec:fontdefs}. |
| 3514 |
% \begin{macrocode} |
| 3515 |
\DeclareStringOption[true]{fontdefs}[true] |
| 3516 |
\DeclareVoidOption{nofontdefs}{\def\phfnote@opt@fontdefs{false}} |
| 3517 |
% \end{macrocode} |
| 3518 |
% |
| 3519 |
% Adjustments for footnotes. \PrintMarginLabel{[footnotedefs=...]} See |
| 3520 |
% \autoref{sec:footnotedefs}. |
| 3521 |
% \begin{macrocode} |
| 3522 |
\DeclareStringOption[true]{footnotedefs}[true] |
| 3523 |
\DeclareVoidOption{nofootnotedefs}{\def\phfnote@opt@footnotedefs{false}} |
| 3524 |
% \end{macrocode} |
| 3525 |
% |
| 3526 |
% Load \pkgname{hyperref} and corresponding |
| 3527 |
% definitions. \PrintMarginLabel{[hyperrefdefs=...]} See |
| 3528 |
% \autoref{sec:hyperrefdefs}. |
| 3529 |
% \begin{macrocode} |
| 3530 |
\DeclareStringOption[]{hyperrefdefs}[] |
| 3531 |
\DeclareVoidOption{nohyperrefdefs}{\def\phfnote@opt@hyperrefdefs{false}} |
| 3532 |
% \end{macrocode} |
| 3533 |
% |
| 3534 |
% Adjustments for bibliography, including default |
| 3535 |
% style. \PrintMarginLabel{[bibliographydefs=...]} See |
| 3536 |
% \autoref{sec:bibliographydefs}. |
| 3537 |
% \begin{macrocode} |
| 3538 |
\DeclareStringOption[true]{bibliographydefs}[true] |
| 3539 |
\DeclareVoidOption{nobibliographydefs}{\def\phfnote@opt@bibliographydefs{false}} |
| 3540 |
% \end{macrocode} |
| 3541 |
% |
| 3542 |
% \begin{macro}{\phfnote@loadpreset} |
| 3543 |
% A helper macro to load presets. Can be used by presets that want to extend |
| 3544 |
% other presets. |
| 3545 |
% \begin{macrocode} |
| 3546 |
\def\phfnote@loadpreset#1{% |
| 3547 |
\IfFileExists{phfnotepreset-#1.def}{% |
| 3548 |
\input{phfnotepreset-#1.def}% |
| 3549 |
}{% |
| 3550 |
\ifcsname phfnote@preset@#1\endcsname% |
| 3551 |
\csname phfnote@preset@#1\endcsname% |
| 3552 |
\else% |
| 3553 |
\PackageError{phfnote}{Unknown preset: `#1'!}{You specified the |
| 3554 |
option 'preset=...' with an invalid value. Please look up the |
| 3555 |
package documentation corresponding to your version of phfnote |
| 3556 |
for possible values. Additionally, no file named `phfnotepreset-#1.def' |
| 3557 |
was found.}% |
| 3558 |
\fi% |
| 3559 |
}% |
| 3560 |
} |
| 3561 |
% \end{macrocode} |
| 3562 |
% \end{macro} |
| 3563 |
% |
| 3564 |
% Preset option. \PrintMarginLabel{[preset=...]} See \autoref{sec:presets}. |
| 3565 |
% \begin{macrocode} |
| 3566 |
\define@key{phfnote}{preset}{% |
| 3567 |
\phfnote@loadpreset{#1}% |
| 3568 |
} |
| 3569 |
% \end{macrocode} |
| 3570 |
% |
| 3571 |
% |
| 3572 |
% Provide the standard error message for unknown options. |
| 3573 |
% \begin{macrocode} |
| 3574 |
\DeclareDefaultOption{% |
| 3575 |
\@unknownoptionerror |
| 3576 |
} |
| 3577 |
% \end{macrocode} |
| 3578 |
% |
| 3579 |
% |
| 3580 |
% |
| 3581 |
% Small utility to deal with obsolete |XXXdefs=true/false| options. If the |
| 3582 |
% (obsolete) bool option |#1| is set to false (which means it was set |
| 3583 |
% explicitly, so this must be respected), then emit a package warning and set |
| 3584 |
% option |#2| (the regular option) to the string value |false|. |
| 3585 |
% \begin{macrocode} |
| 3586 |
\def\phfnote@ifpkgoptfalsesetfalse#1#2{% |
| 3587 |
\edef\x{% |
| 3588 |
\expandafter\noexpand\csname ifphfnote@opt@#1\endcsname\noexpand\else |
| 3589 |
\noexpand\PackageWarning{phfnote}{Option #1 is obsolete. Please use "#2=false'' instead.}% |
| 3590 |
\noexpand\csgdef{phfnote@opt@#2}{false}\noexpand\fi}% |
| 3591 |
\x |
| 3592 |
} |
| 3593 |
% \end{macrocode} |
| 3594 |
% |
| 3595 |
% \subsubsection{Define Global Presets} |
| 3596 |
% \label{impl:presets} |
| 3597 |
% |
| 3598 |
% Define the global presets here. See \autoref{sec:presets} for a description |
| 3599 |
% of what these presets do. |
| 3600 |
% |
| 3601 |
% Some of the presets whose definitions are short are defined here directly |
| 3602 |
% here, in the |sty| file. Other presets are placed in a separate |
| 3603 |
% |phfnotepreset-XXX.def| file to avoid bloating the main style file. |
| 3604 |
% |
| 3605 |
% \changed[chg-presets-dotdef-files]{v4.0}{2021/10/08}{Moved some presets to |
| 3606 |
% external \phfverb{.def} files} |
| 3607 |
% |
| 3608 |
% \begin{macro}{\phfnote@hook@atendload} |
| 3609 |
% A hook for presets to do stuff at the end of package load. |
| 3610 |
% \begin{macrocode} |
| 3611 |
\def\phfnote@hook@atendload{} |
| 3612 |
% \end{macrocode} |
| 3613 |
% \end{macro} |
| 3614 |
% |
| 3615 |
% \begin{macro}{\phfnote@preset@article} |
| 3616 |
% Article preset. |
| 3617 |
% \begin{macrocode} |
| 3618 |
\def\phfnote@preset@article{ |
| 3619 |
\def\phfnote@opt@title{article} |
| 3620 |
\def\phfnote@opt@par{indent} |
| 3621 |
\def\phfnote@opt@pagegeom{default} |
| 3622 |
} |
| 3623 |
% \end{macrocode} |
| 3624 |
% \end{macro} |
| 3625 |
% |
| 3626 |
% \begin{macro}{\phfnote@presetcommon@xnote} |
| 3627 |
% Specify some common definitions for all our |*note| preset styles. The |
| 3628 |
% optional argument is the URL style to set. |
| 3629 |
% \begin{macrocode} |
| 3630 |
\newcommand\phfnote@presetcommon@xnote[1][noteitsf]{ |
| 3631 |
\def\phfnote@opt@title{default} |
| 3632 |
\def\phfnote@opt@par{skip} |
| 3633 |
%\phfnote@opt@pagegeomdefstrue |
| 3634 |
\def\phfnote@opt@pagegeom{wide} |
| 3635 |
\setlength{\footnotesep}{5pt} |
| 3636 |
\g@addto@macro\phfnote@hook@atendload{ |
| 3637 |
\ifdefined\urlstyle |
| 3638 |
\urlstyle{#1} |
| 3639 |
\fi |
| 3640 |
} |
| 3641 |
} |
| 3642 |
% \end{macrocode} |
| 3643 |
% \end{macro} |
| 3644 |
% |
| 3645 |
% \needspace{5\baselineskip} |
| 3646 |
% \begin{macro}{\phfnote@preset@sfnote} |
| 3647 |
% \begin{macro}{\phfnote@preset@sfssnote} |
| 3648 |
% \begin{macro}{\phfnote@preset@opensansnote} |
| 3649 |
% \begin{macro}{\phfnote@preset@utopianote} |
| 3650 |
% \begin{macro}{\phfnote@preset@mnmynote} |
| 3651 |
% Define the different |*note| styles. |
| 3652 |
% \begin{macrocode} |
| 3653 |
\def\phfnote@preset@sfnote{ |
| 3654 |
\phfnote@presetcommon@xnote |
| 3655 |
\def\phfnote@opt@footnotedefs{true} |
| 3656 |
\def\phfnote@opt@fontdefs{true} |
| 3657 |
\renewcommand\familydefault{\sfdefault} |
| 3658 |
\renewcommand{\notesectionallfontfamily}{\sfdefault} |
| 3659 |
} |
| 3660 |
\def\phfnote@preset@sfssnote{ |
| 3661 |
% \end{macrocode} |
| 3662 |
% set up all the settings as for |sfnote| \ldots |
| 3663 |
% \begin{macrocode} |
| 3664 |
\phfnote@loadpreset{sfnote}% |
| 3665 |
% \end{macrocode} |
| 3666 |
% \ldots but override: |
| 3667 |
% \begin{macrocode} |
| 3668 |
\def\phfnote@opt@fontdefs{false} |
| 3669 |
\PassOptionsToPackage{T1}{fontenc} |
| 3670 |
\RequirePackage{fontenc} |
| 3671 |
\renewcommand\sfdefault{cmss} |
| 3672 |
} |
| 3673 |
\def\phfnote@preset@opensansnote{ |
| 3674 |
% \end{macrocode} |
| 3675 |
% set up all the settings as for |sfnote| \ldots |
| 3676 |
% \begin{macrocode} |
| 3677 |
\phfnote@loadpreset{sfnote}% |
| 3678 |
% \end{macrocode} |
| 3679 |
% \ldots but override: |
| 3680 |
% \begin{macrocode} |
| 3681 |
\def\phfnote@opt@fontdefs{false} |
| 3682 |
\PassOptionsToPackage{T1}{fontenc} |
| 3683 |
\RequirePackage{fontenc} |
| 3684 |
\PassOptionsToPackage{default,scale=0.9}{opensans} |
| 3685 |
\RequirePackage{opensans} |
| 3686 |
} |
| 3687 |
\def\phfnote@preset@utopianote{ |
| 3688 |
\phfnote@presetcommon@xnote[noteit] |
| 3689 |
\def\phfnote@opt@fontdefs{false} |
| 3690 |
\PassOptionsToPackage{T1}{fontenc} |
| 3691 |
\RequirePackage{fontenc} |
| 3692 |
\RequirePackage{fourier} |
| 3693 |
\renewcommand{\notesectionallfontfamily}{put} |
| 3694 |
\renewcommand{\notetitlefont}{\bfseries} |
| 3695 |
\renewcommand{\sfdefault}{phv} |
| 3696 |
} |
| 3697 |
\def\phfnote@preset@mnmynote{ |
| 3698 |
\phfnote@presetcommon@xnote[noteit] |
| 3699 |
\def\phfnote@opt@footnotedefs{false} |
| 3700 |
\def\phfnote@opt@fontdefs{false} |
| 3701 |
\PassOptionsToPackage{T1}{fontenc} |
| 3702 |
\RequirePackage{fontenc} |
| 3703 |
\renewcommand{\notesectionallfontfamily}{\sfdefault} |
| 3704 |
% \end{macrocode} |
| 3705 |
% |
| 3706 |
% Require these packages AFTER the default package set, because some symbols may |
| 3707 |
% be defined in package sets, and I've had problems with re-definitions |
| 3708 |
% etc\ldots anyway this seems to work this way: |
| 3709 |
% \begin{macrocode} |
| 3710 |
\g@addto@macro\phfnote@hook@atendload{ |
| 3711 |
\RequirePackage{MnSymbol} |
| 3712 |
\PassOptionsToPackage{medfamily,textosf,mathlf,minionint,footnotefigures}{MinionPro} |
| 3713 |
\RequirePackage{MinionPro} |
| 3714 |
\PassOptionsToPackage{medfamily}{MyriadPro} |
| 3715 |
\RequirePackage{MyriadPro} |
| 3716 |
} |
| 3717 |
} |
| 3718 |
% \end{macrocode} |
| 3719 |
% \end{macro} |
| 3720 |
% \end{macro} |
| 3721 |
% \end{macro} |
| 3722 |
% \end{macro} |
| 3723 |
% \end{macro} |
| 3724 |
% |
| 3725 |
% \begin{macro}{\phfnote@preset@pkgdoc} |
| 3726 |
% Preset for a package documentation. |
| 3727 |
% |
| 3728 |
% Start by setting the same settings as for other |Xnote| presets. |
| 3729 |
% \begin{macrocode} |
| 3730 |
\def\phfnote@preset@pkgdoc{ |
| 3731 |
\phfnote@presetcommon@xnote[noteit] |
| 3732 |
\def\phfnote@opt@fontdefs{false} |
| 3733 |
% \end{macrocode} |
| 3734 |
% |
| 3735 |
% Then set up the font, which is done in a separate macro |
| 3736 |
% |\phfnote@pkgdoc@setupfont| in case individual documents would like more |
| 3737 |
% specific settings. (For example, some packages may want a different math |
| 3738 |
% font.) |
| 3739 |
% \begin{macrocode} |
| 3740 |
\phfnote@pkgdoc@setupfont |
| 3741 |
% \end{macrocode} |
| 3742 |
% |
| 3743 |
% Finally, set up general appearance. |
| 3744 |
% \begin{macrocode} |
| 3745 |
\def\phfnote@opt@secfmt{section,paragraph,itpar,blockpar,larger,secsquares,secnummargin} |
| 3746 |
\def\phfnote@opt@pagegeom{bigmargin} |
| 3747 |
\def\phfnote@opt@abstract{noname} |
| 3748 |
} |
| 3749 |
% \end{macrocode} |
| 3750 |
% |
| 3751 |
% Also provide a helper macro which is to load the font packages we |
| 3752 |
% want. By default, we use Utopia fonts via the \pkgname{fourier} |
| 3753 |
% package, but some package documentations may want a different math |
| 3754 |
% font. Override |\phfnote@pkgdoc@setupfont| to adjust the whole font |
| 3755 |
% set-up, or |\phfnote@pkgdoc@setupmainfont| to adjust only the main |
| 3756 |
% document font. |
| 3757 |
% |
| 3758 |
% \changed[chg-opensans-fosj]{v3.1}{2020/05/25}{Fixes for more recent |
| 3759 |
% versions of the \pkgname{opensans} package.} |
| 3760 |
% \begin{macrocode} |
| 3761 |
\providecommand\phfnote@pkgdoc@setupfont{ |
| 3762 |
\PassOptionsToPackage{T1}{fontenc} |
| 3763 |
\RequirePackage{fontenc} |
| 3764 |
\phfnote@pkgdoc@setupmainfont |
| 3765 |
\renewcommand{\notesectionallfontfamily}{put} |
| 3766 |
\renewcommand{\notetitlefont}{\bfseries} |
| 3767 |
\IfFileExists{opensans.sty}{}{\PackageError{phfnote}{Font OpenSans is not |
| 3768 |
available (need `opensans' package)}{Please install the opensans |
| 3769 |
package, which provides the OpenSans font.}} |
| 3770 |
\PassOptionsToPackage{scale=0.85,defaultsans}{opensans} |
| 3771 |
\RequirePackage{opensans} |
| 3772 |
} |
| 3773 |
\providecommand\phfnote@pkgdoc@setupmainfont{\RequirePackage{fourier}} |
| 3774 |
% \end{macrocode} |
| 3775 |
% \end{macro} |
| 3776 |
% |
| 3777 |
% \begin{macro}{\phfnote@preset@reset} |
| 3778 |
% Finally, the |reset| preset: |
| 3779 |
% \begin{macrocode} |
| 3780 |
\def\phfnote@preset@reset{ |
| 3781 |
\def\phfnote@opt@pkgset{none} |
| 3782 |
\def\phfnote@opt@title{false} |
| 3783 |
\def\phfnote@opt@pagegeom{false} |
| 3784 |
\def\phfnote@opt@spacingdefs{false} |
| 3785 |
\def\phfnote@opt@par{false} |
| 3786 |
\def\phfnote@opt@abstract{false} |
| 3787 |
\def\phfnote@opt@hyperrefdefs{false} |
| 3788 |
\def\phfnote@opt@fontdefs{false} |
| 3789 |
\def\phfnote@opt@secfmt{false} |
| 3790 |
\def\phfnote@opt@bibliographydefs{false} |
| 3791 |
\def\phfnote@opt@footnotedefs{false} |
| 3792 |
% \end{macrocode} |
| 3793 |
% |
| 3794 |
% \begin{pkgwarning} |
| 3795 |
% NOTE TO SELF: DO NOT FORGET TO ADD HERE RESET COMMANDS FOR ANY NEW OPTION |
| 3796 |
% THAT WE PROVIDE IN THE FUTURE. |
| 3797 |
% \end{pkgwarning} |
| 3798 |
% |
| 3799 |
% \begin{macrocode} |
| 3800 |
} |
| 3801 |
% \end{macrocode} |
| 3802 |
% \end{macro} |
| 3803 |
% |
| 3804 |
% |
| 3805 |
% \subsubsection{Finally, Process and Execute the Package Options} |
| 3806 |
% |
| 3807 |
% |
| 3808 |
% |
| 3809 |
% Process the options: |
| 3810 |
% |
| 3811 |
% \begin{macrocode} |
| 3812 |
\ProcessKeyvalOptions* |
| 3813 |
% \end{macrocode} |
| 3814 |
% |
| 3815 |
% |
| 3816 |
% Take action according to the user options. |
| 3817 |
% |
| 3818 |
% For the |pkgset| option. |
| 3819 |
% \begin{macrocode} |
| 3820 |
\expandafter\phfnote@do@pkgset\expandafter{\phfnote@opt@pkgset} |
| 3821 |
% \end{macrocode} |
| 3822 |
% |
| 3823 |
% For the |title| option. |
| 3824 |
% \begin{macrocode} |
| 3825 |
\expandafter\phfnote@do@notetitle\expandafter{\phfnote@opt@title} |
| 3826 |
% \end{macrocode} |
| 3827 |
% |
| 3828 |
% For the |abstract| option. |
| 3829 |
% \begin{macrocode} |
| 3830 |
\expandafter\phfnote@do@noteabstract\expandafter{\phfnote@opt@abstract} |
| 3831 |
% \end{macrocode} |
| 3832 |
% |
| 3833 |
% For the |secfmt| option. |
| 3834 |
% \begin{macrocode} |
| 3835 |
\expandafter\phfnote@do@secfmt\expandafter{\phfnote@opt@secfmt} |
| 3836 |
% \end{macrocode} |
| 3837 |
% |
| 3838 |
% For the |pagegeomdefs| option. Here, the first line is needed to deal with |
| 3839 |
% the obsolete option `|pagegeom|'. |
| 3840 |
% \begin{macrocode} |
| 3841 |
\phfnote@ifpkgoptfalsesetfalse{pagegeomdefs}{pagegeom} |
| 3842 |
\expandafter\phfnote@do@pagegeom\expandafter{\phfnote@opt@pagegeom} |
| 3843 |
% \end{macrocode} |
| 3844 |
% |
| 3845 |
% For the |spacingdefs| option. |
| 3846 |
% \begin{macrocode} |
| 3847 |
\expandafter\phfnote@do@spacingdefs\expandafter{\phfnote@opt@spacingdefs} |
| 3848 |
% \end{macrocode} |
| 3849 |
% |
| 3850 |
% For the |par| option. |
| 3851 |
% \begin{macrocode} |
| 3852 |
\expandafter\phfnote@do@par\expandafter{\phfnote@opt@par} |
| 3853 |
% \end{macrocode} |
| 3854 |
% |
| 3855 |
% For the |hyperrefdefs| option. |
| 3856 |
% \begin{macrocode} |
| 3857 |
\expandafter\phfnote@do@hyperrefdefs\expandafter{\phfnote@opt@hyperrefdefs} |
| 3858 |
% \end{macrocode} |
| 3859 |
% |
| 3860 |
% For the |fontdefs| option. |
| 3861 |
% \begin{macrocode} |
| 3862 |
\expandafter\phfnote@do@fontdefs\expandafter{\phfnote@opt@fontdefs} |
| 3863 |
% \end{macrocode} |
| 3864 |
% |
| 3865 |
% For the |bibliographydefs| option. |
| 3866 |
% \begin{macrocode} |
| 3867 |
\expandafter\phfnote@do@bibliographydefs\expandafter{\phfnote@opt@bibliographydefs} |
| 3868 |
% \end{macrocode} |
| 3869 |
% |
| 3870 |
% For the |footnotedefs| option. |
| 3871 |
% \begin{macrocode} |
| 3872 |
\expandafter\phfnote@do@footnotedefs\expandafter{\phfnote@opt@footnotedefs} |
| 3873 |
% \end{macrocode} |
| 3874 |
% |
| 3875 |
% Finally, execute the hook we set up for definitions at the end of the package |
| 3876 |
% loading: |
| 3877 |
% \begin{macrocode} |
| 3878 |
\phfnote@hook@atendload |
| 3879 |
% \end{macrocode} |
| 3880 |
% |
| 3881 |
% |
| 3882 |
% \subsection{Helper files} |
| 3883 |
% |
| 3884 |
% Now we write some code to some external |.def| files for large chunks of code |
| 3885 |
% that are only needed in specific situations, in order to avoid bloating the |
| 3886 |
% main style file. |
| 3887 |
% |
| 3888 |
% \subsubsection{The \emph{xpkgdoc} preset} |
| 3889 |
% \label{sec:impl-xpkgdoc} |
| 3890 |
% |
| 3891 |
% The |xpkgdoc| preset is based on the |pkgdoc| preset. It introduces multiple |
| 3892 |
% pretty involved tools and definitions on top of |pkgdoc|; these are not needed |
| 3893 |
% unless this preset is loaded. Let's write all of the corresponding |
| 3894 |
% definitions into a separate |.def| file. |
| 3895 |
% |
| 3896 |
% \iffalse |
| 3897 |
%</package> |
| 3898 |
% \fi |
| 3899 |
% \begin{verbatim} |
| 3900 |
%<*phfnotepreset-xpkgdoc> |
| 3901 |
% \end{verbatim} |
| 3902 |
% |
| 3903 |
% Load the |pkgdoc| preset before anything else: |
| 3904 |
% \begin{macrocode} |
| 3905 |
\phfnote@loadpreset{pkgdoc} |
| 3906 |
% \end{macrocode} |
| 3907 |
% |
| 3908 |
% Include the \pkgname{verbdef} package, because it's always useful. |
| 3909 |
% \begin{macrocode} |
| 3910 |
\RequirePackage{verbdef} |
| 3911 |
% \end{macrocode} |
| 3912 |
% |
| 3913 |
% \textbf{Some patching first:} |
| 3914 |
% Patch up |\PrintChanges| and |\PrintIndex|, if they are defined (for if we are |
| 3915 |
% using the \pkgname{ltxdoc} package for latex package documentation). We want |
| 3916 |
% these to generate an entry in the table of contents. Also provide the utility |
| 3917 |
% |\PrintChangesAndIndex|, which calls both |\PrintChanges| and |\PrintIndex| with |
| 3918 |
% some additional spacing. |
| 3919 |
% \begin{macrocode} |
| 3920 |
\ifdefined\PrintChanges |
| 3921 |
\phfnoteHackSectionStarWithTOCInCommand\PrintChanges |
| 3922 |
\fi |
| 3923 |
\ifdefined\PrintIndex |
| 3924 |
\phfnoteHackSectionStarWithTOCInCommand\PrintIndex |
| 3925 |
\fi |
| 3926 |
\def\PrintChangesAndIndexSpacing{\vspace{3cm plus 2cm minus 2cm}} |
| 3927 |
\def\PrintChangesAndIndex{\PrintChangesAndIndexSpacing\PrintChanges |
| 3928 |
\PrintChangesAndIndexSpacing\PrintIndex} |
| 3929 |
% \end{macrocode} |
| 3930 |
% |
| 3931 |
% Set the index to TWO columns only (three is too tight). |
| 3932 |
% \begin{macrocode} |
| 3933 |
\ifdefined\c@IndexColumns |
| 3934 |
\setcounter{IndexColumns}{2} |
| 3935 |
\fi |
| 3936 |
% \end{macrocode} |
| 3937 |
% |
| 3938 |
% And set the glossary, that is, the list of changes history to single-column. |
| 3939 |
% For this, renew the environment completely to remove the |multicols| |
| 3940 |
% environment. |
| 3941 |
% \begin{macrocode} |
| 3942 |
\let\phfnote@xpkgdoc@old@theglossary\theglossary |
| 3943 |
\let\phfnote@xpkgdoc@old@endtheglossary\endtheglossary |
| 3944 |
\renewenvironment{theglossary}{% |
| 3945 |
\glossary@prologue% |
| 3946 |
\GlossaryParms \let\item\@idxitem \ignorespaces} |
| 3947 |
{} |
| 3948 |
% \end{macrocode} |
| 3949 |
% |
| 3950 |
% Tools to condense the macro names in the margins, and make them break at the |
| 3951 |
% margin width (at arbitrary points in the macro name) instead of overflowing on |
| 3952 |
% the documentation text. |
| 3953 |
% \begin{macrocode} |
| 3954 |
\def\phf@fillwithdiscretionaries#1#2#3{% |
| 3955 |
\def\phf@fillwithdescretionaries@a{#1}% |
| 3956 |
\def\phf@fillwithdescretionaries@b{#2}% |
| 3957 |
\edef\x{#3}% |
| 3958 |
\expandafter \phf@fillwithdiscretionaries@ \x \@nil |
| 3959 |
} |
| 3960 |
\def\phf@fillwithdiscretionaries@#1#2\@nil{% |
| 3961 |
\if\relax\detokenize{#1}\relax\else |
| 3962 |
#1% |
| 3963 |
\if\relax\detokenize{#2}\relax\else |
| 3964 |
\discretionary{\phf@fillwithdescretionaries@a}{% |
| 3965 |
\phf@fillwithdescretionaries@b}{}% |
| 3966 |
\phf@fillwithdiscretionaries@#2\@nil |
| 3967 |
\fi |
| 3968 |
\fi |
| 3969 |
} |
| 3970 |
\definecolor{phfxpkgdocmacronamehyphencolor}{rgb}{0.6,0.6,0.7} |
| 3971 |
\def\phf@xpkgdoc@macrobreakhyphen{% |
| 3972 |
\hbox{\textcolor{phfxpkgdocmacronamehyphencolor}{-}}} |
| 3973 |
\def\ScaleHorizontallyAndHyphenateAnywhere#1#2{% {hscale-factor}{text} |
| 3974 |
\scalebox{#1}[1.0]{% |
| 3975 |
\parbox{% compute inverse of #1 ... |
| 3976 |
\dimexpr \marginparwidth*65536 / |
| 3977 |
\number\dimexpr #1\p@ \relax \relax |
| 3978 |
}{\raggedleft\phf@fillwithdiscretionaries{% |
| 3979 |
\phf@xpkgdoc@macrobreakhyphen}{}{#2}\hfill}% |
| 3980 |
}% |
| 3981 |
} |
| 3982 |
\def\phf@xpkgdoc@marginmacronamecompressfactor{0.85} |
| 3983 |
\def\phf@xpkgdoc@macrofont{\small\bfseries}% \footnotesize ? |
| 3984 |
\def\PrintMarginLabelContents#1{% |
| 3985 |
\strut\MacroFont\phf@xpkgdoc@macrofont |
| 3986 |
\ScaleHorizontallyAndHyphenateAnywhere{% |
| 3987 |
\phf@xpkgdoc@marginmacronamecompressfactor}{#1}% |
| 3988 |
\par |
| 3989 |
} |
| 3990 |
\def\PrintMarginLabel#1{\marginpar{\PrintMarginLabelContents{#1}}} |
| 3991 |
\def\PrintDescribeMacro#1{\PrintMarginLabelContents{\string#1}} |
| 3992 |
\let\PrintMacroName\PrintDescribeMacro |
| 3993 |
\let\PrintDescribeEnv\PrintMarginLabelContents |
| 3994 |
\let\PrintEnvName\PrintMarginLabelContents |
| 3995 |
% \end{macrocode} |
| 3996 |
% |
| 3997 |
% \textbf{Hyperref:} Request default \pkgname{hyperref} definitions with |
| 3998 |
% |hyperrefdefs=defer|, but we'll load \pkgname{hyperdoc} instead of |
| 3999 |
% \pkgname{hyperref}. |
| 4000 |
% \begin{macrocode} |
| 4001 |
\def\phfnote@opt@hyperrefdefs{defer} |
| 4002 |
\g@addto@macro\phfnote@hook@atendload{ |
| 4003 |
\RequirePackage{hypdoc} |
| 4004 |
\urlstyle{noteit} |
| 4005 |
} |
| 4006 |
% \end{macrocode} |
| 4007 |
% |
| 4008 |
% \textbf{Provide Macro:} |\pkgname|\marg{package name} to format a package |
| 4009 |
% name. Also place it in the general index. This command is robust and |
| 4010 |
% can be used in section titles etc. |
| 4011 |
% \begin{macrocode} |
| 4012 |
\def\pkgname#1{% |
| 4013 |
\pkgnamefmt{#1}% |
| 4014 |
\index{#1=\pkgnamefmt{#1}|hyperpage}% |
| 4015 |
\index{packages:>#1=\pkgnamefmt{#1}|hyperpage}% |
| 4016 |
} |
| 4017 |
\robustify\pkgname |
| 4018 |
\def\pkgnamefmt#1{\textsf{#1}} |
| 4019 |
\robustify\pkgnamefmt |
| 4020 |
% \end{macrocode} |
| 4021 |
% |
| 4022 |
% |
| 4023 |
% \textbf{Provide Macros:} |\changed| and |\changedreftext|, with more |
| 4024 |
% advanced support for displaying changes in package functionality or API. |
| 4025 |
% |
| 4026 |
% First, we need a counter for the x-ref system. |
| 4027 |
% \begin{macrocode} |
| 4028 |
\newcounter{phfnotechanged} |
| 4029 |
% \end{macrocode} |
| 4030 |
% |
| 4031 |
% Mark changes in the implementation section of the package documentation |
| 4032 |
% with the command |\changed|\oarg{label |
| 4033 |
% name}\marg{v1.0}\marg{2016/05/22}\marg{description}. This command |
| 4034 |
% automatically adds the change to the package's change history list, and |
| 4035 |
% allows you to refer to this change anywhere else in the package doc with |
| 4036 |
% |\changedreftext|. |
| 4037 |
% \begin{macrocode} |
| 4038 |
\newcommand*\changed[4][]{% |
| 4039 |
% \end{macrocode} |
| 4040 |
% |
| 4041 |
% First, if no label is given as optional argument, then just display the |
| 4042 |
% change and add it to the package changes list. |
| 4043 |
% \begin{macrocode} |
| 4044 |
\if\relax\detokenize{#1}\relax% |
| 4045 |
\changedtextfmt{#2}{#3}{#4}% |
| 4046 |
\changes{#2}{#3}{#4}% |
| 4047 |
\else% |
| 4048 |
% \end{macrocode} |
| 4049 |
% |
| 4050 |
% If a label name is provided as optional argument, then we need to write |
| 4051 |
% some stuff to the \texttt{.aux} file to make the change visible in the |
| 4052 |
% whole document. |
| 4053 |
% \begin{macrocode} |
| 4054 |
\protected@edef\phfnotechanged@tmpa{{#2}{#3}{#4}}% |
| 4055 |
\immediate\write\@auxout{\string\phfnote@changed@set% |
| 4056 |
{#1}{\expandonce\phfnotechanged@tmpa}}% |
| 4057 |
\par\hspace*{0pt}\refstepcounter{phfnotechanged}\label{phfnotechanged:#1}% |
| 4058 |
\begingroup\let\phfnote@changedreftext@par\relax |
| 4059 |
\changedreftext[\@secondoftwo]{#1}% |
| 4060 |
\endgroup |
| 4061 |
\changes{#2}{#3}{\hyperref[phfnotechanged:#1]{#4}}% |
| 4062 |
\fi |
| 4063 |
} |
| 4064 |
\def\phfnote@changed@set#1{% |
| 4065 |
\expandafter\gdef\csname phfnote@changed@lbl@#1\endcsname% |
| 4066 |
} |
| 4067 |
% \end{macrocode} |
| 4068 |
% |
| 4069 |
% When you document changes with the help of |\changed|, you may refer to |
| 4070 |
% any specific change from anywhere else in the package doc with the help |
| 4071 |
% of |\changedreftext|\marg{label name}. |
| 4072 |
% \begin{macrocode} |
| 4073 |
\def\phfnote@changedreftext@par{\par} |
| 4074 |
\newcommand*\changedreftext[2][\phfnote@changedrefto]{% |
| 4075 |
\phfnote@changedreftext@par% |
| 4076 |
\ifcsname phfnote@changed@lbl@#2\endcsname |
| 4077 |
#1{#2}{% |
| 4078 |
\expandafter\expandafter\expandafter\changedtextfmt% |
| 4079 |
\csname phfnote@changed@lbl@#2\endcsname |
| 4080 |
} |
| 4081 |
\else |
| 4082 |
\hyperref[phfnotechanged:#2]{% |
| 4083 |
\changedtextfmt{???}{???}{[\textbf{missing ref}]}% |
| 4084 |
}% |
| 4085 |
\fi |
| 4086 |
\par |
| 4087 |
} |
| 4088 |
\def\phfnote@changedrefto#1{\hyperref[phfnotechanged:#1]} |
| 4089 |
% \end{macrocode} |
| 4090 |
% |
| 4091 |
% The macro |\changedtextfmt|\marg{v1.0}\marg{2016/05/22}\marg{description} |
| 4092 |
% takes care of formatting the change on the spot. |
| 4093 |
% \begin{macrocode} |
| 4094 |
\newcommand*\changedtextfmt[3]{% |
| 4095 |
\textit{Changed in {#1\kern 0.3ex\relax[#2]}:} #3. |
| 4096 |
} |
| 4097 |
% \end{macrocode} |
| 4098 |
% |
| 4099 |
% \textbf{Provide environment \phfverb{pkgoptions}:} Set up an elaborate |
| 4100 |
% environment (based on a |description| environment) to describe package |
| 4101 |
% options. |
| 4102 |
% \begin{macrocode} |
| 4103 |
\RequirePackage{enumitem} |
| 4104 |
\newlist{pkgoptions}{description}{1} |
| 4105 |
\setlist[pkgoptions]{font=\pkgoptionfmt@many[{\vspace*{5pt}}],style=nextline} |
| 4106 |
% \end{macrocode} |
| 4107 |
% |
| 4108 |
% But patch the |pkgoptions|' |\item| command, so that it puts an additional |
| 4109 |
% pair of braces around its argument. In this way, the |font=| attribute for |
| 4110 |
% the list sees the full label as its next token, and can be used as a macro |
| 4111 |
% argument. (This is not needed for newer versions of \pkgname{enumitem}.) |
| 4112 |
% \begin{macrocode} |
| 4113 |
\def\pkgoptions@item{\@ifnextchar[\pkgoptions@item@\pkgoptions@item@@}%] |
| 4114 |
\def\pkgoptions@item@[#1]{\pkgoptions@old@item[{{#1}}]}% |
| 4115 |
\def\pkgoptions@item@@{\PackageWarning{phfnote}{{pkgoptions}: you must |
| 4116 |
specify label to \string\item as \string\item[label].}% |
| 4117 |
\pkgoptions@old@item}% |
| 4118 |
\apptocmd\pkgoptions{% |
| 4119 |
\let\pkgoptions@old@item\item |
| 4120 |
\let\item\pkgoptions@item |
| 4121 |
}{}{\PackageWarning{phfnote}{preset xpkgdoc: Failed to patch command |
| 4122 |
\string\pkgoptions}} |
| 4123 |
% \end{macrocode} |
| 4124 |
% |
| 4125 |
% For convenience, also provide a |\meta|-like command for boolean arguments |
| 4126 |
% (|true| or |false|). `|\metatruefalsearg|' typesets as `\metatruefalsearg'. |
| 4127 |
% \begin{macrocode} |
| 4128 |
\def\metatruefalsearg{\meta{\phfverb{true} $\mid$ \phfverb{false}}} |
| 4129 |
% \end{macrocode} |
| 4130 |
% |
| 4131 |
% Include also a command to format a package option. Puts the option in a box |
| 4132 |
% in typewriter text style, and indexes it. The optional argument is meant to |
| 4133 |
% be internal---it adds commands after the displayed text (use it to add, e.g.\@ |
| 4134 |
% spacing). |
| 4135 |
% |
| 4136 |
% When indexing the packages, make sure to remove the protective braces if any. |
| 4137 |
% \begin{macrocode} |
| 4138 |
\newcommand\pkgoptionfmt[2][]{% |
| 4139 |
\begingroup\let\meta\pkgoptfmt@meta\pkgopt@fbox{\normalfont\ttfamily #2}\endgroup% |
| 4140 |
\expandafter\phfnote@pkgdoc@index\expandafter{\@firstofone #2}% |
| 4141 |
#1} |
| 4142 |
\newcommand\pkgoptionfmt@many[2][]{% |
| 4143 |
\def\pkgoptionfmt@tmp@addcomma{} |
| 4144 |
\def\do##1{\pkgoptionfmt@tmp@addcomma\pkgoptionfmt{\vphantom{#2}##1}% |
| 4145 |
\def\pkgoptionfmt@tmp@addcomma{\hskip0.25em\relax,\hskip0.8em\relax}}% |
| 4146 |
\expandafter\docsvlist\expandafter{\@firstofone #2}% |
| 4147 |
#1} |
| 4148 |
\let\pkgopt@save@meta\meta |
| 4149 |
\def\pkgopt@fbox{\fbox} |
| 4150 |
\def\pkgoptfmt@meta#1{\begingroup\normalfont\itshape\pkgopt@save@meta{#1}\endgroup} |
| 4151 |
% \end{macrocode} |
| 4152 |
% |
| 4153 |
% Whenever a package option is formatted with |\pkgoptionfmt|, it is placed in |
| 4154 |
% the index. Because package options may be of the form |key=val|, we want to |
| 4155 |
% split keys from values and put them independently in the index. This is done |
| 4156 |
% by entering a \TeX{} group, and using an |\lccode| trick: the code is prepared |
| 4157 |
% to iterate over a list of comma-separated stuff, but then the ``lowercase'' |
| 4158 |
% version of that code is executed instead, where the |=|'s have been replaced |
| 4159 |
% by |,|'s. |
| 4160 |
% \begin{macrocode} |
| 4161 |
\def\phfnote@pkgdoc@index#1{% |
| 4162 |
\begingroup\lccode`\= = `\,\relax% |
| 4163 |
\def\x{\lowercase{\def\@tmpa{#1}}}% |
| 4164 |
\x% |
| 4165 |
\let\meta\@gobble% |
| 4166 |
\let\marg\@gobble% |
| 4167 |
\let\oarg\@gobble% |
| 4168 |
\let\parg\@gobble% |
| 4169 |
\let\vphantom\@gobble% |
| 4170 |
\let\hphantom\@gobble% |
| 4171 |
\let\pkgoptattrib\@firstofone% |
| 4172 |
\let\pkgoptattribnodots\@firstofone% |
| 4173 |
\let\pkgoptattribempty\@empty% |
| 4174 |
\def\handleitemindex##1{% |
| 4175 |
\edef\@tmpc{##1}% |
| 4176 |
\if\relax\detokenize\expandafter{\@tmpc}\relax\else% |
| 4177 |
\edef\@tmpb{{\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+ (\pkgoptname)|hyperpage}}% |
| 4178 |
\expandafter\index\@tmpb% |
| 4179 |
\edef\@tmpb{{\packageoptionsname:>\expandonce\@tmpc=\string\verb!*+\expandonce\@tmpc+|hyperpage}}% |
| 4180 |
\expandafter\index\@tmpb% |
| 4181 |
\fi% |
| 4182 |
}% |
| 4183 |
\def\@tmpc{\forcsvlist{\handleitemindex}}% |
| 4184 |
\expandafter\@tmpc\expandafter{\@tmpa}% |
| 4185 |
\endgroup% |
| 4186 |
} |
| 4187 |
\def\pkgoptname{pkg. opt.} |
| 4188 |
\def\packageoptionsname{package options} |
| 4189 |
% \end{macrocode} |
| 4190 |
% |
| 4191 |
% \textbf{Provide environment \phfverb{cmdoptions}:} hijack the |pkgoptions| |
| 4192 |
% environment to do the same thing, except we place the items in the index under |
| 4193 |
% ``command options'' instead of ``package options.'' |
| 4194 |
% \begin{macrocode} |
| 4195 |
\def\cmdoptions{\begingroup\setcmdnotpkgoptions |
| 4196 |
\pkgoptions} |
| 4197 |
\def\endcmdoptions{\endpkgoptions\endgroup} |
| 4198 |
\newcommand\cmdoptionfmt[2][]{\begingroup\setcmdnotpkgoptions |
| 4199 |
\pkgoptionfmt[{#1}]{#2}\endgroup} |
| 4200 |
\def\cmdoptname{cmd. opt.} |
| 4201 |
\def\commandoptionsname{command options} |
| 4202 |
\def\setcmdnotpkgoptions{\let\pkgoptname\cmdoptname |
| 4203 |
\let\packageoptionsname\commandoptionsname |
| 4204 |
\let\pkgopt@fbox\cmdoptionsfbox} |
| 4205 |
\def\cmdoptionsfbox#1{\ensuremath{\underline{{\text{#1}}}}} |
| 4206 |
% \end{macrocode} |
| 4207 |
% |
| 4208 |
% Provide the |\pkgoptattrib| command, which typesets its argument as |
| 4209 |
% |\{arg, ...\}|---useful to typeset attributes such as in |
| 4210 |
% \autoref{sec:abstract-attributes}. The variant |\pkgoptattribondots{arg}| |
| 4211 |
% typesets |\{arg\}| while |\pkgoptattribempty| expands to |{}|. |
| 4212 |
% \begin{macrocode} |
| 4213 |
\def\pkgoptattrib#1{\{#1,...\}} |
| 4214 |
\def\pkgoptattribnodots#1{\{#1\}} |
| 4215 |
\def\pkgoptattribempty{\{\}} |
| 4216 |
% \end{macrocode} |
| 4217 |
% |
| 4218 |
% \textbf{Colorful boxes: environments \phfverb{pkgnote}, |
| 4219 |
% \phfverb{pkgwarning}, and \phfverb{pkgtip}.} Now, load the |
| 4220 |
% \pkgname{tcolorbox} package to provide visual ``Note,'' ``Warning,'' and |
| 4221 |
% ``Tip'' boxes. Because \pkgname{tcolorbox} includes the |
| 4222 |
% \pkgname{verbatim} package which messes up the |verbatim| environment in |
| 4223 |
% latex dtx files (for which source lines all start with a |%| which needs |
| 4224 |
% to be stripped), we save the |verbatim|-related commands, and restore |
| 4225 |
% them after the interfering packages have been loaded. |
| 4226 |
% \begin{macrocode} |
| 4227 |
\phfnoteSaveDefs{verbatimstuff}{% |
| 4228 |
verbatim,@verbatim,@xverbatim,@sxverbatim,endverbatim} |
| 4229 |
\usepackage{tcolorbox} |
| 4230 |
\newtcolorbox{pkgnote}{ |
| 4231 |
colback=blue!5!white, |
| 4232 |
colframe=blue!5!white, |
| 4233 |
coltitle=blue!50!black, |
| 4234 |
toptitle=1.5ex, |
| 4235 |
fonttitle=\bfseries, |
| 4236 |
title={NOTE} |
| 4237 |
} |
| 4238 |
\newtcolorbox{pkgwarning}{ |
| 4239 |
colback=red!5!white, |
| 4240 |
colframe=red!5!white, |
| 4241 |
coltitle=red!50!black, |
| 4242 |
toptitle=1.5ex, |
| 4243 |
fonttitle=\bfseries, |
| 4244 |
title={WARNING} |
| 4245 |
} |
| 4246 |
\newtcolorbox{pkgtip}{ |
| 4247 |
colback=green!5!white, |
| 4248 |
colframe=green!5!white, |
| 4249 |
coltitle=green!50!black, |
| 4250 |
toptitle=1.5ex, |
| 4251 |
fonttitle=\bfseries, |
| 4252 |
title={TIP} |
| 4253 |
} |
| 4254 |
\phfnoteRestoreDefs{verbatimstuff} |
| 4255 |
% \end{macrocode} |
| 4256 |
% |
| 4257 |
% Patch the |verbatim| environment to remove extraneous space after the |
| 4258 |
% environment caused by I don't know what weird cause: |
| 4259 |
% \begin{macrocode} |
| 4260 |
\appto\endverbatim{\vspace{-\baselineskip}} |
| 4261 |
% \end{macrocode} |
| 4262 |
% |
| 4263 |
% Common title stuff: |
| 4264 |
% \begin{macrocode} |
| 4265 |
\def\phfqitltxPkgTitle#1{The \pkgname{#1} package\thanks{\itshape |
| 4266 |
This document corresponds to \pkgname{#1}~\fileversion, dated \filedate. It |
| 4267 |
is part of the |
| 4268 |
\href{https://github.com/phfaist/phfqitltx/}{\pkgname{phfqitltx}} package |
| 4269 |
suite, see \url{https://github.com/phfaist/phfqitltx}.}} |
| 4270 |
% \end{macrocode} |
| 4271 |
% |
| 4272 |
% Utility to parse package file date into ``|\today|''-style date: invoke as |
| 4273 |
% |\date{\pkgfmtdate\filedate}|. |
| 4274 |
% \begin{macrocode} |
| 4275 |
\def\pkgfmtdate#1{% |
| 4276 |
\edef\pkgfmtdate@thedate{#1}% |
| 4277 |
\expandafter\pkgfmtdate@next\pkgfmtdate@thedate\@nil% |
| 4278 |
} |
| 4279 |
\def\pkgfmtdate@next#1/#2/#3\@nil{% YYYY/MM/DD |
| 4280 |
\ifcase #2 \or January\or February\or March\or April\or May% |
| 4281 |
\or June\or July\or August\or September\or October% |
| 4282 |
\or November\or December\fi\space #3,% |
| 4283 |
\space #1} |
| 4284 |
\robustify\pkgfmtdate@next |
| 4285 |
% \end{macrocode} |
| 4286 |
% |
| 4287 |
% \begin{verbatim} |
| 4288 |
%</phfnotepreset-xpkgdoc> |
| 4289 |
% \end{verbatim} |
| 4290 |
% \iffalse |
| 4291 |
%<*package> |
| 4292 |
% \fi |
| 4293 |
% |
| 4294 |
% |
| 4295 |
% |
| 4296 |
% |
| 4297 |
%\Finale |
| 4298 |
%</package> |
| 4299 |
\endinput |