作为示例,我在下面添加了一个我创建的 TikZPoster 块。请注意蓝色内块之间的白色间隙。通常,内块背景颜色在蓝色和白色之间交替,这意味着白色内块看起来更大。我得出结论,这个白色间隙是没有内块标题的产物,因为如果我什么都不画,它看起来就像这样:
\draw[draw=none, fill=innerblockbodybgcolor]
(innerblockbody.south west) rectangle (innerblockbody.north east);
相反,如果我在标题区域上进行绘制,间隙就会消失(但内部块的内容不再位于视觉中心):
\draw[draw=none, fill=innerblockbodybgcolor]
(innerblockbody.south west) rectangle (innerblocktitle.north east);
这个空间对我来说毫无价值,因为我有其他方法来创建文本分隔。每当我使用\useinnerblockstyle{Minimal}
(或 Basic 类)和时,间隙仍然可见\useblockstyle{Basic}
。我该如何禁用它?如果我尝试像我最后提供的图像那样填充空间,它会占用不必要的空间并使图像看起来偏离中心。
梅威瑟:
\documentclass[25pt, a0paper, portrait, margin=0pt, innermargin=40pt, colspace=50pt, blockverticalspace=50pt]{tikzposter}
% dummy text generation
\usepackage{lipsum}
% based on "Minimal" blockstyle
\defineblockstyle{Minimal2}{
titlewidthscale=1, bodywidthscale=1, titlecenter,
titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
bodyverticalshift=0pt, roundedcorners=6, linewidth=0.42cm,
titleinnersep=1cm, bodyinnersep=0.00cm}
{
\begin{scope}[line width=\blocklinewidth, rounded corners=\blockroundedcorners]
% title rectangle
\draw[draw=none, fill=blue]
(blocktitle.south west) rectangle (blocktitle.north east);
% box outline
\draw[color=blue, fill=none]
(blockbody.south west) rectangle (blocktitle.north east);
\end{scope}
}
% based on "Minimal" innerblockstyle
\defineinnerblockstyle{MinimalInner}{
titlewidthscale=1, bodywidthscale=1, titlecenter,
titleoffsetx=0pt, titleoffsety=-0pt, bodyoffsetx=0pt, bodyoffsety=90pt,
bodyverticalshift=0pt, roundedcorners=0, linewidth=0.0cm,
titleinnersep=0pt, bodyinnersep=25pt
}{
\begin{scope}[line width=\innerblocklinewidth, rounded corners=\innerblockroundedcorners]
\ifInnerblockHasTitle %
\draw[draw=none, fill=blue]
(innerblockbody.south west) rectangle (innerblocktitle.north east);
\else
\draw[draw=none, fill=blue]
(innerblockbody.south west) rectangle (innerblockbody.north east);
\fi
\end{scope}
}
\begin{document}
\usebackgroundstyle{Default}
\useblockstyle{Minimal2}
\useinnerblockstyle{MinimalInner}
\block{BLOCKTITLE}{\innerblock{}{\lipsum[1]} \innerblock{}{\lipsum[1]}}
\end{document}
答案1
您描述的问题可能源于这样一个事实:在tikzposter
文档类中,innerblocktitle
在内部块标题应出现的位置定义了一个名为的节点。然而,即使内部块标题为空,此节点也始终被定义。这里的错误是,节点inner sep
默认有一个,这显然导致了您注意到的这个奇怪的空间。
在下面的代码中,我使用包xpatch
将样式附加inner sep=0pt
到此节点。这样就消除了间距。此外,为了尽量减少相邻内部块之间的微小空间(我认为这是由于舍入误差造成的),您可能需要在内部块周围添加与背景颜色相同的蓝色边框。
\documentclass[25pt, a0paper, portrait, margin=0pt, innermargin=40pt, colspace=50pt, blockverticalspace=50pt]{tikzposter}
% dummy text generation
\usepackage{lipsum}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\innerblock}{\node[minimum width=\TP@innerblocktitlewidth, minimum height=\TP@innerblocktitleheight, anchor=center] (innerblocktitle)}{\node[inner sep=0pt, minimum width=\TP@innerblocktitlewidth, minimum height=\TP@innerblocktitleheight, anchor=center] (innerblocktitle)}{}{}
\makeatother
% based on "Minimal" blockstyle
\defineblockstyle{Minimal2}{
titlewidthscale=1, bodywidthscale=1, titlecenter,
titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=0pt,
bodyverticalshift=0pt, roundedcorners=6, linewidth=10pt,
titleinnersep=1cm, bodyinnersep=0.00cm}
{
\begin{scope}[line width=\blocklinewidth, rounded corners=\blockroundedcorners]
% title rectangle
\fill[blue]
(blocktitle.south west) rectangle (blocktitle.north east);
% box outline
\draw[blue]
(blockbody.south west) rectangle (blocktitle.north east);
\end{scope}
}
% based on "Minimal" innerblockstyle
\defineinnerblockstyle{MinimalInner}{
titlewidthscale=1, bodywidthscale=1, titlecenter,
titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0pt, bodyoffsety=90pt,
bodyverticalshift=0pt, roundedcorners=0, linewidth=0.0cm,
titleinnersep=0pt, bodyinnersep=25pt
}{
\begin{scope}[line width=\innerblocklinewidth, rounded corners=\innerblockroundedcorners]
\ifInnerblockHasTitle%
\filldraw[blue]
(innerblockbody.south west) rectangle (innerblocktitle.north east);
\else
\filldraw[blue]
(innerblockbody.south west) rectangle (innerblockbody.north east);
\fi
\end{scope}
}
\begin{document}
\usebackgroundstyle{Default}
\useblockstyle{Minimal2}
\useinnerblockstyle{MinimalInner}
\block{BLOCKTITLE}{\innerblock{}{\lipsum[1]}\innerblock{}{\lipsum[1]}}
\end{document}