手动设置粗体后如何去除表格单元格中文本上方的空格?谢谢
\documentclass[12pt,a4paper]{report}
\usepackage[table]{xcolor}
\usepackage{booktabs}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{multirow, tabularx}
\captionsetup{justification=centering}
\usepackage{xfakebold}
\newcommand{\fbseries}{\unskip\setBold\aftergroup\unsetBold\aftergroup\ignorespaces}
\makeatletter
\newcommand{\setBoldness}[1]{\def\fake@bold{#1}}
\makeatother
\begin{document}
\setBoldness{2}
\begin{table}[!htp]
\centering
\begin{tabularx}{\textwidth}{|l|l|*{6}{>{\centering\arraybackslash}X|}l|}
\hline
\multirow{2}{*}{Name} &
\multirow{2}{*}{H} &
\multicolumn{2}{c|}{A} &
\multicolumn{2}{c|}{A} &
\multicolumn{2}{c|}{A} &
\multirow{2}{*}{Note} \\
\cline{3-8}
& & {\fbseries BAD} & J & K & L & M & N & \\
\hline
A & 4180 & & & & & & & \\
\hline
\end{tabularx}
\end{table}
\end{document}
答案1
我需要一些不那么大胆的东西,一些介于两者之间的东西......
假设你正在使用 Computer Modern 字体系列,我建议你使用它的非扩展粗体字体粗细。幸运的是,这种字体粗细没有表现出你拼凑起来的“假粗体”(fb)字体粗细的任何特质[!]。而且,它比 Computer Modern 的标准粗体(又名加粗扩展、字体粗细。
\documentclass{report}
\usepackage{tabularx}
\usepackage{xfakebold}
%% Do you need \unskip, \aftergroup [twice!], and \ignorespaces?
\newcommand{\fbseries}{\setBold}
\makeatletter
\newcommand{\setBoldness}[1]{\def\fake@bold{#1}}
\makeatother
\newcommand{\nbold}{\fontseries{b}\selectfont}
\begin{document}
\setBoldness{2}
\noindent
\begin{tabularx}{\textwidth}{|l|l| *{6}{X|} l|}
\hline
Name & 4180 & \fbseries BAD & J & K & L & M & N & Note\\ \hline
B & 4180 & \nbold BAD & O & P & Q & R & S & \\ \hline
C & 4180 & \bfseries BAD & T & U & V & W & X & \\ \hline
\end{tabularx}
\end{document}