![如何在多列中並排放置兩個圖形](https://rvso.com/image/286964/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%A4%9A%E5%88%97%E4%B8%AD%E4%B8%A6%E6%8E%92%E6%94%BE%E7%BD%AE%E5%85%A9%E5%80%8B%E5%9C%96%E5%BD%A2.png)
我想將兩個數字並排放置在兩列環境中(兩個數字都適合單列)我已閱讀答案,但它對我不起作用。該圖位於下一頁。
我:
\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
s 需要知道它們所處的浮動環境,因此\@captype
有必要明確設定。caption
提供\captionof{<type>}{<caption>}
,但對 沒有幫助\subfloat
。
答案2
由於multicols
不允許浮動環境,該提案定義了一個名為 的新環境figurehere
。正如您所看到的,浮動屬性被抑制並錨定在人們想要的地方。此環境已根據套件subcaptionbox
中的命令subcaption
(第一個圖像)和 套件subfloat
中的命令subfig
(第二個圖像)進行了測試。它們都包含在程式碼中。
\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}