我在使用命令时遇到问题\pgfplotstableread
。我总是得到以下输出:
Package PGF Math Error: Could not parse input 'VasconcelosEtAl2012' as a floating point number, sorry.
The unreadable part was near 'VasconcelosEtAl2012'.. }
我的目的是使用一个表格(内联或 csv),其中几行填充了数据,以便用biber
(Citecommands)或siunitx
(坐标角度)进行处理。
以下是我理解的 MWE:
\documentclass{minimal}
\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplotstable}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{longtable}
\usepackage[style=authoryear-comp,maxbibnames=25, maxcitenames=2,backend=biber]{biblatex}
%some bib-libraries
\usepackage{booktabs}
\begin{document}
\begin{landscape}%
\pgfplotstabletypeset[begin table=\begin{longtable},end table=\end{longtable},
header=true, col sep=comma, row sep=newline,
%0
columns/0/.style={ string replace*={##1}{\textcite{##1}}, column name {Quelle1}, string type, column type =l},
%1
columns/1/.style={column name={Ort}, verb string type, column type = l},
%2
columns/2/.style={column name={Longitude}, string replace*={##1}{\ang{##1}},string type, column type=r},
%3
columns/3/.style={column name={Latitude},string replace*={##1}{\ang{##1}}, string type, column type=r},
%4
columns/4/.style={column name ={Wert}, column type=r, dec sep align,fixed,precision=2},
%5
columns/5/.style={column name={[Einheit]}, replace string*{##1}{$##1$}, string type},
%6
columns/6/.style={column name=Beschreibung, verb string type, column type=l},
%7
columns/7/.style={column name={$\rho [kg/m^3]$}, column type=r, dec sep align,fixed,precision=2},
%8
columns/8/.style={column name={Quelle $\rho$}, string replace*={##1}{\textcite{##1}}, string type, column type=l},
%9
columns/9/.style={column name={$l$}, precision=2, column type=r},
%10
columns/10/.style={column name={NAI [$m^3\cdot ha^{-1}$]}, dec sep align,fixed,precision=2, column type=r},
%11
columns/11/.style={column name={Spezien}, string replace*{##1}{\textit{##1}}, string type},
]{
Autor,Ort,Longitude,Latitude,Wert,Einheit,Beschreibung,Dichte,DQuelle,la,NAI,Baumarten
VasconcelosEtAl2012,Brasilien ,-1;19;0,+47;57;0,14.45,$Mg / ha \cdot year$,ANPP,0.704,NogueiraEtAl2005,0.5,4.928,-
BernierEtAl2007,Chibougamau Quebec,+49;41;31.2,+74;25;55.2,2090,$kg /ha \cdot yr$, ANPP Stems,0.45,AseevaEtAl2014,,4.644444444,Picea mariana (Black Spruce)
}
\end{landscape}%
\end{document}`
在原始文件中我使用的是 BiBLaTeX,但这个替换在另一个表中起作用,在那里我只有一排键,这就是为什么我猜测它与包有关siunitx
或者我没有看到缺少的括号。
是的,这个表格对于标准格式来说太宽了,但这是另一个问题。
----------
所以大部分问题都解决了,但接下来还有:
\documentclass{article}
\usepackage[margin=1cm,a3paper]{geometry}
\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplotstable}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{longtable}
\usepackage[style=authoryear-comp,maxbibnames=25,maxcitenames=2,backend=biber]{biblatex}
%some bib styles and files
\usepackage[babel,german=quotes]{csquotes}
\usepackage{booktabs}
\pgfplotsset{compat=1.12}
\usepackage{booktabs}
\begin{document}
\begin{landscape}%
\pgfplotstabletypeset[begin table=\begin{longtable},end table=\end{longtable},
header=true, col sep=comma, use comma, row sep=newline,
every head row/.append style={after row=\endhead},
%0
columns/Autor/.style={string replace*={##1}{\textcite{##1}},column name={Quelle}, string type, column type =l},
%1
columns/Ort/.style={column name={Ort}, verb string type, column type = l},
%2
columns/Longitude/.style={column name={Longitude},string replace*={##1} {\ang{##1}}, string type, column type=r},
%3
columns/Latitude/.style={column name={Latitude},string replace*={##1}{\ang{##1}} , string type, column type=r},
%4
columns/Wert/.style={column name ={Wert}, column type=r, dec sep align,fixed,precision=2},
%5
columns/Einheit/.style={column name={[Einheit]}, string replace*={##1}{$##1$}, string type},
%6
columns/Beschreibung/.style={column name=Beschreibung,string replace*={##1}{$\mathrm{##1}$}, string type, column type=l},
%7
columns/Dichte/.style={column name={$\rho [kg/m^3]$}, column type=r, dec sep align,fixed,precision=2},
%8
columns/DQuelle/.style={column name={Quelle $\rho$}, string replace*={##1}{\textcite{##1}}, string type, column type=l},
%9
columns/la/.style={column name={$l$}, precision=2, column type=r},
%10
columns/NAI/.style={column name={NAI [$m^3\cdot ha^{-1}$]},fixed,precision=2, column type=r , dec sep align},
%11
columns/Baumarten/.style={column name={Spezien}, string replace*={##1}{\textit{##1}}, string type, column type =l}
]
{
Autor,Ort,Longitude,Latitude,Wert,Einheit,Beschreibung,Dichte,DQuelle,la,NAI,Baumarten
BernierEtAl2007,Groundhog River Ontario,48;13;1.2,82;9;21.6,,,,0.45,AseevaEtAl2014,,,Picea mariana (BS)
}
\end{landscape}%
\end{document}
输出为:
扫描 \pgfutil@in@@ 的使用情况时文件结束。
我猜想这与“空单元格”有关... 它与上面 MWE 中提供的行一起工作,但一旦开始读取这些行,,,,
它就会停止工作。empty cell with
这有用吗?
答案1
以下修复了大部分错误。您有许多拼写错误的键,包括“ replace string*
instead of”string replace*
和“ verb string type
instead of” string type
。
列数上仍然存在一些我尚无法追踪的不匹配问题,但我发布此信息是希望您能够进一步了解。
\documentclass{article}
\usepackage[margin=1cm,a3paper]{geometry}
\usepackage{siunitx}
\usepackage[T1]{fontenc}
\usepackage{stix}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{biblatex}
\usepackage{pgfplotstable}
\usepackage{pdflscape}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{landscape}
\pgfplotstabletypeset[begin table=\begin{longtable},end table=\end{longtable},
header=true, col sep=comma, use comma, row sep=newline,
every head row/.append style={after row=\endhead},
%0
columns/Autor/.style={string replace*={##1}{\textcite{##1}},column name={Quelle}, string type, column type =l},
%1
columns/Ort/.style={column name={Ort}, verb string type, column type = l},
%2
columns/Longitude/.style={column name={Longitude},string replace*={##1}{\ang{##1}}, string type, column type=r},
%3
columns/Latitude/.style={column name={Latitude},string replace*={##1}{\ang{##1}} , string type, column type=r},
%4
columns/Wert/.style={column name ={Wert}, column type=r, dec sep align,fixed,precision=2},
%5
columns/Einheit/.style={column name={[Einheit]}, string replace*={##1}{$##1$}, string type},
%6
columns/Beschreibung/.style={column name=Beschreibung, verb string type, column type=l},
%7
columns/Dichte/.style={column name={$\rho [kg/m^3]$}, column type=r, dec sep align,fixed,precision=2},
%8
columns/DQuelle/.style={column name={Quelle $\rho$}, string replace*={##1}{\textcite{##1}}, string type, column type=l},
%9
columns/la/.style={column name={$l$}, precision=2, column type=r},
%10
columns/NAI/.style={column name={NAI [$m^3\cdot ha^{-1}$]}, dec sep align,fixed,precision=2, column type=r},
%11
columns/Baumarten/.style={column name={Spezien}, string replace*={##1}{\textit{##1}}, string type}
]{
Autor,Ort,Longitude,Latitude,Wert,Einheit,Beschreibung,Dichte,DQuelle,la,NAI,Baumarten
VasconcelosEtAl2012,Brasilien ,-1;19;0,+47;57;0,14.45,Mg / ha \cdot year,ANPP,0.704,NogueiraEtAl2005,0.5,4.928,-
BernierEtAl2007,Chibougamau Quebec,+49;41;31.2,+74;25;55.2,2090,kg /ha \cdot yr,ANPP Stems,0.45,AseevaEtAl2014,0,4.644444444,Picea mariana (Black Spruce)
}
\end{landscape}
\end{document}