0

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}
3
  • Ages ago I converted some letters to TikZ paths to use with decorations, see for example tex.stackexchange.com/a/66091/86. I suspect that there are easier ways now than back then, but would that sort of thing help? Sep 8 at 22:18
  • Sorry teacher, I couldn't do what you told me because Because I am still new to "tikz".
    – Sam
    Sep 9 at 8:30
  • Actually, tex.stackexchange.com/a/21594/86 might be more what you're after. Sep 9 at 15:28
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.