2

I am trying to make a lab report and want a few sections/subsections to be in two columns, but when I try changing it to two columns, it doesn't generate my image when I compile it. I tried using \includegraphics[width=0.5\textwidth]{chapter/introduction/Thermionic.png} which works fine but I want to use \begin{figure} \end{figure} as I need to include a caption and label it. Below is my code for this.

\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}

I can't seem to understand what's wrong with my code. Any help would be appreciated.

JamesT
  • 3,169
  • Welcome. // Please make it a habit to present code we can copy and compile. Please start at \documentclass and end at \end{document}. Please edit your code as needed. Thanks. – MS-SPO Mar 11 '23 at 01:59
  • 1
    Somewhat related: https://tex.stackexchange.com/questions/530084/i-want-to-wrap-text-only-above-and-below-a-figure-inside-of-a-column – John Kormylo Mar 11 '23 at 03:14

1 Answers1

6

LaTeX's float mechanism is partly disabled in multicols. So you can use \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}

enter image description here

Clara
  • 6,012