1

How can a text make the path of a letter, for example, letter "S"? Instead of taking a circle like for the following code:

\documentclass[landscape]{article}
%\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[absolute,overlay]{textpos}
\usepackage{listings}
\usepackage{xcolor}

\usepackage{tikz} \usepgfmodule{decorations} \usetikzlibrary{patterns} \usetikzlibrary{decorations.shapes} \usetikzlibrary{shapes.geometric} \usetikzlibrary{decorations.text}

\begin{document} \DeclareFixedFont{\pb}{T1}{pbk}{b}{n}{5cm}

\mbox{}
\begin{textblock*}{200mm}[0.2,0.5](67mm,33mm)

    \catcode`\|12
    \begin{tikzpicture}
        %\draw [help lines] (4,4)grid (0,2);
        \fill [draw=none,fill=none,
        postaction={decorate,decoration={raise=8pt,text along path,
                text=around and around and around and around we go we go we go we go we go we go we go we go we go we go we go}}]
        (0,1) arc (180:-180:3.5cm and 2.4cm);
    \end{tikzpicture}

\end{textblock*}

\end{document}

Sam
  • 11
  • Ages ago I converted some letters to TikZ paths to use with decorations, see for example https://tex.stackexchange.com/a/66091/86. I suspect that there are easier ways now than back then, but would that sort of thing help? – Andrew Stacey Sep 08 '21 at 22:18
  • Sorry teacher, I couldn't do what you told me because Because I am still new to "tikz". – Sam Sep 09 '21 at 08:30
  • Actually, https://tex.stackexchange.com/a/21594/86 might be more what you're after. – Andrew Stacey Sep 09 '21 at 15:28

1 Answers1

2

The code's a bit old, so is not guaranteed to be robust. It needs some files from the old TeX-SX Launchpad project:

  • pgflibraryshapes.letters.dtx after downloading run tex pgflibraryshapes.letters.dtx to generate the necessary files
  • stikz-normal-paths.tex to load the paths for the STIX fonts

It seems to only work with pdflatex (not lualatex), possibly due to some bad encoding choices in some of the files. So it shouldn't be difficult to fix that.

\documentclass{article}
%\url{https://tex.stackexchange.com/q/614684/86}
\pagestyle{empty}
\thispagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{
  shapes.letters,
  decorations.text,
}

\pgfmathsetmacro{\emcm}{1em/1cm} \pgfkeys{ /pgf/letter/.cd, % load font={stikz}{italic}, load font={stikz}{normal}, size=10, load encoding=char, every letter/.append style={ fill, }, sentence width=.9\textwidth, }

\begin{document} \begin{tikzpicture} \node[letter=S, decorate, decoration={ raise=8pt, text along path, text={Round and round the garden Like a teddy bear; One step, two step, Tickle you under there! Round and round the garden Like a teddy bear; One step, two step, Tickle you under there! Round and round the garden Like a teddy bear; One step, two step, Tickle you under there!} } ] {}; \end{tikzpicture} \end{document}

Text around a letter S

Andrew Stacey
  • 153,724
  • 43
  • 389
  • 751