Tikzposter:如何去除块背景颜色中的分级?

Tikzposter:如何去除块背景颜色中的分级?

我正在用 tikzposter 制作海报,并已选定Desert主题。但是我发现块标题的渐变颜色很烦人,我想只使用颜色。

但是我似乎无法摆脱它。当我使用颜色更改颜色时,\colorlet{blocktitlebgcolor}{green}颜色会更改,但分级仍然存在。

(我希望分级是正确的词,我指的是块标题上颜色变为灰色的效果)

最小工作示例:

\documentclass[a0paper]{tikzposter}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usetheme{Desert}
\title{Title}
\author{authors}
\institute{institute}
\usepackage{url,lipsum}

\definetitlestyle{sampletitle}{
    width=\paperwidth, roundedcorners=10, linewidth=2pt, innersep=5pt,
    titletotopverticalspace=0mm, titletoblockverticalspace=30mm
}{
\begin{scope}[line width=\titlelinewidth, rounded corners=\titleroundedcorners]
    \draw[color=blocktitlebgcolor, fill=titlebgcolor]
    (\titleposleft,\titleposbottom) rectangle (\titleposright,\titlepostop);
\end{scope}
}
%%% Added for avoding small caps in the title
\usepackage{etoolbox}
\makeatletter
\patchcmd{\TP@maketitle}
{\bfseries \Huge \sc}
{\bfseries\Huge}
{}{}
\makeatother
%%%

%%% Added to change title font
\makeatletter
\settitle{ \centering \vbox{
        \@titlegraphic \\[\TP@titlegraphictotitledistance] \centering
        \color{titlefgcolor} {\bfseries \Huge \@title \par}
        \vspace*{1em}
        {\huge \@author \par} \vspace*{1em} {\LARGE \@institute}
    }}
\makeatother
%%%

\usetitlestyle{sampletitle}
\colorlet{blocktitlebgcolor}{green}

\begin{document}

    \maketitle;

    \block{Block 1}{Block1}

\end{document}

答案1

主题的Desert块使用了Slide的样式,其中标题的背景是从blocktitlebgcolor到 的渐变blockbodybgcolor。您可以看到标题右侧的颜色与块主体的颜色相同。

解决此问题的一种方法是重新定义Slide样式,通过在序言中添加以下内容:

\defineblockstyle{Slide}{
    titlewidthscale=1, bodywidthscale=1, titleleft,
    titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
    bodyverticalshift=0pt, roundedcorners=0, linewidth=0pt, titleinnersep=1cm,
    bodyinnersep=1cm
}{
    \ifBlockHasTitle%
        % changed "right color=..,left color=.." to "fill=blocktitlebgcolor"
        \draw[draw=none, fill=blocktitlebgcolor] 
           (blocktitle.south west) rectangle (blocktitle.north east);
    \fi%
    \draw[draw=none, fill=blockbodybgcolor] %
        (blockbody.north west) [rounded corners=30] -- (blockbody.south west) --
        (blockbody.south east) [rounded corners=0]-- (blockbody.north east) -- cycle;
}

这是从 取而代之的tikzposterBlockstyles.tex,并left color=blocktitlebgcolor, right color=blockbodybgcolor改为fill=blocktitlebgcolor

以下代码生成的块的屏幕截图

\documentclass[a0paper]{tikzposter}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\usetheme{Desert}
% redefine Slide style
\defineblockstyle{Slide}{
    titlewidthscale=1, bodywidthscale=1, titleleft,
    titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
    bodyverticalshift=0pt, roundedcorners=0, linewidth=0pt, titleinnersep=1cm,
    bodyinnersep=1cm
}{
    \ifBlockHasTitle%
        % changed "right color=..,left color=.." to "fill=blocktitlebgcolor"
        \draw[draw=none, fill=blocktitlebgcolor] 
           (blocktitle.south west) rectangle (blocktitle.north east);
    \fi%
    \draw[draw=none, fill=blockbodybgcolor] %
        (blockbody.north west) [rounded corners=30] -- (blockbody.south west) --
        (blockbody.south east) [rounded corners=0]-- (blockbody.north east) -- cycle;
}
% end of redefinition

\title{Title}
\author{authors}
\institute{institute}
\usepackage{url,lipsum}

\definetitlestyle{sampletitle}{
    width=\paperwidth, roundedcorners=10, linewidth=2pt, innersep=5pt,
    titletotopverticalspace=0mm, titletoblockverticalspace=30mm
}{
\begin{scope}[line width=\titlelinewidth, rounded corners=\titleroundedcorners]
    \draw[color=blocktitlebgcolor, fill=titlebgcolor]
    (\titleposleft,\titleposbottom) rectangle (\titleposright,\titlepostop);
\end{scope}
}
%%% Added for avoding small caps in the title
\usepackage{etoolbox}
\makeatletter
\patchcmd{\TP@maketitle}
{\bfseries \Huge \sc}
{\bfseries\Huge}
{}{}
\makeatother
%%%

%%% Added to change title font
\makeatletter
\settitle{ \centering \vbox{
        \@titlegraphic \\[\TP@titlegraphictotitledistance] \centering
        \color{titlefgcolor} {\bfseries \Huge \@title \par}
        \vspace*{1em}
        {\huge \@author \par} \vspace*{1em} {\LARGE \@institute}
    }}
\makeatother
%%%

\usetitlestyle{sampletitle}
\colorlet{blocktitlebgcolor}{green}

\begin{document}

    \maketitle;

    \block{Block 1}{Block1}

\end{document}

相关内容