问题

问题

在我使用 pgfplotstable 进行实验时,我遇到了一些问题:

问题

我似乎无法正确地将其添加\multicolumn{}{}{}到我的便携式图形格式绘图表中。

我查看过以下问题:

例子

\documentclass{article}
\usepackage{fontspec}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage{multicol}% <-- Don't think this is needed.
\pgfplotstableset{% Global config
    every head row/.style={before row=\toprule,after row=\midrule},
    every last row/.style={after row=\bottomrule},
    col sep=&,
    row sep=\\,
    column type=l,
    column type={>{\fontseries{bx}\selectfont\color{orange}}l}, %see sec 2.6 for defining column types
    string type,
    postproc cell content/.append style={ % see sec 3.2
    /pgfplots/table/@cell content/.add={\fontseries{\seriesdefault}\selectfont\color{black}}{}}
}%

\begin{document}
\pgfplotstabletypeset{%
col1 & col2 & col3\\ 
here & more & stuff\\
for & good & looks \\ % \multicolumn{2}{c}{good looks} % <-- Replacing the cells "good" and look" with this causes problems
}%
\end{document}

答案1

我认为最好给出真正的最小工作示例。有很多内容与问题无关...

也许,你正在寻找这样的东西:

\pgfplotstableset{
every row no 0/.append style={after row={
for & \multicolumn{2}{c}{\color{red} good   looks} \\
}},
}

在此处输入图片描述

% arara: lualatex

%\documentclass{article}
\documentclass[margin=5mm]{standalone}
\usepackage{fontspec}
\usepackage{booktabs}
\usepackage{pgfplotstable}

%\usepackage{multicol}% <-- Don't think this is needed.

\pgfplotstableset{% Global config
    every head row/.style={before row=\toprule,after row=\midrule},
    every last row/.style={after row=\bottomrule},
    col sep=&,
    row sep=\\,
    column type=l,
    column type={>{\fontseries{bx}\selectfont\color{orange}}l}, %see sec 2.6 for defining column types
    string type,
    postproc cell content/.append style={ % see sec 3.2
    /pgfplots/table/@cell content/.add={\fontseries{\seriesdefault}\selectfont\color{black}}{}
},
%
}%

\begin{document}
\pgfplotstableset{
every row no 0/.append style={after row={
for & \multicolumn{2}{c}{\color{red} good   looks} \\
}},
}



\pgfplotstabletypeset{%
col1 & col2 & col3\\ 
here & more & stuff\\
for & good  & looks \\ % \multicolumn{2}{c}{good looks} \\% <-- Replacing the cells "good" and look" with this causes problems
}%
\end{document}

相关内容