0

I am using following code but unfortunately it doesn't render the figure environment. The problem is because of \begin{multicols}{2} \end{multicols} but I do not know how to resolve it:

\documentclass[twoside]{article}

\usepackage{amsfonts,amssymb,amsbsy,textcomp,marvosym,picins,amsmath,amsthm,subfigure}
\usepackage{eurosym,mathrsfs,fancyhdr,CJK,multicol,indentfirst,color,bm,upgreek,booktabs}
\usepackage{url,adjustbox,slashbox,amstext}
\usepackage[flushleft]{threeparttable}
\usepackage{caption, multirow, makecell}
\usepackage[utf8]{inputenc}
\usepackage{diagbox}
\usepackage[perpage]{footmisc}
\usepackage{caption}
\usepackage{graphicx}

%\usepackage[noend]{algorithm}
%\usepackage[noend]{algorithmic}
%\usepackage[lined,algonl,boxed]{algorithm2e}
\looseness=-1
%------------Page layout and margin and Headrule-------------
\headsep=5mm \headheight=4mm \topmargin=0cm \oddsidemargin=-0.5cm
\evensidemargin=-0.5cm \marginparwidth=0pt \marginparsep= 0pt
\marginparpush=0pt \textheight=23.1cm \textwidth=17.5cm \footskip=8mm
\columnsep=7mm \setlength{\doublerulesep}{0.1pt}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\footnotesep=3.5mm\arraycolsep=2pt
\font\tenrm=cmr10
%===========================================================
\def\footnoterule{\kern 1mm \hrule width 10cm \kern 2mm}
\def\rmd{{\rm d}} \def\rmi{{\rm i}} \def\rme{{\rm e}}
\def\sj#1{$^{[#1]}$}\def\lt{\left}\def\rt{\right}
\renewcommand{\captionfont}{\footnotesize}
\renewcommand\tablename{\bf \footnotesize Table}
\renewcommand\figurename{\footnotesize Fig.\!\!}
\captionsetup{labelsep=period}%
\captionsetup[longtable]{labelsep=period}%
\allowdisplaybreaks
\sloppy
\renewcommand{\headrulewidth}{0pt}
\catcode`@=11
\def\title#1{\vspace{3mm}\begin{flushleft}\vglue-.1cm\Large\bf\boldmath\protect\baselineskip=18pt plus.2pt minus.1pt #1
\end{flushleft}\vspace{1mm} }
\def\author#1{\begin{flushleft}\normalsize #1\end{flushleft}\vspace*{-4pt} \vspace{3mm}}
\def\address#1#2{\begin{flushleft}\vglue-.35cm${}^{#1}$\small\it #2\vglue-.35cm\end{flushleft}\vspace{-2mm}\par}
\def\jz#1#2{{$^{\footnotesize\textcircled{\tiny #1}}$\footnotetext{$^{\footnotesize\textcircled{\tiny #1}}$#2}}}
\def\jzd#1#2{$^{\footnotesize\textcircled{\tiny{#1}}}$\footnotetext{$^{\footnotesize\textcircled{\tiny{#1}}}$#2}}
\catcode`@=11
\def\section{\@startsection{section}{1}{\z@}%
 %{-3.5ex \@plus -1ex \@minus -.2ex}%
 {-3ex \@plus -.3ex \@minus -.2ex}%
 {2.2ex \@plus.2ex}%
{\normalfont\normalsize\protect\baselineskip=14.5pt plus.2pt minus.2pt\bfseries}}
\def\subsection{\@startsection{subsection}{2}{\z@}%
 %{-3.25ex\@plus -1ex \@minus -.2ex}%
 {-3ex\@plus -.2ex \@minus -.2ex}%
 {2ex \@plus.2ex}%
{\normalfont\normalsize\protect\baselineskip=12.5pt plus.2pt minus.2pt\bfseries}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
 %{-3.25ex\@plus -1ex \@minus -.2ex}%
 {-2.2ex\@plus -.21ex \@minus -.2ex}%
 {1.4ex \@plus.2ex}
{\normalfont\normalsize\protect\baselineskip=12pt plus.2pt minus.2pt\sl}}
\def\proofname{{\indent \it Proof.}}
%===========================================================ÒÔÉϲ»¶¯
\pagestyle{fancy}
\fancyhf{}% Çå¿Õҳüҳ½Å
\fancyhead[LO]{\small\sl Shortened Title Within 45 Characters}%
\fancyhead[RO]{\small\thepage}
\fancyhead[LE]{\small\thepage}
\fancyhead[RE]{\small\sl aaa.}
\setcounter{page}{1}
\begin{document}
\begin{CJK*}{GBK}{song}
\thispagestyle{empty}
\vspace*{-13mm}
\end{CJK*}
\begin{multicols}{2}
\begin{figure}
  \includegraphics[width=1\linewidth]{a.jpg}
\end{figure}


\begin{figure}[!htb]
    \centering
    \begin{minipage}{.5\textwidth}
        \centering
  \includegraphics[width=1\linewidth]{b.jpg}
    \end{minipage}%
    \begin{minipage}{0.5\textwidth}
        \centering
 \includegraphics[width=1\linewidth]{a.jpg}
    \end{minipage}
\end{figure}
\end{multicols}
\end{document} 
  • You should read the multicol documentation (section 2.4 Floats inside a multicols environment). Specifically, use figure*, not figure. – Werner Nov 5 '18 at 18:21
  • @Werner That was it – lonesome Nov 5 '18 at 18:28
  • \looseness=-1 is a very odd thing to have in the preamble (it just applies to the first paragraph in the document) also why the plain tex declarations such font\tenrm=cmr10 and \rm , \bf ? – David Carlisle Nov 5 '18 at 18:47
  • @DavidCarlisle Because that is the journal's template and I have no power to change anything! – lonesome Nov 6 '18 at 8:10
  • a journal just gives you a template of bad definitions to put into an article class document instead of providing you with a class or package to use? That is very odd. – David Carlisle Nov 6 '18 at 8:56
3

The multicol documentation states the following in section 2.4 Floats inside a multicols environment:

Within the multicols environment the usual star float commands are available but their function is somewhat different as in the twocolumn mode of standard LaTeX. Stared floats, e.g., figure*, denote page wide floats that are handled in a similar fashion as normal floats outside the multicols environment. However, they will never show up on the page where they are encountered. In other words, one can influence their placement by specifying a combination of t, b, and/or p in their optional argument, but h doesn't work because the first possible place is the top of the next page. One should also note, that this means that their placement behavior is determined by the values of \topfraction, etc. rather than by \dbl....

So, if you want a (floating) figure to appear, use figure*, not figure.

  • What if someone wants to print a figure in only one column? Any solution? – lonesome Nov 6 '18 at 8:11

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.