0% found this document useful (0 votes)
17K views

Actuarial Angle Symbol For Life Contingencies and Financial Mathematics

This document describes a LaTeX package called "actuarialangle" that provides commands for typesetting symbols used in actuarial notation. It defines commands for an "angle" symbol denoting a duration (n) and an overhead angle bracket used to denote joint status (xy). It offers options for thin or thick spacing between the symbol and contents. The package implements these symbols and handles font sizes. Earlier features moved to another package are noted.

Uploaded by

Vicente Jorge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17K views

Actuarial Angle Symbol For Life Contingencies and Financial Mathematics

This document describes a LaTeX package called "actuarialangle" that provides commands for typesetting symbols used in actuarial notation. It defines commands for an "angle" symbol denoting a duration (n) and an overhead angle bracket used to denote joint status (xy). It offers options for thin or thick spacing between the symbol and contents. The package implements these symbols and handles font sizes. Earlier features moved to another package are noted.

Uploaded by

Vicente Jorge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Actuarial angle symbol for life contingencies

and financial mathematics∗


Vincent Goulet†
[email protected]
June 13, 2019

Abstract
The package actuarialangle provides commands to typeset the
“angle” symbol denoting a duration n in actuarial notation, as in n ,
and an overhead angle bracket, as in xy .

1 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: n . The second is an overhead angle bracket (or “roof”) used
to emphasize joint status when ambiguity is possible: xy . The bracket
is normally used with a precedence number above. Facilities to position
such numbers are provided by the package actuarialsymbol (Beauchemin
and Goulet, 2017).
For additional details on actuarial notation for life contingencies, see
Bowers et al. (1997).

2 Package options
The package offers the following options:
∗ This document corresponds to actuarialangle v2.1, dated 2019/06/13.
† École d’actuariat, Université Laval.

1
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;

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;

nobracket do not define command \overanglebracket and its alias


\group; this option also prevents loading of package pict2e.

We provide the option nobracket in case the bracket symbol is not needed
and pict2e (Gäßlein et al., 2016) interferes with other packages. Loading
the package with

\usepackage[thickspace,nobracket]{actuarialangle}

yields the behaviour of versions prior to 2.0, but for the defunct features
mentioned in section 4.

3 Package features
\actuarialangle In math mode, the command

\actuarialangle{hdurationi}

composes an angle symbol around hdurationi. This is the “raw” command


that does not insert any space between hdurationi and the right descender
of the angle. The symbol scales gracefully if the command is used outside
of a first-level subscript.

\actuarialangle{n} \quad
n an
a_{\actuarialangle{n}}

\angl Users are expected to typeset angle symbols with the command
\angln
\anglr \angl{hdurationi}
\anglk In contrast to \actuarialangle, this command inserts some thin space (by
default or with package option thinspace) or thick space (with package
option thickspace) between {hdurationi} and the right descender.

2
% with option thinspace:
n an
\angl{n} \quad a_{\angl{n}}
% with option thickspace:
n an
\angl{n} \quad a_{\angl{n}}
Commands \angln, \anglr and \anglk are shortcuts for the common
cases \angl{n}, \angl{r} and \angl{k}, respectively.
\overanglebracket The command
\group
\overanglebracket{hstatusesi}
composes an angle bracket (“roof”) above hstatusesi. The rule thickness
and spacing relative to the statuses match those of the angle symbol. The
command \group is a convenient alias for \overanglebracket.
\group{xy} \quad
xy A xy :n
A_{\group{xy}:\angln}

4 Defunct features
Versions prior to 2.0 of the package included the undocumented com-
mands
\topprecedence (with alias \lift)
\vartopprecedence
\bottomprecedence
\varbottomprecedence
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 actuarialsymbol (Beauchemin and Goulet, 2017).

A Implementation
This appendix contains the annotated source code of the package. Most
readers can stop reading here.

A.1 Package options


\ifacta@thinspace Two flags are defined to keep track of the spacing between the material
\ifacta@nobracket under the angle and right descender, and whether or not the package
should define the command \overanglebracket and load package pict2e.

3
1 \newif\ifacta@thinspace \acta@thinspacetrue
2 \newif\ifacta@bracket \acta@brackettrue

\DeclareOption Declaration of the package options and processing. Defaults are thinspace
and to define the bracket.
3 \DeclareOption{thinspace}{\acta@thinspacetrue}
4 \DeclareOption{thickspace}{\acta@thinspacefalse}
5 \DeclareOption{nobracket}{\acta@bracketfalse}
6 \ProcessOptions

A.2 Variable extra space, rule thickness and vertical gap


\acta@overbarkern@fontdimen We first deal with Type 1 math fonts. We define the \fontdimen’s and
\acta@overbarkern@family families used for the thickness of the \overline rule and the amount of
\acta@overbarrule@fontdimen vertical gap between the rule and the content, as well as the extra white
\acta@overbarrule@family space above the rule.
\acta@overbarvgap@fontdimen 7 \def\acta@overbarkern@fontdimen{8}
\acta@overbarvgap@family 8 \def\acta@overbarkern@family{\thr@@}
9 \def\acta@overbarrule@fontdimen{8}
10 \def\acta@overbarrule@family{\thr@@}
11 \def\acta@overbarvgap@fontdimen{8}
12 \def\acta@overbarvgap@family{\thr@@}

\acta@overbarkern 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.
13 \def\acta@overbarkern#1{%
14 \fontdimen\acta@overbarkern@fontdimen
15 \ifx#1\displaystyle
16 \textfont
17 \else
18 \ifx#1\textstyle
19 \textfont
20 \else
21 \ifx#1\scriptstyle
22 \scriptfont
23 \else
24 \scriptscriptfont
25 \fi
26 \fi
27 \fi
28 \acta@overbarkern@family

4
29 }

\acta@overbarrule 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.
30 \def\acta@overbarrule#1{%
31 \fontdimen\acta@overbarrule@fontdimen
32 \ifx#1\displaystyle
33 \textfont
34 \else
35 \ifx#1\textstyle
36 \textfont
37 \else
38 \ifx#1\scriptstyle
39 \scriptfont
40 \else
41 \scriptscriptfont
42 \fi
43 \fi
44 \fi
45 \acta@overbarrule@family
46 }

\acta@overbarvgap 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.
47 \def\acta@overbarvgap#1{%
48 \ifx\acta@overbarrule@fontdimen\acta@overbarvgap@fontdimen
49 \thr@@
50 \fi
51 \fontdimen\acta@overbarvgap@fontdimen
52 \ifx#1\displaystyle
53 \textfont
54 \else
55 \ifx#1\textstyle
56 \textfont
57 \else
58 \ifx#1\scriptstyle
59 \scriptfont
60 \else
61 \scriptscriptfont
62 \fi
63 \fi

5
64 \fi
65 \acta@overbarvgap@family
66 }

A.3 Actuarial angle


The code for \actuarialangle, \acta@angle, \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.

\actuarialangle We first define the “raw” user level command.


67 \DeclareRobustCommand{\actuarialangle}{\mathpalette\acta@angle}

The operation of \mathpalette ensures that proper sizing the command


is ever used outside of a first-level subscript.

\acta@angle Next we define the real workhorse.


68 \def\acta@angle#1#2{%
69 \mathord{%
Add a bit of preceding space.
70 \mkern1mu%
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.
71 \vbox{%
72 \kern\acta@overbarkern#1%
73 \hrule \@height\acta@overbarrule#1%
74 \hbox{%
75 \vbox{%
The amount of vertical gap is the normal space for \overline.
76 \kern\acta@overbarvgap#1%
77 \hbox{$\m@th#1#2$}%
78 }%
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.
79 \setbox\z@\hbox{$#1\mathstrut$}%
80 \vrule \@width\acta@overbarrule#1\@depth\dp\z@
81 }%
82 }%

6
Finishing touch is a bit of following space.
83 \mkern1mu%
84 }%
85 }

\angl Finally, we define the main user level function \angl and shortcuts for
\angln common cases.
\anglr 86 \ifacta@thinspace
\anglk 87 \newcommand*\angl[1]{{\actuarialangle{#1\mkern1mu}}}
88 \else
89 \newcommand*\angl[1]{{\actuarialangle{#1\mkern2mu}}}
90 \fi
91 \newcommand*\angln{{\angl n}}
92 \newcommand*\anglr{{\angl r}}
93 \newcommand*\anglk{{\angl k}}

A.4 Over angle bracket


The code of this section is executed only if \acta@bracket is true, that is
when the package is not loaded with option nobracket.
94 \ifacta@bracket

Drawing the angle bracket requires package pict2e (Gäßlein et al., 2016) to
get arbitrary slopes and neat line joins in paths.
95 \RequirePackage{pict2e}

\overanglebracket Here is the user level command.


96 \DeclareRobustCommand{\overanglebracket}{%
97 \mathpalette\acta@anglebracket}
We use \mathpalette as above.

\acta@anglebracket The workhorse is \acta@anglebracket. It builds the bracket symbol with


path lines.
98 \def\acta@anglebracket#1#2{%
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.
99 \mathord{%
100 \mkern1mu%
We setup the rule thickness here.
101 \linethickness{\acta@overbarrule#1}%

7
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.
102 \setbox\z@\hbox{$\m@th#1#2$}%
103 \dimen\z@\wd\z@ \dimen\tw@\ht\z@
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.
104 \setbox\tw@\hbox{%
105 \unitlength\dimen\tw@
106 \begin{picture}(0.4,0)
107 \polyline(0.4001,0)(0.4,0)(0,-0.8)
108 \end{picture}%
109 \unitlength\dimen\z@
110 \begin{picture}(1,0)
111 \put(0,0){\line(1,0){1}}
112 \end{picture}%
113 \unitlength\dimen\tw@
114 \begin{picture}(0.4,0)
115 \polyline(-0.0001,0)(0,0)(0.4,-0.8)
116 \end{picture}%
117 }%
We store the total width of the whole bracket to center the material under
it, as follows.
118 \dimen@\wd\tw@
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.
119 \vbox{%
120 \baselineskip\z@
121 \lineskip\acta@overbarvgap#1%
122 \advance\lineskip\@halfwidth
123 \lineskiplimit\lineskip
The extra space is the same as in \acta@angle, plus half the rule thickness
\@halfwidth.
124 \kern\acta@overbarkern#1%
125 \kern\@halfwidth
126 \box\tw@
127 \hbox to\dimen@{\hss\unhbox\z@\hss}%
128 }%

8
Finish with a bit of following space.
129 \mkern1mu%
130 }%
131 }

\group Alias for \overanglebracket.


132 \let\group\overanglebracket
133 \fi

A.5 Compatibility with unicode-math and OpenType math fonts


\AtBeginDocument The unicode-math package is to be loaded after other math setup packages,
e.g., amsmath and mathtools. This usually implies that unicode-math is
loaded after actuarialangle. So we delay the adjustments for unicode-math.
134 \AtBeginDocument{%
135 \@ifpackageloaded{unicode-math}{%
When the 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.
136 \ifx\XeTeXcharclass\@undefined
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, respec-
tively. We also undefine the fontdimen and family parameters.
137 \global\let\acta@overbarkern\Umathoverbarkern
138 \global\let\acta@overbarrule\Umathoverbarrule
139 \global\let\acta@overbarvgap\Umathoverbarvgap
140 \global\let\acta@overbarkern@fontdimen\@undefined
141 \global\let\acta@overbarkern@family\@undefined
142 \global\let\acta@overbarrule@fontdimen\@undefined
143 \global\let\acta@overbarrule@family\@undefined
144 \global\let\acta@overbarvgap@fontdimen\@undefined
145 \global\let\acta@overbarvgap@family\@undefined
146 \else
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 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.

9
147 \gdef\acta@overbarkern@fontdimen{54}% XeTeX mistake? Use 55?
148 \gdef\acta@overbarkern@family{\tw@}%
149 \gdef\acta@overbarrule@fontdimen{54}%
150 \gdef\acta@overbarrule@family{\tw@}%
151 \gdef\acta@overbarvgap@fontdimen{54}% XeTeX mistake? Use 53?
152 \gdef\acta@overbarvgap@family{\tw@}%
153 \fi
154 }{}%
155 }

References
D. Beauchemin and V. Goulet. Actuarial symbols of life contingencies
and financial mathematics, 2017. URL https://www.ctan.org/pkg/
actuarialsymbol/.

N. L. Bowers, H. U. Gerber, J. C. Hickman, D. A. Jones, and C. J. Nesbitt.


Actuarial Mathematics. Society of Actuaries, Shaumburg, IL, second
edition, 1997. ISBN 0-9389594-6-8.

H. Gäßlein, R. Niepraschk, and J. Tkadlec. The pict2e package, 2016. URL


https://www.ctan.org/pkg/pict2e/.

Version history

v1.0 (“roof”) above statuses. . . . . 7


General: Initial release. . . . . . . 1 General: Complete new
v1.0a documentation. ......... 1
General: Various improvements v2.1
to the README file, \AtBeginDocument:
including conversion to Compatibility with
markdown format after the unicode-math. . . . . . . . . . . . . 9
project was moved to \acta@angle: Added missing %. 6
GitHub. . . . . . . . . . . . . . . . 1 Moved \m@th in front. . . . . . . 6
v2.0 Use \mathstrut. . . . . . . . . . . 6
\anglk: Added an \anglk Variable extra space. . . . . . . . 6
shortcut. . . . . . . . . . . . . . . . 7 Variable gap. . . . . . . . . . . . . 6
\overanglebracket: Command Variable thickness. . . . . . . . . 6
\overanglebracket added \acta@anglebracket: Added
to typeset an angle bracket missing %. . . . . . . . . . . . . . . 8

10
Improved construction. . . . . . 7 \acta@overbarvgap@family:
Use local dimen registers. . . . 8 Define fontdimen and family
Variable extra space. . . . . . . . 8 parameters. . . . . . . . . . . . . 4
Variable gap. . . . . . . . . . . . . 8 \anglk: No need for extra
Variable thickness. . . . . . . . . 7 braces around #1. . . . . . . . . 7
\acta@overbarkern: Define Use \newcommand* instead of
usable extra space. . . . . ... 4 \def. . . . . . . . . . . . . . . . . . 7
\acta@overbarrule: Define General: Variable extra space,
usable rule thickness. . . ... 5 rule thickness and vertical
\acta@overbarvgap: Define gap; contributed by Ruixi
usable vertical gap. . . . . ... 5 Zhang. . . . . . . . . . . . . . . . . 1

11

You might also like