我似乎无法理解为什么我在编译乳胶文档时没有生成图像

我似乎无法理解为什么我在编译乳胶文档时没有生成图像

我正在尝试制作实验报告,并希望将几个部分/小节分成两列,但当我尝试将其更改为两列时,它在编译时不会生成我的图像。我尝试使用 ,\includegraphics[width=0.5\textwidth]{chapter/introduction/Thermionic.png}效果很好,但我想使用 ,\begin{figure} \end{figure}因为我需要包含标题和标签。下面是我的代码。

\begin{multicols}{2}

When a metal filament is heated in a vacuum by passing a sufficient large current along the filament, electrons are emitted. By applying a positive voltage to an anode nearby, a current will start flowing between the filament (which acts as a cathode) and the anode. This setup is known as the \textbf{thermionic diode}. Figure \ref{fig:thermdiode} shows the schematic of a thermionic diode similar to the one used in the experiment. \cite{labbook}

\begin{figure}[h!]
  {\includegraphics[width = 0.5\textwidth]{chapter/introduction/Thermionic.png}}
    
  \caption{Schematic Diagram of a Thermionic Diode  \cite{labbook}}
  \label{fig:ThermDiode}
\end{figure}

%\includegraphics[width=0.5\textwidth]{chapter/introduction/Thermionic.png}
\end{multicols}

我似乎不明白我的代码出了什么问题。如能得到任何帮助我将不胜感激。

答案1

LaTeX 的浮动机制在 中被部分禁用multicols。因此您可以使用\captionof

\documentclass{article}
\usepackage{showframe}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{multicol}
\begin{document}
\begin{multicols}{2}
When a metal filament is heated in a vacuum by passing a sufficient large current along the filament, electrons are emitted. By applying a positive voltage to an anode nearby, a current will start flowing between the filament (which acts as a cathode) and the anode. This setup is known as the \textbf{thermionic diode}. \figurename~\ref{fig:ThermDiode} shows the schematic of a thermionic diode similar to the one used in the experiment.
\begin{minipage}{\linewidth}
\centering
\includegraphics[width = 0.5\textwidth]{example-image}
\captionof{figure}{Schematic Diagram of a Thermionic Diode}
\label{fig:ThermDiode}
\end{minipage}
\end{multicols}
\end{document}

在此处输入图片描述

相关内容