假设我有一张这样的桌子
我将其保存为.csv
然后像这样用乳胶导入:
\usepackage{adjustbox}
\usepackage{booktabs,csvsimple}
[...]
\begin{table}[ht]
\begin{adjustbox}{max width=0.9\textwidth}
\csvautobooktabular[]{csvs/test.csv}
\end{adjustbox}
\caption{blah blah blah etc.}
\label{tab:IRTL}
\end{table}
这无法编译(请参阅下面的错误消息)。
但如果我将公式从标题单元格移动到其他单元格,例如
experiment,N,Z[ms],X[requests/ms],R [ms],N/X-Z,difference[ms],rel.difference
S=3 write-to-1,690,0,15.0258730823,47.8550460251,45.9207925038,-1.9342535213,-4.0419008693
S=3 write-to-2,690,0,14.8651324965,48.817562994,46.4173461059,-2.4002168881,-4.9167077193
S=3 write-to-3,690,0,14.6532775453,49.1099377034,47.088441331,-2.0214963724,-4.1162674337
S=5 write-to-1,690,0,13.0724002789,55.1449088796,52.7829614514,-2.3619474282,-4.2831649852
S=5 write-to-3,690,0,13.1264672245,54.9158028824,52.5655523452,-2.3502505371,-4.2797344549
S=5 write-to-5,690,0,12.5929567643,57.5819507206,54.7925330734,-2.7894176472,-4.8442569455
S=7 write-to-1,690,0,11.9808507671,59.7164732682,57.5919033977,-2.1245698706,-3.5577617938
$\frac{N}{X}-Z$,690,0,11.5527991632,62.7957745235,59.7257850893,-3.0699894342,-4.8888471517
[\%],690,0,11.2594853556,64.3044356113,61.2816641441,-3.0227714673,-4.7007200025
一切正常:
autobooktabular
所以我猜这与处理标题的方式有关。
我如何让表格正确解析标题?
错误消息:
<to be read again>
\begingroup
l.198 \csvautobooktabular[]{csvs/test.csv}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing } inserted.
<inserted text>
}
l.198 \csvautobooktabular[]{csvs/test.csv}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing $ inserted.
<inserted text>
$
l.198 \csvautobooktabular[]{csvs/test.csv}
I've inserted a begin-math/end-math symbol since I think
you left one out. Proceed, with fingers crossed.
! Extra }, or forgotten $.
<argument> ...ad/${\begingroup N\endgroup \over X}
-Z$/.@cmd
l.198 \csvautobooktabular[]{csvs/test.csv}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
! Extra \endcsname.
\pgfkeyslet ...ter \let \csname pgfk@#1\endcsname
#2
l.198 \csvautobooktabular[]{csvs/test.csv}
I'm ignoring this, since I wasn't doing a \csname.
)
Runaway argument?
\pgfkeyssetvalue {/csv head/${\begingroup N\endgroup \over X}-Z$/.@bo\ETC.
! File ended while scanning use of \pgfkeys@temp.
<inserted text>
\par
<*> myFile.tex
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
! Emergency stop.
<*> myFile.tex
*** (job aborted, no legal \end found)
Here is how much of TeX's memory you used:
10433 strings out of 495000
168406 string characters out of 6181170
367801 words of memory out of 5000000
13477 multiletter control sequences out of 15000+600000
10920 words of font info for 39 fonts, out of 8000000 for 9000
14 hyphenation exceptions out of 8191
54i,12n,92p,1177b,330s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
答案1
\frac
将它放在 csv 阅读器解释的标头中似乎太脆弱了。您可以将标头条目更改为N/X-Z
,然后自己指定合适的标头。
\csvautobooktabular[table head={\toprule experiment & N & Z[ms] & X[requests/ms] & R [ms] & $\frac{N}{X}-Z$ & difference[ms] & rel.difference \\\midrule}]{table.csv}