为什么 TikZ 覆盖在这个 baposter 中不起作用?

为什么 TikZ 覆盖在这个 baposter 中不起作用?

请考虑以下baposter我添加叠加的 TikZ 图形以在海报顶部绘制箭头的位置。(我观察到在框内添加给定的 TikZ 图形会在其内容下方增加多余的垂直间距,因此我尝试将 TikZ 图形放在最后一个框之后。)

\documentclass[a0paper,portrait]{baposter}

\usepackage{tikz}

\definecolor{bordercol}{RGB}{40,40,40}
\definecolor{headercol1}{RGB}{186,215,230}
\definecolor{headercol2}{RGB}{80,80,80}
\definecolor{headerfontcol}{RGB}{0,0,0}
\definecolor{boxcolor}{RGB}{186,215,230}

\begin{document}

\background{
}

\begin{poster}{
    grid=false, 
    borderColor=bordercol,
    headerColorOne=headercol1,
    headerColorTwo=headercol2,
    headerFontColor=headerfontcol,
    boxColorOne=boxcolor,
    headershape=roundedright,
    headerfont=\Large\sf\bf,
    textborder=rectangle,
    background=user,
    headerborder=open,
    boxshade=plain,
    headerheight=3cm
}
%%% Eye Cacther %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
}
%%% Title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\sf\bf
    \includegraphics[height=3cm]{pix/elte_logo}\\
    Can I lower this title?
}
%%% Authors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
    \vspace{1em} Pr. Oblematic\\
    {Affiliation \\ Long affiliation \\ Very long affiliation}
}
%%% Logo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
}

\headerbox{Problem}{name=problem1,column=0,row=0}{
}

\headerbox{Solution}{name=solution1,column=0,below=problem1,above=bottom}{
}

\headerbox{Problem}{name=problem2,span=2,column=1,row=0}{
}

\headerbox{Solution}{name=solution2,span=2,column=1,below=problem2,above=bottom}{
}
\begin{tikzpicture}[remember picture, overlay]
\draw[red,->] (current page.center) -- (current page.center)++(1cm, 1cm);
\end{tikzpicture}
\end{poster}
\end{document}

(改编自随附的 ECCS2011 教程baposter。)

但是,我得到了以下结果。发生了什么?如何正确地将 TikZ 图片叠加在给定的海报上?

在此处输入图片描述

答案1

  1. 路径

    (current page.center) -- (current page.center)++(1cm, 1cm)
    

    描述从页面中心到页面中心的长度为零的直线,然后相对于中心进行移动到操作(这是一个+),并且将后续相对坐标的新原点移动到该点(另一个这是一个+)。

  2. 作为山姆笔记 baposter内部使用 TikZ 图片,因此只需将另一张 TikZ 图片放入其中就会破坏一切。

  3. 您不能直接将新的 TikZ 图片放在poster环境后面,因为……分页符。

  4. shipout/foreground但是,您可以通过添加以下代码将新的 TikZ 图片放在当前页面的前台:环境poster

    \AddToHookNext{shipout/foreground}{%
      \begin{tikzpicture}[remember picture, overlay]
      \draw[red,->] (current page.center) -- ++(1cm, 1cm);
      \end{tikzpicture}%
    }
    
  5. poster您还可以通过添加来使用 TikZ 图片

    \tikzset{
      remember picture,
      execute at end picture={
    %    \tikzset{overlay}% maybe
        \draw[red, ->] (current page.center) -- ++(1cm, 1cm);
      }
    }
    

    环境poster

代码

\documentclass[a0paper,portrait]{baposter}

\definecolor{bordercol}{RGB}{40,40,40}
\definecolor{headercol1}{RGB}{186,215,230}
\definecolor{headercol2}{RGB}{80,80,80}
\definecolor{headerfontcol}{RGB}{0,0,0}
\definecolor{boxcolor}{RGB}{186,215,230}

\begin{document}
\AddToHookNext{shipout/foreground}{%
  \begin{tikzpicture}[remember picture, overlay]
  \draw[blue, ->] (current page.center) -- ++(-1cm, -1cm);
  \end{tikzpicture}%
}
\background{}

\begin{poster}{
    grid=false,
    borderColor=bordercol,
    headerColorOne=headercol1,
    headerColorTwo=headercol2,
    headerFontColor=headerfontcol,
    boxColorOne=boxcolor,
    headershape=roundedright,
    headerfont=\Large\sffamily\bfseries,
    textborder=rectangle,
    background=user,
    headerborder=open,
    boxshade=plain,
    headerheight=3cm
}
%%% Eye Cacther %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
}
%%% Title %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\sffamily\bfseries
%    \includegraphics[height=3cm]{pix/elte_logo}\\
    Can I lower this title?
}
%%% Authors %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
    \vspace{1em} Pr. Oblematic\\
    {Affiliation \\ Long affiliation \\ Very long affiliation}
}
%%% Logo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
}
\tikzset{
  remember picture,
  execute at end picture={
%    \tikzset{overlay}% maybe
    \draw[red, ->] (current page.center) -- ++(1cm, 1cm);
  }
}

\headerbox{Problem}{name=problem1,column=0,row=0}{
}

\headerbox{Solution}{name=solution1,column=0,below=problem1,above=bottom}{
}

\headerbox{Problem}{name=problem2,span=2,column=1,row=0}{
}

\headerbox{Solution}{name=solution2,span=2,column=1,below=problem2,above=bottom}{
}
\end{poster}
\end{document}

相关内容