5

Hi this is what I wrote:

\documentclass{article}
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage[T1]{fontenc}

\begin{document}
\csvautotabular{Book2.csv}

\end{document}

and this is the content of the csv file, i made it with excel and converted with notepad++

frequenza ν (Hz),frequenza teorica ν (Hz) ,nodi n
510,537.18,2
760,805.78,3
1010,1074.38,4
1280,1342.97,5
1550,1611.56,6

It fails creating the PDF, this is the error message:

Package gensymb Warning: Not defining \perthousand.
Package gensymb Warning: Not defining \micro.

! Undefined control sequence.
\GenericError  ...                                
                                                    #4  \errhelp \@err@     ...
l.12 \csvautotabular{Book2.csv}

? ^C! Interruption.
\GenericError  ...                              #4
                                                    \errhelp \@err@         ...
l.12 \csvautotabular{Book2.csv}

Thank you for your answers

  • 2
    A possible solution is to compile with xelatex and polyglossia, see tex.stackexchange.com/a/329750 for an example. – Marijn Aug 29 at 17:02
  • Thank you, it now creates the pdf with the table, sadly the greek character isn't displayed – user195519 Aug 29 at 17:25
4

Probably a font problem; with Gentium and xelatex seems to work:

\documentclass{article}
\usepackage{fontspec}
\usepackage[greek, italian, english]{babel}
\setmainfont[Mapping=tex-text]{Gentium}
\usepackage{amsmath}
\usepackage{csvsimple}

\begin{document}
\csvautotabular{Book2.csv}
\end{document}

Gives

resulting table

6

For pdflatex you can map the ν character in the input to $\nu$ using \newunicodecharacter. However, csvsimple does not allow macros in header lines because the header values are used to create keys to refer to the corresponding columns. A workaround for that is to disable the code that creates the keys.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{newunicodechar}
% map ν in input to macro
\newunicodechar{ν}{$\nu$}

\makeatletter
% switch off csvsimple column name macros
\def\set@csv@head{\relax}
\makeatother

\begin{document}
\csvautotabular{book2.csv}

\end{document}

Result:

enter image description here

If you don't want to define the character mapping yourself then you can use the alphabeta package - note however that the characters look a bit different.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{alphabeta}

\makeatletter
% switch off csvsimple column name macros
\def\set@csv@head{\relax}
\makeatother

\begin{document}
\csvautotabular{book2.csv}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.