仅为一个表格加粗标题

仅为一个表格加粗标题

我无法仅将一个标题设为粗体,而文档中的其他标题则不设为粗体。在下面的示例中,我希望仅将表格的标题设为粗体,而不影响图形的标题。

\documentclass[12pt]{article}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{pstricks}
\usepackage{multirow}
\usepackage{geometry}
\usepackage{graphics}
\usepackage{booktabs, threeparttable, stackengine}
\usepackage{array}
\setstackgap{L}{12pt}

\begin{document}
\begin{table}
\caption{\textbf{Prisoner's Dilemma}}
\centering

    \begin{tabular}{cc|cc|}\cline{3-4}
& & \multicolumn{2}{c|}{Soda Inc.} \\\cline{3-4}
& & High Price & \multicolumn{1}{|c|}{Low Price} \\\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\Longstack{Cola Kings}}} & High Price & $50,50$ &\multicolumn{1}{|c|}{$10,60$}\\\cline{2-4}
\multicolumn{1}{|c|}{}& Low Price & $60,10$ &\multicolumn{1}{|c|}{\underline{$30$},\underline{$30$}}\\\hline 

\end{tabular}
\end{table}

\begin{figure}
This is a figure.
\caption{This is a figure}
\end{figure}

\end{document}

答案1

我建议您装载caption包裹并发出指令

\captionsetup{font=bf}

紧接着\begin{table}(和之前\caption{...})。此设置只会影响表格标题,而不会影响后面的图形标题。

在此处输入图片描述

\documentclass[12pt]{article}
% deleted all packages not needed for the present example...
\usepackage{multirow}
\usepackage{stackengine}
\setstackgap{L}{12pt}
\usepackage[skip=0.5\baselineskip]{caption}
\begin{document}
\begin{table}
\captionsetup{font=bf}
\caption{Prisoner's Dilemma}
\centering
\begin{tabular}{cc|cc|}\cline{3-4}
& & \multicolumn{2}{c|}{Soda Inc.} \\
\cline{3-4}
& & High Price & \multicolumn{1}{|c|}{Low Price} \\
\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\Longstack{Cola Kings}}} & High Price & $50,50$ &\multicolumn{1}{|c|}{$10,60$}\\
\cline{2-4}
\multicolumn{1}{|c|}{}& Low Price & $60,10$ &\multicolumn{1}{|c|}{\underline{$30$},\underline{$30$}}\\
\hline 

\end{tabular}
\end{table}

\begin{figure}[h!]
\caption{This is a figure. The caption isn't in bold\dots}
\end{figure}

\end{document}

相关内容