我已经写完并排版了大部分论文。目前,我有一份图表清单和一份表格清单。
然而,现在我的委员会告诉我,我还必须有一份计划清单。在化学中,方案是包含化学结构和反应(图像)的环境。
不幸的是,我已经将化学结构编码为图形。有几个包,例如chemstyle
和chemscheme
,它们似乎提供了自己的方案构造。但是,我宁愿不使用它们,因为其中一些包为化学公式等设置了自己的默认值。(例如,我看到chemstyle
包定义了\ie
,但我的论文中已经有了自己的定义\ie
。)我已经在使用chemformula
和chemmacros
包。
有什么方法可以更简单地创建自己的 Scheme 环境?我需要的唯一区别是方案应该标记为“方案”并列在方案列表中。换句话说,数字和方案之间的唯一区别在于记账。
这是我的 MWE,其中包含我正在使用的几个关键软件包。一个可能的复杂因素是,我使用了subcaption
包来创建子图。通常,每个图/方案只有一个图像,但我使用\phantomsubcaption
来自subcaption
包。另外,我正在使用tocloft
包来调整图表和表格列表中的间距,这可能会使事情变得更加复杂。
最后,如果我能将新的“方案”环境与cleveref
包,因为我\cref
经常使用该包中的命令来参考图形、表格等。
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{booktabs}
\usepackage{acro}
\acsetup{
barriers/use, barriers/reset,
use-id-as-short,
}
\newcommand{\ie}{i.e.}
\newcommand{\eg}{e.g.}
\newcommand{\cf}{cf.}
\newcommand{\avg}[1]{\overline{#1}}
\usepackage{mdframed}
\usepackage[capitalize]{cleveref}
\usepackage{chemformula}
\setchemformula{charge-hshift=.5pt}
\usepackage{chemmacros}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{tabto}
\usepackage[titles]{tocloft}
\setlength{\cftfignumwidth}{2.9em}
\setlength{\cfttabnumwidth}{2.9em}
\begin{document}
\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures
% \phantomsection %% Remove if using hyperref
\addcontentsline{toc}{chapter}{\listtablename}
\listoftables
\chapter{First chapter}
Text in the first chapter.
Refer to \cref{fig:firstfig} using cleveref package.
Refer to \cref{tbl:firsttbl}.
Refer to \cref{fig:multi}, \cref{fig:multi:a}, and \cref{fig:multi:b}.
Refer to eventual scheme, \cref{scm:eventualscheme}.
Refer to eventual multi-part scheme, \cref{scm:eventualmultischeme}.
% Example figure
\begin{figure}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\caption{Caption of figure in first chapter.}\label{fig:firstfig}
\end{figure}
% Example table
\begin{table}[!h]
\centering
\begin{tabular}{ll}
\toprule
A & B\\
\bottomrule
\end{tabular}
\caption{Caption of table in first chapter.}\label{tbl:firsttbl}
\end{table}
% MULTIPART FIGURE
\begin{figure}[!h]
\centering
\begin{subfigure}{\textwidth}
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\phantomsubcaption\label{fig:multi:a}
\end{subfigure}
\begin{subfigure}{0pt}
\phantomsubcaption\label{fig:multi:b}
\end{subfigure}
\caption{Caption of figure referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{fig:multi}
\end{figure}
% I NEED TO CHANGE THE FOLLOWING FIGURE TO A SCHEME (SINGLE-PART SCHEME)
\begin{figure}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image-a}
\caption{Caption of eventual scheme.}\label{scm:eventualscheme}
\end{figure}
% I NEED TO CHANGE THE FOLLOWING FIGURE TO A SCHEME (MULTI-PART SCHEME, BUT ONLY WITH ONE IMAGE)
\begin{figure}[!h]
\centering
\begin{subfigure}{\textwidth}
\centering
\includegraphics[width=0.02\textwidth]{example-image-b}
\phantomsubcaption\label{scm:eventualmultischeme:a}
\end{subfigure}
\begin{subfigure}{0pt}
\phantomsubcaption\label{scm:eventualmultischeme:a}
\end{subfigure}
\caption{Caption of eventual scheme referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{scm:eventualmultischeme}
\end{figure}
\chapter{Second chapter}
Text in the second chapter.
Refer to \cref{fig:secondfig}.
% Another example figure
\begin{figure}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\caption{Caption of figure in second chapter.}\label{fig:secondfig}
\end{figure}
\end{document}
答案1
下列显示了如何将chemmacros
'scheme
模块 与subcaption
和结合起来cleveref
。
- 方案列表:
- 方案和子方案的参考:
- 方案说明:
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{booktabs}
\usepackage{acro}
\acsetup{
barriers/use, barriers/reset,
use-id-as-short,
}
\newcommand{\ie}{i.e.}
\newcommand{\eg}{e.g.}
\newcommand{\cf}{cf.}
\newcommand{\avg}[1]{\overline{#1}}
\usepackage{mdframed}
\usepackage{chemformula}
\setchemformula{charge-hshift=.5pt}
\usepackage{chemmacros}
\chemsetup{modules=scheme}
\AtEndPreamble{\DeclareCaptionSubType*{scheme}}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{tabto}
\usepackage[titles]{tocloft}
\setlength{\cftfignumwidth}{2.9em}
\setlength{\cfttabnumwidth}{2.9em}
\usepackage[capitalize]{cleveref}
\crefformat{subscheme}{\schemename~#2#1#3}
\begin{document}
\addcontentsline{toc}{chapter}{\listfigurename}
\listoffigures
% \phantomsection %% Remove if using hyperref
\addcontentsline{toc}{chapter}{\listtablename}
\listoftables
\addcontentsline{toc}{chapter}{\listschemename}
\listofschemes
\chapter{First chapter}
Text in the first chapter.
Refer to \cref{fig:firstfig} using cleveref package.
Refer to \cref{tbl:firsttbl}.
Refer to \cref{fig:multi}, \cref{fig:multi:a}, and \cref{fig:multi:b}.
Refer to eventual scheme, \cref{scm:eventualscheme}.
Refer to eventual multi-part scheme, \cref{scm:eventualmultischeme}, \cref{scm:eventualmultischeme:a}, and \cref{scm:eventualmultischeme:b}.
\begin{figure}[!h]
\caption{Caption of figure in first chapter.}\label{fig:firstfig}
\end{figure}
\begin{table}[!h]
\caption{Caption of table in first chapter.}\label{tbl:firsttbl}
\end{table}
\begin{figure}[!h]
\begin{subfigure}{\textwidth}
\phantomsubcaption\label{fig:multi:a}
\end{subfigure}
\begin{subfigure}{0pt}
\phantomsubcaption\label{fig:multi:b}
\end{subfigure}
\caption{Caption of figure referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{fig:multi}
\end{figure}
\begin{scheme}[!h]
\caption{Caption of scheme.}\label{scm:eventualscheme}
\end{scheme}
\begin{scheme}[!h]
\begin{subfigure}{\textwidth}
\phantomsubcaption\label{scm:eventualmultischeme:a}
\end{subfigure}
\begin{subfigure}{0pt}
\phantomsubcaption\label{scm:eventualmultischeme:b}
\end{subfigure}
\caption{Caption of scheme referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{scm:eventualmultischeme}
\end{scheme}
\chapter{Second chapter}
Text in the second chapter.
Refer to \cref{fig:secondfig}.
\begin{figure}[!h]
\caption{Caption of figure in second chapter.}\label{fig:secondfig}
\end{figure}
\begin{scheme}[!h]
\caption{Caption of scheme.}\label{scm:eventualscheme2}
\end{scheme}
\end{document}
附注:5.11a 版(2020-11-21)之前的版本chemmacros
\listofschemes
与该类不兼容book
。(另请参阅:对应的错误报告)如果上述解决方案对您不起作用,请考虑更新到版本5.11a
或更新版本。
为了简短地回答这个问题,我删除了使用 5.11 版本的 MWE,在其中我展示了如何克服方案列表和图形列表之间的一些格式不一致问题。
答案2
加载的newfloat
包和scheme
模块chemmacros
。
您只需为其设置一个subscheme
环境subcaption
,这必须在开始文档时完成。
我已加载,tocbibind
以便将\listoffigures
和添加\listoftables
到目录中。您的手动方法不正确:您至少应该\cleardoublepage
在 之前\addcontentsline
。
\documentclass[oneside,11pt]{book}
\usepackage[semibold,tt=false]{libertine}
\usepackage{libertinust1math}
\usepackage[font={sf,small},labelsep=quad,labelfont=sc]{caption}
\usepackage[subrefformat=parens]{subcaption}
\usepackage{newfloat}
\usepackage[
expansion = false ,
tracking = smallcaps ,
letterspace = 40 ,
]{microtype}
\usepackage{booktabs}
\usepackage{acro}
\usepackage{mdframed}
\usepackage{chemformula}
\usepackage{chemmacros}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{tabto}
\usepackage[titles]{tocloft}
\usepackage[nottoc]{tocbibind}
\usepackage[capitalize]{cleveref} % should be last
% acro options
\acsetup{
barriers/use, barriers/reset,
use-id-as-short,
}
% chemmacros options
\usechemmodule{scheme}
% chemformula options
\setchemformula{charge-hshift=.5pt}
% tocloft options
\setlength{\cftfignumwidth}{2.9em}
\setlength{\cfttabnumwidth}{2.9em}
% caption options
\AtBeginDocument{\DeclareCaptionSubType*[alph]{scheme}}
% personal commands
\newcommand{\ie}{i.e.}
\newcommand{\eg}{e.g.}
\newcommand{\cf}{cf.}
\newcommand{\avg}[1]{\overline{#1}}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\listofschemes
\chapter{First chapter}
Text in the first chapter.
Refer to \cref{fig:firstfig} using cleveref package.
Refer to \cref{tbl:firsttbl}.
Refer to \cref{fig:multi}, \cref{fig:multi:a}, and \cref{fig:multi:b}.
Refer to eventual scheme, \cref{scm:eventualscheme}.
Refer to eventual multi-part scheme, \cref{scm:eventualmultischeme}.
% Example figure
\begin{figure}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\caption{Caption of figure in first chapter.}\label{fig:firstfig}
\end{figure}
% Example table
\begin{table}[!h]
\centering
\begin{tabular}{ll}
\toprule
A & B\\
\bottomrule
\end{tabular}
\caption{Caption of table in first chapter.}\label{tbl:firsttbl}
\end{table}
% MULTIPART FIGURE
\begin{figure}[!h]
\centering
\begin{subfigure}{0.45\textwidth}
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\phantomsubcaption\label{fig:multi:a}
\end{subfigure}
\begin{subfigure}{0.45\textwidth}
\includegraphics[width=0.02\textwidth]{example-image}
\phantomsubcaption\label{fig:multi:b}
\end{subfigure}
\caption{Caption of figure referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{fig:multi}
\end{figure}
\begin{scheme}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image-a}
\caption{Caption of eventual scheme.}\label{scm:eventualscheme}
\end{scheme}
\begin{scheme}[!h]
\centering
\begin{subscheme}{0.45\textwidth}
\centering
\includegraphics[width=0.02\textwidth]{example-image-a}
\phantomsubcaption\label{scm:eventualmultischeme:a}
\end{subscheme}
\begin{subscheme}{0.45\textwidth}
\includegraphics[width=0.02\textwidth]{example-image-b}
\phantomsubcaption\label{scm:eventualmultischeme:b}
\end{subscheme}
\caption{Caption of eventual scheme referring to parts \subref{fig:multi:a} and \subref{fig:multi:b} with subref command.}\label{scm:eventualmultischeme}
\end{scheme}
\chapter{Second chapter}
Text in the second chapter.
Refer to \cref{fig:secondfig}.
% Another example figure
\begin{figure}[!h]
\centering
\includegraphics[width=0.02\textwidth]{example-image}
\caption{Caption of figure in second chapter.}\label{fig:secondfig}
\end{figure}
\end{document}
答案3
正如@leandriis 在评论中指出的那样,该chemmacros
软件包显然已经满足您的要求。
否则,你只需要添加以下行
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=los,placement={!ht},name=Scheme]{myscheme}
\captionsetup[myscheme]{labelfont=bf}
\crefname{myscheme}{scheme}{schemes}
myscheme
到你的序言中,然后可以使用类似于 的新浮点类型figures
。方案列表是用 生成的\listofmyschemes
。