如何在我的补充部分标题下获取补充图表?

如何在我的补充部分标题下获取补充图表?

我正在尝试制作一份在参考文献后有补充部分的文档。补充图表并非全部位于补充标题下方

\begin{filecontents*}{\jobname.bib}
@article{greenwade93,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351"
}
\end{filecontents*}


\documentclass{article}

\usepackage[english]{babel}


\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}

% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}

\newcommand{\beginsupplement}{%
        \setcounter{table}{0}
        \renewcommand{\thetable}{S\arabic{table}}%
        \setcounter{figure}{0}
        \renewcommand{\thefigure}{S\arabic{figure}}%
     }


\title{Your Paper}
\author{You}

\begin{document}


\section{Introduction}

Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, “and what is the use of a book,” thought Alice “without pictures or conversations?”
\cite{greenwade93} Figure \ref{fig:frog} in this section for an example.


\bibliographystyle{alpha}
\bibliography{\jobname}


\section{Supplementary Material}
\beginsupplement


\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}

\end{document}

在此处输入图片描述

答案1

在此处输入图片描述

您可以使用包\FloatBarrier中的命令placeins。添加

\usepackage{placeins}

在你的序言中,然后在文件中

\FloatBarrier
\section{Supplementary Material}
\beginsupplement

在此处输入图片描述

要让图片直接出现在标题下方,请尝试[h]向图中添加选项:

\FloatBarrier
\section{Supplementary Material}
\beginsupplement


\begin{figure}[h]
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}

相关内容