summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/actuarialangle/actuarialangle.dtx
blob: 229d13d81db2b750a4ebcd3660c31e6ee705b265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
% \iffalse meta-comment
%
% Copyright (C) 2019 Vincent Goulet
%
% This file may be distributed and/or modified under the conditions
% of the LaTeX Project Public License, either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in:
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Vincent Goulet
% <vincent.goulet@act.ulaval.ca>.
%
% This work consists of the files actuarialangle.dtx and
% actuarialangle.ins and the derived files listed in the README.md
% file.
%
% \fi
%
% \iffalse
%<*dtx>
          \ProvidesFile{actuarialangle.dtx}
%</dtx>
%<package>\NeedsTeXFormat{LaTeX2e}[2009/09/24]
%<package>\ProvidesPackage{actuarialangle}[2019/06/13 v2.1 Actuarial angle]
%<*batchfile>
\begingroup
\input docstrip.tex
\keepsilent
\askforoverwritefalse

\preamble

This is a generated file.

Copyright (C) 2019 Vincent Goulet

This file may be distributed and/or modified under the conditions
of the LaTeX Project Public License, either version 1.3c of this
license or (at your option) any later version. The latest version
of this license is in:

   http://www.latex-project.org/lppl.txt

and version 1.3c or later is part of all distributions of LaTeX
version 2006/05/20 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is Vincent Goulet
<vincent.goulet@act.ulaval.ca>.

This work consists of the files actuarialangle.dtx and
actuarialangle.ins and the derived files listed in the README.md file.

\endpreamble
\generate{\file{actuarialangle.sty}{\from{actuarialangle.dtx}{package}}}
\endgroup
%</batchfile>
%<*driver>
\documentclass[11pt,x11names]{ltxdoc}
  \usepackage[utf8]{inputenc}
  \usepackage[T1]{fontenc}
  \usepackage{natbib}
  \usepackage{microtype}
  \usepackage[scaled=0.90]{helvet}
  \usepackage[scaled=1.02]{inconsolata}
  \usepackage[sc]{mathpazo}
  \usepackage{actuarialangle}
  \usepackage{framed}
  \DisableCrossrefs
  \CodelineNumbered
  \RecordChanges
  \GlossaryPrologue{\section*{Version history}%
    \addcontentsline{toc}{section}{Version history}}

  %% colors
  \usepackage{xcolor}
  \definecolor{link}{rgb}{0,0.4,0.6}   % ~dvips RoyalBlue
  \definecolor{url}{rgb}{0.6,0,0}      % dark red
  \definecolor{citation}{rgb}{0,0.5,0} % dark green
  \colorlet{shadecolor}{LightYellow1}

  %% left aligned description list
  \usepackage{enumitem}
  \setlist[description]{leftmargin=*,align=left}

  %% environment for displayed sample code; hybrid between
  %% environments snugshade* and leftbar of framed.sty
  \makeatletter
  \newenvironment{snugshadebar}{%
    \setlength{\topsep}{1pt}
    \def\FrameCommand##1{\hskip\@totalleftmargin
       \vrule width 2pt\colorbox{shadecolor}{\hspace{3pt}##1}%
      % There is no \@totalrightmargin, so:
      \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
    \MakeFramed {\advance\hsize-\width
      \@totalleftmargin\z@ \linewidth\hsize
      \advance\labelsep\fboxsep
      \@setminipage}%
  }{\par\unskip\@minipagefalse\endMakeFramed}
  \makeatother

  %% environments for demo code; 'texample' mostly lifted from
  %% documentation of amsmath
  \newenvironment{demo}{\begin{trivlist}\item}{\end{trivlist}}
  \newenvironment{texample}[1][0.5]{%
    \noindent\begin{minipage}{#1\linewidth}\begin{snugshadebar}%
      \def\producing{\end{snugshadebar}\end{minipage}\hfill\begin{minipage}{\dimexpr0.97\linewidth-#1\linewidth}%
        \hbox\bgroup\kern-.2pt%
        \vbox\bgroup\parindent0pt\relax
        % The 3pt is to cancel the -\lineskip from \displ@y
        \abovedisplayskip3pt \abovedisplayshortskip\abovedisplayskip
        \belowdisplayskip0pt \belowdisplayshortskip\belowdisplayskip
        \noindent}%
    }{%
      \par
      % Ensure that a lonely \[\] structure doesn't take up width less than
      % \hsize.
      \hrule height0pt width\hsize
      \egroup\kern-.2pt\egroup
    \end{minipage}%
    \par
  }

  %% utility macro
  \newcommand{\pkg}[1]{\textsf{#1}}

  %% hyperlinks
  \usepackage{hyperref}
  \hypersetup{colorlinks, linktocpage,
    urlcolor=url, linkcolor=link, citecolor=citation,
    bookmarksopen, bookmarksnumbered, bookmarksdepth=subsection,
    pdftitle={actuarialangle User Guide},
    pdfauthor={Vincent Goulet}}

  %% autoref labels
  \let\subsectionautorefname\sectionautorefname
  \let\subsubsectionautorefname\sectionautorefname

\begin{document}
  \DocInput{actuarialangle.dtx}
\end{document}
%</driver>
% \fi
% \CheckSum{281}
% \changes{v1.0}{2012-10-16}{Initial release.}
% \changes{v1.0a}{2017-02-01}{Various improvements to the README
%   file, including conversion to markdown format after the project was
%   moved to GitHub.}
% \changes{v2.0}{2017-04-09}{Complete new documentation.}
% \changes{v2.1}{2019-06-13}{Variable extra space, rule thickness and
%   vertical gap; contributed by Ruixi Zhang.}
%
% \GetFileInfo{actuarialangle.sty}
%
% \title{Actuarial angle symbol for life contingencies \\
%   and financial mathematics^^A
%   \thanks{This document corresponds to
%   \pkg{actuarialangle}~\fileversion, dated~\filedate.}}
% \author{Vincent Goulet\thanks{^^A
%   École d'actuariat, Université Laval.} \\
%   \url{vincent.goulet@act.ulaval.ca}}
% \maketitle
%
% \begin{abstract}
%   The package \pkg{actuarialangle} provides commands to typeset the
%   ``angle'' symbol denoting a duration $n$ in actuarial notation, as
%   in $\angln$, and an overhead angle bracket, as in $\group{xy}$.
% \end{abstract}
%
% \section{Introduction}
%
% This package defines commands to typeset two symbols used in
% actuarial notation for life contingencies and financial mathematics.
% The first is the ``angle'' denoting a duration in the present value
% of an insurance or annuity: $\angln$. The second is an overhead
% angle bracket (or ``roof'') used to emphasize joint status when
% ambiguity is possible: $\group{xy}$. The bracket is normally used
% with a precedence number above. Facilities to position such numbers
% are provided by the package \pkg{actuarialsymbol}
% \citep{actuarialsymbol}.
%
% For additional details on actuarial notation for life contingencies,
% see \citet{Bowers:2e:1997}.
%
% \section{Package options}
% \label{sec:options}
%
% The package offers the following options:
% \begin{description}
% \item[\mdseries\ttfamily thinspace] insert a thin space of 1mu
%   between the material under the angle and the right descender; this
%   is the default starting with version 2.0 of the package;
% \item[\mdseries\ttfamily thickspace] insert a thicker space of 2mu
%   between the material under the angle and the right descender; this
%   was the value used in versions of the package prior to 2.0;
% \item[\mdseries\ttfamily nobracket] do not define command
%   \cmd{\overanglebracket} and its alias \cmd{\group}; this option
%   also prevents loading of package \pkg{pict2e}.
% \end{description}
% We provide the option |nobracket| in case the bracket symbol is not
% needed and \pkg{pict2e} \citep{pict2e} interferes with other
% packages. Loading the package with
% \begin{quote}
%   |\usepackage[thickspace,nobracket]{actuarialangle}|
% \end{quote}
% yields the behaviour of versions prior to 2.0, but for the defunct
% features mentioned in \autoref{sec:defunct}.
%
% \section{Package features}
%\label{sec:features}
%
% \begin{DescribeMacro}{\actuarialangle}
%   In math mode, the command
%   \begin{quote}
%     |\actuarialangle|\marg{duration}
%   \end{quote}
%   composes an angle symbol around \meta{duration}. This is the
%   ``raw'' command that does not insert any space between
%   \meta{duration} and the right descender of the angle. The symbol
%   scales gracefully if the command is used outside of a
%   first-level subscript.
%   \begin{demo}
%     \begin{texample}
%       |\actuarialangle{n} \quad| \\
%       |a_{\actuarialangle{n}}|
%       \producing
%       $\actuarialangle{n} \quad a_{\actuarialangle{n}}$
%     \end{texample}
%   \end{demo}
% \end{DescribeMacro}
%
% \begin{DescribeMacro}{\angl}
% \begin{DescribeMacro}{\angln}
% \begin{DescribeMacro}{\anglr}
% \begin{DescribeMacro}{\anglk}
%   Users are expected to typeset angle symbols with the command
%   \begin{quote}
%     |\angl|\marg{duration}
%   \end{quote}
%   In contrast to \cmd{\actuarialangle}, this command inserts some
%   thin space (by default or with package option |thinspace|) or
%   thick space (with package option |thickspace|) between
%   \marg{duration} and the right descender.
%   \begin{demo}
%     \begin{texample}
%       |% with option thinspace:| \\
%       |\angl{n} \quad a_{\angl{n}}|
%       \producing
%       $\angl{n} \quad a_{\angl{n}}$
%     \end{texample}
%     \begin{texample}
%       |% with option thickspace:| \\
%       |\angl{n} \quad a_{\angl{n}}|
%       \producing
%       $\angl{n\mkern1mu} \quad a_{\angl{n\mkern1mu}}$
%     \end{texample}
%   \end{demo}
%   Commands \cmd{\angln}, \cmd{\anglr} and \cmd{\anglk} are shortcuts
%   for the common cases \cmd{\angl}|{n}|, \cmd{\angl}|{r}| and
%   \cmd{\angl}|{k}|, respectively.
% \end{DescribeMacro}
% \end{DescribeMacro}
% \end{DescribeMacro}
% \end{DescribeMacro}
%
% \begin{DescribeMacro}{\overanglebracket}
% \begin{DescribeMacro}{\group}
%   The command
%   \begin{quote}
%     \cmd{\overanglebracket}\marg{statuses}
%   \end{quote}
%   composes an angle bracket (``roof'') above \meta{statuses}. The
%   rule thickness and spacing relative to the statuses match those of
%   the angle symbol. The command \cmd{\group} is a convenient alias for
%   \cmd{\overanglebracket}.
%   \begin{demo}
%     \begin{texample}
%       |\group{xy} \quad| \\
%       |A_{\group{xy}:\angln}|
%       \producing
%       $\group{xy} \quad A_{\group{xy}:\angln}$
%     \end{texample}
%   \end{demo}
% \end{DescribeMacro}
% \end{DescribeMacro}
%
% \section{Defunct features}
% \label{sec:defunct}
%
% Versions prior to 2.0 of the package included the undocumented
% commands
% \begin{quote}
%   \cmd{\topprecedence} (with alias \cmd{\lift}) \\
%   \cmd{\vartopprecedence} \\
%   \cmd{\bottomprecedence} \\
%   \cmd{\varbottomprecedence}
% \end{quote}
% to typeset precedence numbers above and below statuses in subscript
% of an actuarial symbol. These features have been moved --- and
% improved on the way --- to package \pkg{actuarialsymbol}
% \citep{actuarialsymbol}.
%
% \StopEventually{
%   \begin{thebibliography}{3}
%   \bibitem[Beauchemin and Goulet(2017)]{actuarialsymbol}
%   D.~Beauchemin and V.~Goulet.
%   \newblock \emph{Actuarial symbols of life contingencies and financial
%     mathematics}, 2017.
%   \newblock URL \url{https://www.ctan.org/pkg/actuarialsymbol/}.
%
%   \bibitem[Bowers et~al.(1997)Bowers, Gerber, Hickman, Jones, and
%     Nesbitt]{Bowers:2e:1997}
%   N.~L. Bowers, H.~U. Gerber, J.~C. Hickman, D.~A. Jones, and C.~J. Nesbitt.
%   \newblock \emph{Actuarial Mathematics}.
%   \newblock Society of Actuaries, Shaumburg, IL, second edition, 1997.
%   \newblock ISBN 0-9389594-6-8.
%
%   \bibitem[Gä{\ss}lein et~al.(2016)Gä{\ss}lein, Niepraschk, and Tkadlec]{pict2e}
%   H.~Gä{\ss}lein, R.~Niepraschk, and J.~Tkadlec.
%   \newblock \emph{The pict2e package}, 2016.
%   \newblock URL \url{https://www.ctan.org/pkg/pict2e/}.
%   \end{thebibliography}
%   \PrintChanges
% }
%
% \appendix
% \section{Implementation}
% \label{sec:implementation}
%
% This appendix contains the annotated source code of the package.
% Most readers can stop reading here.
%\iffalse
%<*package>
%\fi
%
% \subsection{Package options}
% \label{sec:implementation:options}
%
% \begin{macro}{\ifacta@thinspace}
%   \changes{v2.0}{2017-04-07}{Options |thinspace| and |thickspace|
%   added to control spacing between material under the angle and
%   right descender.} %
% \begin{macro}{\ifacta@nobracket}
%   \changes{v2.0}{2017-04-09}{Added option |nobracket| to prevent
%   definition of the command to typeset the over angle bracket and
%   loading of package \pkg{pict2e}.} %
%   Two flags are defined to keep track of the spacing between the
%   material under the angle and right descender, and whether or not
%   the package should define the command \cmd{\overanglebracket} and
%   load package \pkg{pict2e}.
%    \begin{macrocode}
\newif\ifacta@thinspace \acta@thinspacetrue
\newif\ifacta@bracket   \acta@brackettrue
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareOption}
%   Declaration of the package options and processing. Defaults are
%   |thinspace| and to define the bracket.
%    \begin{macrocode}
\DeclareOption{thinspace}{\acta@thinspacetrue}
\DeclareOption{thickspace}{\acta@thinspacefalse}
\DeclareOption{nobracket}{\acta@bracketfalse}
\ProcessOptions
%    \end{macrocode}
% \end{macro}
%
% \subsection{Variable extra space, rule thickness and vertical gap}
%
% \begin{macro}{\acta@overbarkern@fontdimen}
% \begin{macro}{\acta@overbarkern@family}
% \begin{macro}{\acta@overbarrule@fontdimen}
% \begin{macro}{\acta@overbarrule@family}
% \begin{macro}{\acta@overbarvgap@fontdimen}
% \begin{macro}{\acta@overbarvgap@family}
%   \changes{v2.1}{2019-01-11}{Define fontdimen and family parameters.}
%   We first deal with Type~1 math fonts. We define the |\fontdimen|'s
%   and families used for the thickness of the |\overline| rule and the
%   amount of vertical gap between the rule and the content, as well as
%   the extra white space above the rule.
%    \begin{macrocode}
\def\acta@overbarkern@fontdimen{8}
\def\acta@overbarkern@family{\thr@@}
\def\acta@overbarrule@fontdimen{8}
\def\acta@overbarrule@family{\thr@@}
\def\acta@overbarvgap@fontdimen{8}
\def\acta@overbarvgap@family{\thr@@}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\acta@overbarkern}
%   \changes{v2.1}{2019-01-11}{Define usable extra space.}
%   We want a macro to take a math style, e.g., |\displaystyle|, and then
%   to expand into |\fontdimen8\textfont3| (for Type~1 fonts). This will
%   serve as the extra space. The name ``overbarkern'' comes from the
%   corresponding LuaTeX primitive and OpenType Math table entry.
%    \begin{macrocode}
\def\acta@overbarkern#1{%
  \fontdimen\acta@overbarkern@fontdimen
  \ifx#1\displaystyle
    \textfont
  \else
    \ifx#1\textstyle
      \textfont
    \else
      \ifx#1\scriptstyle
        \scriptfont
      \else
        \scriptscriptfont
      \fi
    \fi
  \fi
  \acta@overbarkern@family
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\acta@overbarrule}
%   \changes{v2.1}{2019-01-06}{Define usable rule thickness.}
%   The |\acta@overbarrule| macro is similar. This will
%   serve as the rule thickness. The name ``overbarrule'' comes from the
%   corresponding LuaTeX primitive and OpenType Math table entry.
%    \begin{macrocode}
\def\acta@overbarrule#1{%
  \fontdimen\acta@overbarrule@fontdimen
  \ifx#1\displaystyle
    \textfont
  \else
    \ifx#1\textstyle
      \textfont
    \else
      \ifx#1\scriptstyle
        \scriptfont
      \else
        \scriptscriptfont
      \fi
    \fi
  \fi
  \acta@overbarrule@family
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\acta@overbarvgap}
%   \changes{v2.1}{2019-01-06}{Define usable vertical gap.}
%   The |\acta@overbarvgap| macro is similar. When |\acta@overbarrule@fontdimen|
%   and |\acta@overbarvgap@fontdimen| coincide, we use three times the
%   rule thickness as the vertical gap; otherwise we use the different
%   |\fontdimen| specified by the latter.
%    \begin{macrocode}
\def\acta@overbarvgap#1{%
  \ifx\acta@overbarrule@fontdimen\acta@overbarvgap@fontdimen
    \thr@@
  \fi
  \fontdimen\acta@overbarvgap@fontdimen
  \ifx#1\displaystyle
    \textfont
  \else
    \ifx#1\textstyle
      \textfont
    \else
      \ifx#1\scriptstyle
        \scriptfont
      \else
        \scriptscriptfont
      \fi
    \fi
  \fi
  \acta@overbarvgap@family
}
%    \end{macrocode}
% \end{macro}
%
% \subsection{Actuarial angle}
% \label{sec:implementation:actuarialangle}
%
% The code for \cmd{\actuarialangle}, |\acta@angle|,
% \cs{angl} and the underlying macros were given to the present
% author by a colleague many years ago. The original author is
% unknown. Some of the comments below are his or hers.
%
% \begin{macro}{\actuarialangle}
%   We first define the ``raw'' user level command.
%    \begin{macrocode}
\DeclareRobustCommand{\actuarialangle}{\mathpalette\acta@angle}
%    \end{macrocode}
%   The operation of \cmd{\mathpalette} ensures that proper sizing the
%   command is ever used outside of a first-level subscript.
% \end{macro}
%
% \begin{macro}{\acta@angle}
%   Next we define the real workhorse.
%    \begin{macrocode}
\def\acta@angle#1#2{%
  \mathord{%
%    \end{macrocode}
%   Add a bit of preceding space.
%   \changes{v2.1}{2019-01-02}{Added missing \texttt\%.}
%    \begin{macrocode}
    \mkern1mu%
%    \end{macrocode}
%   We need many nested boxes here: first a vbox to stack the horizontal
%   rule (with some extra space on top) of the angle and the symbol;
%   second an hbox to position the symbol
%   and the right descender of the angle side-to-side; third a vbox to
%   insert spacing between the horizontal rule and the symbol.
%   \changes{v2.1}{2019-01-11}{Variable extra space.}
%   \changes{v2.1}{2019-01-06}{Variable thickness.}
%    \begin{macrocode}
    \vbox{%
      \kern\acta@overbarkern#1%
      \hrule \@height\acta@overbarrule#1%
      \hbox{%
        \vbox{%
%    \end{macrocode}
%   The amount of vertical gap is the normal space for |\overline|.
%   \changes{v2.1}{2019-01-06}{Variable gap.}
%   \changes{v2.1}{2019-01-02}{Moved \cmd{\m@th} in front.}
%    \begin{macrocode}
          \kern\acta@overbarvgap#1%
          \hbox{$\m@th#1#2$}%
        }%
%    \end{macrocode}
%   Make the right-hand rule extending down to the depth of a parenthesis
%   even if the symbol under the angle does not have a descender.
%   \changes{v2.1}{2019-01-06}{Use \cmd{\mathstrut}.}
%   \changes{v2.1}{2019-01-06}{Variable thickness.}
%    \begin{macrocode}
        \setbox\z@\hbox{$#1\mathstrut$}%
        \vrule \@width\acta@overbarrule#1\@depth\dp\z@
      }%
    }%
%    \end{macrocode}
%   Finishing touch is a bit of following space.
%    \begin{macrocode}
    \mkern1mu%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\angl}
% \begin{macro}{\angln}
% \begin{macro}{\anglr}
% \begin{macro}{\anglk}
%   \changes{v2.0}{2017-04-07}{Added an \cmd{\anglk} shortcut.} %
%   Finally, we define the main user level function \cmd{\angl} and
%   shortcuts for common cases.
%   \changes{v2.1}{2019-01-02}{Use \cmd{\newcommand*} instead of \cmd{\def}.}
%   \changes{v2.1}{2019-01-02}{No need for extra braces around \texttt{\#1}.}
%    \begin{macrocode}
\ifacta@thinspace
  \newcommand*\angl[1]{{\actuarialangle{#1\mkern1mu}}}
\else
  \newcommand*\angl[1]{{\actuarialangle{#1\mkern2mu}}}
\fi
\newcommand*\angln{{\angl n}}
\newcommand*\anglr{{\angl r}}
\newcommand*\anglk{{\angl k}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsection{Over angle bracket}
% \label{sec:implementation:overanglebracket}
%
% The code of this section is executed only if |\acta@bracket| is
% |true|, that is when the package is \emph{not} loaded with option
% |nobracket|.
%    \begin{macrocode}
\ifacta@bracket
%    \end{macrocode}
% Drawing the angle bracket requires package \pkg{pict2e}
% \citep{pict2e} to get arbitrary slopes and neat line joins in paths.
%    \begin{macrocode}
  \RequirePackage{pict2e}
%    \end{macrocode}
%
% \begin{macro}{\overanglebracket}
%   \changes{v2.0}{2017-04-08}{Command \cmd{\overanglebracket} added to
%   typeset an angle bracket (``roof'') above statuses.} %
%   Here is the user level command.
%    \begin{macrocode}
  \DeclareRobustCommand{\overanglebracket}{%
    \mathpalette\acta@anglebracket}
%    \end{macrocode}
%   We use \cmd{\mathpalette} as above.
% \end{macro}
%
% \begin{macro}{\acta@anglebracket}
%   The workhorse is |\acta@anglebracket|. It builds the bracket
%   symbol with path lines.
%    \begin{macrocode}
  \def\acta@anglebracket#1#2{%
%    \end{macrocode}
%   \changes{v2.1}{2019-01-06}{Improved construction.}
%   We construct the whole symbol in the same style as |\acta@angle|,
%   i.e., a bit of preceding and following space, to prevent clashing
%   into the trailing colon.
%    \begin{macrocode}
    \mathord{%
      \mkern1mu%
%    \end{macrocode}
%   \changes{v2.1}{2019-01-06}{Variable thickness.}
%   We setup the rule thickness here.
%    \begin{macrocode}
      \linethickness{\acta@overbarrule#1}%
%    \end{macrocode}
%   Box zero contains the material under the bracket. The width of this
%   box will determine the width of the flat part of the bracket and the
%   height, the length of the descenders of the bracket.
%   Hence we store these values.
%   \changes{v2.1}{2019-01-02}{Added missing \texttt\%.}
%   \changes{v2.1}{2019-01-02}{Use local dimen registers.}
%    \begin{macrocode}
      \setbox\z@\hbox{$\m@th#1#2$}%
      \dimen\z@\wd\z@ \dimen\tw@\ht\z@
%    \end{macrocode}
%   Box two contains the bracket itself. It is drawn in three parts
%   stitched together; the first and third parts are expressed in a
%   dimension relative to |\dimen2| whereas the central part is
%   expressed relative to |\dimen0|.
%   \changes{v2.1}{2019-01-02}{Added missing \texttt\%.}
%    \begin{macrocode}
      \setbox\tw@\hbox{%
        \unitlength\dimen\tw@
        \begin{picture}(0.4,0)
          \polyline(0.4001,0)(0.4,0)(0,-0.8)
        \end{picture}%
        \unitlength\dimen\z@
        \begin{picture}(1,0)
          \put(0,0){\line(1,0){1}}
        \end{picture}%
        \unitlength\dimen\tw@
        \begin{picture}(0.4,0)
          \polyline(-0.0001,0)(0,0)(0.4,-0.8)
        \end{picture}%
      }%
%    \end{macrocode}
%   We store the total width of the whole bracket to center the
%   material under it, as follows.
%    \begin{macrocode}
      \dimen@\wd\tw@
%    \end{macrocode}
%   The box containing the whole symbol. The lineskip between the bracket
%   and the statuses is the same as in |\acta@angle|, plus half the
%   rule thickness |\@halfwidth|.
%   \changes{v2.1}{2019-01-06}{Variable gap.}
%    \begin{macrocode}
      \vbox{%
        \baselineskip\z@
        \lineskip\acta@overbarvgap#1%
        \advance\lineskip\@halfwidth
        \lineskiplimit\lineskip
%    \end{macrocode}
%   \changes{v2.1}{2019-01-11}{Variable extra space.}
%   The extra space is the same as in |\acta@angle|, plus half the
%   rule thickness |\@halfwidth|.
%    \begin{macrocode}
        \kern\acta@overbarkern#1%
        \kern\@halfwidth
        \box\tw@
        \hbox to\dimen@{\hss\unhbox\z@\hss}%
      }%
%    \end{macrocode}
%   Finish with a bit of following space.
%    \begin{macrocode}
      \mkern1mu%
    }%
  }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\group}
%   Alias for \cmd{\overanglebracket}.
%    \begin{macrocode}
  \let\group\overanglebracket
\fi
%    \end{macrocode}
% \end{macro}
%
% \subsection{Compatibility with \pkg{unicode-math} and OpenType math fonts}
%
% \begin{macro}{\AtBeginDocument}
%   \changes{v2.1}{2019-01-06}{Compatibility with \pkg{unicode-math}.}
%   The \pkg{unicode-math} package is to be loaded \emph{after} other math
%   setup packages, e.g., \pkg{amsmath} and \pkg{mathtools}. This usually
%   implies that \pkg{unicode-math} is loaded after \pkg{actuarialangle}.
%   So we delay the adjustments for \pkg{unicode-math}.
%    \begin{macrocode}
\AtBeginDocument{%
  \@ifpackageloaded{unicode-math}{%
%    \end{macrocode}
%   When the \pkg{unicode-math} package is loaded, OpenType math font will
%   be used and the compile engine must be either LuaTeX or XeTeX. We test
%   against the XeTeX primitive |\XeTeXcharclass| to find out which engine
%   is used.
%    \begin{macrocode}
    \ifx\XeTeXcharclass\@undefined
%    \end{macrocode}
%   In this case the engine is LuaTeX. We redefine |\acta@overbarkern|,
%   |\acta@overbarrule| and |\acta@overbarvgap| to be the LuaTeX primitives
%   |\Umathoverbarkern|, |\Umathoverbarrule| and |\Umathoverbarvgap|,
%   respectively. We also undefine the fontdimen and family parameters.
%    \begin{macrocode}
      \global\let\acta@overbarkern\Umathoverbarkern
      \global\let\acta@overbarrule\Umathoverbarrule
      \global\let\acta@overbarvgap\Umathoverbarvgap
      \global\let\acta@overbarkern@fontdimen\@undefined
      \global\let\acta@overbarkern@family\@undefined
      \global\let\acta@overbarrule@fontdimen\@undefined
      \global\let\acta@overbarrule@family\@undefined
      \global\let\acta@overbarvgap@fontdimen\@undefined
      \global\let\acta@overbarvgap@family\@undefined
    \else
%    \end{macrocode}
%   Otherwise the engine is XeTeX. We use |\fontdimen54\<X>font2| for the
%   rule thickness. We should use |\fontdimen53| and |\fontdimen55|
%   for the vertical gap and the extra space, respectively,
%   but XeTeX seems to have made a mistake here (see \href{^^A
%   https://tex.stackexchange.com/q/468496}{the discussion} on StackExchange).
%   So, for the vertical gap, we fallback to three times the rule thickness.
%   For the extra space, we fallback to the rule thickness.
%    \begin{macrocode}
      \gdef\acta@overbarkern@fontdimen{54}% XeTeX mistake? Use 55?
      \gdef\acta@overbarkern@family{\tw@}%
      \gdef\acta@overbarrule@fontdimen{54}%
      \gdef\acta@overbarrule@family{\tw@}%
      \gdef\acta@overbarvgap@fontdimen{54}% XeTeX mistake? Use 53?
      \gdef\acta@overbarvgap@family{\tw@}%
    \fi
  }{}%
}
%    \end{macrocode}
% \end{macro}
%
%\iffalse
%</package>
%\fi
%
% \Finale
% \obeyspaces
% \typeout{*************************************************************}
% \typeout{*                                                           *}
% \typeout{* To finish the installation you have to move the following *}
% \typeout{* file into a directory searched by TeX:                    *}
% \typeout{*                                                           *}
% \typeout{*  actuarialangle.sty                                       *}
% \typeout{*                                                           *}
% \typeout{* To produce the documentation, run actuarialangle.dtx      *}
% \typeout{* through LaTeX.                                            *}
% \typeout{*                                                           *}
% \typeout{* Happy actuarial TeXing!                                   *}
% \typeout{*                                                           *}
% \typeout{*************************************************************}
%
% ^^A Local Variables:
% ^^A mode: doctex
% ^^A TeX-master: t
% ^^A End:
\endinput