\begin{figure}[ht] 无效

\begin{figure}[ht] 无效

我正在使用这个模板。https://www.overleaf.com/latex/templates/latex-template-for-journal-of-plasma-physics-jpp/mtstpytyffvy

我使用figure插入了一张图片,但是图片左侧显示[ht]不正确,浮点数也不正确,这是为什么?

\begin{figure}[ht]
\centering
\includegraphics[scale=0.2]{c2.png}
\caption{error}
\end{figure}

为什么[ht]在左边?

该项目及其完整代码在这里:

\documentclass{jpp}
\usepackage{graphicx}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{listings}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{listings}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}

\shorttitle{XXX}
\shortauthor{XXXX}

\title{XXXX}

\author{XXXX\aff{1}
  \corresp{\email{XXX@XXX}}}

\affiliation{\aff{1}XXX}
\usepackage{float}
\begin{document}

\maketitle

\begin{abstract}
XXXX
\end{abstract}


\section{sample}

\begin{figure}[ht]
    \centering
    \includegraphics{example-image}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}

\end{document}

https://www.overleaf.com/read/tvfnfbfmdzmj

答案1

正如在示例文档中看到的那样,单击您在问题中分享的链接中的“查看源代码”即可访问该文档(https://www.overleaf.com/latex/templates/latex-template-for-journal-of-plasma-physics-jpp/mtstpytyffvy)你不应该使用任何覆盖规范,只需写

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{c2.PNG}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}

快速浏览一下,我认为该类别使用[tp]默认值,并且在页面底部有一个特殊的图形环境。

% This is file JFM2esam.tex
% first release v1.0, 20th October 1996
%       release v1.01, 29th October 1996
%       release v1.1, 25th June 1997
%       release v2.0, 27th July 2004
%       release v3.0, 16th July 2014
%       release v4.0, 15th June 2017
%   (based on JFMsampl.tex v1.3 for LaTeX2.09)
% Copyright (C) 1996, 1997, 2014, 2017 Cambridge University Press

\documentclass{jpp}
\usepackage{graphicx}
% \usepackage{epstopdf, epsfig}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{listings}
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{pgfplots}
\usepackage{listings}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}


\shorttitle{XXX}
\shortauthor{XXXX}

\title{XXXX}

\author{XXXX\aff{1}
  \corresp{\email{XXX@XXX}}}

\affiliation{\aff{1}XXX}
\usepackage{float}
\begin{document}

\maketitle

\begin{abstract}
XXXX
\end{abstract}

%
% Uncomment for keywords
%\vspace{2pc}
%\noindent{\it Keywords}: XXXXXX, YYYYYYYY, ZZZZZZZZZ
%
% Uncomment for Submitted to journal title message
%\submitto{\JPA}
%
% Uncomment if a separate title page is required
%\maketitle
% 
% For two-column output uncomment the next line and choose [10pt] rather than [12pt] in the \documentclass declaration
%\ioptwocol
%

\section{sample}

\begin{figure}
    \centering
    \includegraphics[width=\textwidth]{c2.PNG}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}

% susie put cite commands here, don't bother with citet etc just yet.
\end{document}

在此处输入图片描述

相关内容