1

The following MWE creates a simple little table with pgfplotstable and works fine:

\documentclass{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat = 1.16}

\begin{document}
\pgfplotstabletypeset[
    col sep=comma,
    columns/Parameter/.style={string type}
]{
Parameter, no. 1, no. 2
A, 100,100
B,100,100
}
\end{document} 

I wanted to use '#1', '#2', etc. in the header instead of 'no. 1', 'no. 2', etc. But as soon as I type \# in the header row (or the body of the table for that matter) I get 22 errors insisting that The control sequence marked <to be read again> should not appear between \csname and \endcsname.

Is there a way to make this work?

3
  • 2
    \# is a command that takes a character of the current font and puts it on paper, so it's not valid where TeX expects simple characters. Try \edef\hash{\string#} and then Parameter, \hash1, \hash2. Feb 26 '20 at 2:34
  • That worked @PhelypeOleinik. Thank you! Feb 26 '20 at 2:53
  • @A.Arredondo If the answer works for you, please consider accepting it by clicking on the check mark on its left to "accept" it.
    – user194703
    Feb 26 '20 at 4:05
2

You should use simple names for the columns (just ASCII characters), that can be changed with columns.

\documentclass{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat = 1.16}

\begin{document}

\pgfplotstabletypeset[
  col sep=comma,
  columns/Parameter/.style={string type},
  columns/1/.style={column name={\#1}},
  columns/2/.style={column name={\#2}},
]{
  Parameter, 1, 2
  A, 100,100
  B,100,100
}

\end{document}

enter image description here

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.