3

Looking for a solution to avoid arithmetic error while trying to get tikz and shapepar working together.

\documentclass{beamer}
\usepackage{tikz,shapepar}

\setbeamertemplate{title page}{%
\begin{tikzpicture}[remember picture,overlay]
%\node[circle,fill=black,text=white] {\shapepar{\circleshape} \inserttitle\par}; % <- not working
\end{tikzpicture}}

\title{Some title with variable length}
\begin{document}
\maketitle

\begin{frame}
\shapepar{\circleshape} \huge\inserttitle % <- working fine here
\end{frame}
\end{document}

According to David, this should be the syntax: \node[shape=circle,text width=0cm, fill=black,text=white] {\shapepar{\circleshape} \inserttitle\par};, with text width=0cm so that the node scales with the content. Anyhow, depending on the length of \inserttitle, I still encounter arithmetic overflow.

2
  • You can't specify 0pt: shapepar needs a target width for linebreaking? Nov 16, 2014 at 16:41
  • I guess it'll set the best linewidth by itself...
    – s__C
    Nov 16, 2014 at 16:42

1 Answer 1

6

a node is an \hbox and can't have paragraph things unless you specify either text width or align=<...> keys (when it becomes a minipage environment)

\documentclass{beamer}
\usepackage{tikz,shapepar}

\setbeamertemplate{title page}{%
\begin{tikzpicture}[remember picture,overlay]
\node[text width=6cm, fill=black,text=white] {\shapepar{\circleshape} \inserttitle\par}; % <- not working
\end{tikzpicture}}

\title{Some title with variable length}
\begin{document}
\maketitle

\begin{frame}
\shapepar{\circleshape} \huge\inserttitle % <- working fine here
\end{frame}
\end{document}

or a version with a long title and the division operator modified so it never overflows (just returns \maxdimen

enter image description here

\documentclass{beamer}
\usepackage{tikz,shapepar}
\makeatletter
\def\fpdivide#1#2{%
\@tempcntb #2\relax
\multiply\@tempcntb10
#1=\dimexpr(#1*\p@ /\@tempcntb) \relax
\ifdim#1>0.1\maxdimen
#1=\maxdimen
\else
\multiply#1 by 10
\fi
}

\makeatother

\setbeamertemplate{title page}{%
\begin{tikzpicture}[remember picture,overlay]
\node[text width=8cm, fill=black,text=white] {\shapepar{\circleshape} \inserttitle\par}; % <- not working
\end{tikzpicture}}

\title{Some title with variable length
x x x x x x x x x x x
very very long
very very long
very very long
very very long
very very long
}
\begin{document}


\maketitle

\begin{frame}
\shapepar{\circleshape} \huge\inserttitle % <- working fine here
\end{frame}
\end{document}
7
  • What about the arithmetic overflow? (\fpdivide ...1=\dimexpr #1*\p@ /\@tempcntb \relax)
    – s__C
    Nov 16, 2014 at 16:34
  • @s__C I got no overflow on the document as posted (texlive 2014) what versions are you using? Nov 16, 2014 at 16:40
  • MacTeX 2014 here. Have you tried increasing the length of \title?
    – s__C
    Nov 16, 2014 at 16:40
  • @s__C the question is supposed to provide an example that demonstrates the problem:-) I'll add some words.... Nov 16, 2014 at 16:42
  • Like this: "Some title with variable length all across the titlepage even with a very long title"...
    – s__C
    Nov 16, 2014 at 16:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .