[pgf-tikz] Use of \input within the text attribute of the decoration parameter of a tikzpicture

Henri Menke henrimenke at gmail.com
Wed Jul 10 23:40:41 CEST 2019


On 10/07/19 10:58 PM, Taylor, P wrote:
> 
> Could any experienced TikZ user please advise me how (apart from \expandafter hacks or a wrapper macro) I may achieve the effect of  the last part of :
> 
> 
> 
> \begin {tikzpicture} [decoration={text={\input very-long-text-file}, ...]
> 
> 
> 
> Used as-is, the \input is not expanded and the file not inserted.  I tried :
> 
> 
> \def \Input #1{\input {Polylingual-welcomes}}
> \begin {tikzpicture} [decoration={text={*}, style characters={*} with {character command=\Input}, ...]
> 
> but although syntactically valid and \input being expanded, the timing is such that that "text effects along path" and other formatting requirements are all lost.

That is what the `catchfile` package is there for.  I patched together
some examples from the manual and used the `lorem.tex` example file
which comes with the ConTeXt suite in TeX Live.

    \documentclass{article}
    \usepackage{catchfile}
    \usepackage{tikz}
    \usetikzlibrary{decorations.text}
    \begin{document}
    \CatchFileDef\decorationtext{lorem.tex}{}
    \begin{tikzpicture}[decoration={text along path,text={\decorationtext}}]
        \draw [postaction=decorate] (180:5) \foreach \a in {0,...,42}{
            arc (180-\a*90:90-\a*90:4.5-\a/10)
        };
    \end{tikzpicture}
    \end{document}

Cheers, Henri

> 
> Philip Taylor
> 
> 
> 
> 
> 




More information about the pgf-tikz mailing list