双栏文章中的图表并排显示

双栏文章中的图表并排显示

我写了这个 latex,但它看起来并不完全符合我的要求。这是一篇双栏文章,所以图表应该是两栏,图表应该流经两栏,两张图表并排在一栏中,但这占据了整个页面,然后标题跨越了整个页面,而不仅仅是一栏。请帮我让它在双栏文章的背景下看起来不错。欢迎提出任何建议。谢谢。

—里克

在此处输入图片描述

%File: formatting-instruction.tex
\documentclass[letterpaper]{article}
\usepackage{aaai}
\usepackage{mathptmx} % Times Roman for text *and* math
\usepackage{times}
\usepackage{helvet}
\usepackage{courier}
\usepackage{graphicx}
\usepackage{array}
\usepackage{booktabs,tabularx}
\usepackage{caption}
\usepackage{subcaption}
\newcolumntype{L}{>{\centering\arraybackslash}m{3cm}}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
\graphicspath{ {images/} }
\frenchspacing
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}
\pdfinfo{
/Title (Insert Your Title Here)
/Author (Put All Your Authors Here, Separated by Commas)}
\setcounter{secnumdepth}{0}  
 \begin{document}
\begin{figure*}
\centering
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data1}
\caption{Day1: 02-Nov-2014: Adverse Event Count = 106 (time duration 08:50) Max Excursion= 3.96° DF}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data14}
\caption{Day14: 15-Nov-2014: Adverse Event Count = 107 (time duration 08:55) Max Excursion= 1.95° F
}\label{label-b}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data15}
\caption{Day15: 16-Nov-2014: Adverse Event Count = 103 (time duration 08:35) Max Excursion= 3.96° F
}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data16}
\caption{Day16: 17-Nov-2014: Adverse Event Count = 7 (time duration 00:35) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data19}
\caption{Day19: 20-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data22}
\caption{Day22: 22-Nov-2014: Adverse Event Count = 75 (time duration 06:15) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data23}
\caption{Day23: 23-Nov-2014: Adverse Event Count = 114 (time duration 09:30) Max Excursion= 4.98° F
}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data24}
\caption{Day24: 24-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data25}
\caption{Day25: 25-Nov-2014: Adverse Event Count = 12 (time duration 01:00) Max Excursion= 1.04° F}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data26}
\caption{Day26: 27-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F}\label{label-b}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data61}
\caption{Day61: 01-Jan-2015: Adverse Event Count = 19 (time duration 01:35) Max Excursion= 0.57° F}\label{label-a}
\end{minipage}\qquad
\begin{minipage}[b]{.45\columnwidth}
\includegraphics[width=\columnwidth]{Data73}
\caption{Day73: 13-Jan-2015: Adverse Event Count = 23 (time duration 01:55) Max Excursion= 0.80° F
}\label{label-b}
\end{minipage}\qquad
\caption*{Figure 9-20: Adverse Area Plots (Quantity Below 68.1 Degrees F) for all days containing adverse events. As per ACCEPT Adverse Event Paradigm, these events are only in testing/validation data-sets}
\end{figure*}

\end{document}

答案1

看看以下解决方案是否接近您所寻找的解决方案:

在此处输入图片描述

我向你的 MWE 添加showframe(为了查看页面布局,实际使用时应省略)选项font=smalljustification=RaggedRightcaption(这样图像的高度会略微降低)并使用两个图像环境进行 hack 以获得所需的页面格式。包lipsum用于虚拟文本。

\documentclass[letterpaper,twocolumn]{article}
\usepackage{mathptmx} % Times Roman for text *and* math
\usepackage{times}
\usepackage{helvet}
\usepackage{courier}
\usepackage{graphicx}
\usepackage[font=small,justification=RaggedRight]{caption}% <-- added options
\frenchspacing
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}

\usepackage{ragged2e}% <-- new

\usepackage{lipsum}% <-- in real use should be omitted
\usepackage{showframe}% <-- in real use should be omitted

 \begin{document}
\lipsum[1-3]
\begin{figure*}[t!]
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day1: 02-Nov-2014: Adverse Event Count = 106 (time duration 08:50) Max Excursion= 3.96° DF}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day14: 15-Nov-2014: Adverse Event Count = 107 (time duration 08:55) Max Excursion= 1.95° F
}\label{label-b}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day15: 16-Nov-2014: Adverse Event Count = 103 (time duration 08:35) Max Excursion= 3.96° F
}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day16: 17-Nov-2014: Adverse Event Count = 7 (time duration 00:35) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}

\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day19: 20-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day22: 22-Nov-2014: Adverse Event Count = 75 (time duration 06:15) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day23: 23-Nov-2014: Adverse Event Count = 114 (time duration 09:30) Max Excursion= 4.98° F
}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day24: 24-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
}\label{label-b}
\end{minipage}

\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day25: 25-Nov-2014: Adverse Event Count = 12 (time duration 01:00) Max Excursion= 1.04° F}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day26: 27-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F}\label{label-b}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day61: 01-Jan-2015: Adverse Event Count = 19 (time duration 01:35) Max Excursion= 0.57° F}\label{label-a}
\end{minipage}
\hfill
\begin{minipage}[b]{.22\linewidth}
\includegraphics[width=\columnwidth]{example-image}
\caption{Day73: 13-Jan-2015: Adverse Event Count = 23 (time duration 01:55) Max Excursion= 0.80° F
}\label{label-b}
\end{minipage}
    \end{figure*}
    \begin{figure}[h!]
    \vskip1ex
\captionof*{figure}{Figure 9-20: Adverse Area Plots (Quantity Below 68.1 Degrees F) for all days containing adverse events. As per ACCEPT Adverse Event Paradigm, these events are only in testing/validation data-sets}
    \vskip-5ex
    \end{figure}
\lipsum[4-9]
\end{document}

如您所见,MWE 在第二个图形环境中有两个垂直空间的手动调整,仅用于上述图形的常见标题/注释。

附录:上述解决方案基于以下假设:所有图形都应相互关联,即,图形之间没有文字,并且在紧随其后的一栏中有共同的描述。

可以将图形组织成 4 x 3 矩阵(如问题所示),分布在环境中的两列上,figure*然后是另一列图形,并带有共同的说明/标题。如果两个图形的高度总和小于一页上允许的图形面积,则可以实现这一点。这就是为什么标题中的字体大小减小的原因。

另一种可能性是将图形组织到两个figure环境中,其中第二个环境也包含通用的“标题”(见下面的示例)。此解决方案不能保证所有图像都会出现在一个页面中,就像上面的解决方案中的情况一样。

minipage在第二个解决方案中,使用代替tabularx(显然,在第一个解决方案中也可以使用它)。第一个图有选项[t!],第二个图有[b!]。这样就实现了图流。

    \documentclass[letterpaper,twocolumn]{article}
    \usepackage{mathptmx} % Times Roman for text *and* math
    \usepackage{times,helvet,courier}
    \usepackage{graphicx}
    \usepackage[font=small,justification=RaggedRight]{caption}% <-- added options
    \frenchspacing
    \setlength{\pdfpagewidth}{8.5in}
    \setlength{\pdfpageheight}{11in}

    \usepackage{ragged2e}% <-- new
    \usepackage{tabularx}% <-- new

    \usepackage{lipsum}% <-- in real use should be omitted
    \usepackage{showframe}% <-- in real use should be omitted

     \begin{document}
    \lipsum[1-3]
    \begin{figure}[b!]
    \begin{tabularx}{\columnwidth}{@{}*{2}{X}@{}}
\includegraphics[width=\linewidth]{example-image}
\caption{Day1: 02-Nov-2014: Adverse Event Count = 106 (time duration 08:50) Max Excursion= 3.96° DF}\label{label-a}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day14: 15-Nov-2014: Adverse Event Count = 107 (time duration 08:55) Max Excursion= 1.95° F
        }\label{label-b}
                    \\
\includegraphics[width=\linewidth]{example-image}
\caption{Day15: 16-Nov-2014: Adverse Event Count = 103 (time duration 08:35) Max Excursion= 3.96° F
}\label{label-b}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day16: 17-Nov-2014: Adverse Event Count = 7 (time duration 00:35) Max Excursion= 0.94° F
        }\label{label-c}
                    \\
\includegraphics[width=\linewidth]{example-image}
\caption{Day19: 20-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
}\label{label-a}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day22: 22-Nov-2014: Adverse Event Count = 75 (time duration 06:15) Max Excursion= 0.94° F
        }\label{label-d}
    \end{tabularx}
    \end{figure}
% second part    
    \begin{figure}[t!]
    \begin{tabularx}{\columnwidth}{@{}*{2}{X}@{}}
\includegraphics[width=\linewidth]{example-image}
\caption{Day23: 23-Nov-2014: Adverse Event Count = 114 (time duration 09:30) Max Excursion= 4.98° F
}\label{label-e}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day24: 24-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F
        }\label{label-f}
                    \\
\includegraphics[width=\linewidth]{example-image}
\caption{Day25: 25-Nov-2014: Adverse Event Count = 12 (time duration 01:00) Max Excursion= 1.04° F}\label{label-g}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day26: 27-Nov-2014: Adverse Event Count = 8 (time duration 00:40) Max Excursion= 0.94° F}\label{label-h}
                    \\
\includegraphics[width=\linewidth]{example-image}
\caption{Day61: 01-Jan-2015: Adverse Event Count = 19 (time duration 01:35) Max Excursion= 0.57° F}\label{label-i}
    &   \includegraphics[width=\linewidth]{example-image}
        \caption{Day73: 13-Jan-2015: Adverse Event Count = 23 (time duration 01:55) Max Excursion= 0.80° F
    }\label{label-j}
    \end{tabularx}\vskip-3ex

\captionof*{figure}{Figure 9-20: Adverse Area Plots (Quantity Below 68.1 Degrees F) for all days containing adverse events. As per ACCEPT Adverse Event Paradigm, these events are only in testing/validation data-sets}
        \end{figure}
    \lipsum[4-9]
    \end{document}

在此处输入图片描述

可以通过引入重复文本的缩写来进一步改善数字外观,例如 AEC不良事件计数,我为最大行程,其含义可以在通用“标题”中给出。同样,可以用数字替换安装短名称(例如 02-Nov-2011 --> 02-11-2014)。有了这些,标题将变得更加紧凑,图形的高度也会减小。

代码是不言自明的。第一个解决方案与所讨论的 MWE 仅略有不同,第二个解决方案的主要区别在于使用tabularx,这简化了代码并使其更简洁。

相关内容