![/更新/ 我怎样才能使表格标题直立?](https://linux22.com/image/388144/%2F%E6%9B%B4%E6%96%B0%2F%20%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E4%BD%BF%E8%A1%A8%E6%A0%BC%E6%A0%87%E9%A2%98%E7%9B%B4%E7%AB%8B%EF%BC%9F.png)
我想让表格的标题直立,而不是斜体。这是我现在正在编写的代码:
- 更新:添加前言(仅包括与该问题相关的一些包)并删除一些冗余信息。
\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 ;因此,没有任何作用,应该省略。table
figure
\hspace{-\parindent}