如何升高或降低文本?

如何升高或降低文本?

如何实现自动升高文字?

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

enter image description here

相关:https://www.tug.org/texshowcase/diminuendo.tex

答案1

expl3带有变量循环的版本\str

\documentclass{article}
\usepackage{graphicx}

\usepackage{xparse}


\ExplSyntaxOn
\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}
  }
}

\newcommand{\raisetext}[2][0.5]{%
\resize_me:nn{#1}{#2}
}
\ExplSyntaxOff
\begin{document}

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

\end{document}

enter image description here

答案2

TikZ库decorations.text允许用文本修饰任意路径或从变异文本创建路径。手动的有一个示例描述您的确切查询。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\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);
\end{tikzpicture}
\end{document}

enter image description here

答案3

以下是使用 OPmac 的版本:

\input opmac

\def\grow{\futurelet\next\growA}
\def\growA{\expandafter\ifx\space\next \space\fi \growB}
\def\growB#1{\ifx.#1.\else#1\textfontscale[1100]\expandafter\grow\fi}

\grow This is text.

\bye

相关内容