2

I have the following code, adapted from here.

\documentclass{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstabletypeset[col sep=comma,
  every head row/.style={
    typeset cell/.code={
      \ifnum\pgfplotstablecol=0
        \pgfkeyssetvalue{/pgfplots/table/@cell content}{&}%
      \else
      \ifnum\pgfplotstablecol=\pgfplotstablecols
        \pgfkeyssetvalue{/pgfplots/table/@cell content}{\rotatebox{90}{##1}\\}%
      \else
        \pgfkeyssetvalue{/pgfplots/table/@cell content}{\rotatebox{90}{##1}&}%
      \fi
      \fi
      }
    },
   %display columns/1/.style={dec sep align={r}}
  ]{
  one,two,three
  1,2.34,3
  2,1.45,4
  4,23.56,6
  5,2.45,9
  }
\end{document}

enter image description here

If I uncomment the commented line in an attempt to align the second column by decimal point, I get the following error:

! Misplaced \omit.
\multispan ->\omit 
                   \@multispan 
l.26 }

?

Can anyone provide a solution?

1 Answer 1

1

Use

  1. column name=\rotatebox{90}{two} for the second column
  2. assign column name/.style={ /pgfplots/table/column name={\rotatebox{90}{#1}}} for the other columns

%

\documentclass{standalone}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstabletypeset[col sep=comma,
   display columns/1/.style={
   column name=\rotatebox{90}{two}, % <---------
   dec sep align,
   },
  assign column name/.style={
/pgfplots/table/column name={\rotatebox{90}{#1}} % <-----------
},
  ]{
  one,,three % <------
  1,2.34,3
  2,1.45,4
  4,23.56,6
  5,2.45,9
  }
\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 .