a) Most journal have old LaTeX distribution or do not want to bother with “complicated” packages such as those derived from pgf (see Using TikZ in journal articles).

I have build a table using pgfplotstable and I would like the editors to reproduce its formatting. However, due to remark a), I suppose it will be better not to include the corresponding code in my submission but something that self-compile. Is there a way to include my table in a fashion similar to externalization with TikZ? Not including another non-standard package would be better; the definition of non-standard being rather dependent on the targeted journal.

In any case, I suppose the editors would have the table rekeyed to fit their style. How do you suggest to provide them with the data of the table?


pgfplotstable can write the output latex code to a file, if you need. Consider this example:



\pgfplotstableread[col sep=comma]{test.csv}\mytable

\pgfplotstabletypeset[outfile=mytable.out.tex, % ----->write latex code to the file.
            begin table=\begin{longtable},
            end table=\end{longtable},
            every head row/.style={before row=\toprule,after row=\midrule\endhead},
            every last row/.style={after row=\bottomrule},
            columns/A/.style={int detect,column name=A},
            columns/B/.style={int detect,column name=B},
            columns/C/.style={string type,column name=C},

Note the outfile=mytable.out.tex, directive in the code. pgfplotstable writes the latex code to the file mytable.out.tex in the same folder as your other auxiliary files. The contents of mytable.out.tex will be

\begin {longtable}{ccc}%
\toprule A&B&C\\\midrule \endhead %
\pgfutilensuremath {0}&\pgfutilensuremath {0}&T\\%
\pgfutilensuremath {1}&\pgfutilensuremath {1}&T\\%
\pgfutilensuremath {2}&\pgfutilensuremath {2}&T\\%
\pgfutilensuremath {3}&\pgfutilensuremath {3}&T\\%
\pgfutilensuremath {4}&\pgfutilensuremath {4}&T\\%
\pgfutilensuremath {5}&\pgfutilensuremath {5}&T\\\bottomrule %
\end {longtable}%

When you submit your paper to the journal, replace \pgfplotstabletypeset[..]{..}\mytable with the contents of mytable.out.tex as usual (you may \input{mytable.out.tex}).

For more details, search outfile in the pgfplotstable manual. In my copy, it is discussed in detail in page 22.

  • As stated in the documentation, some post editing might be required. In addition to replacing \pgfutilensuremath by \ensuremath, I had to remove \pgfplotstableresetcolortbloverhangright and \pgfplotstableresetcolortbloverhangleft. I think these are caused by the dec sep align option. There are some slight spacing issue when simply removing them.
    – M. Toya
    Jul 24 '13 at 7:45
  • In my setup I use outfile=mytable.out.tex in combination with typeset=false and \include{mytable.out.tex}. The option typeset=false will only generate the outfile without including the table right in place. So I split all the table generation stuff in to another file and later do the includes in place where needed. Before publishing I exclude the table generation file and do some replacing e.g. \pgfutilensuremath by \ensuremath and remove the pgfplotstable import in the preamble
    – David Boho
    Jun 27 '18 at 8:01

Stripping out all the pgf commands is the way to go once one has created the outfile. Also it's worth removing \usepackage{pgfplotstable} from the preamble as I've noticed that this can create compilation errors with certain journal style files even if no pgf commands/macros are used in the document.

I replaced the \pgfplotstableresetcolortbloverhang[left right] commands with \ragged[left right] and it seems to have worked ok.

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.