![如何在保留数字格式的同时用粗体字体突出显示 pgfplotstable 单元格?](https://linux22.com/image/320810/%E5%A6%82%E4%BD%95%E5%9C%A8%E4%BF%9D%E7%95%99%E6%95%B0%E5%AD%97%E6%A0%BC%E5%BC%8F%E7%9A%84%E5%90%8C%E6%97%B6%E7%94%A8%E7%B2%97%E4%BD%93%E5%AD%97%E4%BD%93%E7%AA%81%E5%87%BA%E6%98%BE%E7%A4%BA%20pgfplotstable%20%E5%8D%95%E5%85%83%E6%A0%BC%EF%BC%9F.png)
我想突出显示 pgfplotstable 中的单元格,但粗体字体设置会覆盖我的数字格式。如何防止这种情况?
以下是 MWE:
\documentclass[12pt]{standalone}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\begin{filecontents}{data.csv}
0.563725,0.819520,0.713402
0.563725,0.819520,0.713402
\end{filecontents}
\pgfplotstabletypeset[
col sep=comma,
every row 1 column 1/.style={
postproc cell content/.style={
@cell content=\textbf{##1}
}
},
fixed,fixed zerofill,
precision=1,
multiply with=100,
]{data.csv}
\end{document}
输出为:
答案1
你可以 @cell content=\textbf{##1}
用@cell content/.add={$\bf}{$}
代码
\documentclass[12pt]{standalone}
\usepackage{xcolor}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}
\begin{filecontents}{data.csv}
0.563725,0.819520,0.713402
0.563725,0.819520,0.713402
\end{filecontents}
\pgfplotstabletypeset[
col sep=comma,
every row 1 column 1/.style={
postproc cell content/.style={
@cell content/.add={$\bf}{$}
}
},
fixed,fixed zerofill,
precision=1,
multiply with=100,
]{data.csv}
\end{document}
结果