0

I do not want my numbers to become string types in the transposed table.
What do I have to set in \pgfplotstabletranspose?

enter image description here

\documentclass[a4paper, landscape=false]{article}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}

\begin{document}
\section{Table}

\pgfplotstablenew[
create on use/Names/.style={create col/set list={Name-A, Name-B, Name-C}, string type},
columns={Names}, string type
]{7}\modulotable

\pgfplotsinvokeforeach{4,...,0}{%% .
% Calculations ================
\pgfmathsetmacro{\aaa}{#1}
\pgfmathsetmacro{\bbb}{\aaa+1}
\pgfmathsetmacro{\ccc}{\aaa*\bbb}
% Column ===================
\edef\next{%
\noexpand\pgfplotstablecreatecol[
create col/set list={\aaa, \bbb, \ccc}
]{No-#1}\noexpand\modulotable}\next
}%
%Table =============================
\noindent\pgfplotstabletypeset[%string type, % not wanted
columns/Names/.style={string type, column type=l},
]\modulotable

\section{Transposed Table Test}

\pgfplotstabletranspose[
header=true, 
%colnames from=Names, % works not...
%input colnames to=,
]\Target{\modulotable}
\pgfplotstabletypeset[ string type, % Problem
% columns/colnames/.style={string type, column type=l}, % works not
header=false, 
]{\Target}

\end{document}
1
  • Your main problem is that you specified 7 rows and only created 3. Dec 10, 2019 at 2:34

1 Answer 1

1

Changing Names to New Names was simply to keep track of which is which.

\documentclass[a4paper, landscape=false]{article}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.16}

\begin{document}
\section{Table}

\pgfplotstablenew[
create on use/Names/.style={create col/set list={Name-A, Name-B, Name-C}, string type},
columns={Names}, string type
]{3}\modulotable

\pgfplotsinvokeforeach{4,...,0}{%% .
% Calculations ================
\pgfmathsetmacro{\aaa}{#1}
\pgfmathsetmacro{\bbb}{\aaa+1}
\pgfmathsetmacro{\ccc}{\aaa*\bbb}
% Column ===================
\edef\next{%
\noexpand\pgfplotstablecreatecol[
create col/set list={\aaa, \bbb, \ccc}
]{No-#1}\noexpand\modulotable}\next
}%
%Table =============================
\noindent\pgfplotstabletypeset[%string type, % not wanted
columns/Names/.style={string type, column type=l},
]\modulotable

\section{Transposed Table Test}

\pgfplotstabletranspose[
header=true, 
colnames from=Names, % works not...
input colnames to=New Names,
]\Target{\modulotable}
\pgfplotstabletypeset[% string type, % Problem
columns/New Names/.style={string type, column type=l}, % works not
%header=false, 
]{\Target}

\end{document}

demo

You must log in to answer this question.

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