我似乎無法理解為什麼在編譯乳膠文件時沒有生成圖像

我似乎無法理解為什麼在編譯乳膠文件時沒有生成圖像

我正在嘗試製作實驗室報告,並希望將一些部分/小節分成兩列,但是當我嘗試將其更改為兩列時,它在編譯時不會生成我的圖像。我嘗試使用\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}

在此輸入影像描述

相關內容