3

I hope someone is able to help me. I'm trying to create landscape pages, that are holding my survey items. After several tries with CSV files, I wrote everything by hand, but it's just too inflexible, so I wanted to give it another try.

In my first tries the sample CSV had a first column with the category name, but as I didn't manage to load it, I decided to make an own file for each category. Just in case anybody has an idea how to do it with one file only.

I tried so many combinations already, one time there is a problem if the questionnaire is spanning multiple pages, the other time (datatool), I got an issue with the citation. I'm using biblatex with biber backend.

Is it not possible to import a CSV file with citations in it?

I tried it with this sources so far: CsvSimple + Datatool, Pgfplotstable + Citations, Datatool, and several more...

Best regards,

Lisa

\documentclass{article}
\begin{filecontents*}{test.csv}
category,original,source,modified,reason,translated,
PE1,This is a Test sample.,\textcite[1]{testcite},This is no test sample.,Not sure.,ABC,
PE2,This is a Test sample.,\textcite[1]{testcite},This is no test sample.,Not sure.,ABC,
PE3,This is a Test sample.,\textcite[3]{testcite},This is no test sample.,Other reason.,ABC,
PE4,This is a Test sample.,\textcite[2]{testciteother},This is no test sample.,Not sure.,ABC,
\end{filecontents*}

\begin{document}
%What to write so it's working?
\end{document}

Desired result

1

Here are two ways of doing this: an easy way with \csvautotabular and a more controlled way with \csvreader:

\documentclass{article}

\begin{filecontents*}{test.csv}
category,original,source,modified,reason,translated
PE1,This is a Test sample.,\textcite[1]{testcite},This is no test sample.,Not sure.,ABC
PE2,This is a Test sample.,\textcite[1]{testcite},This is no test sample.,Not sure.,ABC
PE3,This is a Test sample.,\textcite[3]{testcite},This is no test sample.,Other reason.,ABC
PE4,This is a Test sample.,\textcite[2]{testciteother},This is no test sample.,Not sure.,ABC
\end{filecontents*}

\usepackage{csvsimple}% csv reader and formatter
\usepackage{biblatex}%  since csv file contains \textcite
\usepackage{booktabs}%  better formatting of tables   
\usepackage[landscape]{geometry}% to put in landscape 

\begin{document}

  \csvautotabular{test.csv}

  \bigskip

  \begin{tabular}{*6l}\toprule
      Category& Original& Source& Modified& Reason& Translated\\\midrule
      \csvreader[head to column names, late after line=\\]{test.csv}{}%
         {\category& \original& \source& \modified& \reason& \translated}%
      \bottomrule
  \end{tabular}

\end{document}

Here is the output:

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.