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 just ran across this, and I'm curious about whether it can be replicated in TeX...

enter image description here

Ideally one would have the spiral getting tighter and tighter as one got to the centre, as in

enter image description here

I know TikZ has the ability to fit text along a path, but I'm not sure how one might make text get smaller and smaller. The closest I can find is create elegant display of digits and symbols, but that uses manually inserted font commands.

Edit: I got what I wanted using mwibrow's answer:

mwibrow

share|improve this question
1  
I don't know how to do it in tikz, but the curve you are referring to (getting closer as you move in) is called an Involute, as opposed to an Archimedean Spiral (which has constant separation) have a look at en.wikipedia.org/wiki/Involute for the maths. –  Nicholas Hamilton Dec 31 '12 at 13:27
    
@ADP That looks like a method for producing a curve from another curve. The involute of a circle definitely isn't what is wanted. I think it might just be a log spiral that is needed. –  Mohan Dec 31 '12 at 13:43
    
I disagree. 15 Characters is too much for me. –  Nicholas Hamilton Dec 31 '12 at 14:01
    
@ADP: I was specifically asking for a solution in which the spiral got tighter towards the centre (although I couldn't find an example with text for illustrative purposes, which is why I posted the second picture). The involute of a circle doesn't achieve this. –  Mohan Dec 31 '12 at 14:15
1  
@Herbert What happened to your PSTricks-based answer? I accepted the other because tikz is more convenient for me, but your answer was definitely worth having as well! –  Mohan Jan 2 '13 at 16:59
show 1 more comment

2 Answers

up vote 39 down vote accepted

Overrated or not, it is the case that tikz cannot do this by default. Also, somewhat annoyingly it isn't possible to use \lipsum[1] as an argument for text key in the text along path decoration (which I concede is entirely my fault).

A proper solution would take a bit more work, so here's a crude - but servicable - hack:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\makeatletter

\let\pgf@lib@dec@text@dobox@original=\pgf@lib@dec@text@dobox%

\def\pgf@lib@dec@text@dobox{%
    \pgf@lib@dec@text@dobox@original%
    \ifpgfdecorationtextalongpathscaletext%
    \pgfmathparse{\pgf@lib@dec@text@endscale+(\pgf@lib@dec@text@startscale-\pgf@lib@dec@text@endscale)*\pgfdecoratedremainingdistance/\pgfdecoratedpathlength}%
    \setbox\pgf@lib@dec@text@box=\hbox{\scalebox{\pgfmathresult}{\box\pgf@lib@dec@text@box}}%
    \fi%
}
\newif\ifpgfdecorationtextalongpathscaletext
\def\pgf@lib@dec@text@startscale{1}
\def\pgf@lib@dec@text@endscale{1}

\pgfkeys{/pgf/decoration/.cd,
    text path start scale/.code={%
        \pgfdecorationtextalongpathscaletexttrue%
        \def\pgf@lib@dec@text@startscale{#1}%
    },
    text path end scale/.code={%
        \pgfdecorationtextalongpathscaletexttrue%
        \def\pgf@lib@dec@text@endscale{#1}%
    }
}
\begin{document}    
\begin{tikzpicture}[
    decoration={
    reverse path,
    text along path,
    text path start scale=1.5,
    text path end scale=0,
    text={Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
    nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
    reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
    pariatur. Excepteur sint occaecat cupidatat non proident, sunt
    inculpa qui officia deserunt mollit anim id est laborum.}}
]
\draw [decorate] 
    (0,0) 
    \foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)}; 
\useasboundingbox (-2.75,-2.75) rectangle (2.75,2.75); 
\end{tikzpicture}    
\end{document}

enter image description here

share|improve this answer
add comment

run with latex->dvips->ps2pdf

\documentclass[12pt]{article}
\usepackage{pst-plot}
\usepackage{pst-text}
\usepackage{lipsum}

\pagestyle{empty}
\begin{document}
\large
\begin{pspicture}(-3.8,-5)(4.5,4.5)
\pstextpath{%
  \parametricplot[linestyle=none,plotpoints=5000,algebraic,unit=0.25]
    {0}{200}{t^2*sin(t)/200 | t^2*cos(t)/200}}{\lipsum[1]}%
\end{pspicture}

\end{document}

enter image description here

it is also possible to increase the fontsize, but then we have to handle every character.

enter image description here

\documentclass[pstricks]{standalone}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
\usepackage{pst-plot}
\usepackage{pst-text}

\newdimen\MyDim \MyDim=30pt
\makeatletter
\def\doPerChar#1#2\@nil{%
    \CharacterAction{#1}%
    \ifx\relax#2\relax\else\doPerChar#2\@nil\fi}
\def\perChar#1{\doPerChar#1\@nil}
\def\CharacterAction#1{%
  \fontsize{\MyDim}{1.1\MyDim}\selectfont#1%
  \global\advance\MyDim by -0.175pt}
\makeatother

\pagestyle{empty}
\begin{document}

\begin{pspicture}(-3,-3)(3,3)
\pstextpath{%
  \parametricplot[linestyle=none,plotpoints=5000,algebraic,unit=0.2]
    {50}{0}[/A 5e-3 def ]{A*(cos(t)+t^2*sin(t)) | A*(sin(t)-t^2*cos(t))}}{\perChar{Now~we~write~some~nensense~text~here~to~write~it~on~%
        an~involute~only~to~see~what~happens~with~this~nonsense~text~%
        in~this~nonsense~example!}}
\end{pspicture}

\end{document}
share|improve this answer
2  
You may be right. But a time ago I tried tikz and pstricks. And with pstricks I had some problems creating pdf-output. Therefore I like tikz better. –  Dave Dec 31 '12 at 15:04
3  
@Dave see tex.stackexchange.com/tags/pstricks/info (for example) of the compilation method; PSTricks is more powerful than tikz; it seems that a lot of people on tex exchange favour tikz because of the syntax, and the fact that it works (easily) with pdflatex –  cmhughes Dec 31 '12 at 17:50
    
This is a good answer. However, it is an answer for a different question: people will see the tags and the question's title and will skip it if they search for a pstricks solution. Adding the pstricks tag to the question appears to be a mismatch with the title. I would have preferred to read this (good) answer as part of the tex.sx knowledge base for a separate question - perhaps with a link in a comment. –  Christian Feuersänger Jan 1 '13 at 11:37
    
@ChristianFeuersänger Not a new problem: “Just for fun” –  Qrrbrbirlbel Jan 5 '13 at 13:21
    
@Herbert please excuse my ignorant comment: I have just learned from meta.tex.stackexchange.com/questions/3452/… how answers with unrequested tags are to be handled –  Christian Feuersänger Apr 11 '13 at 17:24
add comment

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.