Externalize pgfplotstable with csv file
Ok I fixed it but it wasn't as spectacular as I thought
\documentclass{standalone}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage[allowlitunits]{siunitx}
\begin{document}
\sisetup{per-mode=symbol}
\pgfplotsinvokeforeach{100,90,...,10}{
\pgfmathsetmacro\concentration{#1/100*0.25}
\pgfplotstableset{
columns/#1/.estyle={
fixed,fixed zerofill,precision=3,
column type=p{4.5em},
column name={\SI[round-mode=places,round-precision=3]{\concentration}{\mol\per\liter} (\SI{#1}{\percent})}}
}
}
\pgfplotstabletypeset[col sep=semicolon,
header=true,
columns/Zeit/.style={fixed,fixed ,column type=r},
every head row/.style={
before row=\toprule,
after row=\midrule
},
every last row/.style={
after row=\bottomrule
}
]{t3.dat}
\end{document}
looks pretty much the same but since standalone
does not work with longtable
I removed this part:
\pgfplotstableset{
begin table=\begin{longtable},
end table=\end{longtable},
}
what I forgot was to remove the \endhead
command within after row
(see first Question)
And I moved all files to the same directory, not sure if this is that important. It is not that pretty but works for me.
Related videos on Youtube
Rico
Updated on June 07, 2020Comments
-
Rico over 3 years
This is a direct follow-up question to this: Adding units to pgfplotstable header
After fixing the output I tried outsourcing the
table
. After figuring out thatstandalone
does not work withlongtable
(thanks to @Jake) I removed that, but even then every time i try to compile withpdfLaTeX
I get this error:! Package pgfplots Error: Could not read table file 't3.dat'. In case you inten ded to provide inline data: maybe TeX screwed up your end-of-lines? Try
row se p=crcr' and terminate your lines with \\
(refer to thepgfplotstable
manual for details).where
t3.csv
is the file where all the data is stored.My file currently looks like this:
\documentclass{standalone} \usepackage{pgfplotstable} \usepackage{booktabs} \usepackage[allowlitunits]{siunitx} \begin{document} \pgfplotsinvokeforeach{100,90,...,10}{ \pgfmathsetmacro\concentration{#1/100*0.25} \pgfplotstableset{ columns/#1/.estyle={ fixed,fixed zerofill,precision=3, column type=p{4.5em}, column name={\SI[round-mode=places,round-precision=3]{\concentration}{\mol\per\liter} (\SI{#1}{\percent})}} } } \pgfplotstabletypeset[col sep=semicolon, header=true, columns/Zeit/.style={fixed,fixed ,column type=r}, every head row/.style={ before row=\toprule, after row=\midrule\endhead }, every last row/.style={ after row=\bottomrule } ]{t3.dat} \end{document}
So to summarize the whole thing, I tried 2 ways to include this table:
- Using the
standalone
class and including the file with\includestandalone{subdir/filename}
- Using a file without any preamble and
\documentclass
and using the\input{subdir/filename}
method.
Still I'm not able to determine what causes this error. Running Windows 7 and TeXStudio
EDIT
it looks like I am not able to write a file into any directory. so the question should be, why am I not able to write a file?
-
Jake over 10 yearsHm, it compiles fine for me using the first method (I didn't try the second). Is the
t3.dat
file in thesubdir
folder? -
percusse over 10 yearsDid you try running TeXStudio as administrator?
- Using the