我想将表格的前缀从“表格 1”更改为“S 3”,文档仅包含该表格,因此我需要自己设置数字。我尝试了设置标题命令,但这只能解决“表格”变为“S”的问题,而不能解决“1”变为“3”的问题。我将非常感谢每一个提示。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[left=26mm,top=26mm,right=26mm,bottom=15mm]{geometry}
\usepackage{booktabs}
\usepackage{dcolumn,tabularx,ragged2e, caption}
\usepackage{threeparttable}
\captionsetup{singlelinecheck = false, justification=justified}\captionsetup[table]{name=S1 Descriptives Table}
\begin{document}
\begin{table}[htbp]
\centering
\begin{threeparttable}
\caption{}
\begin{tabular}{lll}
\textbf{}&\textbf{Mean/Prop.(unimputed) \tnote{1}}& \textbf{Range} \\
\toprule
\textbf{test test test} & 3.157 (0.044) & {0-12} \\
\textbf{test test test} & 25.8\% & \\
\bottomrule
\end{tabular}%
\begin{tablenotes}
\item[1] These values were calculated using weighted and imputed data.
\end{tablenotes}
\label{tab:addlabel}%
\end{threeparttable}
\end{table}%
\end{document}
答案1
这里有一个解决方案,它 (a) 修改 LaTeX 宏\tablename
,\thetable
并且 (b) 在语句(否则不显眼)之前立即将表号设置为预期数字减 1。这种方法保留了通过通常的/机制\caption
创建交叉引用的可能性。\label
\ref
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[hmargin=26mm,top=26mm,bottom=15mm]{geometry}
\usepackage{booktabs, caption}
\usepackage[flushleft]{threeparttable}
\captionsetup{singlelinecheck = false,
justification = justified,
labelsep = space} % <-- new
\renewcommand\tablename{S}
% Omit the next instruction if you want whitespace between "S" and the number:
\renewcommand\thetable{\unskip\arabic{table}}
\begin{document}
\begin{table}[htbp]
\setcounter{table}{2} % intended number minus 1
\centering
\begin{threeparttable}
\caption{Descriptive Table}
\label{tab:addlabel}
\begin{tabular}{@{}lll@{}}
\textbf{}&\textbf{Mean/Prop. (unimputed)\tnote{1}}& \textbf{Range} \\
\toprule
\textbf{test test test} & 3.157 (0.044) & 0--12 \\
\textbf{test test test} & 25.8\% & \\
\bottomrule
\end{tabular}
\begin{tablenotes}
\footnotesize
\item[1] These values were calculated using weighted and imputed data.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}