[texhax] Producing text and math in a 'spiral shape'

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Sep 14 03:20:06 CEST 2012


On Thu, Sep 13, 2012 at 10:47:02AM -0500, Iraj Kalantari wrote:

> In an exchange between Minsu Kim and Ulrike Fischer 
> 
> (see 
> http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2009-07/msg00425.html
> )
> 
> the focus is on how to create *text* in the shape of a spiral.  (See source below.)  They use the digits of Pi for text in a successful example.
> 
> I tried to insert a mathematical formula bookended by $s (say $a^2 + b^2
> =c^2$) but the source does not deliver and stops with an (odd) error
> message.
> 
> Is there a remedy?  Is there a way to get mathematical formulas in the
> shape of a spiral?

The macros can be modified to support token groups instead of single tokens.
Then the equation can be split into token groups manually:

\documentclass{article}
\usepackage{pst-plot}
\usepackage{pst-text}
\usepackage{pstricks-add}

\begin{document}
\makeatletter
\hspace*{4cm}
\begin{pspicture}(2,2)(2,2)
% A \DoPerCharacter macro adapted from Juergen Schlegelmilch
% (posted on comp.text.tex - January 1998)
\def\DoPerCharacter#1#2#3\@nil{%
  #1{#2}% #2 can be a group of tokens
  \def\@tempa{#3}%
  \ifx\@tempa\empty
  \else
    \DoPerCharacter#1#3\@nil
  \fi
}

\def\PerCharacter#1#2{\DoPerCharacter#1#2{}\@nil}
% If the string ends in a group of tokens, then the curly braces
% would be stripped. The empty group before `\@nil' prevents this.

\pst at dimh=0.7pt

\def\CharacterAction#1{%
  \psscalebox{1 \pst at number{\pst at dimh}}{#1}
  \advance\pst at dimh by 0.04pt
}

\pstextpath{\psplot
[linestyle=none,polarplot=true,plotpoints=300,unit=5]
{500}{-500}{1 2.7182818 x 200 div exp 1 add div}}% Spiral
{\PerCharacter{\CharacterAction}{%
%  3,141592653589793238462643383279502884197169399375%
%  10582097494459230781640%
  {$a$}{$\!^2$}+{$b$}{$\!^2$}={$c$}{$\!^2$}%
}}

\end{pspicture}

\end{document}
%%% test.tex %%%

Your sincerely
  Heiko Oberdiek


More information about the texhax mailing list