All styles have its anchor hardcoded, so you should select headershape=small-rounded
or headershape=roundedright
which according to baposter_guide.pdf
gives centered box titles.
If you want to use some other style, will have to change its definition. To do this, you can look how in baposter.cls
how are titles for boxes defined and change according to your needs.
As an example, smallrounded
are defined (lines 685-688 from baposter.cls) with
\newcommand{\baposter@box@headerdrawtext@smallrounded}[1]{
\path (\baposter@box@name nw) +(0.5\boxwidth,-0.5\baposter@box@@boxheaderheight) node[anchor=center] {#1};%
}
while rectangle
style is (lines 682-684)
\newcommand{\baposter@box@headerdrawtext@rectangle}[1]{
\path (\baposter@box@name nw) +(0em,-0.5\baposter@box@@boxheaderheight) node[anchor=west,inner sep=0.4em] {#1};%
}
As you can see second style places title anchored to its left and at a mid point between north west (nw) and south west (\baposter@box@name nw) +(0em,-0.5\baposter@box@@boxheaderheight)
corners of header box. While smallrounded
style places title anchored at its center and in center point of header box. If you can obtain second effect with rectangle
style, change its definition in your preamble with
\makeatletter
\renewcommand{\baposter@box@headerdrawtext@rectangle}[1]{
\path (\baposter@box@name nw) +(0.5\boxwidth,-0.5\baposter@box@@boxheaderheight) node[anchor=center] {#1};%
}
\makeatother
and will obtain a rectangle
header title with centered text:
\documentclass[pdftex, british, a0paper, fontscale=.32]{baposter}
\usepackage{titling}
\title{My Poster}
\author{Apurba Paul}
\makeatletter
\renewcommand{\baposter@box@headerdrawtext@rectangle}[1]{
\path (\baposter@box@name nw) +(0.5\boxwidth,-0.5\baposter@box@@boxheaderheight) node[anchor=center] {#1};%
}
\makeatother
\begin{document}
\begin{poster}{%
background=none,
% bgColorOne=gray!30,
headerColorOne=blue!30,
headershade=plain,
boxshade=none,
headershape=rectangle,
}
{}
{\thetitle}
{\theauthor}
{}
\headerbox{Box title}{name=box1, column=0, row=0}{content here}
\end{poster}
\end{document}
If I'm not mistaken, this is where the title is defined in baposter.cls
\ifbaposter@eyecatcher% Has eye catcher%
\draw (image.east) node(title)[anchor=west,text width=\baposter@titleimage@textwidth]{%
\begin{minipage}{\baposter@titleimage@textwidth}%
\begin{center}%
\textbf{\Huge #3}\\%
{\Large #4}%
\end{center}%
\end{minipage}
};%
\else% Has no eye catcher
\draw (image.east) node(title)[anchor=west] { {\begin{minipage}{\baposter@titleimage@textwidth}{\bfseries\Huge #3}\\{\Large #4}\end{minipage}} };%
\fi
Obviously, the fontsize used are Huge
and Large
, while the tikz node where they are ''hosted'' has no specific font size defined, which will cause bad line spacing. I'd recommend doing it slightly differently and modifying this portion of code such as
- the font size is correctly set inside the tikz node
- the #3 and #4 contents are in two different nodes
- the minipage environment is avoided
This would mean some code like this (for the if part, to be adapted for the else part):
\draw (image.east) node(title)[anchor=west,text width=\baposter@titleimage@textwidth,text badly centered,font=\Huge\bfseries]{#3};
\node[below of=title,anchor=west,text width=\baposter@titleimage@textwidth,text badly centered,font=\Large]{#4};
Note that the positioning
library of tikz might be requested if not already defined in the class header.
Best Answer
The height of the
posterbox
header is given by theboxheaderheight
key. If noposterbox
header is required, set theboxheaderheight
to0em
as one of the keys passed to theposterbox
environment.More generally, all the keys available in the
poster
environment are available to theposterbox
environment. This permits extensive customization of individualposterbox
es. This is illustrated by changing theposterbox
header colour (headerColorOne
) fromblue
togreen
and the font color for the header fromwhite
toblack
for the fourthposterbox
.The MWE:
The result: