| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2019 Vincent Goulet |
| 4 |
% |
| 5 |
% This file may be distributed and/or modified under the conditions |
| 6 |
% of the LaTeX Project Public License, either version 1.3c of this |
| 7 |
% license or (at your option) any later version. The latest version |
| 8 |
% of this license is in: |
| 9 |
% |
| 10 |
% http://www.latex-project.org/lppl.txt |
| 11 |
% |
| 12 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 13 |
% version 2006/05/20 or later. |
| 14 |
% |
| 15 |
% This work has the LPPL maintenance status `maintained'. |
| 16 |
% |
| 17 |
% The Current Maintainer of this work is Vincent Goulet |
| 18 |
% <[email protected]>. |
| 19 |
% |
| 20 |
% This work consists of the files actuarialangle.dtx and |
| 21 |
% actuarialangle.ins and the derived files listed in the README.md |
| 22 |
% file. |
| 23 |
% |
| 24 |
% \fi |
| 25 |
% |
| 26 |
% \iffalse |
| 27 |
%<*dtx> |
| 28 |
\ProvidesFile{actuarialangle.dtx} |
| 29 |
%</dtx> |
| 30 |
%<package>\NeedsTeXFormat{LaTeX2e}[2009/09/24] |
| 31 |
%<package>\ProvidesPackage{actuarialangle}[2019/06/13 v2.1 Actuarial angle] |
| 32 |
%<*batchfile> |
| 33 |
\begingroup |
| 34 |
\input docstrip.tex |
| 35 |
\keepsilent |
| 36 |
\askforoverwritefalse |
| 37 |
|
| 38 |
\preamble |
| 39 |
|
| 40 |
This is a generated file. |
| 41 |
|
| 42 |
Copyright (C) 2019 Vincent Goulet |
| 43 |
|
| 44 |
This file may be distributed and/or modified under the conditions |
| 45 |
of the LaTeX Project Public License, either version 1.3c of this |
| 46 |
license or (at your option) any later version. The latest version |
| 47 |
of this license is in: |
| 48 |
|
| 49 |
http://www.latex-project.org/lppl.txt |
| 50 |
|
| 51 |
and version 1.3c or later is part of all distributions of LaTeX |
| 52 |
version 2006/05/20 or later. |
| 53 |
|
| 54 |
This work has the LPPL maintenance status `maintained'. |
| 55 |
|
| 56 |
The Current Maintainer of this work is Vincent Goulet |
| 57 |
<[email protected]>. |
| 58 |
|
| 59 |
This work consists of the files actuarialangle.dtx and |
| 60 |
actuarialangle.ins and the derived files listed in the README.md file. |
| 61 |
|
| 62 |
\endpreamble |
| 63 |
\generate{\file{actuarialangle.sty}{\from{actuarialangle.dtx}{package}}} |
| 64 |
\endgroup |
| 65 |
%</batchfile> |
| 66 |
%<*driver> |
| 67 |
\documentclass[11pt,x11names]{ltxdoc} |
| 68 |
\usepackage[utf8]{inputenc} |
| 69 |
\usepackage[T1]{fontenc} |
| 70 |
\usepackage{natbib} |
| 71 |
\usepackage{microtype} |
| 72 |
\usepackage[scaled=0.90]{helvet} |
| 73 |
\usepackage[scaled=1.02]{inconsolata} |
| 74 |
\usepackage[sc]{mathpazo} |
| 75 |
\usepackage{actuarialangle} |
| 76 |
\usepackage{framed} |
| 77 |
\DisableCrossrefs |
| 78 |
\CodelineNumbered |
| 79 |
\RecordChanges |
| 80 |
\GlossaryPrologue{\section*{Version history}% |
| 81 |
\addcontentsline{toc}{section}{Version history}} |
| 82 |
|
| 83 |
%% colors |
| 84 |
\usepackage{xcolor} |
| 85 |
\definecolor{link}{rgb}{0,0.4,0.6} % ~dvips RoyalBlue |
| 86 |
\definecolor{url}{rgb}{0.6,0,0} % dark red |
| 87 |
\definecolor{citation}{rgb}{0,0.5,0} % dark green |
| 88 |
\colorlet{shadecolor}{LightYellow1} |
| 89 |
|
| 90 |
%% left aligned description list |
| 91 |
\usepackage{enumitem} |
| 92 |
\setlist[description]{leftmargin=*,align=left} |
| 93 |
|
| 94 |
%% environment for displayed sample code; hybrid between |
| 95 |
%% environments snugshade* and leftbar of framed.sty |
| 96 |
\makeatletter |
| 97 |
\newenvironment{snugshadebar}{% |
| 98 |
\setlength{\topsep}{1pt} |
| 99 |
\def\FrameCommand##1{\hskip\@totalleftmargin |
| 100 |
\vrule width 2pt\colorbox{shadecolor}{\hspace{3pt}##1}% |
| 101 |
% There is no \@totalrightmargin, so: |
| 102 |
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% |
| 103 |
\MakeFramed {\advance\hsize-\width |
| 104 |
\@totalleftmargin\z@ \linewidth\hsize |
| 105 |
\advance\labelsep\fboxsep |
| 106 |
\@setminipage}% |
| 107 |
}{\par\unskip\@minipagefalse\endMakeFramed} |
| 108 |
\makeatother |
| 109 |
|
| 110 |
%% environments for demo code; 'texample' mostly lifted from |
| 111 |
%% documentation of amsmath |
| 112 |
\newenvironment{demo}{\begin{trivlist}\item}{\end{trivlist}} |
| 113 |
\newenvironment{texample}[1][0.5]{% |
| 114 |
\noindent\begin{minipage}{#1\linewidth}\begin{snugshadebar}% |
| 115 |
\def\producing{\end{snugshadebar}\end{minipage}\hfill\begin{minipage}{\dimexpr0.97\linewidth-#1\linewidth}% |
| 116 |
\hbox\bgroup\kern-.2pt% |
| 117 |
\vbox\bgroup\parindent0pt\relax |
| 118 |
% The 3pt is to cancel the -\lineskip from \displ@y |
| 119 |
\abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip |
| 120 |
\belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip |
| 121 |
\noindent}% |
| 122 |
}{% |
| 123 |
\par |
| 124 |
% Ensure that a lonely \[\] structure doesn't take up width less than |
| 125 |
% \hsize. |
| 126 |
\hrule height0pt width\hsize |
| 127 |
\egroup\kern-.2pt\egroup |
| 128 |
\end{minipage}% |
| 129 |
\par |
| 130 |
} |
| 131 |
|
| 132 |
%% utility macro |
| 133 |
\newcommand{\pkg}[1]{\textsf{#1}} |
| 134 |
|
| 135 |
%% hyperlinks |
| 136 |
\usepackage{hyperref} |
| 137 |
\hypersetup{colorlinks, linktocpage, |
| 138 |
urlcolor=url, linkcolor=link, citecolor=citation, |
| 139 |
bookmarksopen, bookmarksnumbered, bookmarksdepth=subsection, |
| 140 |
pdftitle={actuarialangle User Guide}, |
| 141 |
pdfauthor={Vincent Goulet}} |
| 142 |
|
| 143 |
%% autoref labels |
| 144 |
\let\subsectionautorefname\sectionautorefname |
| 145 |
\let\subsubsectionautorefname\sectionautorefname |
| 146 |
|
| 147 |
\begin{document} |
| 148 |
\DocInput{actuarialangle.dtx} |
| 149 |
\end{document} |
| 150 |
%</driver> |
| 151 |
% \fi |
| 152 |
% \CheckSum{281} |
| 153 |
% \changes{v1.0}{2012-10-16}{Initial release.} |
| 154 |
% \changes{v1.0a}{2017-02-01}{Various improvements to the README |
| 155 |
% file, including conversion to markdown format after the project was |
| 156 |
% moved to GitHub.} |
| 157 |
% \changes{v2.0}{2017-04-09}{Complete new documentation.} |
| 158 |
% \changes{v2.1}{2019-06-13}{Variable extra space, rule thickness and |
| 159 |
% vertical gap; contributed by Ruixi Zhang.} |
| 160 |
% |
| 161 |
% \GetFileInfo{actuarialangle.sty} |
| 162 |
% |
| 163 |
% \title{Actuarial angle symbol for life contingencies \\ |
| 164 |
% and financial mathematics^^A |
| 165 |
% \thanks{This document corresponds to |
| 166 |
% \pkg{actuarialangle}~\fileversion, dated~\filedate.}} |
| 167 |
% \author{Vincent Goulet\thanks{^^A |
| 168 |
% École d'actuariat, Université Laval.} \\ |
| 169 |
% \url{[email protected]}} |
| 170 |
% \maketitle |
| 171 |
% |
| 172 |
% \begin{abstract} |
| 173 |
% The package \pkg{actuarialangle} provides commands to typeset the |
| 174 |
% ``angle'' symbol denoting a duration $n$ in actuarial notation, as |
| 175 |
% in $\angln$, and an overhead angle bracket, as in $\group{xy}$. |
| 176 |
% \end{abstract} |
| 177 |
% |
| 178 |
% \section{Introduction} |
| 179 |
% |
| 180 |
% This package defines commands to typeset two symbols used in |
| 181 |
% actuarial notation for life contingencies and financial mathematics. |
| 182 |
% The first is the ``angle'' denoting a duration in the present value |
| 183 |
% of an insurance or annuity: $\angln$. The second is an overhead |
| 184 |
% angle bracket (or ``roof'') used to emphasize joint status when |
| 185 |
% ambiguity is possible: $\group{xy}$. The bracket is normally used |
| 186 |
% with a precedence number above. Facilities to position such numbers |
| 187 |
% are provided by the package \pkg{actuarialsymbol} |
| 188 |
% \citep{actuarialsymbol}. |
| 189 |
% |
| 190 |
% For additional details on actuarial notation for life contingencies, |
| 191 |
% see \citet{Bowers:2e:1997}. |
| 192 |
% |
| 193 |
% \section{Package options} |
| 194 |
% \label{sec:options} |
| 195 |
% |
| 196 |
% The package offers the following options: |
| 197 |
% \begin{description} |
| 198 |
% \item[\mdseries\ttfamily thinspace] insert a thin space of 1mu |
| 199 |
% between the material under the angle and the right descender; this |
| 200 |
% is the default starting with version 2.0 of the package; |
| 201 |
% \item[\mdseries\ttfamily thickspace] insert a thicker space of 2mu |
| 202 |
% between the material under the angle and the right descender; this |
| 203 |
% was the value used in versions of the package prior to 2.0; |
| 204 |
% \item[\mdseries\ttfamily nobracket] do not define command |
| 205 |
% \cmd{\overanglebracket} and its alias \cmd{\group}; this option |
| 206 |
% also prevents loading of package \pkg{pict2e}. |
| 207 |
% \end{description} |
| 208 |
% We provide the option |nobracket| in case the bracket symbol is not |
| 209 |
% needed and \pkg{pict2e} \citep{pict2e} interferes with other |
| 210 |
% packages. Loading the package with |
| 211 |
% \begin{quote} |
| 212 |
% |\usepackage[thickspace,nobracket]{actuarialangle}| |
| 213 |
% \end{quote} |
| 214 |
% yields the behaviour of versions prior to 2.0, but for the defunct |
| 215 |
% features mentioned in \autoref{sec:defunct}. |
| 216 |
% |
| 217 |
% \section{Package features} |
| 218 |
%\label{sec:features} |
| 219 |
% |
| 220 |
% \begin{DescribeMacro}{\actuarialangle} |
| 221 |
% In math mode, the command |
| 222 |
% \begin{quote} |
| 223 |
% |\actuarialangle|\marg{duration} |
| 224 |
% \end{quote} |
| 225 |
% composes an angle symbol around \meta{duration}. This is the |
| 226 |
% ``raw'' command that does not insert any space between |
| 227 |
% \meta{duration} and the right descender of the angle. The symbol |
| 228 |
% scales gracefully if the command is used outside of a |
| 229 |
% first-level subscript. |
| 230 |
% \begin{demo} |
| 231 |
% \begin{texample} |
| 232 |
% |\actuarialangle{n} \quad| \\ |
| 233 |
% |a_{\actuarialangle{n}}| |
| 234 |
% \producing |
| 235 |
% $\actuarialangle{n} \quad a_{\actuarialangle{n}}$ |
| 236 |
% \end{texample} |
| 237 |
% \end{demo} |
| 238 |
% \end{DescribeMacro} |
| 239 |
% |
| 240 |
% \begin{DescribeMacro}{\angl} |
| 241 |
% \begin{DescribeMacro}{\angln} |
| 242 |
% \begin{DescribeMacro}{\anglr} |
| 243 |
% \begin{DescribeMacro}{\anglk} |
| 244 |
% Users are expected to typeset angle symbols with the command |
| 245 |
% \begin{quote} |
| 246 |
% |\angl|\marg{duration} |
| 247 |
% \end{quote} |
| 248 |
% In contrast to \cmd{\actuarialangle}, this command inserts some |
| 249 |
% thin space (by default or with package option |thinspace|) or |
| 250 |
% thick space (with package option |thickspace|) between |
| 251 |
% \marg{duration} and the right descender. |
| 252 |
% \begin{demo} |
| 253 |
% \begin{texample} |
| 254 |
% |% with option thinspace:| \\ |
| 255 |
% |\angl{n} \quad a_{\angl{n}}| |
| 256 |
% \producing |
| 257 |
% $\angl{n} \quad a_{\angl{n}}$ |
| 258 |
% \end{texample} |
| 259 |
% \begin{texample} |
| 260 |
% |% with option thickspace:| \\ |
| 261 |
% |\angl{n} \quad a_{\angl{n}}| |
| 262 |
% \producing |
| 263 |
% $\angl{n\mkern1mu} \quad a_{\angl{n\mkern1mu}}$ |
| 264 |
% \end{texample} |
| 265 |
% \end{demo} |
| 266 |
% Commands \cmd{\angln}, \cmd{\anglr} and \cmd{\anglk} are shortcuts |
| 267 |
% for the common cases \cmd{\angl}|{n}|, \cmd{\angl}|{r}| and |
| 268 |
% \cmd{\angl}|{k}|, respectively. |
| 269 |
% \end{DescribeMacro} |
| 270 |
% \end{DescribeMacro} |
| 271 |
% \end{DescribeMacro} |
| 272 |
% \end{DescribeMacro} |
| 273 |
% |
| 274 |
% \begin{DescribeMacro}{\overanglebracket} |
| 275 |
% \begin{DescribeMacro}{\group} |
| 276 |
% The command |
| 277 |
% \begin{quote} |
| 278 |
% \cmd{\overanglebracket}\marg{statuses} |
| 279 |
% \end{quote} |
| 280 |
% composes an angle bracket (``roof'') above \meta{statuses}. The |
| 281 |
% rule thickness and spacing relative to the statuses match those of |
| 282 |
% the angle symbol. The command \cmd{\group} is a convenient alias for |
| 283 |
% \cmd{\overanglebracket}. |
| 284 |
% \begin{demo} |
| 285 |
% \begin{texample} |
| 286 |
% |\group{xy} \quad| \\ |
| 287 |
% |A_{\group{xy}:\angln}| |
| 288 |
% \producing |
| 289 |
% $\group{xy} \quad A_{\group{xy}:\angln}$ |
| 290 |
% \end{texample} |
| 291 |
% \end{demo} |
| 292 |
% \end{DescribeMacro} |
| 293 |
% \end{DescribeMacro} |
| 294 |
% |
| 295 |
% \section{Defunct features} |
| 296 |
% \label{sec:defunct} |
| 297 |
% |
| 298 |
% Versions prior to 2.0 of the package included the undocumented |
| 299 |
% commands |
| 300 |
% \begin{quote} |
| 301 |
% \cmd{\topprecedence} (with alias \cmd{\lift}) \\ |
| 302 |
% \cmd{\vartopprecedence} \\ |
| 303 |
% \cmd{\bottomprecedence} \\ |
| 304 |
% \cmd{\varbottomprecedence} |
| 305 |
% \end{quote} |
| 306 |
% to typeset precedence numbers above and below statuses in subscript |
| 307 |
% of an actuarial symbol. These features have been moved --- and |
| 308 |
% improved on the way --- to package \pkg{actuarialsymbol} |
| 309 |
% \citep{actuarialsymbol}. |
| 310 |
% |
| 311 |
% \StopEventually{ |
| 312 |
% \begin{thebibliography}{3} |
| 313 |
% \bibitem[Beauchemin and Goulet(2017)]{actuarialsymbol} |
| 314 |
% D.~Beauchemin and V.~Goulet. |
| 315 |
% \newblock \emph{Actuarial symbols of life contingencies and financial |
| 316 |
% mathematics}, 2017. |
| 317 |
% \newblock URL \url{https://www.ctan.org/pkg/actuarialsymbol/}. |
| 318 |
% |
| 319 |
% \bibitem[Bowers et~al.(1997)Bowers, Gerber, Hickman, Jones, and |
| 320 |
% Nesbitt]{Bowers:2e:1997} |
| 321 |
% N.~L. Bowers, H.~U. Gerber, J.~C. Hickman, D.~A. Jones, and C.~J. Nesbitt. |
| 322 |
% \newblock \emph{Actuarial Mathematics}. |
| 323 |
% \newblock Society of Actuaries, Shaumburg, IL, second edition, 1997. |
| 324 |
% \newblock ISBN 0-9389594-6-8. |
| 325 |
% |
| 326 |
% \bibitem[Gä{\ss}lein et~al.(2016)Gä{\ss}lein, Niepraschk, and Tkadlec]{pict2e} |
| 327 |
% H.~Gä{\ss}lein, R.~Niepraschk, and J.~Tkadlec. |
| 328 |
% \newblock \emph{The pict2e package}, 2016. |
| 329 |
% \newblock URL \url{https://www.ctan.org/pkg/pict2e/}. |
| 330 |
% \end{thebibliography} |
| 331 |
% \PrintChanges |
| 332 |
% } |
| 333 |
% |
| 334 |
% \appendix |
| 335 |
% \section{Implementation} |
| 336 |
% \label{sec:implementation} |
| 337 |
% |
| 338 |
% This appendix contains the annotated source code of the package. |
| 339 |
% Most readers can stop reading here. |
| 340 |
%\iffalse |
| 341 |
%<*package> |
| 342 |
%\fi |
| 343 |
% |
| 344 |
% \subsection{Package options} |
| 345 |
% \label{sec:implementation:options} |
| 346 |
% |
| 347 |
% \begin{macro}{\ifacta@thinspace} |
| 348 |
% \changes{v2.0}{2017-04-07}{Options |thinspace| and |thickspace| |
| 349 |
% added to control spacing between material under the angle and |
| 350 |
% right descender.} % |
| 351 |
% \begin{macro}{\ifacta@nobracket} |
| 352 |
% \changes{v2.0}{2017-04-09}{Added option |nobracket| to prevent |
| 353 |
% definition of the command to typeset the over angle bracket and |
| 354 |
% loading of package \pkg{pict2e}.} % |
| 355 |
% Two flags are defined to keep track of the spacing between the |
| 356 |
% material under the angle and right descender, and whether or not |
| 357 |
% the package should define the command \cmd{\overanglebracket} and |
| 358 |
% load package \pkg{pict2e}. |
| 359 |
% \begin{macrocode} |
| 360 |
\newif\ifacta@thinspace \acta@thinspacetrue |
| 361 |
\newif\ifacta@bracket \acta@brackettrue |
| 362 |
% \end{macrocode} |
| 363 |
% \end{macro} |
| 364 |
% \end{macro} |
| 365 |
% |
| 366 |
% \begin{macro}{\DeclareOption} |
| 367 |
% Declaration of the package options and processing. Defaults are |
| 368 |
% |thinspace| and to define the bracket. |
| 369 |
% \begin{macrocode} |
| 370 |
\DeclareOption{thinspace}{\acta@thinspacetrue} |
| 371 |
\DeclareOption{thickspace}{\acta@thinspacefalse} |
| 372 |
\DeclareOption{nobracket}{\acta@bracketfalse} |
| 373 |
\ProcessOptions |
| 374 |
% \end{macrocode} |
| 375 |
% \end{macro} |
| 376 |
% |
| 377 |
% \subsection{Variable extra space, rule thickness and vertical gap} |
| 378 |
% |
| 379 |
% \begin{macro}{\acta@overbarkern@fontdimen} |
| 380 |
% \begin{macro}{\acta@overbarkern@family} |
| 381 |
% \begin{macro}{\acta@overbarrule@fontdimen} |
| 382 |
% \begin{macro}{\acta@overbarrule@family} |
| 383 |
% \begin{macro}{\acta@overbarvgap@fontdimen} |
| 384 |
% \begin{macro}{\acta@overbarvgap@family} |
| 385 |
% \changes{v2.1}{2019-01-11}{Define fontdimen and family parameters.} |
| 386 |
% We first deal with Type~1 math fonts. We define the |\fontdimen|'s |
| 387 |
% and families used for the thickness of the |\overline| rule and the |
| 388 |
% amount of vertical gap between the rule and the content, as well as |
| 389 |
% the extra white space above the rule. |
| 390 |
% \begin{macrocode} |
| 391 |
\def\acta@overbarkern@fontdimen{8} |
| 392 |
\def\acta@overbarkern@family{\thr@@} |
| 393 |
\def\acta@overbarrule@fontdimen{8} |
| 394 |
\def\acta@overbarrule@family{\thr@@} |
| 395 |
\def\acta@overbarvgap@fontdimen{8} |
| 396 |
\def\acta@overbarvgap@family{\thr@@} |
| 397 |
% \end{macrocode} |
| 398 |
% \end{macro} |
| 399 |
% \end{macro} |
| 400 |
% \end{macro} |
| 401 |
% \end{macro} |
| 402 |
% \end{macro} |
| 403 |
% \end{macro} |
| 404 |
% |
| 405 |
% \begin{macro}{\acta@overbarkern} |
| 406 |
% \changes{v2.1}{2019-01-11}{Define usable extra space.} |
| 407 |
% We want a macro to take a math style, e.g., |\displaystyle|, and then |
| 408 |
% to expand into |\fontdimen8\textfont3| (for Type~1 fonts). This will |
| 409 |
% serve as the extra space. The name ``overbarkern'' comes from the |
| 410 |
% corresponding LuaTeX primitive and OpenType Math table entry. |
| 411 |
% \begin{macrocode} |
| 412 |
\def\acta@overbarkern#1{% |
| 413 |
\fontdimen\acta@overbarkern@fontdimen |
| 414 |
\ifx#1\displaystyle |
| 415 |
\textfont |
| 416 |
\else |
| 417 |
\ifx#1\textstyle |
| 418 |
\textfont |
| 419 |
\else |
| 420 |
\ifx#1\scriptstyle |
| 421 |
\scriptfont |
| 422 |
\else |
| 423 |
\scriptscriptfont |
| 424 |
\fi |
| 425 |
\fi |
| 426 |
\fi |
| 427 |
\acta@overbarkern@family |
| 428 |
} |
| 429 |
% \end{macrocode} |
| 430 |
% \end{macro} |
| 431 |
% |
| 432 |
% \begin{macro}{\acta@overbarrule} |
| 433 |
% \changes{v2.1}{2019-01-06}{Define usable rule thickness.} |
| 434 |
% The |\acta@overbarrule| macro is similar. This will |
| 435 |
% serve as the rule thickness. The name ``overbarrule'' comes from the |
| 436 |
% corresponding LuaTeX primitive and OpenType Math table entry. |
| 437 |
% \begin{macrocode} |
| 438 |
\def\acta@overbarrule#1{% |
| 439 |
\fontdimen\acta@overbarrule@fontdimen |
| 440 |
\ifx#1\displaystyle |
| 441 |
\textfont |
| 442 |
\else |
| 443 |
\ifx#1\textstyle |
| 444 |
\textfont |
| 445 |
\else |
| 446 |
\ifx#1\scriptstyle |
| 447 |
\scriptfont |
| 448 |
\else |
| 449 |
\scriptscriptfont |
| 450 |
\fi |
| 451 |
\fi |
| 452 |
\fi |
| 453 |
\acta@overbarrule@family |
| 454 |
} |
| 455 |
% \end{macrocode} |
| 456 |
% \end{macro} |
| 457 |
% |
| 458 |
% \begin{macro}{\acta@overbarvgap} |
| 459 |
% \changes{v2.1}{2019-01-06}{Define usable vertical gap.} |
| 460 |
% The |\acta@overbarvgap| macro is similar. When |\acta@overbarrule@fontdimen| |
| 461 |
% and |\acta@overbarvgap@fontdimen| coincide, we use three times the |
| 462 |
% rule thickness as the vertical gap; otherwise we use the different |
| 463 |
% |\fontdimen| specified by the latter. |
| 464 |
% \begin{macrocode} |
| 465 |
\def\acta@overbarvgap#1{% |
| 466 |
\ifx\acta@overbarrule@fontdimen\acta@overbarvgap@fontdimen |
| 467 |
\thr@@ |
| 468 |
\fi |
| 469 |
\fontdimen\acta@overbarvgap@fontdimen |
| 470 |
\ifx#1\displaystyle |
| 471 |
\textfont |
| 472 |
\else |
| 473 |
\ifx#1\textstyle |
| 474 |
\textfont |
| 475 |
\else |
| 476 |
\ifx#1\scriptstyle |
| 477 |
\scriptfont |
| 478 |
\else |
| 479 |
\scriptscriptfont |
| 480 |
\fi |
| 481 |
\fi |
| 482 |
\fi |
| 483 |
\acta@overbarvgap@family |
| 484 |
} |
| 485 |
% \end{macrocode} |
| 486 |
% \end{macro} |
| 487 |
% |
| 488 |
% \subsection{Actuarial angle} |
| 489 |
% \label{sec:implementation:actuarialangle} |
| 490 |
% |
| 491 |
% The code for \cmd{\actuarialangle}, |\acta@angle|, |
| 492 |
% \cs{angl} and the underlying macros were given to the present |
| 493 |
% author by a colleague many years ago. The original author is |
| 494 |
% unknown. Some of the comments below are his or hers. |
| 495 |
% |
| 496 |
% \begin{macro}{\actuarialangle} |
| 497 |
% We first define the ``raw'' user level command. |
| 498 |
% \begin{macrocode} |
| 499 |
\DeclareRobustCommand{\actuarialangle}{\mathpalette\acta@angle} |
| 500 |
% \end{macrocode} |
| 501 |
% The operation of \cmd{\mathpalette} ensures that proper sizing the |
| 502 |
% command is ever used outside of a first-level subscript. |
| 503 |
% \end{macro} |
| 504 |
% |
| 505 |
% \begin{macro}{\acta@angle} |
| 506 |
% Next we define the real workhorse. |
| 507 |
% \begin{macrocode} |
| 508 |
\def\acta@angle#1#2{% |
| 509 |
\mathord{% |
| 510 |
% \end{macrocode} |
| 511 |
% Add a bit of preceding space. |
| 512 |
% \changes{v2.1}{2019-01-02}{Added missing \texttt\%.} |
| 513 |
% \begin{macrocode} |
| 514 |
\mkern1mu% |
| 515 |
% \end{macrocode} |
| 516 |
% We need many nested boxes here: first a vbox to stack the horizontal |
| 517 |
% rule (with some extra space on top) of the angle and the symbol; |
| 518 |
% second an hbox to position the symbol |
| 519 |
% and the right descender of the angle side-to-side; third a vbox to |
| 520 |
% insert spacing between the horizontal rule and the symbol. |
| 521 |
% \changes{v2.1}{2019-01-11}{Variable extra space.} |
| 522 |
% \changes{v2.1}{2019-01-06}{Variable thickness.} |
| 523 |
% \begin{macrocode} |
| 524 |
\vbox{% |
| 525 |
\kern\acta@overbarkern#1% |
| 526 |
\hrule \@height\acta@overbarrule#1% |
| 527 |
\hbox{% |
| 528 |
\vbox{% |
| 529 |
% \end{macrocode} |
| 530 |
% The amount of vertical gap is the normal space for |\overline|. |
| 531 |
% \changes{v2.1}{2019-01-06}{Variable gap.} |
| 532 |
% \changes{v2.1}{2019-01-02}{Moved \cmd{\m@th} in front.} |
| 533 |
% \begin{macrocode} |
| 534 |
\kern\acta@overbarvgap#1% |
| 535 |
\hbox{$\m@th#1#2$}% |
| 536 |
}% |
| 537 |
% \end{macrocode} |
| 538 |
% Make the right-hand rule extending down to the depth of a parenthesis |
| 539 |
% even if the symbol under the angle does not have a descender. |
| 540 |
% \changes{v2.1}{2019-01-06}{Use \cmd{\mathstrut}.} |
| 541 |
% \changes{v2.1}{2019-01-06}{Variable thickness.} |
| 542 |
% \begin{macrocode} |
| 543 |
\setbox\z@\hbox{$#1\mathstrut$}% |
| 544 |
\vrule \@width\acta@overbarrule#1\@depth\dp\z@ |
| 545 |
}% |
| 546 |
}% |
| 547 |
% \end{macrocode} |
| 548 |
% Finishing touch is a bit of following space. |
| 549 |
% \begin{macrocode} |
| 550 |
\mkern1mu% |
| 551 |
}% |
| 552 |
} |
| 553 |
% \end{macrocode} |
| 554 |
% \end{macro} |
| 555 |
% |
| 556 |
% \begin{macro}{\angl} |
| 557 |
% \begin{macro}{\angln} |
| 558 |
% \begin{macro}{\anglr} |
| 559 |
% \begin{macro}{\anglk} |
| 560 |
% \changes{v2.0}{2017-04-07}{Added an \cmd{\anglk} shortcut.} % |
| 561 |
% Finally, we define the main user level function \cmd{\angl} and |
| 562 |
% shortcuts for common cases. |
| 563 |
% \changes{v2.1}{2019-01-02}{Use \cmd{\newcommand*} instead of \cmd{\def}.} |
| 564 |
% \changes{v2.1}{2019-01-02}{No need for extra braces around \texttt{\#1}.} |
| 565 |
% \begin{macrocode} |
| 566 |
\ifacta@thinspace |
| 567 |
\newcommand*\angl[1]{{\actuarialangle{#1\mkern1mu}}} |
| 568 |
\else |
| 569 |
\newcommand*\angl[1]{{\actuarialangle{#1\mkern2mu}}} |
| 570 |
\fi |
| 571 |
\newcommand*\angln{{\angl n}} |
| 572 |
\newcommand*\anglr{{\angl r}} |
| 573 |
\newcommand*\anglk{{\angl k}} |
| 574 |
% \end{macrocode} |
| 575 |
% \end{macro} |
| 576 |
% \end{macro} |
| 577 |
% \end{macro} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% \subsection{Over angle bracket} |
| 581 |
% \label{sec:implementation:overanglebracket} |
| 582 |
% |
| 583 |
% The code of this section is executed only if |\acta@bracket| is |
| 584 |
% |true|, that is when the package is \emph{not} loaded with option |
| 585 |
% |nobracket|. |
| 586 |
% \begin{macrocode} |
| 587 |
\ifacta@bracket |
| 588 |
% \end{macrocode} |
| 589 |
% Drawing the angle bracket requires package \pkg{pict2e} |
| 590 |
% \citep{pict2e} to get arbitrary slopes and neat line joins in paths. |
| 591 |
% \begin{macrocode} |
| 592 |
\RequirePackage{pict2e} |
| 593 |
% \end{macrocode} |
| 594 |
% |
| 595 |
% \begin{macro}{\overanglebracket} |
| 596 |
% \changes{v2.0}{2017-04-08}{Command \cmd{\overanglebracket} added to |
| 597 |
% typeset an angle bracket (``roof'') above statuses.} % |
| 598 |
% Here is the user level command. |
| 599 |
% \begin{macrocode} |
| 600 |
\DeclareRobustCommand{\overanglebracket}{% |
| 601 |
\mathpalette\acta@anglebracket} |
| 602 |
% \end{macrocode} |
| 603 |
% We use \cmd{\mathpalette} as above. |
| 604 |
% \end{macro} |
| 605 |
% |
| 606 |
% \begin{macro}{\acta@anglebracket} |
| 607 |
% The workhorse is |\acta@anglebracket|. It builds the bracket |
| 608 |
% symbol with path lines. |
| 609 |
% \begin{macrocode} |
| 610 |
\def\acta@anglebracket#1#2{% |
| 611 |
% \end{macrocode} |
| 612 |
% \changes{v2.1}{2019-01-06}{Improved construction.} |
| 613 |
% We construct the whole symbol in the same style as |\acta@angle|, |
| 614 |
% i.e., a bit of preceding and following space, to prevent clashing |
| 615 |
% into the trailing colon. |
| 616 |
% \begin{macrocode} |
| 617 |
\mathord{% |
| 618 |
\mkern1mu% |
| 619 |
% \end{macrocode} |
| 620 |
% \changes{v2.1}{2019-01-06}{Variable thickness.} |
| 621 |
% We setup the rule thickness here. |
| 622 |
% \begin{macrocode} |
| 623 |
\linethickness{\acta@overbarrule#1}% |
| 624 |
% \end{macrocode} |
| 625 |
% Box zero contains the material under the bracket. The width of this |
| 626 |
% box will determine the width of the flat part of the bracket and the |
| 627 |
% height, the length of the descenders of the bracket. |
| 628 |
% Hence we store these values. |
| 629 |
% \changes{v2.1}{2019-01-02}{Added missing \texttt\%.} |
| 630 |
% \changes{v2.1}{2019-01-02}{Use local dimen registers.} |
| 631 |
% \begin{macrocode} |
| 632 |
\setbox\z@\hbox{$\m@th#1#2$}% |
| 633 |
\dimen\z@\wd\z@ \dimen\tw@\ht\z@ |
| 634 |
% \end{macrocode} |
| 635 |
% Box two contains the bracket itself. It is drawn in three parts |
| 636 |
% stitched together; the first and third parts are expressed in a |
| 637 |
% dimension relative to |\dimen2| whereas the central part is |
| 638 |
% expressed relative to |\dimen0|. |
| 639 |
% \changes{v2.1}{2019-01-02}{Added missing \texttt\%.} |
| 640 |
% \begin{macrocode} |
| 641 |
\setbox\tw@\hbox{% |
| 642 |
\unitlength\dimen\tw@ |
| 643 |
\begin{picture}(0.4,0) |
| 644 |
\polyline(0.4001,0)(0.4,0)(0,-0.8) |
| 645 |
\end{picture}% |
| 646 |
\unitlength\dimen\z@ |
| 647 |
\begin{picture}(1,0) |
| 648 |
\put(0,0){\line(1,0){1}} |
| 649 |
\end{picture}% |
| 650 |
\unitlength\dimen\tw@ |
| 651 |
\begin{picture}(0.4,0) |
| 652 |
\polyline(-0.0001,0)(0,0)(0.4,-0.8) |
| 653 |
\end{picture}% |
| 654 |
}% |
| 655 |
% \end{macrocode} |
| 656 |
% We store the total width of the whole bracket to center the |
| 657 |
% material under it, as follows. |
| 658 |
% \begin{macrocode} |
| 659 |
\dimen@\wd\tw@ |
| 660 |
% \end{macrocode} |
| 661 |
% The box containing the whole symbol. The lineskip between the bracket |
| 662 |
% and the statuses is the same as in |\acta@angle|, plus half the |
| 663 |
% rule thickness |\@halfwidth|. |
| 664 |
% \changes{v2.1}{2019-01-06}{Variable gap.} |
| 665 |
% \begin{macrocode} |
| 666 |
\vbox{% |
| 667 |
\baselineskip\z@ |
| 668 |
\lineskip\acta@overbarvgap#1% |
| 669 |
\advance\lineskip\@halfwidth |
| 670 |
\lineskiplimit\lineskip |
| 671 |
% \end{macrocode} |
| 672 |
% \changes{v2.1}{2019-01-11}{Variable extra space.} |
| 673 |
% The extra space is the same as in |\acta@angle|, plus half the |
| 674 |
% rule thickness |\@halfwidth|. |
| 675 |
% \begin{macrocode} |
| 676 |
\kern\acta@overbarkern#1% |
| 677 |
\kern\@halfwidth |
| 678 |
\box\tw@ |
| 679 |
\hbox to\dimen@{\hss\unhbox\z@\hss}% |
| 680 |
}% |
| 681 |
% \end{macrocode} |
| 682 |
% Finish with a bit of following space. |
| 683 |
% \begin{macrocode} |
| 684 |
\mkern1mu% |
| 685 |
}% |
| 686 |
} |
| 687 |
% \end{macrocode} |
| 688 |
% \end{macro} |
| 689 |
% |
| 690 |
% \begin{macro}{\group} |
| 691 |
% Alias for \cmd{\overanglebracket}. |
| 692 |
% \begin{macrocode} |
| 693 |
\let\group\overanglebracket |
| 694 |
\fi |
| 695 |
% \end{macrocode} |
| 696 |
% \end{macro} |
| 697 |
% |
| 698 |
% \subsection{Compatibility with \pkg{unicode-math} and OpenType math fonts} |
| 699 |
% |
| 700 |
% \begin{macro}{\AtBeginDocument} |
| 701 |
% \changes{v2.1}{2019-01-06}{Compatibility with \pkg{unicode-math}.} |
| 702 |
% The \pkg{unicode-math} package is to be loaded \emph{after} other math |
| 703 |
% setup packages, e.g., \pkg{amsmath} and \pkg{mathtools}. This usually |
| 704 |
% implies that \pkg{unicode-math} is loaded after \pkg{actuarialangle}. |
| 705 |
% So we delay the adjustments for \pkg{unicode-math}. |
| 706 |
% \begin{macrocode} |
| 707 |
\AtBeginDocument{% |
| 708 |
\@ifpackageloaded{unicode-math}{% |
| 709 |
% \end{macrocode} |
| 710 |
% When the \pkg{unicode-math} package is loaded, OpenType math font will |
| 711 |
% be used and the compile engine must be either LuaTeX or XeTeX. We test |
| 712 |
% against the XeTeX primitive |\XeTeXcharclass| to find out which engine |
| 713 |
% is used. |
| 714 |
% \begin{macrocode} |
| 715 |
\ifx\XeTeXcharclass\@undefined |
| 716 |
% \end{macrocode} |
| 717 |
% In this case the engine is LuaTeX. We redefine |\acta@overbarkern|, |
| 718 |
% |\acta@overbarrule| and |\acta@overbarvgap| to be the LuaTeX primitives |
| 719 |
% |\Umathoverbarkern|, |\Umathoverbarrule| and |\Umathoverbarvgap|, |
| 720 |
% respectively. We also undefine the fontdimen and family parameters. |
| 721 |
% \begin{macrocode} |
| 722 |
\global\let\acta@overbarkern\Umathoverbarkern |
| 723 |
\global\let\acta@overbarrule\Umathoverbarrule |
| 724 |
\global\let\acta@overbarvgap\Umathoverbarvgap |
| 725 |
\global\let\acta@overbarkern@fontdimen\@undefined |
| 726 |
\global\let\acta@overbarkern@family\@undefined |
| 727 |
\global\let\acta@overbarrule@fontdimen\@undefined |
| 728 |
\global\let\acta@overbarrule@family\@undefined |
| 729 |
\global\let\acta@overbarvgap@fontdimen\@undefined |
| 730 |
\global\let\acta@overbarvgap@family\@undefined |
| 731 |
\else |
| 732 |
% \end{macrocode} |
| 733 |
% Otherwise the engine is XeTeX. We use |\fontdimen54\<X>font2| for the |
| 734 |
% rule thickness. We should use |\fontdimen53| and |\fontdimen55| |
| 735 |
% for the vertical gap and the extra space, respectively, |
| 736 |
% but XeTeX seems to have made a mistake here (see \href{^^A |
| 737 |
% https://tex.stackexchange.com/q/468496}{the discussion} on StackExchange). |
| 738 |
% So, for the vertical gap, we fallback to three times the rule thickness. |
| 739 |
% For the extra space, we fallback to the rule thickness. |
| 740 |
% \begin{macrocode} |
| 741 |
\gdef\acta@overbarkern@fontdimen{54}% XeTeX mistake? Use 55? |
| 742 |
\gdef\acta@overbarkern@family{\tw@}% |
| 743 |
\gdef\acta@overbarrule@fontdimen{54}% |
| 744 |
\gdef\acta@overbarrule@family{\tw@}% |
| 745 |
\gdef\acta@overbarvgap@fontdimen{54}% XeTeX mistake? Use 53? |
| 746 |
\gdef\acta@overbarvgap@family{\tw@}% |
| 747 |
\fi |
| 748 |
}{}% |
| 749 |
} |
| 750 |
% \end{macrocode} |
| 751 |
% \end{macro} |
| 752 |
% |
| 753 |
%\iffalse |
| 754 |
%</package> |
| 755 |
%\fi |
| 756 |
% |
| 757 |
% \Finale |
| 758 |
% \obeyspaces |
| 759 |
% \typeout{*************************************************************} |
| 760 |
% \typeout{* *} |
| 761 |
% \typeout{* To finish the installation you have to move the following *} |
| 762 |
% \typeout{* file into a directory searched by TeX: *} |
| 763 |
% \typeout{* *} |
| 764 |
% \typeout{* actuarialangle.sty *} |
| 765 |
% \typeout{* *} |
| 766 |
% \typeout{* To produce the documentation, run actuarialangle.dtx *} |
| 767 |
% \typeout{* through LaTeX. *} |
| 768 |
% \typeout{* *} |
| 769 |
% \typeout{* Happy actuarial TeXing! *} |
| 770 |
% \typeout{* *} |
| 771 |
% \typeout{*************************************************************} |
| 772 |
% |
| 773 |
% ^^A Local Variables: |
| 774 |
% ^^A mode: doctex |
| 775 |
% ^^A TeX-master: t |
| 776 |
% ^^A End: |
| 777 |
\endinput |