如何更改 baposter 中主标题的背景颜色?

如何更改 baposter 中主标题的背景颜色?

大家好。这是我在这里的第一个问题!我正在制作一张海报。我试图将主标题的颜色改为:背景——海蓝色,文字颜色——白色。我成功地直接使用 \textbf{\color{white}{main title}} 将主标题的文字颜色改为白色,但不知何故找不到改变背景颜色的方法。我尝试更改所有颜色选项以查看是否有任何效果,但没有成功。有人能帮我吗?非常感谢! baposter.cls

\documentclass[landscape,archE]{baposter}

\usepackage{color}
\usepackage{times}
\usepackage{helvet}
\usepackage{palatino}
\selectcolormodel{RGB}
\begin{document}
\definecolor{reddishyellow}{cmyk}{0,0.22,1.0,0.0}
\definecolor{black}{cmyk}{0,0,0.0,1.0}
\definecolor{DrexelBlue}{HTML}{07294D}
\definecolor{Gray}{HTML}{777675}
\typeout{Poster Starts}
\background{
\begin{tikzpicture}[remember picture,overlay]%
\draw (current page.north west)+(-2em,2em) node[anchor=north west] {\includegraphics[height=1.1\textheight]{silhouettes_background}};
\end{tikzpicture}%
}
\newlength{\leftimgwidth}
\begin{poster}%
% Poster Options
{
% Show grid to help with alignment
grid=false,
columns=5,
% Column spacing
colspacing=1em,
% Color style
bgColorOne=DrexelBlue,
bgColorTwo=white, 
borderColor=Gray,
headerColorOne=Gray,
headerColorTwo=reddishyellow,
headerFontColor=white, 
boxColorOne=white, 
%boxColorTwo=lighteryellow,
% Format of textbox
textborder=none,
textborder=rectangle,
% Format of text header
eyecatcher=false,
headerborder=open,
headerheight=0.15\textheight, %11
headershape=rectangle,
headershade=plain,
headerfont=\Large\textsf, %Sans Serif
boxshade=plain,
background=shadeTB,
linewidth=.5pt
}
% Eye Catcher
{% No eye catcher for this poster. (eyecatcher=no above).
}%If an eye catcher is present, the title is centered between eye-catcher and logo.
% Title
{\sf %Sans Serif
%\bf% Serif
\vspace{.25em}
\textbf{Evaluating the Model}\\}
% Authors
{\sf %Sans Serif
\vspace{.25em}John Smith$^{1}$, Harrison Frank$^{2}$\\ %.25
{\small
$^1$ Doctoral Student,USA\\
$^2$ USA}
}
{
\begin{minipage}[t]{50.0em} %28
\begin{tabular}{ll}
\end{tabular}
\vfill
\end{minipage}
} 
\tikzstyle{light shaded}=[top color=baposterBGtwo!30!white,bottom color=baposterBGone!30!white,shading=axis,shading angle=30]
\setlength{\leftimgwidth}{0.78em+8.0em}
\newcommand{\colouredcircle}[1]{%
\tikz{\useasboundingbox (-0.2em,-0.32em) rectangle(0.2em,0.32em); \draw[draw=black,fill=baposterBGone!80!black!#1!white,line width=0.03em] (0,0) circle(0.18em);}}
\small
\headerbox{Introduction}{name=data,column=0,row=0,span=2}{
\begin{minipage}[l]{1\textwidth}
\end{minipage} 
}
\headerbox{Methods}{name=model,column=0,below=data,span=2}{
\begin{minipage}[l]{1\textwidth}
\end{minipage}
}
\headerbox{Case Study}{name=trends,column=2,row=0,span=3}{
}
\headerbox{Summary}{name=summary,column=2,below=trends,span=3}{
\begin{minipage}[l]{1\textwidth}
\end{minipage}
}

\end{poster}

\end{document}

答案1

欢迎使用 TeX.SE。海报标题的背景设置没有快捷键。设置过程如下:

  1. headerheight用定义headerheight=0.10\textheight。这意味着海报页面高度的 10% 将用于写入海报标题。
  2. 设置键background=user。这意味着您将定义如何使用宏创建海报baposter背景\background{}
  3. 编写代码来绘制和/或填充背景。在本例中,您希望标题使用不同的颜色。我们可以通过以下方式实现此目的:\fill [fill=HeaderBackground] (current page.north west) rectangle ([yshift=-\headerheight] current page.north east);其中定义您选择的颜色,我们绘制一个等于海报宽度且高度等于(如上所定义)的HeaderBackground矩形。headerheight

绘制背景的完整代码是:

\background{
    \begin{tikzpicture}[remember picture,overlay]%
    %the poster background color (the whole page)
    \fill[fill=PosterBackground] (current page.north west) rectangle 
    (current page.south east); 
    %the header (just the top of the page where the title is written)
    \fill [fill=HeaderBackground] (current page.north west) rectangle 
    ([yshift=-\headerheight] current page.north east); 
    \end{tikzpicture}
}

这样做会产生以下结果:

在此处输入图片描述

其他一些评论。\headerbox是一个已弃用并被 替换的宏\begin{posterbox} ... \end{posterbox}。 不同之处在于您不能在\headerbox宏中包含逐字内容,而因为\begin{posterbox} ... \end{posterbox}是一个环境,所以您可以包含逐字材料。 如果您喜欢可以使用 创建的网格布局baposter,那么您可能会对包poster中的库提供的功能感兴趣tcolorbox。 它是以 为模型的baposter,但可以说具有更多功能。

完整代码如下:

\PassOptionsToPackage{dvipsnames,svgnames,x11names}{xcolor} % <-- added
\documentclass[landscape,archE]{baposter}

\usepackage{times}
\usepackage{helvet}
\usepackage{palatino}
\selectcolormodel{RGB}
\definecolor{reddishyellow}{cmyk}{0,0.22,1.0,0.0}
\definecolor{black}{cmyk}{0,0,0.0,1.0}
\definecolor{DrexelBlue}{HTML}{07294D}
\definecolor{Gray}{HTML}{777675}
\colorlet{HeaderBackground}{NavyBlue} % <-- added
\colorlet{PosterBackground}{SkyBlue}  % <-- added
\newlength{\leftimgwidth}

\begin{document}

\typeout{Poster Starts}
\background{
    \begin{tikzpicture}[remember picture,overlay]%
    %the poster background color
    \fill[fill=PosterBackground] (current page.north west) rectangle (current page.south east); %% cover the whole poster
    %the header
    \fill [fill=HeaderBackground] (current page.north west) rectangle ([yshift=-\headerheight] current page.north east); % just for the poster header, fill with a different color.
    \end{tikzpicture}
}

\begin{poster}%
% Poster Options
{
% Show grid to help with alignment
grid=false,
columns=5,
% Column spacing
colspacing=1em,
% Color style
bgColorOne=DrexelBlue,
bgColorTwo=white,
borderColor=Gray,
headerColorOne=Gray,
headerColorTwo=reddishyellow,
headerFontColor=white,
boxColorOne=white,
%boxColorTwo=lighteryellow,
% Format of textbox
textborder=none,
textborder=rectangle,
% Format of text header
eyecatcher=false,
headerborder=open,
headershape=rectangle,
headershade=plain,
headerfont=\Large\sffamily, %Sans Serif  % <-- \sffamily
boxshade=plain,
%background=shadeTB,                    % <-- omit
background=user, %user or none or plain % <-- added
headerheight=0.10\textheight,           
linewidth=.5pt
}
% Eye Catcher
{% No eye catcher for this poster. (eyecatcher=no above).
}%If an eye catcher is present, the title is centered between eye-catcher and logo.
% Title
{\sffamily\color{white}% %Sans Serif   % <-- \sffamily\color{white}
\vspace{.5em}%
\textbf{Evaluating the Model}%
}
% Authors
{\sffamily\color{white}%              % <-- \sffamily\color{white}
\vspace{.5em}%
John Smith\textsuperscript{1}, Harrison Frank\textsuperscript{2}\par%
{\small%
\textsuperscript{1} Doctoral Student,USA\par
\textsuperscript{2} USA}}
{}% Logo
\begin{posterbox}[name=box1, column=0, span=1]{Header}   % <-- replace headerbox with posterbox
Some text
\end{posterbox}

\end{poster}

\end{document}     

相关内容