如何在多列中并排放置两个图形

如何在多列中并排放置两个图形

我想在双列环境中并排放置两个图形(两个图形都适合单列)我已经阅读了答案,但它对我来说不起作用。图形放在下一页。

我:

   \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}

答案1

您可以将图形放置在minipage宽度内\columnwidth(并且没有缩进):

在此处输入图片描述

\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}

由于\subfloat需要知道它们处于哪个浮动环境中,因此\@captype有必要明确设置。caption提供\captionof{<type>}{<caption>},但是它没有帮助\subfloat

答案2

由于multicols不允许浮动环境,本提案定义了一个名为 的新环境figurehere。如您所见,浮动属性被抑制,并固定在所需的位置。此环境已在subcaptionboxcommand from subcaptionpackage(第一张图片)和 subfloatcommand from subfigpackage(第二张图片)上进行了测试。它们都包含在代码中。

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

子标题框

代码

\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}

子浮点型

相关内容