0

I am writing an exam. Using a 2-column layout with \begin{multicols}{2}, which works fine.

The exam is a multiple-choice question set; hence I have a nested enumerate starting immediately after beginning multicolumn and ending immediately before multicolumn.

So far, so good.

The rub is that occasionally, a batch of questions refers to a diagram or table. On these occasions, I would like to insert such diagram/table in a single column (i.e. spanning the 2 columns) so that they are legible.

Of course, since I am already inside an enumerate, LaTeX throws an error if I try to end multicolumn, insert chart, and begin multicolumn again.

I saw float mentioned somewhere, but not sure of whether it does the trick. To be clear, if the inserted/floated object spans all columns of my multicolumn environment, that is 100% acceptable.

I have tried figure, but anything inside this environment completely disappears.

\begin{figure}[t]
    \exbatch{Questions 4 is based on the following table: }
    \includegraphics{test1_q4_sample}
    \end{figure}

PARTIALLY SOLVED: Replaced {figure} with {figure*} environment, and it sorta worked - h placement still doesn't work. t works, but pushes the image to the next page, irrespective of whether there's something before the figure or not on the page.

Turns out there is no solution to this, and {figure*} environment has no h, which explains the above issue.

1
  • Also, multicols doesn't support floats. Jun 27, 2021 at 1:36

2 Answers 2

1

Is this what you are trying to achieve?

BTW, I know emumitem supports a [resume*] option, but it seems to only work locally, not globally.

\documentclass{article}
\usepackage{multicol}
%\usepackage{enumitem}
\newcommand{\savenum}{}% reserve global name

\usepackage{blindtext}% MWE only

\begin{document}

\begin{multicols}{2}
\begin{enumerate}
\item Bla
\item Bla
\item Bla
\item Bla
\xdef\savenum{\theenumi}% current counter
\end{enumerate}
\end{multicols}

\begin{figure}[ht]
\caption{\blindtext}
\end{figure}

\begin{multicols}{2}
\begin{enumerate}
\setcounter{enumi}{\savenum}% global resume*
\item Bla
\item Bla
\item Bla
\item Bla
\end{enumerate}
\end{multicols}

\end{document}

Based on leandriis' comment:

\documentclass{article}
\usepackage{multicol}
\usepackage{enumitem}

\usepackage{blindtext}% MWE only

\begin{document}

\begin{multicols}{2}
\begin{enumerate}[series=questions]
\item Bla
\item Bla
\item Bla
\item Bla
\end{enumerate}
\end{multicols}

\begin{figure}[ht]
\caption{\blindtext}
\end{figure}

\begin{multicols}{2}
\begin{enumerate}[resume=questions]
\item Bla
\item Bla
\item Bla
\item Bla
\end{enumerate}
\end{multicols}

\end{document}
3
  • Regarding the resumeoption offered by the enumitem package: If you use \begin{enumerate}[series=myseries] for the first enumerate environment, you can use \begin{enumerate}[resume=myseries] without manually storing and alter on setting the counter.
    – leandriis
    Jun 27, 2021 at 8:04
  • @leandriis - Thanks! Although isn't that precisely what enumitem is doing (with a macro name based on the series name)? Jun 27, 2021 at 14:36
  • I suppose so. But since you added a remark on resume* not being applicable in this case, I just wanted to point out the resume*=〈series〉 version, as well.
    – leandriis
    Jun 27, 2021 at 15:26
0

It's hard to understand what you're doing from your question courtesy of phrasing like:

hence I have a nested enumerate starting immediately after beginning multicolumn and ending immediately before multicolumn.

I'm guessing from this that you're using begin{multicols}{2}\end{multicols} for your answer choices only (or maybe it's the questions themselves).

So I'll consider two possible scenarios:

Scenario 1: You don't actually need a figure environment

Since you're talking about using the h placement and your example doesn't show you using a \caption command, why don't you just write:

\exbatch{Questions 4 is based on the following table: }
\includegraphics{test1_q4_sample}

where you want the figure to appear without wrappign it in figure?

I have no idea what \exbatch does but it appears to be putting a label of sorts on your graphics. You probably want to define a new command that would wrap both commands up in a single command and perhaps surround them with {\centering} as well, but you can then get on with your exam writing.

Scenario 2: You actually do need a figure environment

This seems unlikely from your description, but assuming that you do indeed want to have floating figures, don't use the multicols environment for your two columns. Instead use LaTeX's built-in \twocolumn command. This is, in some ways, more capable than multicols and in other ways less capable. What you get:

  • Single-column floats including footnotes

What you lose:

  • Automatic balancing of columns at document's end
  • Mid-page switches between two columns and single columns (but see below)

There is a limited ability to put single-column material at the top of the page where the two column begins. This is managed by using the optional argument on the \twocolumn command, e.g.,:

\twocolumn[\maketitle]

Note also, that if you're using one of the base document classes, like article, there is a twocolumn option on the document class that will automatically put the title into the full width on the first page before typesetting the rest of the document in two columns.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .