下面是重现我的 tikzposter 的最小工作示例,如下所示:
我想在标题的右侧和左侧各放一个二维码。不需要很大,只要比蓝色标题框的高度略小一点就行。我该怎么做?
\documentclass[20pt, a0paper, portrait, margin=0mm, innermargin=5mm, blockverticalspace=5mm, subcolspace=-.5cm]{tikzposter}
\title{Title}
\author{Author}
\date{\today}
\institute{University}
\usepackage{blindtext}
\usepackage{comment}
\usepackage{wrapfig}
\usepackage{pgfplots}
\usepackage{floatrow}
\usetheme{Desert}
\begin{document}
\maketitle
\block[bodyoffsety=1.5cm,
titleoffsety=1.5cm]{Abstract}{Abstract goes here}
\begin{columns}
\column{0.5} % left column
\block{Block 1}{Block 1 text}
\block{Block 2}{Block 2 text}
\block{Block 3}{Block 3 text}
\column{0.5} % right column
\block{Block 4}{Block 4 text}
\block{Block 5}{Block 5 text}
\block{Bibliography}{Bibliography goes here}
\end{columns}
\end{document}
评论后更新
我按照评论中建议的 Stackexchange 帖子更新了代码:
\documentclass[20pt, a0paper, portrait, margin=0mm, innermargin=5mm, blockverticalspace=5mm, subcolspace=-.5cm]{tikzposter}
\title{Title}
\author{Author}
\date{\today}
\institute{University}
\makeatletter
\newcommand\insertlogoi[2][]{\def\@insertlogoi{\includegraphics[#1]{#2}}}
\newcommand\insertlogoii[2][]{\def\@insertlogoii{\includegraphics[#1]{#2}}}
\newlength\LogoSep
\setlength\LogoSep{-70pt}
\insertlogoi[width=6cm]{qrcode}
\insertlogoii[width=6cm]{qrcode}
\renewcommand\maketitle[1][]{ % #1 keys
\normalsize
\setkeys{title}{#1}
% Title dummy to get title height
\node[transparent,inner sep=\TP@titleinnersep, line width=\TP@titlelinewidth, anchor=north, minimum width=\TP@visibletextwidth-2\TP@titleinnersep]
(TP@title) at ($(0, 0.5\textheight-\TP@titletotopverticalspace)$) {\parbox{\TP@titlewidth-2\TP@titleinnersep}{\TP@maketitle}};
\draw let \p1 = ($([email protected])-([email protected])$) in node {
\setlength{\TP@titleheight}{\y1}
\setlength{\titleheight}{\y1}
\global\TP@titleheight=\TP@titleheight
\global\titleheight=\titleheight
};
% Compute title position
\setlength{\titleposleft}{-0.5\titlewidth}
\setlength{\titleposright}{\titleposleft+\titlewidth}
\setlength{\titlepostop}{0.5\textheight-\TP@titletotopverticalspace}
\setlength{\titleposbottom}{\titlepostop-\titleheight}
% Title style (background)
\TP@titlestyle
% Title node
\node[inner sep=\TP@titleinnersep, line width=\TP@titlelinewidth, anchor=north, minimum width=\TP@visibletextwidth-2\TP@titleinnersep]
at (0,0.5\textheight-\TP@titletotopverticalspace)
(title)
{\parbox{\TP@titlewidth-2\TP@titleinnersep}{\TP@maketitle}};
\node[inner sep=0pt,anchor=west]
at ([xshift=-\LogoSep]title.west)
{\@insertlogoi};
\node[inner sep=0pt,anchor=east]
at ([xshift=\LogoSep]title.east)
{\@insertlogoii};
% Settings for blocks
\normalsize
\setlength{\TP@blocktop}{\titleposbottom-\TP@titletoblockverticalspace}
}
\makeatother
\usepackage{blindtext}
\usepackage{comment}
\usepackage{wrapfig}
\usepackage{pgfplots}
\usepackage{floatrow}
\usepackage{qrcode} % Add this to your preamble
\usetheme{Desert}
\begin{document}
\maketitle
\block[bodyoffsety=1.5cm,
titleoffsety=1.5cm]{Abstract}{Abstract goes here}
\begin{columns}
\column{0.5} % left column
\block{Block 1}{Block 1 text}
\block{Block 2}{Block 2 text}
\block{Block 3}{Block 3 text}
\column{0.5} % right column
\block{Block 4}{Block 4 text}
\block{Block 5}{Block 5 text}
\block{Bibliography}{Bibliography goes here}
\end{columns}
\end{document}
答案1
使用 TikZPoster 的\settitle
命令可以重新定义标题布局。
下面的示例基于默认设置(参见 TikZPoster 手册)并在标题栏的外端插入二维码,两者都自动缩放以适合标题栏的预定义边距(innersep
如果需要,可以使用选项进行调整,参见手册):
\makettitle[innersep=...]
pst-barcode
应该优先选择该包qrcode
,因为它的输出质量更好(参见:https://tex.stackexchange.com/a/710114),但在这里,我们qrcode
在问题中使用as。
梅威瑟:
\documentclass[20pt, a0paper, portrait, margin=0mm, innermargin=5mm, blockverticalspace=5mm, subcolspace=-.5cm]{tikzposter}
\title{Title}
\author{Author}
\date{\today}
\institute{University}
\usepackage{blindtext}
\usepackage{comment}
\usepackage{wrapfig}
\usepackage{pgfplots}
\usepackage{floatrow}
\usetheme{Desert}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% define left and right title graphics (two QR codes), at their default size
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{qrcode}
%\usepackage{pst-barcode}
\newcommand\titlegraphicLeft{%
\qrcode{https://ctan.org/tex-archive/graphics/pstricks/contrib/pst-barcode}%
% \makebox[1in][l]{\rule{0pt}{1in}%
% \psbarcode{https://ctan.org/tex-archive/graphics/pstricks/contrib/pst-barcode}{width=1 height=1}{qrcode}%
% }%
}
\newcommand\titlegraphicRight{%
\qrcode{https://tex.stackexchange.com/q/710219}%
% \makebox[1in][l]{\rule{0pt}{1in}%
% \psbarcode{https://tex.stackexchange.com/q/710219}{width=1 height=1}{qrcode}%
% }%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% redefine poster title based on default implementation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\settitle{%
%rescale and insert left QR
\raisebox{-0.5\totalheight+\depth}{\makebox[0pt][l]{\resizebox*{!}{\titleheight-2\titleinnersep}{\titlegraphicLeft}}}%
%insert title matter
\raisebox{-0.5\totalheight+\depth}{\makebox[\linewidth]{%
\vbox{%
\centering%
\color{titlefgcolor}%
{\bfseries\Huge\sc\@title\par}%
\vspace*{1em}%
{\huge \@author\par}%
\vspace*{1em}%
{\LARGE \@institute}%
}%
}}%
%rescale and insert right QR
\raisebox{-0.5\totalheight+\depth}{\makebox[0pt][r]{\resizebox*{!}{\titleheight-2\titleinnersep}{\titlegraphicRight}}}%
}%
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\maketitle
\block[bodyoffsety=1.5cm,
titleoffsety=1.5cm]{Abstract}{Abstract goes here}
\begin{columns}
\column{0.5} % left column
\block{Block 1}{Block 1 text}
\block{Block 2}{Block 2 text}
\block{Block 3}{Block 3 text}
\column{0.5} % right column
\block{Block 4}{Block 4 text}
\block{Block 5}{Block 5 text}
\block{Bibliography}{Bibliography goes here}
\end{columns}
\end{document}