# Pgfplots working as standalone but not in main document

Original: In my main document I have been including a pgfplotstable as:

\SSTeTableTypeT %contains \pgfplotstableset - included in the end of the question.
\pgfplotstabletypeset[ %
\caption{SSTe results based on input data from ISO 11855-4} %
\label{tab:SSTe11855-4_TypeT}\\ %
\toprule},}
]{DataSSTe/11855-4_RT.dat}


This used to work until I made some changes to the program that is generating the data I want to put in a table. In an attempt to find the problem I used the standalone package and created the following (I have not included all that is needed to typeset this - if it helps I can provide a link to all the data for download):

\documentclass[tikz]{standalone}

% Usepackages
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{longtable}
\usepackage{booktabs}

% Needed for Definitions
\input{../Setup/Definitions} % Global definitions of units I use throughout the document

% Setting the table environment
\input{../Setup/pgfplots} % defining \SSTeTableTypeT (included below)

% Data Source Folder
\newcommand{\SSTeData}{../DataSSTe/} % the content of the table
% this is included as the relative
% path changes when included in the main document

\begin{document}
\SSTeTableTypeT % see below for details
\pgfplotstabletypeset[ %
\caption{SSTe results based on input data from ISO 11855-4} %
\label{tab:SSTe11855-4_TypeT}\\ %
\toprule},}
]{\SSTeData/11855-4_RT.dat}
\end{document}


If I just typeset the above a standalone I will get a table that is just as I would like to have it. However, if I include it into my main document as:

\usepackage[mode=build]{standalone} % image or build or ...
...
\includestandalone{Table/SSTe11855-4_RT}


I get the error: Missing \endgroup inserted ]{\SSTeData/11855-4_RT.dat}

If I just write

\input{Table/SSTe11855-4_RT}


the code will, however, compile without any problems.

Why is the \endgroup missing the one way but all is fine the other way around?

Honestly, I don't have an idea what the problem really is and, therefore, also have not been able to search for a solution myself. I just don't know where to look. Even though it works using \input I would prefer to use \includestandalone as it speeds up the build process as long as I just use the image option.

How the table looks if set in standalone

Definition of \SSTeTableTypeT that is stored in ../setup/pgfplots

\newcommand{\SSTeTableTypeT}{\pgfplotstableset{%
reset styles,
disable rowcol styles=false,
%   comment chars={0},
columns={time,
tHWaterIn,
tHSetWaterIn,
tHWaterOut,
tHF,
tHP,
tHC,
tHIws,
tHIw,
tHA,
tHMr,
tHOp},
columns/time/.style={
column name={Step},
fixed,
},
columns/tHWaterIn/.style={
column name={$\tHWaterIn$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHSetWaterIn/.style={
column name={$\tHSetWaterIn$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHWaterOut/.style={
column name={$\tHWaterOut$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHF/.style={
column name={$\tHF$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHP/.style={
column name={$\tHP$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHC/.style={
column name={$\tHC$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHIws/.style={
column name={$\tHIws$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHIw/.style={
column name={$\tHIw$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHA/.style={
column name={$\tHA$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHMr/.style={
column name={$\tHMr$},
fixed zerofill,
precision=1,
fixed,
},
columns/tHOp/.style={
column name={$\tHOp$},
fixed zerofill,
precision=1,
fixed,
},
%   row sep=\\,
begin table=\begin{longtable},
every first row/.append style={ %
before row={\midrule
\multicolumn{12}{c}{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\midrule
\bottomrule
\endfoot
\bottomrule
\endlastfoot
},
},
end table=\end{longtable},
}
}

• You have a backslash in {\SSTeData/11855-4_RT.dat}? – percusse May 2 '14 at 9:39
• @percusse Yes, thats because \SSTeData is used to set the document location. Basically the data I use is in a different relative location depending if is set the document with standalone or as part of the main document. For standalone it is: ../DataSSTe/ and if used in the main document it is only: DataSSTe/ – MatoBehr May 2 '14 at 9:52
• I have been using the same system for the source file location with tikz-pictures and never had a problem with that. – MatoBehr May 2 '14 at 9:59
• Can you put the first 5-6 rows of data in the question too? – percusse May 2 '14 at 10:03
• @percusse I could not post it into the listing itself. That somehow messed it up. But I have added a linke to the file at the top. It is a plain text file. – MatoBehr May 2 '14 at 10:56