![最小工作示例:](https://linux22.com/image/378846/%E6%9C%80%E5%B0%8F%E5%B7%A5%E4%BD%9C%E7%A4%BA%E4%BE%8B%EF%BC%9A.png)
对于我的论文,我希望能够将所有图表和表格(基本上是所有可浮动的内容,但就我而言,我认为我只会使用图表)暂停到附录中,将它们全部收集在一起 - 最好是图表列表,然后是表格列表,依此类推。此外,它们应该保留如果放在文本中会收到的编号。因为我正在使用记事本我希望他们分别保留章节编号。
边注:我已经尝试过这个包端浮点 关联这在某种程度上满足了我的愿望,但:
1)将图表和表格放在结尾整个文档,但我更喜欢另一个地方
2)从第二次运行开始产生编译错误,导致我无法从那时起编译文档。
最小工作示例:
现在我的文件看起来像这样(我把大部分包留在里面,以便在发布答案之前避免可能的冲突。如果它们使文档有点混乱,我很抱歉):
\documentclass[a4paper, 12pt, toc=listof, titlepage, toc=bibliography, open=right, ngerman]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style = ieee, urldate =comp, citestyle = numeric-comp]{biblatex}
\addbibresource{tex/mybib.bib}
\DefineBibliographyStrings{german}{
andothers = \mkbibemph{et al\adddot},
url = [Online]\adddot\addspace Url:
}
\usepackage[sfdefault,lf]{carlito}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[onehalfspacing]{setspace}
\usepackage[margin=12pt,font=sf,labelfont=bf]{caption}
\usepackage[format=hang,justification=centering,singlelinecheck=off]{caption}
\usepackage[a4paper,inner=3.5cm,outer=2.5cm,includeheadfoot,top=2cm,bottom=2cm,footskip=1cm]{geometry}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage[unicode=true,bookmarks=false,breaklinks=true,colorlinks=true,allcolors=blue]{hyperref}
\usepackage{listings}
\usepackage[nottoc]{tocbibind}
\usepackage{url}
\usepackage[toc,style=long,entrycounter,]{glossaries}
\renewcommand*{\glsentrycounterlabel}{}
\makeglossaries
%\loadglsentries[main]{./tex/acronyms}
\selectlanguage{ngerman}
\usepackage[headsepline]{scrlayer-scrpage}
\begin{document}
\sloppy
\overfullrule=2cm
\pagenumbering{Roman}
The titlepage
\normalsize
\vspace*{10cm}
\thispagestyle{empty}
\newpage
% Abstract
Abstract here
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\pagenumbering{arabic}
% actual content here
\chapter{My test chapter}
Chapter description
\section{My test section}
Section description
\begin{figure}[p]
\centering
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\\ \vspace{1cm}
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
% \hfill
\caption{Some figures}
\end{figure}
\chapter{Next chapter}
Next chapter description
\section{Next Section}
Next section description
\cleardoubleoddpage
% beginning of appendix
\pagenumbering{Alph}
%
% This is the place where I want my figures to actually appear
%
\printglossary[title={Glossar}]
\setlength{\emergencystretch}{3em}
\printbibliography
\end{document}
您会发现自己有一份长达十三页的文档,其中只有 3 页是章节和图表内容(从第 9 页到第 11 页)。我在代码中标记了我想要放置浮动元素的空间(好像我可以在那里写一个命令来强制它)。
答案1
在下面,仅使用 endfloat 将导致标题编号使用当前章节编号(在本例中为 2.1 而不是 1.1)。宏\savecaptionof
需要在每个图形或表格后面。 \restorecaptionof
重新定义\thefigure
或\thetable
使用这些存储的值。
我不确定\label
会有什么效果,但每页一个图就应该可以正常工作。
\documentclass[a4paper, 12pt, toc=listof, titlepage, toc=bibliography,
open=right, ngerman]{scrbook}
%\usepackage[utf8]{inputenc}% ASCII here
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style = ieee, urldate =comp, citestyle = numeric-comp]{biblatex}
\addbibresource{tex/mybib.bib}
\DefineBibliographyStrings{german}{
andothers = \mkbibemph{et al\adddot},
url = [Online]\adddot\addspace Url:
}
\usepackage[sfdefault,lf]{carlito}
%\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[onehalfspacing]{setspace}
\usepackage[margin=12pt,font=sf,labelfont=bf,format=hang,justification=centering,singlelinecheck=off]{caption}
\usepackage[a4paper,inner=3.5cm,outer=2.5cm,includeheadfoot,top=2cm,bottom=2cm,footskip=1cm]{geometry}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage[unicode=true,bookmarks=false,breaklinks=true,colorlinks=true,allcolors=blue]{hyperref}
\usepackage{listings}
%\usepackage[nottoc]{tocbibind}
\usepackage{url}
\usepackage[toc,style=long,entrycounter,]{glossaries}
\renewcommand*{\glsentrycounterlabel}{}
\makeglossaries
%\loadglsentries[main]{./tex/acronyms}
\selectlanguage{ngerman}
\usepackage[headsepline]{scrlayer-scrpage}
\usepackage{endfloat}
\newcommand{\savecaptionof}[1]% #1 = figure or table (counter)
{%
\refstepcounter{#1}%
\expandafter\xdef\csname #1\arabic{#1}\endcsname{\csname the#1\endcsname}% store as \figure1 etc.
}
\newcommand{\restorecaptionof}[1]% #1 = figure or table (counter)
{%
\setcounter{#1}{0}%
\expandafter\gdef\csname the#1\endcsname{\csname #1\arabic{#1}\endcsname}%
}
\begin{document}
\sloppy
\overfullrule=2cm
\pagenumbering{Roman}
The titlepage
\normalsize
\vspace*{10cm}
\thispagestyle{empty}
\newpage
% Abstract
Abstract here
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\pagenumbering{arabic}
% actual content here
\chapter{My test chapter}
Chapter description
\section{My test section}
Section description
\begin{figure}[p]
\centering
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\\ \vspace{1cm}
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
% \hfill
\caption{Some figures}
\end{figure}
\savecaptionof{figure}% goes immediately after figure or table
\chapter{Next chapter}
Next chapter description
\section{Next Section}
Next section description
\cleardoubleoddpage
% beginning of appendix
\pagenumbering{Alph}
%
% This is the place where I want my figures to actually appear
\restorecaptionof{figure}% goes before \processdelayedfloats
\processdelayedfloats
%
\printglossary[title={Glossar}]
\setlength{\emergencystretch}{3em}
\printbibliography
\end{document}