2

I would like to place two figures side by side in two column environment (Both figures fitting withing a single column) I have read the answers but it's not working for me. The figure is placed on the next page.

ME:

   \documentclass[a0,portrait]{a0poster}
   \usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{multicol}
   \columnsep=100pt 
   \columnseprule=3pt 
   \usepackage[czech, english]{babel}
   \usepackage[svgnames]{xcolor} 
   \usepackage{palatino} % Uncomment to use the Palatino font
   \usepackage{subfig}
   \usepackage{graphicx} 
   \graphicspath{{figures/}} % Location of the graphics files
   \usepackage{booktabs} % Top and bottom rules for table
   \usepackage[font=small,labelfont=bf]{caption}
   \usepackage{amsfonts, amsmath, amsthm, amssymb} 
   \usepackage{wrapfig} % Allows wrapping text around tables and figures
   \usepackage{lipsum}

   \begin{document}
   \title{Morphological key at Afrilex 2014} % Poster

   \begin{multicols}{2} 
   \section*{Introduction - Icelandic and Czech?}
   \lipsum[3-6]
  \begin{figure*}[b!]
  \centering

  \subfloat[Market revenue]{%
  \includegraphics[width=10cm]{online_dict2.png}%
  \label{fig:evaluation:revenue}%
  }\qquad
  \subfloat[Average price]{%
  \includegraphics[width=10cm]{online_dict2.png}%
  \label{fig:evaluation:avgPrice}%
  }

  \caption{Simulation results}
  \end{figure*}

  \subsection*{Types of Media}
  \end{multicols}
  \end{document}
  • Put the float at the beginning (after \maketitle, \title only do nothing...) or after multicols environment with [h]. – Fran Mar 25 '14 at 18:35
  • I need to place the float (severel floats) inside multicols environment. – chejnik Mar 26 '14 at 9:36
  • Are you interested in having the two figures span the entire page (one figure per column) or both figures fitting within a single column? – cslstr Mar 28 '14 at 6:45
  • Both figures fitting withing a single column. – chejnik Mar 28 '14 at 6:47
  • This might work. Do not use the figure environment. Directly use includegraphics. For captions, use the caption package – dips Mar 28 '14 at 6:48
7
+200

You can place the figures inside a minipage of width \columnwidth (and no indent):

enter image description here

\documentclass[a0,portrait]{a0poster}
\usepackage{multicol}
\columnsep=100pt 
\columnseprule=3pt 
\usepackage{subfig}
\usepackage{graphicx} 
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{lipsum}

\title{Morphological key at Afrilex 2014} % Poster

\begin{document}

\maketitle

\begin{multicols}{2} 
  \section*{Introduction - Icelandic and Czech?}
  \lipsum[3-6]

  \noindent
  \begin{minipage}{\columnwidth}
    \makeatletter
    \newcommand{\@captype}{figure}
    \makeatother
    \centering
    \subfloat[Market revenue]{%
      \includegraphics[width=10cm]{example-image-a}%
      \label{fig:evaluation:revenue}%
    }\qquad%
    \subfloat[Average price]{%
      \includegraphics[width=10cm]{example-image-b}%
      \label{fig:evaluation:avgPrice}%
    }
    \caption{Simulation results}
  \end{minipage}

  \subsection*{Types of Media}
\end{multicols}
\end{document}

Since \subfloats require to know which float environment they're in, setting the \@captype explicitly is necessary. caption provides \captionof{<type>}{<caption>}, but it doesn't help for \subfloat.

  • 1
    Some people also might suggest using the float package and supply an [H] float specifier. In this and the above case, you may have to adjust for the spacing with respect to the surrounding text. See Drawbacks of the H specifier – Werner Mar 28 '14 at 6:58
  • I am sorry for late bounty awarding - I thought I have already done it. Thank you for help. – chejnik Apr 2 '14 at 6:54
2

Since multicols does not allow float environments, this proposal defines a new environment called figurehere. As you can see, the floating property is suppressed and it anchors at where one desires. This environment has been tested on subcaptionbox command from subcaption package (first image) and subfloat command from subfig package (second image). They are all included in the code.

\makeatletter
\newenvironment{figurehere}
{\def\@captype{figure}}
{}
\makeatother

subcaptionbox

Code

\documentclass[a0,portrait]{a0poster}
   \usepackage{standalone}
   \usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{multicol}
   \columnsep=100pt 
   \columnseprule=3pt 
   \usepackage{palatino} 
%   \usepackage{subfig}       % for subfloat
   \usepackage{subcaption}% for subcaptionbox
   \usepackage{graphicx} 
   \usepackage{amsfonts, amsmath, amsthm, amssymb} 
   \usepackage{lipsum}

\makeatletter
\newenvironment{figurehere}
{\def\@captype{figure}}
{}
\makeatother

\captionsetup{labelfont=it,textfont={bf,it},justification=centering}
\renewcommand{\thesubfigure}{\alph{subfigure}}
\renewcommand{\thefigure}{\arabic{figure} }

\begin{document}


\title{Morphological key at Afrilex 2014} % Poster
\author{Author}
\maketitle

\begin{multicols}{2} 
\section*{Introduction - Icelandic and Czech?}
\lipsum[3-6]

% to run this session, please disable `sufig` package and enable `subcaption` package

\subsection*{Subcaptionbox section}

\begin{figurehere}
 \centering
  \subcaptionbox{Market revenue  \label{fig:evaluation:revenue}}{%
  \includegraphics[width=0.45\columnwidth]{example-image-a}}\quad
  \subcaptionbox{Average price  \label{fig:evaluation:avgPrice}}{%
  \includegraphics[width=0.45\columnwidth]{example-image-b} }
  \caption{Simulation results}\label{Fig}
\end{figurehere}


% to run this session, please disable `subcaption` package and enable `subfig` package

%\subsection*{Subfloat section}
%
%\begin{figurehere}
% \centering
%\captionsetup{justification=centering}
%  \subfloat[Market revenue]{%
%  \includegraphics[width=0.45\columnwidth]{example-image-a}
%  \label{fig:evaluation:revenue}
%}\quad
%  \subfloat[Average price]{%
%  \includegraphics[width=0.45\columnwidth]{example-image-b}
%  \label{fig:evaluation:avgPrice}
%}
%  \caption{Simulation results,\label{Fig}}
%\end{figurehere}
%

\subsection*{Types of Media}

\end{multicols}
\end{document}

subfloat

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.