350 Tugboat, Volume 38 (2017), No. 3 Typesetting Actuarial Symbols Easily and Consistently with Actuarialsymbol and Actuarialang
Total Page:16
File Type:pdf, Size:1020Kb
350 TUGboat, Volume 38 (2017), No. 3 Typesetting actuarial symbols easily and consistently with actuarialsymbol and actuarialangle David Beauchemin and Vincent Goulet Abstract Actuarial notation is characterized by subscripts and Figure 1: \Actuariat" (French for Actuarial Science) written using actuarial symbols on the 1972 graduating superscripts on both sides of a principal symbol, num- class mosaic at Universit´eLaval bers positioned above or below subscripts, and some otherwise unusual symbols. The pair of packages actuarialsymbol and actuarialangle provides all sons but imported by the latter, provides the angle the facilities to compose actuarial symbols of life and overhead angle bracket symbols. contingencies and financial mathematics, easily and consistently. 2 Existing alternatives Authors often use ad hoc constructions like 1 Introduction {}_tA_x to put subscripts and superscripts in front of a sym- Actuaries, the \engineers of insurance", denote var- bol. This notation quickly becomes a nightmare to ious quantities of life contingencies using a whole parse mentally and the source code has little relation- array of symbols. The highly descriptive, yet com- ship to the actual significance of the symbol. That pact, notation was standardized as far back as in said, the worst practical drawback to this approach 1898 [10]. Figure 1 shows a creative use of the no- is probably that there is no way to ensure that sub- tation by the graduating class of 1972 in Actuarial scripts and superscripts on either side of the principal Science at Universit´eLaval. symbol are aligned vertically. As most readers of TUGboat are probably unfa- The package mathtools [5] provides a command miliar with actuarial notation, let us start with the \prescript to put a subscript or superscript to the following examples: left of an argument. This works well when the argu- 1. the net single premium for an n-year term insur- ment (or principal symbol) has sub- and superscripts ance payable at the end of year of death issued on all four corners, but otherwise the auxiliary sym- 1 to a person aged x is Ax:n ; bols may end up at different heights. 2. the monthly premium for an annual life annuity Finally, various packages tailored for specific payable at the beginning of the year, starting n disciplines offer the possibility to position sub- and (12) years from now is P (nja¨x ); superscripts on the left, for example tensor [7] for 3. the net reserve at time t for a whole life insurance tensors or mhchem [4] for isotopes. There was a previ- A payable at death is tV¯ (A¯x ). ous attempt at a LTEX package for actuarial notation All symbols are for nominal benefits of 1. [9], but lifecon does not seem to be officially dis- Actuarial notation is characterized by auxiliary tributed, either from CTAN or from anywhere else. symbols positioned in subscript and superscript on 3 Actuarial notation both sides of a principal symbol, something notori- Appendix 4 of [2] offers an excellent overview of the ously difficult to achieve consistently in LATEX. It also requires some unusual symbols not found in standard composition rules for symbols of actuarial functions. mathematics packages, like the \angle" denoting a In a nutshell, a principal symbol, say S, is combined duration n, as in n , or the overhead angle bracket with auxiliary symbols positioned in subscript or in xy used to emphasize the joint status of lives x and superscript, to the left or to the right. Schematically, y when ambiguity is possible. we thus have: II IV The package actuarialsymbol [1] provides a S (1) generic command to position all subscripts and su- I III perscripts easily and consistently around a princi- The principal symbol is in general a single letter. pal symbol, four commands to position precedence The letter may be \accented" with a bar (A¯), double numbers above and below statuses, and a number of dots (a¨) or a circle (˚e). Most commonly, there are shortcuts to ease entry of the most common actuarial alphanumeric statuses in the lower-right position functions of financial mathematics and life contingen- III . Numerals can be placed above or below the cies. The companion package actuarialangle [3], individual statuses to show the order of failure; we separate from actuarialsymbol for historical rea- will refer to these numerals as precedence numbers. David Beauchemin and Vincent Goulet TUGboat, Volume 38 (2017), No. 3 351 Otherwise, auxiliary symbols appear lower-left I , huri is the upper right superscript IV . The princi- upper-left II and upper-right IV , in that order of pal symbol and the right subscript are required, the frequency. other arguments are optional. Symbols for benefit premiums (P ), reserves (V ) \actsymb{A}{x} Ax and amount of reduced paid-up insurance (W ), are \actsymb[n]{A}{x} nAx combined with benefit symbols unless the benefit is a 2 \actsymb[n][2]{A}{x} nAx level unit insurance payable at the end of the year of \actsymb[n][2]{A}{x}[(m)] 2A(m) death. In such cases, we have the following symbol n x structure (replace P by V or W as needed): The command \actsymb supports one more op- tional argument, for composing symbols for premi- II IV P S (2) ums, reserves and paid-up insurance. The extended I III command 4 Additional special symbols \actsymb[hlli][huli][hPi]{hsymboli}{hlri}[huri] puts the symbol hPi outside the parentheses in the The package actuarialangle defines commands to draw two special symbols used in actuarial and fi- schematic representation (2). nancial notation. In math mode, the command \actsymb[][][P]{\bar{A}}{x:\angln} P (A¯x:n ) \angl{hdurationi} \actsymb[k][][V]{\bar{A}}{x}[\{1\}] f1g ¯ kV (Ax) ¯ ¯ composes an angle symbol around hdurationi with \actsymb[k][][\bar{W}]{\bar{A}}{x} kW (Ax) some space (thin by default) between hdurationi and Composing actuarial symbols from scratch using the right descender. The symbol scales gracefully if \actsymb can easily get quite involved. For this the command is used outside of a first-level subscript. reason, the package defines a large number of shortcut \angl{n} \quad a_{\angl{n}} n an macros to ease entry of the most common symbols. Table 1 offers a glimpse of the available shortcuts; Commands \angln, \anglr and \anglk are short- the package documentation has the complete list. cuts for the common cases \angl{n}, \angl{r} and The definition of \actsymb is heavily inspired \angl{k}, respectively. by the code of \prescript from package mathtools The code for \angl and the underlying macro which, as reported by the author, is itself based on a were given to the second author by a colleague many posting to comp.text.tex by Michael J. Downes. years ago. The original author is unknown. The command 6 Positioning of subscripts \overanglebracket{hstatusesi} TEX adjusts the position of a subscript downward composes an angle bracket (\roof") above hstatusesi. when a superscript is present: 2 The rule thickness and spacing relative to the statuses Ax Ax: match those of the angle symbol. The command Command \actsymb maintains this behavior, some- \group is a convenient alias for \overanglebracket. thing we believe to be a desirable feature. Therefore, entering the symbols above using the standard op- \group{xy} \quad xy A A_{\group{xy}:\angln} xy :n erators ^ and _ or with \actsymb yields the same result. 5 Construction of actuarial symbols 2 A_x \quad A_x^2 Ax Ax The package actuarialsymbol provides the generic \actsymb{A}{x} \quad 2 Ax A command \actsymb to typeset a principal symbol \actsymb{A}{x}[2] x with surrounding subscripts and superscripts. Its Furthermore, the command ensures that the left and syntax is somewhat unusual for LATEX, but it serves right subscripts, when both present, are at the same well the natural order of the building blocks of a level, something common ad hoc constructions do symbol and their relative prevalence: not provide. \actsymb[hlli][huli]{hsymboli}{hlri}[huri] 2 {}_tA_x \quad {}_tA_x^2 tAx tAx Above, hlli identifies the auxiliary symbol in the \actsymb[t]{A}{x} \quad 2 tAx A lower left subscript position I (following the nota- \actsymb[t]{A}{x}[2] t x tion in the schematic representation (1)); huli is the Authors who would prefer a uniform subscript upper left superscript II ; hsymboli is the principal position throughout their document can load the pack- symbol S; hlri is the lower right subscript III ; and age subdepth [8]. Typesetting actuarial symbols easily and consistently with actuarialsymbol and actuarialangle 352 TUGboat, Volume 38 (2017), No. 3 Table 1: Sample of shortcuts for life table, insurance and annuity symbols. All commands accept the optional arguments hlli, huli and huri of \actsymb. Definition Example Output \lxfhageig \lx{x} `x \dxfhageig \dx[n]{x} ndx \pxfhageig \px[t]{x} tpx \qxfhageig \qx[t]{x} tqx \eringxfhlrig \eringx{x:\angln} ˚ex:n \Axfhlrig \Ax{x:\angln} Ax:n \Ax*fhlrig \Ax*{x:\angln} A¯x:n \Exfhlrig \Ex[n]{x} nEx \axfhlrig \ax{x:\angln} ax:n \ax*fhlrig \ax*{x:\angln} a¯x:n \ax**fhlrig \ax**{x:\angln} a¨x:n \aringxfhlrig \aringx{x:\angln} ˚ax:n 7 Precedence numbers For such rare circumstances, we left to the user to Precedence numbers appear above or below individ- insert a strut in the subscript to push it downward ual statuses in the right subscript III of a symbol. as needed. The commands \actsymb{A}{\rule{0pt}{2.3ex}% (m) A1 \nthtop[hlengthi]{hnumberi}{hstatusi} \nthtop{1}{x}:\angln}[(m)] x:n \nthbottom[hlengthi]{hnumberi}{hstatusi} put a precedence hnumberi above (resp. below) a This remark also applies to bottom precedence num- hstatusi, smashed so that the apparent height of the bers in inline formulas or multiline equations.