# How to center the box header text in baposter

I am writing a poster using baposter class. I want to centre the text in header box(for one particular headerbox not all). Here is the minimum working example.

\documentclass[pdftex, british,a0paper, fontscale=.32]{baposter}
\usepackage{titling}
\usepackage{enumitem}
\usepackage{color}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{graphicx}
\title{My Poster}
\author{Apurba Paul}
\begin{document}
\begin{poster}{
{}
{\thetitle}
{theauthor}
{}}
content here
}
\end{document}


I watn the "Box title" to be appear in the center of the box header not at the left side.

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
\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
\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,

• Sorry, @Ignasi it is already known to me that if I use headershape=rounded the header will be aligned to center. But actually I was looking for a solution where I don,t have to use rounded headershape. – Apurba Jun 14 '13 at 17:31