![我似乎无法理解为什么我在编译乳胶文档时没有生成图像](https://linux22.com/image/462179/%E6%88%91%E4%BC%BC%E4%B9%8E%E6%97%A0%E6%B3%95%E7%90%86%E8%A7%A3%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E5%9C%A8%E7%BC%96%E8%AF%91%E4%B9%B3%E8%83%B6%E6%96%87%E6%A1%A3%E6%97%B6%E6%B2%A1%E6%9C%89%E7%94%9F%E6%88%90%E5%9B%BE%E5%83%8F.png)
我正在尝试制作实验报告,并希望将几个部分/小节分成两列,但当我尝试将其更改为两列时,它在编译时不会生成我的图像。我尝试使用 ,\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}