How to Generate Actuarial Symbols in Latex

How to Generate Actuarial Symbols in Latex

date: 2016-04-16 by Zakaria al Azhar

When I've started this website some years ago, I wanted to embed actuarial and mathematical symbols in my blogs. I've figured out that the easiest way to achieve this is by using LaTeX. The difficult part was to implement LaTeX on my  Foxpro webserver such that it would automate the generation process.  EventualIy I reached my goals by using a combination of ImageMagick, Ghostscript, Latex and Foxpro code that converted LaTeX scripts in webimages. The easy part was to write actuarial symbols in LaTeX, which was just a matter of  sub- and supscripting.

What surprised me is that I got a lot of questions from readers about how to write actuarial symbols in LaTeX. I even got some questions from PHDs. I'm not an expert in LaTeX at all, in fact I had never used LaTeX before.  But by reading the LaTeX online documentation and googling I was able to come up with the following LaTeX script:  

\documentclass[6pt]{article}
\usepackage[latin1]{inputenc}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{color} \
pagestyle{empty}

\begin{document}
\color{blue}
\def\haak#1{{% \vbox{\hrule height .2pt \kern 1pt \hbox{$\scriptstyle {#1}\kern 1pt$}% }\kern-.05pt \vrule width .2pt }}    

$A_{x:\haak{n}}^{1} $
$a_{x:\haak{n}}$  

\end{document}

This would generate the following actuarial symbols:


I'm in a process of converting my visual foxpro LaTeX code to Python.