# different values for bodyinnersep (left, top, right, bottom) in tikzposter Block

I am using tikzposter and defined my own block style. The background of the block is one the left and right special such that I need to have a big padding on the left and right for the text to not overlap with the special border. However, as far as I know, I can only specify a bodyinnersep value that applies equally to left, top, right bottom.

Is it possible to specify different bodyinnersep values for left, top, right, bottom separation just as you can do with margin/padding in html/css?

• Welcome to TeX.SX! Please specify your question. Do you know the geometry package? – Bobyandbob Mar 16 '18 at 9:01
• I don't know the geometry package. Will take a look at it. Reading my question again, I realize that it is missing a lot of info, sorry about that. – meow Mar 16 '18 at 9:17
• @Bobyandbob geometry won't help with a tikzposter block. – Torbjørn T. Mar 16 '18 at 9:21

Note: I can't guarantee that this works in all cases.

With a bit of work you can at least set left/right and top/bottom separately, though setting the left padding different to the right requires a different approach altogether, as TikZ doesn't implement it in the first place. It does have inner xsep/inner ysep though.

So what can be done is to define two new keys, bodyxinnersep and bodyyinnersep, and then patch (modify) \block to use these instead of bodyinnersep, where needed. You need to also set bodyxinnersep=X,bodyyinnersep=Y in your custom block definition.

\documentclass[a2paper]{tikzposter}
\usepackage{lipsum}
\usepackage{xpatch}
\makeatletter
% define new lenghts for x and y inner sep
\newlength\TP@blockbodyxinnersep
\newlength\TP@blockbodyyinnersep
\newlength\blockbodyxinnersep
\newlength\blockbodyyinnersep
% define keys for tikzposter to use
\define@key{block}{bodyxinnersep}{\TP@blockbodyxinnersep=#1 \blockbodyxinnersep=#1}
\define@key{block}{bodyyinnersep}{\TP@blockbodyyinnersep=#1 \blockbodyyinnersep=#1}

% patch to fix https://bitbucket.org/surmann/tikzposter/issues/38/
% note use of bodyxinnersep
\xpatchcmd{\block}%
{\TP@blockbodywidth-2\TP@blockbodyinnersep-\TP@blockbodyoffsetx}
{\TP@blockbodywidth-2\TP@blockbodyxinnersep}
{}{}

% patch to use the bodyyinnersep to calculate height of node
\xpatchcmd{\block}
{\setlength{\TP@blockbodyheight}{\ht\TP@blockbodybox + \dp\TP@blockbodybox +2\TP@blockbodyinnersep}}
{\setlength{\TP@blockbodyheight}{\ht\TP@blockbodybox + \dp\TP@blockbodybox +2\TP@blockbodyyinnersep}}
{}{}

% patch to set inner x and y seps separately, instead of just inner sep
\xpatchcmd{\block}
{text width=\TP@blockbodywidth-2\TP@blockbodyinnersep, inner sep=\TP@blockbodyinnersep}
{text width=\TP@blockbodywidth-2\TP@blockbodyxinnersep, inner xsep=\TP@blockbodyxinnersep,
inner ysep=\TP@blockbodyyinnersep}
{}{}
\makeatother

% I grabbed this sampleblockstyle from the manual
\defineblockstyle{sampleblockstyle}{
titlewidthscale=0.9, bodywidthscale=1,titleleft,
titleoffsetx=0pt, titleoffsety=0pt, bodyoffsetx=0mm, bodyoffsety=15mm,
bodyverticalshift=10mm, roundedcorners=5, linewidth=2pt,
titleinnersep=6mm, bodyinnersep=1cm,
% note addition of the following two keys:
bodyxinnersep=6cm,bodyyinnersep=1cm
}{
\draw[color=framecolor, fill=blockbodybgcolor,
rounded corners=\blockroundedcorners] (blockbody.south west)
rectangle (blockbody.north east);
\ifBlockHasTitle
\draw[color=framecolor, fill=blocktitlebgcolor,
rounded corners=\blockroundedcorners] (blocktitle.south west)
rectangle (blocktitle.north east);
\fi
}

% use the custom style
\useblockstyle{sampleblockstyle}

\author{a}
\title{b}
\begin{document}
\maketitle
\block{foo}{\lipsum*[1]}
\end{document}