0

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, 
  before reading={\tiny},  
  head to column names,  
  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
1

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}
\csvreader[  
  head to column names,  
  autotabular]
  {\jobname.csv}{}{\csvlinetotablerow} 
\bibliography{\jobname}

\end{document}

output of code

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.