In the Phy Update Diary I'm writing about the process of updating the first App I have ever put into the App Store.

The formulas in [Phy](https://itunes.apple.com/de/app/phy-physics-formulas-calculator/id325836855?l=en&mt=8) are png images created using LaTeX. I used LaTeX because the formulas then look so good. Here is an example:

documentclass{article}
usepackage{amsmath}
begin{document}
pagestyle{empty}
hoffset = -5cm
voffset = -4.2cm
$F = gamma frac{m _1 , m _2}{r ^{2}} , frac{vec r}{| vec r |}$ 
end{document}

creates

gravitationskraft@3x

(Fun fact: While putting together this blog post I realized that his formula is wrong. There is a vector sign missing on the `F`. :))

I already have the pngs for the formulas in the current version but for the update I need to have in addition @3x version for the iPhone 6 and the iPhone 6+. When Apple released the iPhone 4 with its Retina display I had the same problem (yes, Phy is that old). To create the @2x (and now the @3x images) I used a shell script that takes all `.tex` files and creates images with different resolutions (essentially it just changes the DPI of the output).

Here is the script to generate the @2x and the @3x images an copy them to the project folder.

#!/bin/bash

while [ -n "$1" ] 
do
        name1=$1
        name2=${name1/'.tex'}
        echo $name2
        latex $name2
        dvipng -D 300 $name2.dvi -o $name2@2x.png
        cp $name2@2x.png ~/Documents/development/Phy/Phy/Resources/images/
        rm $name2.div $name2.log $name2.log $name2.aux

        dvipng -D 450 $name2.dvi -o $name2@3x.png
        cp $name2@3x.png ~/Documents/development/Phy/Phy/Resources/images/
        rm $name2.div $name2.log $name2.log $name2.aux

        shift
done

If you have comments or questions about this post, ping me on App.net or Twitter.