I have just began to use the csvsimple package, where I noticed a problem with national letters. The problems occurs with the danish letter å (\aa) and Å (\AA). Before the table these letters are written normally, but after the \csvreader command. Where it actually changes both the letter and the macroes into a and A instead. Does anyone know a solution to this problem?

I have the following csv file,

4.2 A,775,693,1.12,1.42
4.2 B,883,756,1.17,1.49
4.3 B,415,768,0.541,0.688
4.3 C,479,656,0.730,0.929
4.3 D,615,712,0.864,1.10
4.3 E,594,781,0.760,0.967
5.1 A,589,763,0.772,0.982
5.1 B,610,762,0.800,1.02
5.3 A,641,762,0.841,1.07
5.3 B,593,751,0.789,1.00

I use the following code,


æøå ÆØÅ \aa\AA
     \csvreader[head to column names,tabular=|l|l|l|l|l|,%
                table head=\hline Navn & c & h & r & s\\\hline]%
     \caption{æøå ÆØÅ \aa\AA}
æøå ÆØÅ \aa\AA

Which generate the following

enter image description here

Any help is appreciated :)

  • Welcome to TeX.SX! A short extract from the csv file is needed to play with.
    – egreg
    May 19, 2017 at 10:25
  • I can't reproduce the issue.
    – egreg
    May 19, 2017 at 10:33
  • I completely forgot about adding the csv file. I have added it now
    – Simon
    May 19, 2017 at 11:06
  • I can confirm the problem. It seems to be related to head to column names, the problem goes away if the first line in the CSV is written differently. No idea what that option is suppose to do.
    – daleif
    May 19, 2017 at 11:21
  • @daleif this seems to have solved the problem
    – Simon
    May 19, 2017 at 12:50

1 Answer 1


What happens with head to column names is that csvsimple defines control sequences based on the contents of the first line in the .csv file. In particular, it defines \r (besides \Navn, \c, \h and \s) and does a global definition. :-(

Thus \r gets redefined multiple times and at the end it expands to nothing. Thus \aa and \AA, whose definition is \r{a} and \r{A} respectively, turn out to give just ‘a’ and ‘A’ respectively.

The idea behind this is to being able to refer to the current contents of the line as \Navn, \c, \h, \r and \s, for example with

\Navn & \c & \h & \r & \s

instead of


However, this must apparently be avoided unless one ensures the column names don't conflict with existing macros.

Removing head to column names avoids the issue.

The problem is here:

  \toks1=\expandafter{\csname csvcol\romannumeral\c@csvcol\endcsname}%

(lines 184–189 in csvsimple.sty); the \gdef is the problem.

The package should at least warn that a column name could conflict with an existing macro; better, it should keep a list of the redefined macros and restore their definitions after the action of \csvreader ends.

  • Even then you'd still get into trouble if the second line of the CSV contained \aa. An interface like \Header{Navn}, \Header{c}` would probably have been better.
    – daleif
    May 19, 2017 at 14:40
  • @daleif Definitely better.
    – egreg
    May 19, 2017 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .