Skip to content

Commit

Permalink
contrib: poster (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
LogCreative authored Sep 20, 2022
1 parent d339f9e commit 5d10b75
Show file tree
Hide file tree
Showing 4 changed files with 354 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:
branches:
- main
- develop
types:
- 'review_requested'
paths:
- 'contrib/**'

Expand Down Expand Up @@ -44,7 +42,7 @@ jobs:
run: |
apk add ghostscript imagemagick gnupg
sed -i "s|<policy domain=\"coder\" rights=\"none\" pattern=\"PDF\" />|<policy domain=\"coder\" rights=\"read\|write\" pattern=\"PDF\" />|g" /etc/ImageMagick-*/policy.xml
.github/ci/build_contrib.sh -halt-on-error -time -quiet -xelatex
.github/ci/build_contrib.sh -halt-on-error -time -xelatex
name: build contrib doc with XeLaTeX
- uses: actions/upload-artifact@v2
with:
Expand Down
168 changes: 168 additions & 0 deletions contrib/poster/poster.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
\documentclass{ctexbeamer}
\usetheme[red]{sjtubeamer}
\usesjtutheme{poster}
% \usesjtutheme[landscape]{poster}
% \usesjtutheme[sepinst]{poster}
% \usesjtutheme[noindent]{poster}
\usepackage{subcaption}
\usepackage[style=gb7714-2015]{biblatex}
\addbibresource{\getcontribpath{poster}{ref.bib}}
\usepackage{zhlipsum}
\begin{document}
\title{poster 子主题}
\author{作者}
\logo{\zhlogo}
\institute[Test Institute]{测试机构}
\footline[左脚注]{右脚注}
\begin{frame}[fragile]
\begin{columns}[T]
\begin{column}{.45\textwidth}

\begin{stampblock}{主题概述}
\texttt{poster} 子主题基于 \texttt{beamerposter} 宏包\cite{beamerposter},对 SJTUBeamer 进行适配以制作海报,展示您的成果。
\codeblockinput[firstline=1,lastline=3]{开始使用}{poster.tex}
\end{stampblock}

\begin{stampblock}{风格建议}
建议使用 \texttt{stampblock} 环境分割不同的区块。你也可以使用 \texttt{block} 环境分割不同的区块。相较于普通 \texttt{beamer} 幻灯片文字较少的情形,\texttt{poster} 更有可能会写入大段文字,所以默认情况下这些区块内部会有首行缩进。由于 \texttt{column} 环境内部不受外部首行缩进的影响,所以不推荐之间在 \texttt{column} 环境中书写内容,而应该再套一层 \texttt{stampblock} 或 \texttt{block}。

可以插入图片来丰富你的海报内容,但请注意由于海报的纸张尺寸较大,像一些高 DPI 显示的场景一样,会对文字大小进行缩放,但是度量上却没有发生变化,请注意要使用相对于平时更大的度量插入图片。

不推荐直接插入 Ti\emph{k}Z 的代码,推荐使用 \texttt{standalone} 文档类产生 PDF 文件后再插入,否则会导致图片内的文字过大而排版错乱。
\end{stampblock}

\begin{stampblock}{多栏对齐}
推荐使用 \texttt{columns} 环境分割多栏,环境可选选项可以用于指定顶部对齐 \texttt{t},居中对齐 \texttt{c},底部对齐 \texttt{b}。
\codeblockinput[firstline=16,lastline=16,firstnumber=1]{多栏}{poster.tex}
\end{stampblock}

\end{column}
\begin{column}{.45\textwidth}

\begin{stampblock}{图文混排}
由于 \texttt{beamer} 关闭了浮动体浮动,所以推荐使用多栏分割的方式实现图文混排。
或者是多图并排放置。
\begin{columns}
\begin{column}{0.7\textwidth}
上海交通大学的东大门---紫气东来门,简称庙门,位于上海市闵行区莲花南路 4800 号。
\end{column}
\begin{column}{0.3\textwidth}
\begin{figure}
\includegraphics[width=\textwidth]{vi/sjtuphoto.jpg}
\caption{庙门}
\end{figure}
\end{column}
\end{columns}
\begin{figure}
\begin{subfigure}{0.4\textwidth}
\resizebox{\textwidth}{!}{\secondaryinstlogo[Test Institute]{测试机构}{\zhlogo}}
\caption{中文}
\end{subfigure}\hspace*{20pt}
\begin{subfigure}{0.4\textwidth}
\resizebox{\textwidth}{!}{\secondaryinstlogo[]{Test Institute}{\enlogo}}
\caption{英文}
\end{subfigure}
\caption{二级机构徽标}
\end{figure}
\end{stampblock}

\begin{stampblock}{参考文献}

可以使用图标样式的参考文献。

\begin{bibliolist}{00}
\onlineitem \textsc{Tantau T}, \textsc{Wright J}, and \textsc{Mileti\'c V}.\newblock
The beamer class: User Guide for version 3.67[OL].\newblock
2022. \url{https://github.com/josephwright/beamer}
\articleitem \textsc{上海交通大学}.\newblock
上海交通大学视觉形象识别系统[OL].\newblock
2016. \url{https://vi.sjtu.edu.cn}
\bookitem \textsc{Knuth DE}.\newblock
The \TeX{}book[M].\newblock
Addison-Wesley. 1986.
\end{bibliolist}

你也可以使用 \texttt{biblatex} 插入参考文献。

\printbibliography

\end{stampblock}

\end{column}
\end{columns}

% 分割线
\vspace*{2cm}
\begin{tikzpicture}
\draw[cprimary,decoration=stampline,segment length=1cm,decorate] (0,0) -- (0.94\textwidth,0);
\end{tikzpicture}
\vspace*{2cm}

\begin{columns}
\begin{column}{0.45\textwidth}
\begin{block}{选项}
\texttt{poster} 子主题拥有一些选项。
\begin{description}
\item[\texttt{sepinst}] 分离徽标与机构于两侧
\item[\texttt{landscape}] 横向海报
\item[\texttt{noindent}] 首行不缩进
\end{description}
\end{block}
\begin{alertblock}{脚注}
使用 \texttt{\textbackslash{}footline[左脚注]\{右脚注\}} 设定左脚注和右脚注。
\end{alertblock}
\begin{exampleblock}{区块}
仍然可以使用内置的 \texttt{block}, \texttt{alertblock}, \texttt{exampleblock} 插入对应的区块。
\end{exampleblock}
\end{column}
\begin{column}{0.45\textwidth}

\begin{stampblock}[a]{印记区块}
使用 \texttt{stampblock} 环境插入带有印记图案的区块,编号会自动递增。你也可以通过指定可选参数来设置编号内容。
\end{stampblock}

\begin{codeblock}[numbers=none]{代码块}
% 应当减少代码块的使用,增加了标题栏的高度。
% 关闭代码行号编号可以在 codeblock 上添加选项 numbers=none
\end{codeblock}

\begin{columns}[b]
\begin{column}{.5\textwidth}
\begin{stampbox}
\includegraphics[width=16cm]{vi/sjtuphoto.jpg}
\end{stampbox}
\end{column}
\begin{column}{.5\textwidth}
$\leftarrow$ 你仍然可以使用 \texttt{stampbox} 环境插入带边框的图片\vspace{1ex}
\end{column}
\end{columns}
\end{column}
\end{columns}
\end{frame}
\title{}
\author{}
\logo{}
\institute[]{}
\begin{frame}
\begin{columns}

\begin{column}{.5\textwidth}
\begin{stampblock}{测试}
\zhlipsum[1]
\end{stampblock}

\begin{stampblock}{测试}
\zhlipsum[2]
\end{stampblock}

\vspace*{0.5ex}

\begin{stampblock}{测试}
\zhlipsum[3]
\end{stampblock}
\end{column}

\end{columns}

\end{frame}
\end{document}
8 changes: 8 additions & 0 deletions contrib/poster/ref.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@Misc{beamerposter,
author = {Dreuw, Philippe and Deselaers, Thomas},
title = {The beamerposter package},
year = {2021},
url = {https://github.com/deselaers/latex-beamerposter},
}

@Comment{jabref-meta: databaseType:bibtex;}
177 changes: 177 additions & 0 deletions contrib/poster/sjtubeamerthemeposter.ltx
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
%% ------------------------------------------------------------------------
%% Copyright (C) 2022 LogCreative
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%% ------------------------------------------------------------------------
% 设置文件元数据
\ProvidesFile{sjtubeamerthemeposter.ltx}[2022/09/20 Beamerposter adapter for SJTUBeamer]
\PassOptionsToPackage{orientation=portrait}{beamerposter}
\if\EqualOption{poster}{landscape}{true}
\PassOptionsToPackage{orientation=landscape}{beamerposter}
\fi
% 加载 beamerposter
\usepackage[size=a0,scale=1.4]{beamerposter}
% 设置 headline 颜色跟随亮色/暗色
\setbeamercolor{headline}{parent=palette primary}
\AtBeginDocument{
% 修改 headline,需要在文档起始处覆盖,防止 default 的行为
\setbeamertemplate{headline}{
\begin{beamercolorbox}[wd=\paperwidth,sep=0.02\paperwidth]{headline}
\begin{columns}
\begin{column}{0.25\textwidth}
\hspace*{0.02\paperwidth}
\if\EqualOption{poster}{sepinst}{true}%
\resizebox{!}{4cm}{\vphantom{-}\usebeamertemplate{logo}}
\else%
\if\EqualOption{inner}{lang}{en}%
\resizebox{!}{4cm}{\vphantom{-}\secondaryinstlogo{\csname beamer@shortinstitute\endcsname}{\usebeamertemplate{logo}}}
\else%
\resizebox{!}{4cm}{\vphantom{-}\secondaryinstlogo[\insertshortinstitute]{\insertinstitute}{\usebeamertemplate{logo}}}
\fi%
\fi%
\end{column}
\begin{column}{0.5\textwidth}
\vfill
\centering
\usebeamercolor{title in headline}{%
\color{fg}\textbf{\LARGE{\inserttitle}}\vskip2.5ex
}
\usebeamercolor{author in headline}{%
\color{fg}\large{\insertauthor}
}
\vfill
\end{column}
\begin{column}{0.25\textwidth}
\if\EqualOption{poster}{sepinst}{true}
\hfill
\if\EqualOption{inner}{lang}{en}
\resizebox{!}{4cm}{\vphantom{-}\secondaryinstlogo{\csname beamer@shortinstitute\endcsname}{}}
\else
\resizebox{!}{4cm}{\vphantom{-}\secondaryinstlogo[\insertshortinstitute]{\insertinstitute}{}}
\fi
\hspace*{0.03\paperwidth}
\else
\begin{tikzpicture}[overlay]
\if\EqualOption{poster}{landscape}{true}
\def\stampheight{0.05}
\def\stampsize{60pt}
\else
\def\stampheight{0.03}
\def\stampsize{50pt}
\fi
\usebeamercolor{palette primary}
\stamparray{\stampsize}{(-0.05\paperwidth,-\stampheight\paperheight)}{(\paperwidth,\stampheight\paperheight)}
\fill[bg, path fading=fade right] (-0.05\paperwidth, -\stampheight\paperheight) rectangle (\paperwidth, \stampheight\paperheight);
\end{tikzpicture}
\fi
\end{column}
\end{columns}
\end{beamercolorbox}
}
}
% 新的命令 设置底栏 \footline[左脚注]{右脚注}
\newif\ifposterfootline
\def\posterrightfootline{}
\def\posterleftfootline{}
\providecommand{\footline}[2][]{
\def\posterleftfootline{#1}
\def\posterrightfootline{#2}
}
% 底栏为空时不会出现
\setbeamercolor{footline}{parent=palette primary}
\setbeamertemplate{footline}{%
\resizebox{\paperwidth}{!}{\sjtugate[cprimary]}\vskip-6cm\par
\posterfootlinetrue
\ifx\posterleftfootline\relax
\ifx\posterrightfootline\relax
\posterfootlinefalse
\fi
\fi
\ifposterfootline
\begin{beamercolorbox}[wd=\paperwidth]{footline}
\small\vskip1.5ex\hspace*{0.02\paperwidth}\posterleftfootline\hfill
\posterrightfootline\hspace*{0.02\paperwidth}\vskip3ex
\end{beamercolorbox}
\fi
}
% 重置区块间隙
\setbeamertemplate{block begin}{
\vskip.75ex
\begin{beamercolorbox}[colsep*=.75ex]{block title}%
\usebeamerfont*{block title}\insertblocktitle
\end{beamercolorbox}%
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block end}{
\end{beamercolorbox}
}
\setbeamertemplate{block alerted begin}{
\vskip.75ex
\begin{beamercolorbox}[colsep*=.75ex]{block title alerted}%
\usebeamerfont*{block title}\insertblocktitle
\end{beamercolorbox}%
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body alerted}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block alerted end}{
\end{beamercolorbox}
}
\setbeamertemplate{block example begin}{
\vskip.75ex
\begin{beamercolorbox}[colsep*=.75ex]{block title example}%
\usebeamerfont*{block title}\insertblocktitle
\end{beamercolorbox}%
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body example}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block example end}{
\end{beamercolorbox}
}
% tcolorbox 设定
\tcbset{toptitle=2.5mm,bottomtitle=2.5mm}
\if\EqualOption{poster}{noindent}{true}\else%
% 首行缩进
\setlength{\parindent}{2em}%
% 重定义 stampblock 的首行缩进
\addtobeamertemplate{block stamp begin}{}{%
\setlength{\parindent}{2em}%
}
% 重定义 block 的缩进
\addtobeamertemplate{block begin}{}{%
\setlength{\parindent}{2em}%
}
\addtobeamertemplate{block alerted begin}{}{%
\setlength{\parindent}{2em}%
}
\addtobeamertemplate{block example begin}{}{%
\setlength{\parindent}{2em}%
}
\fi%
% 重设引用条目同名图标大小
\pgfdeclareimage[height=26pt]{beamericonbook}{beamericonbook}
\pgfdeclareimage[height=26pt]{beamericonbookshaded}{beamericonbook.20}
\pgfdeclareimage[height=34pt]{beamericonarticle}{beamericonarticle}
\pgfdeclareimage[height=34pt]{beamericonarticleshaded}{beamericonarticle.20}
\pgfdeclareimage[height=32pt]{beamericononline}{beamericononline}
\pgfdeclareimage[height=32pt]{beamericononlineshaded}{beamericononline.20}
% 为了防止无法悬挂对齐的情形,直接使用 text 模式的 bibliography item
% 可以改为正常的 article, book, online 等。
% 注意!如果使用 gb7714-2015ay 样式,请手动删除本行。
\setbeamertemplate{bibliography item}[text]

0 comments on commit 5d10b75

Please sign in to comment.