2

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}
{}}
\headerbox{Box title}{name=box1, column=0, row=0}{%
content here
}
\end{document}

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

5

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}

enter image description here

| improve this answer | |
  • 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
  • @Apurba: Look at updated answer. Hope it helps. – Ignasi Jun 16 '13 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.