对于我的论文,我想创建一个新的标题,内容是模型 1,模型 2到目前为止,我已经开始说模型,但尚未编号。
我已经使用过这个命令:
\captionsetup[model]{name=Model, labelformat = original}
我想在以下设置中使用它:
\begin{center}
\begin{tabular}
bla bla bla
\end{tabular}
\captionof{model}{caption}\label{Tab:model1}}
\end{center}
我应该在标题设置中添加什么内容来确保它能正确地进行编号?
提前致谢!
答案1
它也适用于\captionof
:
\documentclass{book}
\usepackage[skip=1ex,
font=small, labelfont=bf]
{caption}
\renewcommand{\tablename}{Model}
\begin{document}
\begin{table}[ht]
\centering
\begin{tabular}{|c|}
\hline
table I \\
\hline
\end{tabular}
\captionof{table}{A caption II}
\end{table}
\begin{center} % <---
\centering
\begin{tabular}{|c|}
\hline
table \\
bla bla bla bla bla \\
\hline
\end{tabular}
\captionof{table}{A caption II} % <---
\label{tab:model1}
\end{center}
See table \ref{tab:model1} ...
\end{document}
答案2
更新
在新环境下model
,您可以分别对常规表和模型表进行编号和引用。
该环境需要 2 个参数:标题和表格本身,均在括号内。
采用这种方法,模型就不会浮动,它们会停留在放置它们的位置,我认为这是一个优点。
\documentclass[12pt,a4paper]{book}
\usepackage{caption}
\captionsetup[table]{position=bottom,
labelfont={bf, small},
labelsep=space,
textfont={small},
aboveskip=3pt,
singlelinecheck=off,
justification=centering}
% ******************** added
\newcounter{modelnumber}
\newenvironment{model}[2]{%
\refstepcounter{modelnumber}
\begin{minipage}{\linewidth}
#2 \smallskip\par
\small\textbf{Model~\themodelnumber}\, #1%
\end{minipage}
}
{\medskip}
\begin{document}
\begin{model}{A caption for model I\label{Tab:model1}}
{\centering
\begin{tabular}{c}
model model model
\end{tabular}}
\end{model}
\begin{table}[ht!]
\centering
\begin{tabular}{c}
normal table
\end{tabular}
\caption{A caption for table I}\label{Tab:table1}
\end{table}
\begin{model}{A caption for model II\label{Tab:model2}}
{\centering
\begin{tabular}{c}
model model model model model
\end{tabular}}
\end{model}
\begin{table}[ht!]
\centering
\begin{tabular}{c}
Another normal table
\end{tabular}
\caption{A caption for table II}\label{Tab:table2}
\end{table}
See Table~\ref{Tab:table1} and Table~\ref{Tab:table2}, and also Model~\ref{Tab:model1} and Model~\ref{Tab:model2}
\end{document}
使用该包,除了和之外,还可以添加一个新的浮点数()。newfloat
用于列出所有模型。Model
table
figure
\listofModels
\documentclass[12pt,a4paper]{book}
\usepackage{newfloat}% added <<<<
\DeclareFloatingEnvironment[fileext=fml,placement={!ht},name=Model]{Model} % fmodel as a new float
\usepackage{lipsum}% dummy text
\usepackage{caption}
\captionsetup[table]{position=bottom,
labelfont={bf, small},
labelsep=space,
textfont={small},
aboveskip=3pt,
singlelinecheck=off,
justification=centering}
\captionsetup[Model]{position=bottom,
labelfont={bf, small},
labelsep=space,
textfont={small},
aboveskip=3pt,
singlelinecheck=off,
justification=centering}
\newenvironment{model} % added <<<<<<<<<<
{\begin{Model}[tb]
}% send to top or bottom by using [tb]
{\end{Model}}
\begin{document}
\listoftables
\listofModels % <<<<<<<<<<<<<<<<<
\pagestyle{plain}\cleardoublepage
\lipsum[2]
\begin{model}
\centering
\begin{tabular}{c}
model model model model
\end{tabular}
\captionof{Model}{A caption for model I}\label{Tab:model1}
\end{model}
\begin{table}[ht!]
\centering
\begin{tabular}{c}
normal table
\end{tabular}
\caption{A caption for table I}\label{Tab:table1}
\end{table}
\begin{model}
\centering
\begin{tabular}{c}
model model model model model
\end{tabular}
\captionof{Model}{A caption for model II}\label{Tab:model2}
\end{model}
\begin{table}[ht!]
\centering
\begin{tabular}{c}
Another normal table
\end{tabular}
\caption{A caption for table II}\label{Tab:table2}
\end{table}
See Table~\ref{Tab:table1} and Table~\ref{Tab:table2}, and also Model~\ref{Tab:model1} and Model~\ref{Tab:model2}
\end{document}