Monthly Archive: November 2015

bankstatement 0.9.2 available in CTAN

Recently, the new version 0.9.2 of bankstatement is available in CTAN (see Announcement (ctan-ann@ctan.org)). Here is a brief summary of the new features in the README:

Changes in v0.9.2:

* use of siunitx to force two decimals, if csv data contains
other formats like 16.2 -> 16.20

* added support for Standard Bank (Namibia) and namibian

feature requests by Dr. Eberhard Lisse

* organized package in dtx format

The update should be available soon also in TeXLive and MiKTeX!

HowTo support arbitrary CSV formats

#bankstatement #howto

Using the example of the new csv format file csv-standard-bank-na.def I would like to explain – hopefully comprehensible – how to support more or less arbitrary csv formats. Take just one of the existing files and adjust them accordingly!

  1. First one determines the order of the keys in the csv file.
  2. Then we define \STM@JK@DTLforeach ; a macro that reads the csv file line by line and outputs them as LaTeX table row. It uses to the \DTLforeach macro (datatool.sty)

    • As the first argument you pass the name of the csv file. No change!
    • The second argument maps the csv keys to macros
    • In the third and final argument, the output of the three-column table row is done
      • In the first column we output the posting and value dates
      • In the second column we output the reference, which may be composed of several csv keys.
      • In the third column we output the value. A negative amount will be typeset in red (negativcolor option)
      • Finally, a test on the last row of data is performed and the closing balance or a blank line is issued.
  3. In the last step, we define the separator of the csv file and determine whether it has a header row (Caution: header → noheader=false! (noheader option (datatool.sty))). The last line can be usually simply copied (siunitx setup)!

Hopefully this helps to adapt and support other csv formats! 😉

HowTo support other languages

#bankstatement #howto

Using the example of the new file stmnamibian.def I’d like to briefly explain how to support other languages. One recognizes immediately, that the filename must follow the pattern stmLANGUAGE.def. First, we consider the definition file for english:

If you want to support a namibian bank now, it requires of course the change of currency (3rd column) and the SEPA terms BIC and IBAN:

siunitx for rounding to 2 decimals exactly

#bankstatement #develop

The latest version of bankstatement ensures that account transactions having exactly two decimals. Especially when an amount of e.g. 16.2€ is stored in the csv file (16.2 → 16.20).

In addition, the use of siunitx allows the determination of the decimal marker on dependence on the language – however independent of notation in the csv file, like \sisetup{output-decimal-marker={.}} in the file stmenglish.def. This is more important in other languages where the comma acts as decimal marker!