0

I would like to be able to use \csname to manipulate a table previously assigned to a macro via \pgfplotstableread. Attempting to use the macro indirectly, however, fails to compile. Here is a MWE:

\documentclass{standalone}

\usepackage{pgfplotstable}

\begin{document}

\pgfplotstableread{ a b 1 4 2 5 3 6 }{\testTable}

% OK %\pgfplotstabletypeset{\testTable}

% Fails to compile \pgfplotstabletypeset{\csname testTable\endcsname}

\end{document}

When attempting to compile the version of the \pgfplotstabletypeset command that uses \csname, I get the following error:

! Undefined control sequence.
\testTable ->\pgfpl@@ 
                      {a}\pgfpl@@ {b}
l.18 ...stabletypeset{\csname testTable\endcsname}

Is it possible to refer to a loaded pgfplotstable in this way? I also tried replacing the command involving \csname with

\newcommand{\myTable}{\testTable}
\pgfplotstabletypeset{\myTable}

only to obtain the same sort of error message.

1 Answers1

1

You can construct the csname before calling \pgfplotstabletypeset:

\documentclass{standalone}

\usepackage{pgfplotstable}

\begin{document}

\pgfplotstableread{ a b 1 4 2 5 3 6 }{\testTable}

% OK %\pgfplotstabletypeset{\testTable}

% Fails to compile \expandafter\pgfplotstabletypeset\expandafter{\csname testTable\endcsname}

\end{document}

David Carlisle
  • 757,742