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. Commented Feb 26, 2020 at 2:34
  • That worked @PhelypeOleinik. Thank you! Commented Feb 26, 2020 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
    Commented Feb 26, 2020 at 4:05

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .