Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In my beamer block the title always comes left alined. Is that possible to make the title of the block centered?

\documentclass[final, 12pt]{beamer}    
\usepackage[size=custom,width=120,height=120,scale=1.7,orientation=portrait]{beamerposter} 
\usepackage{ragged2e} 
\usepackage{graphicx} 
\usepackage{lipsum} 
\usepackage{etoolbox} 

\apptocmd{\frame}{\justifying}{}{}

\usebackgroundtemplate{\centering \includegraphics[width=\paperwidth, height=\paperheight]{Figure/LG_PKL.jpg}} 
\addtobeamertemplate{block begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}} 
\addtobeamertemplate{block beamercolorbox begin}{\pgfsetfillopacity{0.65}}{\pgfsetfillopacity{1}}

\newenvironment<>{varblock}[2][\textwidth]{% 
  \setlength{\textwidth}{#1} 
  \begin{actionenv}#3% 
  \def\insertblocktitle{#2}% 
  \par% 
  \usebeamertemplate{block begin}} 
{\par% 
  \usebeamertemplate{block end}% 
  \end{actionenv}}

\usecolortheme{rose}

\begin{document} 

\begin{frame}


\begin{textblock}{}(0.2,1.15)% 
\begin{varblock}[35cm]{\textbf{1. Introduction}} 
\justifying Space for discussion. 
\end{varblock} 
\end{textblock}

\end{document}
share|improve this question
    
Please, once again, show a minimal, yet complete version of your document (including \documentclass, and all the settings relevant to this particular issue; for example, what kind of blocks are you using). –  Gonzalo Medina May 13 '12 at 3:45
    
After your first comment, I was on the way to edit my question. Sorry. Will remember later. –  Mahzabin May 13 '12 at 3:55
    
Thank you for providing a complete version of the code ;-) Don't forget my other suggestion: revisit your other questions and up-vote good answers and accept those which you consider solved your problem. –  Gonzalo Medina May 13 '12 at 4:08
add comment

1 Answer

up vote 2 down vote accepted

Change your definition of varblock to

\newenvironment<>{varblock}[2][\textwidth]{% 
  \setlength{\textwidth}{#1} 
  \begin{actionenv}#3% 
  \def\insertblocktitle{\centering#2\par}% 
  \par% 
  \usebeamertemplate{block begin}} 
{\par% 
  \usebeamertemplate{block end}% 
  \end{actionenv}}
share|improve this answer
    
@Medina,Thanks a lot....... –  Mahzabin May 13 '12 at 5:48
    
@Mahzabin: You're welcome! I apologize for being so insistent, but please review all the questions you've asked and accept those answers that solved your problems. In case of doubt, see how do you accept an answer?, –  Gonzalo Medina May 13 '12 at 17:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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