/更新/ 我怎样才能使表格标题直立?

/更新/ 我怎样才能使表格标题直立?

我想让表格的标题直立,而不是斜体。这是我现在正在编写的代码:

  • 更新:添加前言(仅包括与该问题相关的一些包)并删除一些冗余信息。

\documentclass{apa6}
\usepackage{stfloats}
\usepackage{sectsty}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}

\begin{table*}[bp]
\centering
 \vspace*{2em}
  \begin{threeparttable}
  \captionsetup{font=up, labelfont=bf, labelsep=newline}
  \caption[font={up}]{Behavioural performance during the perceptual judgement functional magnetic resonance imaging task}
  \label{tab:Beh}
  \begin{tabular}{*{7}{l}}  \toprule
  \multirow{2}*{} & \multicolumn{3}{l}{Young} & \multicolumn{3}{l}{Old} \\
  \cmidrule(lr){2-4}\cmidrule(lr){5-7} & Rep 1 & Rep 2 & Rep 3 & Rep 1 & Rep 2 & Rep3 \\
    \midrule
  Proportion correct & 0.90 (0.09) & 0.94 (0.07) & 0.94 (0.05) & 0.88 (0.10) & 0.90     (0.08) & 0.91 (0.09) \\ 
RT (ms) & 783 (68) & 669 (53) & 662 (81) & 938 (113) & 830 (121) & 811 (107) \\
\bottomrule
\end{tabular}
\smallskip

   \begin{tablenotes}
 {\small
        Accuracy and reaction time (RT) means (standard deviation) for stimuli presented the first time (Rep 1), second time (Rep 2), and third time (Rep 3) in the perceptual judgement task.
                 }
    \end{tablenotes}
  \end{threeparttable}
\end{table*}

\end{document}

事情是这样的: 在此处输入图片描述

我想将“感知判断功能磁共振成像任务中的行为表现”改为直立形式,而不是斜体。我尝试使用包“caption”并进行设置,\captionsetup{font=up}但没有成功。

先感谢您!

答案1

好吧,如果你检查类的代码,apa6.cls你可以找到以下代码:

\ifapamode{% man
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
}{% jou
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent
}\textit{#1}} % <===========================================================
}{% doc
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}
}

我用 : 标记了相关位置<=========,其中定义了标题应为斜体。要摆脱该更改\textit{\textup{在@mico 的评论中提到):

ifapamode{% man
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
}{% jou
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent
}\textup{#1}} % <================================================================
}{% doc
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}
}

完整代码如下

\documentclass{apa6} % 

\ifapamode{% man
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}\raggedright#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\raggedright\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\raggedright\textit{#1}}
}{% jou
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent
}\textup{#1}} % <================================================================
}{% doc
    \DeclareCaptionLabelFormat{tablelabel}{\hspace{-\parindent}#1 #2}
    \DeclareCaptionLabelFormat{figurelabel}{\hspace{-\parindent}\textit{#1 #2}}
    \DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}
}

\usepackage{multirow}

\begin{document}

\begin{table*}[bp]
\centering
 \vspace*{2em}
  \begin{threeparttable}
  \captionsetup{font=up, labelfont=bf, labelsep=newline}
  \caption[font={up}]{Behavioural performance during the perceptual judgement functional magnetic resonance imaging task}
  \label{tab:Beh}
  \begin{tabular}{*{7}{l}}  \toprule
  \multirow{2}*{} & \multicolumn{3}{l}{Young} & \multicolumn{3}{l}{Old} \\
  \cmidrule(lr){2-4}\cmidrule(lr){5-7} & Rep 1 & Rep 2 & Rep 3 & Rep 1 & Rep 2 & Rep3 \\
    \midrule
  Proportion correct & 0.90 (0.09) & 0.94 (0.07) & 0.94 (0.05) & 0.88 (0.10) & 0.90     (0.08) & 0.91 (0.09) \\ 
RT (ms) & 783 (68) & 669 (53) & 662 (81) & 938 (113) & 830 (121) & 811 (107) \\
\bottomrule
\end{tabular}
\smallskip

   \begin{tablenotes}
 {\small
        Accuracy and reaction time (RT) means (standard deviation) for stimuli presented the first time (Rep 1), second time (Rep 2), and third time (Rep 3) in the perceptual judgement task.
                 }
    \end{tablenotes}
  \end{threeparttable}
\end{table*}

\end{document}

得到结果:

在此处输入图片描述

但请注意:如果你必须提交论文,请不要像这样改变风格apa6。期刊希望标题采用斜体字母……

答案2

  • 据我所知,默认行为是表格标题中的直立文本。
  • 我附加了一个小例子来说明我的意思。
  • 我认为你的序言中有一个包caption包括。
  • textfont = it您是否在序言中看到类似内容作为caption-package 的选项?
  • 更新:在您的代码中,我看到了\captionsetup{font=up, labelfont=bf, labelsep=newline},所以我假设您知道该caption包。如果您不提供更多信息,很难提供帮助。

\documentclass{article}
\usepackage{threeparttable}

\begin{document}

% Example taken from https://tex.stackexchange.com/questions/118743 and modified
\begin{table}
\caption{Some very informative caption}
\begin{threeparttable}
\begin{tabular}{lll}
TextText\tnote{1} & TextText & TextText \\ 
TextText & TextText\tnote{2} & TextText \\ 
\end{tabular}
\begin{tablenotes}
\item[1] Some remark. \item[2] Another remark.
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document}

在此处输入图片描述


无关,也许让自己熟悉这里的“规则”,例如https://stackoverflow.com/help/how-to-ask我刚刚被要求写一个最简单的例子,那是什么?

答案3

正如指出的那样这个答案apa6文档类会自动加载包,并通过指令设置相关标题caption的文本部分的格式table

\DeclareCaptionTextFormat{tabletext}{\hspace{-\parindent}\textit{#1}}

要重新定义它,只需运行

\DeclareCaptionTextFormat{tabletext}{\textup{#1}}

在你的序言中。

补充:正如@egreg在另一条评论中指出的那样,文件中的LaTeX代码质量apa6.cls并不高。也就是说,\hspace{-\parindent}原始形式的指令\DeclareCaptionTextFormat没有任何用处,因为长度参数在和环境中自动\parindent设置为0 ;因此,没有任何作用,应该省略。tablefigure\hspace{-\parindent}

相关内容