0

I am attempting to use "in-line" images as LaTeX figures (so that they can be numbered and appear in the Table of Figures), in a two-column document created with the package << multicols >>. If I use this "normal" construction syntax: `

\begin{multicols}{2}
    [
    \section{First Section}
    \large{\textsl{All human things are subject to decay. And when fate summons, Monarchs must obey.\todo{findreference}}}\normalsize
    ]
        \lipsum[1-2]
        %\begin{figure}
        \includegraphics[width=0.50\textwidth]{placeholder.png}        \caption{\textbf{\textit{Here is an inline image}}}
    %\label{fig:The placeholder logo}
    %\end{figure}

    \lipsum[4-6]
]
\textbf{This is the end of the First Section}

\end{multicols} `

the image disappears from the column(NB: here the offending lines have been % away).

If this construct doesn't work,

  1. Why does it fail (e.g., using the <> vs specifying [twocolumns] option in the document class)?

  2. How do I turn these images into "Figures" ??

Simon Dispa
  • 39,141
Birdman
  • 135
  • Welcome to TeX.SE. Please extend your code fragment to complete small document, which we can test as it is. Use of the package multicolumn doesn't allow floating environments. Why you use \begin{multicols}{2}? Does option \documentclass[twocolumn]{article} not provide what you after? – Zarko Dec 30 '22 at 20:16
  • Aside: \large is a switch, not a command, so \large{Stuff} is the same as \large Stuff and will make everything large until the group ends or you get to \normalsize. – Teepeemm Dec 30 '22 at 20:45

2 Answers2

0

multicol does not support floats, but you can use \captionof{figure}{<text>} to add a caption for the inline figure (package caption).

a

\documentclass{article}
\usepackage{graphicx}

\usepackage{multicol} \usepackage{lipsum}

\usepackage{caption} % added <<<<<<<<<<<<<<<<

\usepackage{todonotes}

\begin{document} \begin{multicols}{2}

    \section{First Section}
    {\large\textsl{All human things are subject to decay. And when fate summons, Monarchs must obey.\todo{findreference}}}

    \lipsum[1-2]

    \noindent\includegraphics[width=\columnwidth]{example-image}        
    \captionof{figure}{\textbf{\textit{Here is an inline image\label{fig:The placeholder logo}}}}   % added &lt;&lt;&lt;&lt;&lt;&lt;&lt; 

    \lipsum[4-6]

    \textbf{This is the end of the First Section}

\end{multicols}

\end{document}

todonotes will not work but you can list them at the end of the document adding

\newpage
\listoftodos[Notes]

Option using \documentclass[twocolumn]{article} to allow floats.

[b2

\documentclass[twocolumn]{article}

\usepackage{graphicx}

\usepackage{lipsum}

\usepackage{caption} % added <<<<<<<<<<<<<<<<

\usepackage{todonotes} \setlength{\marginparwidth}{1.5cm} % added to have todonote in the margin<<< \begin{document}

\section{First Section}
{\large\textsl{All human things are subject to decay. And when fate summons, Monarchs must obey.\todo{find reference}}}

\lipsum[1-2]
\begin{figure}[ht!]
    \includegraphics[width=\columnwidth]{example-image}         
    \caption{\textbf{\textit{Here is an inline image\label{fig:The placeholder logo}}}} 
\end{figure}
\lipsum[4-6]

\textbf{This is the end of the First Section}

\end{document}

Simon Dispa
  • 39,141
  • Thanks for the helpful insights on [twocolumns] vs [multicols]. Indeed, I am going to continue to use [multicols] because it allows me to use full-width headers for Sections / subsections (etc) and flexibility with in-column or column-spanning images. I am very grateful for the pointer to the package {caption} and the command \captionof , the use of which does generate entries in the Table of Figures!

    Package {hyperref} "doesn't play nicely" with package {todo} in the {multicols} environment. If a work-around exists, or you have hacking suggestions, by all means let me know!

    – Birdman Dec 31 '22 at 23:43
-1

This problem seems to have resulted from a call to the hyperref package.

The call to hyperref also caused problems with implementing the xcolor package. Please see my answer to that question about Dvips / Dvipsnames.

Werner
  • 603,163
Birdman
  • 135