# cite inside a csv file

I am trying to create a table from a csv file that has a citation column. Here is a sample from the csv file:

id, ref
1, \cite{ref1}
2, \cite{ref2}


when I use:

\csvreader[
respect all,
autotabular]
{Res/myTable.csv}{}{\csvlinetotablerow}
\small


I get:

id, ref
1, “cite–ref1"
2, “cite–ref2"


Is it possible that the ref column is interpreted as a citation providing that ref1 and ref2 are already in my bib file.

Regards!

• Welcome to TeX.se. Please don't post code fragments. Instead put the fragments into a compilable document that people can play with. – Alan Munn Apr 28 '18 at 22:08

There's no problem to have code in the CSV file as long as you don't begin a row with a backslash (\). But you need to remove the respect all key from your \csvreader command, since that makes all characters normal characters.

\begin{filecontents*}{\jobname.csv}
id, ref
1, \cite{ref1}
2, \cite{ref2}
\end{filecontents*}
\begin{filecontents*}{\jobname.bib}

@book{ref1,
Author = {Joe Author},
Publisher = {Some Press},
Title = {A title},
Year = {2018}}

@book{ref2,
Author = {Sam Author},
Publisher = {Some Press},
Title = {Another title},
Year = {2017}}

\end{filecontents*}
\documentclass{article}
\bibliographystyle{alpha}
\usepackage{csvsimple}
\begin{document}