我不希望我的数字在转置表中变成字符串类型。
我必须设置什么\pgfplotstabletranspose
?
\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
将名称更改为新名称只是为了跟踪哪个是哪个。
\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}