我希望有人能帮助我。我正在尝试创建横向页面,用于保存我的调查项目。使用 CSV 文件尝试几次后,我手动编写了所有内容,但这种方式太不灵活了,所以我想再试一次。
在我首次尝试时,示例 CSV 的第一列包含类别名称,但由于我没能加载它,我决定为每个类别创建一个自己的文件。以防有人知道如何仅使用一个文件来做到这一点。
我已经尝试了很多组合,有一次如果问卷跨越多页就会出现问题,另一次(datatool),我遇到了引用问题。我正在使用 biblatex 和 biber 后端。
是否无法导入包含引文的 CSV 文件?
到目前为止,我已经尝试过以下来源: CsvSimple + 数据工具, Pgfplotstable + 引文, 数据工具,还有其他一些...
此致,
丽莎
\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}
答案1
有两种方法可以实现此目的:一种是使用简单的方法,\csvautotabular
另一种是使用更可控的方法\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}
输出如下: