How to do automatic raising text?

1pt-2pt-3pt ... 12pt

enter image description here

Related to: https://www.tug.org/texshowcase/diminuendo.tex


A version with expl3 and looping of \str variable.



\cs_new:Nn \resize_me:nn {
  \str_set:Nx \l_tmpa_str {#2}
  \fp_set:Nn \l_tmpa_fp {1.0}
  \int_step_inline:nnnn {1}{1}{\str_count:N \l_tmpa_str}{%
    \scalebox{\fp_use:N \l_tmpa_fp}{\str_item:Nn \l_tmpa_str {##1}}
    \fp_add:Nn \l_tmpa_fp {#1}


\raisetext[0.3]{A very long useless text}


enter image description here


The decorations.text library for TikZ allows to decorate arbitrary paths with text or create paths from mutated text. The manual has an example describing your exact query.

\begin{tikzpicture}[decoration={text effects along path,
    text={text effects along path!},
    text effects/.cd,
    path from text,
    character count=\i, character total=\n,
    characters={text along path, scale=\i/\n+0.5}}]
  \path [decorate] (0,0);

enter image description here


Here is a version using OPmac:

\input opmac

\def\growA{\expandafter\ifx\space\next \space\fi \growB}

\grow This is text.


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.