我怎样才能使表格或图形停留在原来的位置,而不是转到文档的附录或末尾?

我怎样才能使表格或图形停留在原来的位置,而不是转到文档的附录或末尾?

我怎样才能让数字不被推到文档的末尾?

我已经访问过上述链接,并尝试了他们所说的内容,但未能完成我的任务。我的代码如下。请帮助我将图形、表格放在位置本身,而不是让它们放在文档末尾。

\documentclass[a4paper,man,natbib]{apa6}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{placeins}           

\title{Your APA6-Style Manuscript}
\shorttitle{Your APA6-Style Manuscript}
\author{You}
\affiliation{Somewhere}

\abstract{Your abstract here.}

\begin{document}
    \maketitle

    \section{Introduction}

    Your introduction goes here! Some examples of commonly used commands and features are listed below, to help you get started.
    If you have a question, please use the support box in the bottom right of the screen to get in touch. \citep{paper1}

    \section{Some \LaTeX{} Examples}
    \label{sec:examples}

    \subsection{Sections}

    Use section and subsection commands to organize your document. \LaTeX{} handles all the formatting and numbering automatically. Use ref and label commands for cross-references.

    \subsection{Comments}

    You can add inline TODO comments with the todonotes package, like this:
    \todo[inline, color=green!40]{This is an inline comment.}

    \subsection{References}

    LaTeX automatically generates a bibliography in the APA style from your .bib file. The citep command generates a formatted citation in parentheses \citep{Lamport1986}. The cite command generates one without parentheses. LaTeX was first discovered.

    \subsection{Tables and Figures}

    Use the table and tabular commands for basic tables --- see Table~\ref{tab:widgets}, for example. You can upload a figure (JPEG, PNG or PDF) using the files menu. To include it in your document, use the includegraphics command as in the code for Figure~\ref{fig:frog} below.


    % Commands to include a figure:
    \begin{figure}
        \centering
        \includegraphics[width=0.5\textwidth]{frog.jpg}
        \caption{\label{fig:frog}This is a figure caption.}     
        \afterpage{\FloatBarrier}   
    \end{figure}

    \begin{table}
        \centering
        \begin{tabular}{l|r}
            Item & Quantity \\\hline
            Widgets & 42 \\
            Gadgets & 13
        \end{tabular}
        \caption{\label{tab:widgets}An example table.}
    \end{table}

    \subsection{Mathematics}

    \LaTeX{} is great at typesetting mathematics. Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
    $$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
    = \frac{1}{n}\sum_{i}^{n} X_i$$
    denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.

    \subsection{Lists}

    You can make lists with automatic numbering \dots

    \begin{enumerate}
        \item Like this,
        \item and like this.
    \end{enumerate}
    \dots or bullet points \dots
    \begin{itemize}
        \item Like this,
        \item and like this.
    \end{itemize}

    We hope you find write\LaTeX\ useful, and please let us know if you have any feedback using the help menu above.

    \bibliography{sample}

\end{document}

答案1

您正在使用apa6如果您查看文档 ( texdoc apa6) 第 6.2 节,您将看到man您使用的选项将所有浮动移动到文档末尾,因为这是使用该设置的期刊的要求。对于起草,您可以使用该选项floatsintext禁用此功能并将浮动保留在源中的位置。

在此处输入图片描述

\documentclass[a4paper,man,floatsintext,natbib]{apa6}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{placeins}           

\title{Your APA6-Style Manuscript}
\shorttitle{Your APA6-Style Manuscript}
\author{You}
\affiliation{Somewhere}

\abstract{Your abstract here.}

\begin{document}
    \maketitle

    \section{Introduction}

    Your introduction goes here! Some examples of commonly used commands and features are listed below, to help you get started.
    If you have a question, please use the support box in the bottom right of the screen to get in touch. \citep{paper1}

    \section{Some \LaTeX{} Examples}
    \label{sec:examples}

    \subsection{Sections}

    Use section and subsection commands to organize your document. \LaTeX{} handles all the formatting and numbering automatically. Use ref and label commands for cross-references.

    \subsection{Comments}

    You can add inline TODO comments with the todonotes package, like this:
    \todo[inline, color=green!40]{This is an inline comment.}

    \subsection{References}

    LaTeX automatically generates a bibliography in the APA style from your .bib file. The citep command generates a formatted citation in parentheses \citep{Lamport1986}. The cite command generates one without parentheses. LaTeX was first discovered.

    \subsection{Tables and Figures}

    Use the table and tabular commands for basic tables --- see Table~\ref{tab:widgets}, for example. You can upload a figure (JPEG, PNG or PDF) using the files menu. To include it in your document, use the includegraphics command as in the code for Figure~\ref{fig:frog} below.


    % Commands to include a figure:
\begin{figure}
        \centering
        \includegraphics[width=0.5\textwidth]{example-image.jpg}
        \caption{\label{fig:frog}This is a figure caption.}     
%        \afterpage{\FloatBarrier}   
\end{figure}

\begin{table}
        \centering
        \begin{tabular}{l|r}
            Item & Quantity \\\hline
            Widgets & 42 \\
            Gadgets & 13
        \end{tabular}
        \caption{\label{tab:widgets}An example table.}
\end{table}

    \subsection{Mathematics}

    \LaTeX{} is great at typesetting mathematics. Let $X_1, X_2, \ldots, X_n$ be a sequence of independent and identically distributed random variables with $\text{E}[X_i] = \mu$ and $\text{Var}[X_i] = \sigma^2 < \infty$, and let
    $$S_n = \frac{X_1 + X_2 + \cdots + X_n}{n}
    = \frac{1}{n}\sum_{i}^{n} X_i$$
    denote their mean. Then as $n$ approaches infinity, the random variables $\sqrt{n}(S_n - \mu)$ converge in distribution to a normal $\mathcal{N}(0, \sigma^2)$.

    \subsection{Lists}

    You can make lists with automatic numbering \dots

    \begin{enumerate}
        \item Like this,
        \item and like this.
    \end{enumerate}
    \dots or bullet points \dots
    \begin{itemize}
        \item Like this,
        \item and like this.
    \end{itemize}

    We hope you find write\LaTeX\ useful, and please let us know if you have any feedback using the help menu above.

    \bibliography{sample}

\end{document}

答案2

您是否尝试过使用漂浮包裹?还有H图中的选项?

\usepackage{float}

...

\begin{figure}[H]

来源

相关内容