# How to install and use the key fonts for a TI-Calculator in pdflatex or xelatex

This answer http://tex.stackexchange.com/a/37550/4011 suggested that it should be possible to install a font which enables one to typeset the keys of a TI-calculator.

Now my question is, how to install and use it exactly on a texlive linux system with pdflatex or xelatex.

For example I want this: http://education.ti.com/educationportal/sites/US/productDetail/us_key_font_83p_84p.html

The first problem is that there are only exe and hqx files for download.

Edit I followed ArTourters suggestion, extracted the fonts to /home/myuser/Downloads/TiKeys/

And tried to compile the following with xelatex

\documentclass{article}
\usepackage{fontspec}

{TI83____.TTF}

\begin{document}
Test.
\end{document}

Then I get:

! Font \zf@basefont=TI83____.TTF at 10.0pt not loadable: Metric (TFM) file or i
\zf@fontspec ...ntname \zf@suffix " at \f@size pt
\unless \ifzf@icu \zf@set@...
l.12 {TI83____.TTF}

And lot's of other messages.

It produces a pdf which uses standard font. I don't want to use this font for the whole document, I just want to typeset the TI-Calculator keys. So how to do so?

-

The windows version is a self-extracting zip file. You can get the files by:

unzip ti83pkeys.exe
Archive:  ti83pkeys.exe
inflating: Ti83keys.txt
inflating: TI83____.PFB
inflating: TI83____.PFM
inflating: TI83____.TTF

You can then use your favourite way of using fonts in latex to include the True Type or the Postscript Type 1 font.

## Edit 1:

I have to say I am getting puzzled.

using the following code with LuaLaTex should work but somehow, despite the fact that the font is seen and loaded by lualatex, the tex itself does not appear in the resulting pdf nor is the font embedded.

\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\TIfont}{TI83____.TTF}
\DeclareTextFontCommand{\tifont}{\TIfont}

\begin{document}

\tifont{A}

\end{document}

Not all characters are defined in this font but A is and should display something like [TAN⁻¹].

looking at the logs, you get the following when the font is loaded:

fontspec info: Font TI83____.TTF does not contain any OpenType Script' information.

\g_fontspec_family_TI83____.TTF_int=\count363
fontspec info: Defining font family 'TI83____.TTF(0)' for font 'TI83____.TTF'
with options [].

\g_fontspec_TI83____.TTF(0)_prop=\toks38
fontspec info: Defining shape 'normal' with NFSS spec.:<br>
(fontspec)  <->"file:TI83____.TTF:mode=node;"

I have tried adding [Script={Latn,Common}] to the \newfontfamily call and although the warning disappear, it doesn't change anything to the output.

I'll keep looking but if @khaled-hosny feels like shading some light...

## Edit 2:

I tried the same code with XeLaTeX, which gave a bit more info. The code compiles, with the font embedded but the characters appear as rectangles, with the following note in the log:

Missing character: There is no A in font [TI83____.TTF]/ICU:!

Now I guess it is a question of finding the characters and their encodings which have data. I thought that A was one of them but LaTeX does seem to think so.

## Edit 3: This one is the last!

Thanks to this question and this question I think I have solved it. The problem comes from the fact the the font does not have UTF-8 characters so you need some other ways to get to them.

this can be done with XeLaTeX using the \XeTeXglyph command, or with a bit more hackery with lualatex by define a command of the form \def\fontchar#1{\directlua{fonts.otf.char("#1")}}

The following code will work on both XeLaTeX and LuaLaTeX and defines the command \TI which takes for argument the name of the glyph (if you use the glyph number, although \XeTeXglyph<number> will work as expected, the lua fonts.otf.char("<number>") will revert back to the TeX \char which in this case doesn't work.

\documentclass{standalone}
\usepackage{fontspec}
\usepackage{ifluatex,ifxetex}
\newfontfamily{\TIfont}{TI83____.TTF}
\DeclareTextFontCommand{\tifont}{\TIfont}

\ifluatex
\def\TI#1{\tifont{\directlua{fonts.otf.char("#1")}}}
\fi
\ifxetex
\def\TI#1{\tifont{\XeTeXglyph\the\XeTeXglyphindex"#1"}}
\fi

\begin{document}

A sample text \\
\TI{A}\TI{B}\TI{C}\TI{D}\TI{E}\TI{F}\TI{G}\TI{H}

\end{document}

Which gives:

if you use LuaLaTex, a file will be created in ~/.texlive2011/texmf-var/luatex-cache/generic/fonts/otf/temp-ti83-.lua, or something similar, which will detail the font and its characters. if you looks in it(it is plain text) you can find the names of each characters. Ido not know how to get this information otherwise.

-
Thanks. Using it with pdflatex seems to be pretty complicated, perhaps I should use XeLaTeX instead. – student May 19 '12 at 12:49
XeLaTeX or LuaLaTeX would enable you to use the TTF font without too much hassle. It also gives you access to OpenType fonts. I have moved from PDFLaTeX to LuaLaTeX recently but haven't tried XeLaTeX – ArTourter May 19 '12 at 13:27
answer updated. (several times!) one not is that the code provided assume the TTF font is locate in the same folder as the TeX file. – ArTourter May 19 '12 at 20:43
Thanks I will try it. Please could you add the pdf-output of your third edit as an image? – student May 19 '12 at 21:29
I put the TTF-file into the same folder as the tex file, however xelatex gives me: kpathsea: Running mktexmf TI83____ ! I can't find file TI83____'. <*> ...ljfour; mag:=1; nonstopmode; input TI83____ – student May 20 '12 at 8:32