7

How do I typeset annuity and life-insurance symbols, actuarial notation in ConTeXt. I see there are packages available but not for ConTeXt.

enter image description here

Thanks

jub0bs
  • 58,916
  • 1
    It would be nice to have an example of how they look like. I don't know those symbols. – Marco Oct 22 '13 at 10:51
  • From what I recall having seen some of the actuarial study material, there's nothing that can't be done using standard maths notation. I think you'll need left sub- and superscripts, and some accents not normally used (\urcorner as an accent on a subscript) – Chris H Oct 22 '13 at 10:58
  • for examples, see http://www.actuaries.org.uk/research-and-resources/documents/formulae-and-tables-actuarial-exams-1st-edition try starting at p33. – Chris H Oct 22 '13 at 11:00
  • In the source code of the Wikipedia page on actuarial notation, the symbol is typeset as follows: a_{\overline{n|}i}. – jub0bs Oct 22 '13 at 12:03
  • 1
    although unicode recognizes the "actuarial bend" as a character, I doubt it can be easily produced as a single symbol in a font. it certainly isn't acceptably represented by the upper right "quine corner" (\urcorner). – barbara beeton Oct 22 '13 at 12:15
  • @Jubobs a_{\overline{n|}i} will have to do for the time being, will look for a prettier solution and post back, or finally just make the move to latex ... – YoungGrandpa Oct 22 '13 at 13:02
  • @barbarabeeton \urcorner might not be ideal, but it's the best I can find, certainly better than the broken version provided in other comments. – Chris H Oct 22 '13 at 13:38
  • \urcorner can never be acceptable for more than one letter at a time. i don't have a tex system available to experiment, and won't for several weeks, but i will mark this question for a look when i return home, and if no other good answer has appeared by then, i will try to devise one in plain tex terms. (i don't use context.) – barbara beeton Oct 22 '13 at 16:22
  • @barbarabeeton: The symbol is present in stix fonts! Do you have any suggestion for the tex name for this symbol and its math class? I can add the corresponding definition to ConTeXt. – Aditya Oct 22 '13 at 22:08
  • @barbarabeeton my hazy second hand recollection is that a single symbol is used under the corner, but if I'm wrong, of course it won't work, and of course it's always better to handle the general case. – Chris H Oct 23 '13 at 07:25

3 Answers3

7

This is Plain TeX, but I guess it can do for ConTeXt. Experts can improve it.

\def\actuarial#1{%
  \vbox{
    \offinterlineskip
    \tabskip=0pt
    \mathsurround=0pt
    \halign{##&\vrule##\cr
      \noalign{\hrule}%
      &height 1pt\cr
      $\scriptstyle#1$&\cr
    }%
  }%
}

$a_{\actuarial{n}}$

\bye

enter image description here

egreg
  • 1,121,712
  • I normally avoid using an explicit \subscriptstyle. It may be better to use \mathpallet to get automatic scaling of the argument. – Aditya Oct 22 '13 at 23:46
  • @Aditya I don't know whether ConTeXt has \mathpalette. ;-). However I don't think this symbol is ever used in subscripts. – egreg Oct 23 '13 at 07:18
  • ConTeXt has almost all commands defined in plain TeX, so yes it has mathpalette, although the current practice is to use setmathstyle instead (basically assume that over etc will not be used so that the math style is predictable) – Aditya Oct 23 '13 at 14:03
2

Based on Barbara Beeton's comment, you just need to pick a font that includes the actuarial bend symbol. For example, using XITS fonts you get:

% Use a math font that has the actuarial bend symbol
\usemodule[simplefonts]
\setmathfont[XITS] 

\Umathchardef\actuarial "0 "0 "20E7

\starttext

$a_{n \actuarial}$

\stoptext

enter image description here

If someone can tell what is the right mathclass and tex name for this glyph, I can send in a request to add this to char-def.lua so that it works out of the box in ConTeXt.

Aditya
  • 62,301
  • The spacing seems wrong. The horizontal bar should not touch the preceding letters. – Marco Oct 22 '13 at 22:28
  • @Marco: Tell that to the glyph designer :) (But it could also be something due to incorrect scaling in subscripts) – Aditya Oct 22 '13 at 23:43
  • The scaling of the subscripts is correct. This looks OK if a wider glyph is used. – Aditya Oct 22 '13 at 23:51
  • so the basic glyph really should be narrower, and horizontally extendable. i'll forward that comment for consideration. – barbara beeton Oct 23 '13 at 07:22
0

Here's something to get you going, you may want to tweak the raisebox dimension, and the negative spaces, and maybe the size of the \urcorner.

\documentclass{article}

\usepackage{amsmath,amssymb}
\newcommand{\bend}[1]{\smash{#1\!\!\!{\raisebox{-0.2em}{\big\urcorner}}}}
\begin{document}
This is horrible:

$a_{\overline{n|}i}$

This isn't great, but is much better:

$a_{\bend{n} i}$
\end{document}

enter image description here

No doubt someone can propose a cleaner way of doing the adjustments, I can update for comments.

Also it will need testing in ConTeXt - I don't use it, though from what I've read it should work.

Chris H
  • 8,705