0

I have a typical 2 columns journal template. I wanted to insert two side by side figures in the second column. How can I do that.

My current code goes like this, but the figures never showed up. [Image path is okay. not a problem of that]

I edited my file so hopefully you can directly reproduce my problem. To reproduce, please create a directory figure under current dir, and put two image files fig_1a.png and fig_1b.png there..THX!!1

---UPDATE---

And I got this warning.

Package multicol Warning: Floats and marginpars not allowed inside `multicols' 
environment!.

which seems to suggest float is not supported here.

\documentclass[twoside]{article}
\renewcommand{\thesubsection}{\Alph{subsection} ) }
% ------
% Multiple figures 
\usepackage{subcaption}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.png,.jpg}
\graphicspath{{./figure/}}

% \graphicspath{/home/xushunyi/infocom/figure/}
% \newcommand{\figureroot}{/home/xushunyi/infocom/figure/}
% ------
% Fonts and typesetting settings
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\linespread{1.05} % Palatino needs more space between lines
\usepackage{microtype}


% ------
% Page layout
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt, left=2cm, right=2cm]{geometry}
\usepackage[font=it]{caption}
\usepackage{paralist}
\usepackage{multicol}

% ------
% Lettrines
\usepackage{lettrine}


% ------
% Abstract
\usepackage{abstract}
    \renewcommand{\abstractnamefont}{\normalfont\bfseries}
    \renewcommand{\abstracttextfont}{\normalfont\small\itshape}


% ------
% Titling (section/subsection)
\usepackage{titlesec}
\renewcommand\thesection{\Roman{section}}
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{}


% ------
% Header/footer
\usepackage{fancyhdr}
    \pagestyle{fancy}
    \fancyhead{}
    \fancyfoot{}
    \fancyhead[C]{Journal paper template $\bullet$ April 2012 $\bullet$ Vol. XXI, No. 1}
    \fancyfoot[RO,LE]{\thepage}


% ------
% Clickable URLs (optional)
\usepackage{hyperref}

% ------
% Maketitle metadata
\title{\vspace{-15mm}%
    \fontsize{24pt}{10pt}\selectfont
    \textbf{Long Titles Look More Impressive Than Short Ones}
    }   
\author{%
    \large
    \textsc{Jonathan S. Doe}\thanks{Template by \href{http://www.howtotex.com}{howtoTeX.com}} \\[2mm]
    \normalsize University of Technology, Delft \\
    \normalsize \href{mailto:frits@howtoTeX.com}{frits@howtoTeX.com}
    \vspace{-5mm}
    }
\date{}



%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle
\thispagestyle{fancy}

\begin{abstract}
\noindent I am abstract

\end{abstract}


\begin{multicols}{2}

hendrerit aliquet porttitor.

\section{Introduction}
This is intro
\begin{compactitem}
\item
ccccccccccccccccccccinformed decision
\item 
bbbbbbbbbbbbbbbbnetwork. 
\item 
aaaaaaaaaaaa
\end{compactitem}

\begin{itemize}
\item werwerwerwerwerwer
\item sdgfsdfswerwrwerwer
\item gsdgsgsdgsdgdgsgsdgsdg
\item ...
\end{itemize}

Two figures standing side by side spanning the second columns should appear here. But I see nothing!!!! 



\begin{figure}[!h]
\centering
\begin{subfigure}[h]{0.45\columnwidth}
  \centering
  \includegraphics[width=.4\columnwidth]{fig_1a}
  \caption{1a}
  \label{fig:sfig1}
\end{subfigure}%
\begin{subfigure}[h]{0.45\columnwidth}
  \centering
  \includegraphics[width=.4\columnwidth]{fig_1b}
  \caption{1b}
  \label{fig:sfig2}
\end{subfigure}
\caption{plots of....}
\label{fig:fig1}
\end{figure}

what do you think is the reason?

\section{Algorithm Design}

\section{Evalutation}

\section{Conclusion}

\end{multicols}

\end{document}
  • Please edit your question so that it includes a complete example code that reproduces the problem. As it stands it will be difficult for anyone to help you. – Ian Thompson Jul 17 '14 at 8:37
  • I edited it. please see if you can reproduce the problem – Daniel Jul 17 '14 at 8:47
1

Since multicols does not allow float environments (this explains why you don't see any figures), 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 too. Remove the [demo] option in graphicx to show the correct image

enter image description here

Code

\documentclass[twoside]{article}
\renewcommand{\thesubsection}{\Alph{subsection} ) }
% ------
% Multiple figures 
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\DeclareGraphicsExtensions{.png,.jpg}
\graphicspath{{./figure/}}

% \graphicspath{/home/xushunyi/infocom/figure/}
% \newcommand{\figureroot}{/home/xushunyi/infocom/figure/}
% ------
% Fonts and typesetting settings
\usepackage[sc]{mathpazo}
\usepackage[T1]{fontenc}
\linespread{1.05} % Palatino needs more space between lines
\usepackage{microtype}


% ------
% Page layout
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt, left=2cm, right=2cm]{geometry}
\usepackage[font=it]{caption}
\usepackage{paralist}
\usepackage{multicol}

% ------
% Lettrines
\usepackage{lettrine}


% ------
% Abstract
\usepackage{abstract}
    \renewcommand{\abstractnamefont}{\normalfont\bfseries}
    \renewcommand{\abstracttextfont}{\normalfont\small\itshape}


% ------
% Titling (section/subsection)
\usepackage{titlesec}
\renewcommand\thesection{\Roman{section}}
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{}


% ------
% Header/footer
\usepackage{fancyhdr}
    \pagestyle{fancy}
    \fancyhead{}
    \fancyfoot{}
    \fancyhead[C]{Journal paper template $\bullet$ April 2012 $\bullet$ Vol. XXI, No. 1}
    \fancyfoot[RO,LE]{\thepage}


% ------
% Clickable URLs (optional)
\usepackage{hyperref}

% ------
% Maketitle metadata
\title{\vspace{-15mm}%
    \fontsize{24pt}{10pt}\selectfont
    \textbf{Long Titles Look More Impressive Than Short Ones}
    }   
\author{%
    \large
    \textsc{Jonathan S. Doe}\thanks{Template by \href{http://www.howtotex.com}{howtoTeX.com}} \\[2mm]
    \normalsize University of Technology, Delft \\
    \normalsize \href{mailto:frits@howtoTeX.com}{frits@howtoTeX.com}
    \vspace{-5mm}
    }
\date{}

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

%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle
\thispagestyle{fancy}

\begin{abstract}
\noindent I am abstract

\end{abstract}


\begin{multicols}{2}

hendrerit aliquet porttitor.

\section{Introduction}
This is intro
\begin{compactitem}
\item
ccccccccccccccccccccinformed decision
\item 
bbbbbbbbbbbbbbbbnetwork. 
\item 
aaaaaaaaaaaa
\end{compactitem}

\begin{itemize}
\item werwerwerwerwerwer
\item sdgfsdfswerwrwerwer
\item gsdgsgsdgsdgdgsgsdgsdg
\item ...
\end{itemize}

Two figures standing side by side spanning the second columns should appear here. But I see nothing!!!! 

\begin{figurehere}
\centering
\begin{subfigure}[h]{0.45\columnwidth}
  \centering
  \includegraphics[width=.4\columnwidth]{fig_1aa}
  \caption{1a}
  \label{fig:sfig1}
\end{subfigure}%
\begin{subfigure}[h]{0.45\columnwidth}
  \centering
  \includegraphics[width=.4\columnwidth]{fig_1bb}
  \caption{1b}
  \label{fig:sfig2}
\end{subfigure}
\caption{plots of....}
\label{fig:fig1}
\end{figurehere}
\columnbreak
what do you think is the reason?
%
\begin{figurehere}
\centering
\subcaptionbox{2a}
{\includegraphics[width=0.45\columnwidth]{fig2a}}
  \label{fig:sfig2a}
%
\subcaptionbox{1b}
{\includegraphics[width=0.45\columnwidth]{fig2b}}
  \label{fig:sfig2b}
\caption{plots of....}
\label{fig:fig2}
\end{figurehere}

\section{Algorithm Design}

\section{Evalutation}

\section{Conclusion}

\end{multicols}

\end{document}

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.