我对 LaTeX 很陌生,用它来写大学学期论文。关于文本的一切都很好。我正在尝试将图像插入到文件中,但每当我这样做时,它要么显示在该部分的顶部,要么显示在下一页的顶部,要么显示在新页面上,具体取决于我使用的指令。
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{titling}
\usepackage{graphicx}
\usepackage[font=small,labelfont=bf]{caption}
\graphicspath{ {./images/} }
\renewcommand{\familydefault}{\sfdefault}
***skip***
\section{Timeline}
\vspace{\baselineskip}
"a paragraph goes here"
\begin{figure}
\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[width=.7\textwidth]{chronology.png}
\caption{Chronology of initial attack on NHS systems (NHS 2017)}
\end{minipage}
\end{figure}
\section{Motivation}
\vspace{\baselineskip}
这是我要插入的图像部分。我希望它位于
Timeline
部分的正下方(见下图),但它显示在新页面下一个部分的中间。
我做错了什么,我怎样才能纠正它以获得预期的结果?
如果有任何不同,我正在使用 TeXmaker。
您可以尝试将名为“float”的包与您的图形的 [H] 选项结合使用:
\usepackage{float}
...
\section{Timeline}
\vspace{\baselineskip}
"a paragraph goes here"
\begin{figure}[H]
\noindent\begin{minipage}{\textwidth}
\centering
\includegraphics[width=.7\textwidth]{chronology.png}
\caption{Chronology of initial attack on NHS systems (NHS 2017)}
\end{minipage}
\end{figure}
\section{Motivation}
\vspace{\baselineskip}
参考这篇文章force-figure-placement澄清