I am trying to do some Alice in Wonderland style text size changes to irritate the reader. I am having two basic troubles with the code below. Firstly, I would like to retain the spaces. Secondly, for some completely inexplicable reason the exponential increase function seems to break down after a certain number of characters. Any advice appreciated.
Most of the code would be in my preamble, but I have included it in the body for demonstration.
\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.8}
\usepackage{graphicx}
\begin{document}
\newcounter{numcharacters}
\def\changesize#1{\setcounter{numcharacters}{0}\changesizeinternal{#1}}
\def\changesizeinternal#1{\ifx#1\relax\else\changesizechar#1\endchangesize\fi}
\def\changesizechar#1#2\endchangesize{\addtocounter{numcharacters}{1}\scaleString{#1}{\thenumcharacters}\changesizeinternal{#2}}
\def\scaleString#1#2{\pgfmathparse{6/(#2+2)}\scalebox{\pgfmathresult}{#1}}
\changesize{3.1415926535897932384626}%
\changesize{Shrinking away until there is nothing left}%
\def\scaleString#1#2{\pgfmathparse{0.5+(#2/12)}\scalebox{\pgfmathresult}{#1}}
\changesize{This is a linear increase in size 123456789 123456789}%
\def\scaleString#1#2{\pgfmathparse{0.5*(1.05^#2)}\scalebox{\pgfmathresult}{#1}}%exponential grows 5pcnt per character
\changesize{This one is an exponential increase in size 123456789 rabbit}%
\def\scaleString#1#2{\pgfmathparse{1.0*pow(1.08,(#2-1))}\scalebox{\pgfmathresult}{#1}}%exponential grows 8pcnt per character
\changesize{This is a different expontial increase in size 1234567890}%
\end{document}



pgfplotstableloaded so PGF/TikZ,pgfplots,graphicxare all loaded already by it already ;) – percusse Jun 02 '15 at 09:26