2

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 that standalone does not work with longtable (thanks to @Jake) I removed that, but even then every time i try to compile with pdfLaTeX 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 the pgfplotstable 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:

  1. Using the standalone class and including the file with \includestandalone{subdir/filename}
  2. 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?

2
  • Hm, it compiles fine for me using the first method (I didn't try the second). Is the t3.dat file in the subdir folder? – Jake Jun 5 '13 at 21:39
  • Did you try running TeXStudio as administrator? – percusse Jun 6 '13 at 20:20
2

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.

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.