在 baposter 中添加子图和子标题

在 baposter 中添加子图和子标题

我们如何才能在 baposter 中为子图添加子标题。文件 baposter.cls 可在此处获取baposter.cls.代码如下:

\documentclass[landscape,a0paper]{baposter} % Adjust the font scale/size here fontscale=0.285
\usepackage{graphicx} % Required for including images
\graphicspath{{figures/}} % Directory in which figures are storedhttps://www.overleaf.com/project/5f12e7a80c36e30001056c20
\usepackage{amsmath} % For typesetting math
\usepackage{amssymb} % Adds new symbols to be used in math mode
\usepackage{booktabs} % Top and bottom rules for tables
\usepackage{enumitem} % Used to reduce itemize/enumerate spacing
\usepackage{palatino} % Use the Palatino font
\usepackage[font=small,labelfont=bf]{caption} % Required for specifying captions to tables and figures

\usepackage{multicol} % Required for multiple columns
\setlength{\columnsep}{1.5em} % Slightly increase the space between columns
\setlength{\columnseprule}{0mm} % No horizontal rule between columns

\usepackage{tikz} % Required for flow chart
\usetikzlibrary{shapes,arrows} % Tikz libraries required for the flow chart in the template

\newcommand{\compresslist}{ % Define a command to reduce spacing within itemize/enumerate environments, this is used right after \begin{itemize} or \begin{enumerate}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}

\definecolor{lightblue}{rgb}{0.145,0.6666,1} % Defines the color used for content box headers
\definecolor{green1}{cmyk}{0.2,0.8,0.0,0.2}
\definecolor{darkblue}{cmyk}{0.8,0.2,0.0,0.8}
\definecolor{darkgreen}{cmyk}{0.8,0,0.0,0.45}
\definecolor{lightgreen}{cmyk}{0.8,0,0.0,0.25}

\begin{document}
\background{
    \begin{tikzpicture}[remember picture,overlay]%
    \node[anchor=north west] at (current page.north west) {\includegraphics[height=2em, width = 2em]{example-image-a}};
    \node[anchor=north east] at (current page.north east) {\includegraphics[height=2em, width = 2em]{example-image-a}};
    \end{tikzpicture}
}
\begin{poster}
{
headerborder=open, % Adds a border around the header of content boxes
colspacing=1em, % Column spacing
bgColorOne=white, % Background color for the gradient on the left side of the poster
bgColorTwo=white, % Background color for the gradient on the right side of the poster
borderColor=lightblue, % Border color
headerColorOne=lightgreen, % Background color for the header in the content boxes (left side)
headerColorTwo=lightgreen, % Background color for the header in the content boxes (right side)
headerFontColor=white, % Text color for the header text in the content boxes
boxColorOne=white, % Background color of the content boxes
textborder=roundedleft, % Format of the border around content boxes, can be: none, bars, coils, triangles, rectangle, rounded, roundedsmall, roundedright or faded
eyecatcher=true, % Set to false for ignoring the left logo in the title and move the title left
headerheight=0.3\textheight, % Height of the header
headershape=roundedright, % Specify the rounded corner in the content box headers, can be: rectangle, small-rounded, roundedright, roundedleft or rounded
headerfont=\Large\bf\textsf, % Large, bold and sans serif font in the headers of content boxes
%textfont={\setlength{\parindent}{1.5em}}, % Uncomment for paragraph indentation
linewidth=2pt, % Width of the border lines around content boxes
background=user %<-- added
}
%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------
{\includegraphics[height=2em, width = 2em]{example-image-a}} %<-- eyecatcher
% {\includegraphics[height=1.5 em, width = 2.5 em]{logo.png}} % First university/lab logo on the left
{\bfseries\sffamily\textcolor{darkblue}{A very long Title}} % Poster title
%{\textsf{}}\vspace{0.1em}\\{}
% Author names and institution
{Authors}
{\includegraphics[height=2em, width = 2em]{example-image-a}}
 % Second university/lab logo on the right

%----------------------------------------------------------------------------------------
%   OBJECTIVES
%----------------------------------------------------------------------------------------

\begin{posterbox}[name=1,column=0,row=0, span = 2]{Introduction}
\begin{minipage}{\linewidth}
\centering
  \subfloat[Image A]{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \hfill
  \subfloat[Image B]{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \captionof{figure}{Signed distance field representation}
\end{minipage}
\end{posterbox}

\end{poster}
\end{document} 

答案1

每个posterbox都是一个盒子。您不能将诸如figure和 之类的浮动环境table放入盒子中。

解决方案是使用包中的创建一个假figure环境。请注意,您需要在前言中更改为。然后按预期工作。您可以恢复使用而不是,尽管当然仍然有效。\setcaptiontype{figure}subcaption\usepackage{caption}usepackage{subcaption}Subfloat\caption\captionof{figure}\captionof{figure}

另一个选项是使用\subcaptionbox,同样来自subcaption包,用于添加子标题。语法为:\subcaptionbox[<list entry>]{<heading>}[<width>][<inner-pos>]{<contents>}。示例仅使用{<heading>},设置为figure,和{<contents>},设置为Sub1Sub2\subcaptionbox此处未使用这些选项,但它们确实提供了额外的定位精度。请参阅subcaption文档以了解更多详细信息。

在此处输入图片描述

\documentclass[landscape,a0paper]{baposter} % Adjust the font scale/size here fontscale=0.285
\usepackage{graphicx} % Required for including images
\graphicspath{{figures/}} % Directory in which figures are storedhttps://www.overleaf.com/project/5f12e7a80c36e30001056c20
\usepackage{amsmath} % For typesetting math
\usepackage{amssymb} % Adds new symbols to be used in math mode
\usepackage{booktabs} % Top and bottom rules for tables
\usepackage{enumitem} % Used to reduce itemize/enumerate spacing
\usepackage{palatino} % Use the Palatino font
\usepackage[font=small,labelfont=bf]{subcaption} % <-- changed to subcaption

\usepackage{multicol} % Required for multiple columns
\setlength{\columnsep}{1.5em} % Slightly increase the space between columns
\setlength{\columnseprule}{0mm} % No horizontal rule between columns

\usepackage{tikz} % Required for flow chart
\usetikzlibrary{shapes,arrows} % Tikz libraries required for the flow chart in the template

\newcommand{\compresslist}{ % Define a command to reduce spacing within itemize/enumerate environments, this is used right after \begin{itemize} or \begin{enumerate}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}

\definecolor{lightblue}{rgb}{0.145,0.6666,1} % Defines the color used for content box headers
\definecolor{green1}{cmyk}{0.2,0.8,0.0,0.2}
\definecolor{darkblue}{cmyk}{0.8,0.2,0.0,0.8}
\definecolor{darkgreen}{cmyk}{0.8,0,0.0,0.45}
\definecolor{lightgreen}{cmyk}{0.8,0,0.0,0.25}

\begin{document}
\background{
    \begin{tikzpicture}[remember picture,overlay]%
    \node[anchor=north west] at (current page.north west) {\includegraphics[height=2em, width = 2em]{example-image-a}};
    \node[anchor=north east] at (current page.north east) {\includegraphics[height=2em, width = 2em]{example-image-a}};
    \end{tikzpicture}
}
\begin{poster}
{
headerborder=open, % Adds a border around the header of content boxes
colspacing=1em, % Column spacing
bgColorOne=white, % Background color for the gradient on the left side of the poster
bgColorTwo=white, % Background color for the gradient on the right side of the poster
borderColor=lightblue, % Border color
headerColorOne=lightgreen, % Background color for the header in the content boxes (left side)
headerColorTwo=lightgreen, % Background color for the header in the content boxes (right side)
headerFontColor=white, % Text color for the header text in the content boxes
boxColorOne=white, % Background color of the content boxes
textborder=roundedleft, % Format of the border around content boxes, can be: none, bars, coils, triangles, rectangle, rounded, roundedsmall, roundedright or faded
eyecatcher=true, % Set to false for ignoring the left logo in the title and move the title left
headerheight=0.3\textheight, % Height of the header
headershape=roundedright, % Specify the rounded corner in the content box headers, can be: rectangle, small-rounded, roundedright, roundedleft or rounded
headerfont=\Large\bf\textsf, % Large, bold and sans serif font in the headers of content boxes
%textfont={\setlength{\parindent}{1.5em}}, % Uncomment for paragraph indentation
linewidth=2pt, % Width of the border lines around content boxes
background=user %<-- added
}
%----------------------------------------------------------------------------------------
%   TITLE SECTION
%----------------------------------------------------------------------------------------
{\includegraphics[height=2em, width = 2em]{example-image-a}} %<-- eyecatcher
% {\includegraphics[height=1.5 em, width = 2.5 em]{logo.png}} % First university/lab logo on the left
{\bfseries\sffamily\textcolor{darkblue}{A very long Title}} % Poster title
%{\textsf{}}\vspace{0.1em}\\{}
% Author names and institution
{Authors}
{\includegraphics[height=2em, width = 2em]{example-image-a}}
 % Second university/lab logo on the right

%----------------------------------------------------------------------------------------
%   OBJECTIVES
%----------------------------------------------------------------------------------------

\begin{posterbox}[name=1,column=0,row=0, span = 2]{Introduction}
\setcaptiontype{figure}% Fake a figure environment
\centering
  \subfloat[Image A]{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \hfill
  \subfloat[Image B]{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \caption{Signed distance field representation}
\end{posterbox}

\begin{posterbox}[name=2,column=0,below=1, span = 2]{Box2}
  \setcaptiontype{figure}% Fake a figure environment
  \centering
  \subcaptionbox{Sub1}{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \hfill
  \subcaptionbox{Sub1}{\includegraphics[width=0.3\linewidth]{example-image-a}}
  \caption{My figure}
\end{posterbox}

\end{poster}
\end{document}

相关内容