pgfplotstable:如何在循環中使用 \pgfplotstablevertcat

pgfplotstable:如何在循環中使用 \pgfplotstablevertcat

我知道有其他選擇也。

但我想知道: 如何在循環中建立單行表,然後將它們新增到先前的總計表中?

在以下嘗試中,僅接受目前循環值。

我怎樣才能解決這個問題?
\pgfplotstablevertcat我對此功能特別感興趣。
這可能嗎?

在此輸入影像描述

\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}


\begin{document}
\section{Create following Table row by row}
\pgfplotstabletypeset[header=true, col sep=comma]{
k, 2k
1, 2
2, 4
3, 6
} 


\section{Try}
\pgfplotstableread[header=false, col sep=comma]{
k,    2k
}{\main}

Startsituation: \pgfplotstabletypeset[string type]{\main} 

\subsection{Loop}
\pgfplotsforeachungrouped \k in {1,2,3} {%%
\pgfmathsetmacro\Double{2*\k}
\pgfplotstableread[header=false, col sep=comma, 
row sep=\\ % <--- seems that he wants that............
]{
\k, \Double \\
}{\temp}

\noindent Temprow (good!): \pgfplotstabletypeset[]{\temp} 

\pgfplotstablevertcat{\main}{\temp} 
\noindent Tempsituation (bad!): \pgfplotstabletypeset[string type]{\main} 
}%%
\end{document}

相關內容