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.

I have redefined the table of contents bullets in my slides to a circled number. However, long section titles which span more than one line do not align with the text from the previous line but with the section number. How can I fix this?

Minimal working example

\documentclass{beamer}

\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}

\setbeamertemplate{section in toc}{
    \protect\usebeamercolor[fg]{enumerate item}%
    \protect\circled{\inserttocsectionnumber}~\inserttocsection%
}

\begin{document}

\section{some really long title some really long title some really long title
         some really long title}

\begin{frame}{Contents}
    \tableofcontents[currentsection,hideallsubsections,subsubsectionstyle=hide]
\end{frame}

\end{document}
share|improve this question
    
Hi ilprincipe. It is always preferable to post complete minimal working examples rather than code snippets because this helps people to answer you. You should also include the code needed to generate \circled{} for the sake of completeness. –  Claudio Fiandrino Aug 21 '13 at 14:24
    
Sorry, I thought this was sufficiently simple. Have added a MWE. –  ilprincipe Aug 21 '13 at 14:34
    
Thank you for providing the MWE. Perhaps, the simplest solution is to exploit \section[Short title that appears only in the toc]{Long title that appears in the frame}. I'm sure we have some answer about this, but at the moment I'm not able to find them. –  Claudio Fiandrino Aug 21 '13 at 14:48
    
I am already exploiting that for the header. However, the second part in curly brackets is the one appearing in the table of contents. Also, this is for a presentation of a series of papers/projects, and not all titles can be shortened sufficiently. –  ilprincipe Aug 21 '13 at 15:04
    
this is most probably not the answer you are searching for, but if you put \hspace{-16pt} as the first thing inside of circled[1]{ the text is aligned. –  Trylks Aug 21 '13 at 16:18

2 Answers 2

up vote 4 down vote accepted
+50

The following answer is based on

beamerbaseauxtemplates.sty

Just switched the colours a bit and the linestyle

\documentclass{beamer}

\setbeamertemplate{section in toc}{
    \leavevmode\leftskip=2ex%
    \llap{%
        \usebeamerfont*{section number projected}%
        \usebeamercolor{section number projected}%
        \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
            \color{bg}
            \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.4ex}
            \pgfusepath{stroke}
            \pgftext[base]{\color{bg}\inserttocsectionnumber}
        \end{pgfpicture}\kern1.25ex%
    }%
    \inserttocsection\par
}

\begin{document}

    \section{some really long title some really long title some really long title
        some really long title}

    \begin{frame}{Contents}
        \tableofcontents[currentsection,hideallsubsections,subsubsectionstyle=hide]
    \end{frame}

\end{document}

enter image description here

share|improve this answer
\documentclass{beamer}

\usepackage{tikz}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,inner sep=1pt] (char) {#1};}}

\setbeamertemplate{section in toc}{%
    \usebeamercolor[fg]{enumerate item}%
    \makebox[2em][l]{\circled{\inserttocsectionnumber}}%
    \parbox[t]{\dimexpr\linewidth-2em}{\inserttocsection}%
}

\begin{document}

\section{some really long title some really long title some really long title
         some really long title}

\begin{frame}{Contents}
    blblblbl % to show the margin
    \tableofcontents[currentsection,hideallsubsections,subsubsectionstyle=hide]
\end{frame}

\end{document}
share|improve this answer

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.