寻找解决方案以避免在尝试协同工作时出现算术tikz
错误shapepar
。
\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}
根据 David 的说法,语法应该是:\node[shape=circle,text width=0cm, fill=black,text=white] {\shapepar{\circleshape} \inserttitle\par};
,text width=0cm
其中,以便节点随内容缩放。无论如何,根据的长度\inserttitle
,我仍然会遇到算术溢出。
答案1
节点是\hbox
不能有段落的,除非你指定text width
或align=<...>
键(当它成为minipage
环境时)
\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}
或者使用长标题版本,并修改除法运算符,使其不会溢出(只返回\maxdimen
\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}