3

There have been a number of questions on how to create text spirals already.

I've been trying to take things a step further, by having the spiral start where the paragraph naturally ends.

Say we have a paragraph:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mauris massa, placerat sit amet scelerisque ac, auctor sed augue.

sed and augue would be the first two points on the spiral. From there the flow of the paragraph would smoothly transition into the curve of the spiral, which would sit in the middle of the page (like in the link above).

Is there a way to accomplish this? I've not had much success modifying the code in the link. In particular, I'm having trouble with how to begin the spiral from where the paragraph leaves off, and having the last few words curve naturally into it.

  • 2
    Welcome to TeX.SX! It is easier to help you if you add a minimal working example that takes the form \documentclass{...}\usepackage{....}\begin{document}...\end{document}. If possible, it should compile and have the minimum amount of code needed to illustrate your problem. In this case it sounds like you don't have much of an idea how to do this but you could assemble code from the examples that you have looked at to least create the spiral. This will give people a better idea of what you want - and save them from working from scratch. –  Jul 01 '15 at 14:57
  • Thanks for the tip! jon was kind enough to provide an answer this time, but I'll keep this in mind for the next. – user1953221 Jul 08 '15 at 08:45

1 Answers1

6

There are certain problems with this question (and, thus, answer). The most important one is that you will need to make sure that the "starting point" of the spiral isn't near the beginning or ending of a line. However, with that caveat and relying on the clever answer you linked to, you could do this:

\documentclass[12pt]{article}
\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}%
    }
}

\makeatother

% \spiralit:
% #1 = rotation correction; default 95°
% #2 = manual horizontal space correction
% #3 = text scaling start point (should be "1" in this context!)
% #4 = text scaling end point
% #5 = text to spiral
\newcommand{\spiralit}[5][95]{%
  \hspace*{#2}%
  \raisebox{-\height}{%
    \tikz [decoration={
      reverse path,
      text along path,
      text path start scale=#3,
      text path end scale=#4,
      text={{#5}}}]
    \path [draw, decorate, rotate=#1]
    (0,0)
   \foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)};
}}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mauris massa, placerat sit amet scelerisque ac, auctor sed augue:
\spiralit{-1.6cm}{1}{0.5}{Is there a way to accomplish this? I've not
  had much success modifying the code in the link. In particular, I'm
  having trouble with how to begin the spiral from where the paragraph
  leaves off}

\bigskip

% Compare the explicit version: with different `end scale`, only 90°, and (consequently) different \hspace...
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent mauris massa, placerat sit amet scelerisque ac, auctor sed augue:
\hspace*{-1.75cm}%
{\raisebox{-\height}{\tikz [
decoration={
    reverse path,
    text along path,
    text path start scale=1,
    text path end scale=0.25,
    text={Is there a way to accomplish this? I've not had much success modifying the code in the link. In particular, I'm having trouble with how to begin the spiral from where the paragraph leaves off, and having the last few words curve naturally into it.}}]
  \path [draw, decorate, rotate=90]
  (0,0)
    \foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)};
}}

\end{document}

tikz-spiral

jon
  • 22,325