I use cas-dc class of Elsevier in Overleaf. I want to put a figure with some subfigures in two-column paper and my code is as follows:
\documentclass[a4paper,fleqn,twocolumn]{cas-dc}
\usepackage{natbib}
\usepackage{adjustbox}
\usepackage{appendix,booktabs}
\usepackage{lipsum}
\usepackage{mathtools, cuted}
\usepackage{autobreak}
\usepackage[utf8]{inputenc}
\usepackage{nccmath}
\usepackage{lipsum}
\usepackage{flushend}
\usepackage{amsmath}
\usepackage{afterpage}
\usepackage{url}
\usepackage{amsfonts,amsmath,amssymb,amstext,amsthm,xspace,pdfsync,enumerate,graphicx}
\usepackage{float}
\usepackage{algpseudocode}
\usepackage{siunitx}
\usepackage[ruled]{algorithm}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage[font=footnotesize,labelfont=bf]{subcaption}
\allowdisplaybreaks
\PassOptionsToPackage{noend}{algpseudocode}% comment out if want end's to show
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\errorcontextlines\maxdimen
\begin{document}
\lipsum[11]
\begin{figure*}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=7cm,height=6cm]{10.png}
\caption{ 10 }
\label{10}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=7cm,height=6cm]{100.png}
\caption{ 100 }
\label{100}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=7cm,height=6cm]{500.png}
\caption{500}
\label{500}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=7cm,height=6cm]{1000.png}
\caption{1000}
\label{1000}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=7cm,height=6cm]{5000.png}
\caption{5000}
\label{5000}
\end{subfigure}
\caption{Comparison }
\label{Comparison }
\end{figure*}
\end{document}
But all figures have been shown in one column and two of them and also the caption have been shown out of the page (under the footnote) such that I cannot see them.
When I use elsarticle class instead of cas-dc:
\documentclass[a4paper,fleqn]{elsarticle}
it works correctly and all sub figures are in two column.
How can I fix the problem with cas-dc class?
Best Answer
The document class
cas-dc
include some packages (for examplegraphicx
) and also redefine them. It also require that some package had to be loaded in preamble, for example packages related to bibliography.After rearranging your
figure
code, I obtain the following result:MWE:
Edit: In the case that you like to have two column document, than you need to add option ˙twocolumn` int document class options:
and than for figures over two column use instead
figure
floatfigure*
, as you use in the your document example. With this changes the result isEdit (2) For unknown reason
cas-dc
doesn't produce two columns document without optiontwocolumn
(tested with my local installation of MikTeX and with Overleaf service). Anyway, the second example has two columns and images are spread over two columns of text regardless how it is obtained.Addendum: In your document preamble are some packages duplicated and in a wrong order. So I try to clean-up and reorganize so that it has a more consistent pattern. At this I wonder, are you really need all these packages?
See, if the following preamble works for you: