尝试在 tikzposter 的某一列中使用子图

尝试在 tikzposter 的某一列中使用子图

我正在尝试在 tikzposter 上的一个块内的图形中使用子图形,该块位于一列中,而不是将图形和标题放在块内,而是将它们放在块外,即海报的中间(见图)在此处输入图片描述。我怎样才能让它们留在街区里?

\documentclass[24pt, a1paper, landscape]{tikzposter}
\usepackage[utf8]{inputenc}

\usepackage[labelfont=bf]{caption}
\captionsetup{font=small}

\usepackage{float}
\usepackage{graphicx}
\usepackage{subcaption}


\title{\textbf{title}}
\author{me}
\date{}
\institute{\small{institute}}


\begin{document}

\maketitle
 \node[above right,opacity=0.65,inner sep=0pt,outer sep=0pt] at (bottomleft) 
{\includegraphics[width=\paperwidth,height=\paperheight]{backgroundsample}};

\block{\textbf{Text}}
{
Some Text  
}
\begin{columns}
\column{0.3}
\block{Also Text}
{
More Text Here

\begin{figure}[H]
\centering
\begin{subfigure}{0.15\textwidth}
\centering
\includegraphics[width=0.7\linewidth]{sample}
\caption{\textit{subcaption}}
\label{fig:1a}
\end{subfigure}%
\begin{subfigure}{0.15\textwidth}
\centering
\includegraphics[width=0.85\linewidth]{sample}
\caption{\textit{subcaption}}
\label{fig:1b}
\end{subfigure}
\caption{\textit{Some caption here}}
\label{fig:1}
\end{figure}



}
\end{columns}
\end{document}

答案1

不幸的是,float环境 在 tikzposter 中不起作用

在 tikzposter 中定义图形和子图形的一般解决方案是:

% preamble
\usepackage{subcaption} -> \usepackage{subfigure}   % for subfigure captions
...
% body
\begin{figure} -> \begin{tikzfigure}                % figure environment
\begin{subcaption}{...} -> \begin{minipage}{...}    % subfigure environment
\caption{...} -> \captionof{figure}{...}            % figure captions
\caption{...} -> \captionof{subfigure}{...}         % subfigure captions

因此,对于您的示例(用 标记的更改% <-):

\documentclass[24pt, a1paper, landscape]{tikzposter}
\usepackage[utf8]{inputenc}

\usepackage[labelfont=bf]{caption}
\captionsetup{font=small}

\usepackage{float}
\usepackage{graphicx}
\usepackage{subfigure} % <-


\title{\textbf{title}}
\author{me}
\date{}
\institute{\small{institute}}


\begin{document}

\maketitle
\node[above right,opacity=0.65,inner sep=0pt,outer sep=0pt] at (bottomleft) {};
% {\includegraphics[width=\paperwidth,height=\paperheight]{backgroundsample}}; % for now

\block{\textbf{Text}}
{
Some Text  
}
\begin{columns}
\column{0.3}
\block{Also Text}
{
More Text Here

\begin{tikzfigure} % <-
\centering
\begin{minipage}{0.12\textwidth} % <-
\centering
\includegraphics[width=0.7\linewidth]{sample}
\captionof{subfigure}{\textit{subcaption}} % <-
\label{fig:1a}
\end{minipage}% % <-
\begin{minipage}{0.12\textwidth} % <-
\centering
\includegraphics[width=0.85\linewidth]{sample}
\captionof{subfigure}{\textit{subcaption}} % <-
\label{fig:1b}
\end{minipage} % <-
\captionof{figure}{\textit{Some caption here}} % <-
\label{fig:1}
\end{tikzfigure} % <-


}
\end{columns}
\end{document}

得出的结果是:

(我还:1.注释掉背景图像,2.调整子图的大小以适应,3.删除它,[H]因为没有必要tikzfigure

结果

答案2

tikzposter 手册说“由于块的实现,无法使用标准 LaTeX 图形环境。” 它提供了一个 tikzfigure 环境,但 tikzposter 实际上并不支持\caption或子图。

剩下的问题是宽度用什么。看起来\textwidth\columnwidth太宽了。 \linewidth可以,但0.15\textwidth确实太小了。

\documentclass[24pt, a1paper, landscape]{tikzposter}
\usepackage[utf8]{inputenc}

\usepackage[labelfont=bf]{caption}
\captionsetup{font=small}

%\usepackage{float}
\usepackage{graphicx}
\usepackage{subcaption}
\makeatletter
\newenvironment{myfigure}{\minipage{\linewidth}\def\@captype{figure}}{\endminipage}
\makeatother

\title{\textbf{title}}
\author{me}
\date{}
\institute{\small{institute}}


\begin{document}

\maketitle
 \node[above right,opacity=0.65,inner sep=0pt,outer sep=0pt] at (bottomleft) 
{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};

\block{\textbf{Text}}
{
Some Text  
}
\begin{columns}
\column{0.3}
\block{Also Text}
{
More Text Here

\begin{myfigure}
\centering
\begin{subfigure}{0.15\textwidth}
\centering
\includegraphics[width=0.7\linewidth]{example-image-a}
\caption{\textit{subcaption}}
\label{fig:1a}
\end{subfigure}%
\begin{subfigure}{0.15\textwidth}
\centering
\includegraphics[width=0.85\linewidth]{example-image-b}
\caption{\textit{subcaption}}
\label{fig:1b}
\end{subfigure}
\caption{\textit{Some caption here}}
\label{fig:1}
\end{myfigure}

}
\end{columns}
\end{document}

相关内容