\usepackage{float}
\usepackage{bigstrut}
\usepackage{makecell}
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\sfdefault}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\begin{table}[H]
\centering
\caption{Add caption}
\begin{tabular}{r r}
\hline
\rowcolor{LightCyan}
\thead{Emax/V \\ $\Delta$= $\pm$ 0 V} & V2 (V) \bigstrut\\
\hline
1 & 2 \bigstrut\\
\end{tabular}
\end{table}
答案1
想必你想要
\renewcommand\theadfont{\sffamily}
并不是
\renewcommand\theadfont{\sfdefault}
\sfdefault
保存字体名称/标识符(此处cmss
),要实际使用无衬线字体,您需要\sffamily
。
\documentclass{article}
\usepackage{float}
\usepackage{bigstrut}
\usepackage{makecell}
\usepackage[table,svgnames]{xcolor}
\usepackage{siunitx} % for typesetting units and numbers with units
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\sffamily}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\begin{document}
\begin{table}[H]
\centering
\caption{Add caption}
\begin{tabular}{r r}
\hline
\rowcolor{LightCyan}
\thead{Emax/V \\ $\Delta= \pm 0$\,V} & V2 (V) \bigstrut\\
\thead{Emax/V \\ $\Delta= \SI[detect-family]{+-0}{\volt}$} & V2 (V) \bigstrut\\ % siunitx-alternative
\hline
1 & 2 \bigstrut\\
\end{tabular}
\end{table}
\end{document}