我正在使用 创建海报tikzposter
。但它似乎有一个algorithm
软件包错误。我使用以下代码,但算法块的边框跨越了海报的整个宽度:
\documentclass[a0paper, landscape]{tikzposter}
\usepackage{graphicx}
\usepackage{color}
\usepackage{tikz}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage{algorithm}
\usepackage{algorithmic}
\title{Title}
\usetheme{Autumn}
\begin{document}
\maketitle
\begin{columns}
\column{0.25}
\block[titlecenter]{1. Introduction}{
\begin{algorithm}[H]
\caption{Algorithm}
\begin{algorithmic}[1]
\STATE get the input
\STATE do the computation
\STATE output the results
\end{algorithmic}
\end{algorithm}
}
\column{0.50}
\block{2. Some graphic}{
some graphic
}
\column{0.25}
\block[titlecenter]{3. Efficiency Comparison}{
some results
}
\end{columns}
\end{document}
我试过了\begin{frame}[fragile also tried] \end{frame}
,但是没有用。有解决办法吗?
我使用了从 fancytikzposter 项目页面获取的这个 zip 文件中的包:https://bitbucket.org/surmann/tikzposter/downloads
答案1
该\column
命令不会更新依赖于设置其宽度(和规则的长度)\columnwidth
的值。algorithm
修复:\setlength{\columnwidth}{\linewidth}
在环境开头添加。使用和algorithm
可以轻松完成。etoolbox
\AtBeginEnvironment
\documentclass[a0paper, landscape]{tikzposter}
\usepackage{graphicx}
\usepackage{color}
\usepackage{tikz}
\usepackage{amsmath,amsfonts,amsthm}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{etoolbox}
\AtBeginEnvironment{algorithm}{%
\setlength{\columnwidth}{\linewidth}%
}
\title{Title}
\usetheme{Autumn}
\begin{document}
\maketitle
\begin{columns}
\column{0.25}
\block[titlecenter]{1. Introduction}{
\begin{algorithm}[H]
\caption{Algorithm}
\begin{algorithmic}[1]
\STATE get the input
\STATE do the computation
\STATE output the results
\end{algorithmic}
\end{algorithm}
}
\column{0.50}
\block{2. Some graphic}{
some graphic
}
\column{0.25}
\block[titlecenter]{3. Efficiency Comparison}{
some results
}
\end{columns}
\end{document}