Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How can I reproduce the figure below?

alt text

The figure is from an old Knuth paper, which you can get at http://www.math.lsa.umich.edu/~millerpd/docs/501_Winter08/Knuth79.pdf (page 364)

share|improve this question
add comment

4 Answers

up vote 7 down vote accepted

http://www.tug.org/texshowcase/, search for "diminuendo.tex"

share|improve this answer
add comment

with LaTeX instead of plain TeX:



\newcount\cntm \cntm=1
  \scalebox{\Scale}{#1}\ifnum\the\cntm=1 \kern-10pt\fi%
  \advance\cntm by \@ne%



alt text

share|improve this answer
add comment

This code iterates over each token in a string and scales them according to a user-defined function:


\usepackage{graphicx} % For \scalebox
\usepackage{pgf}      % For arithmetic calculations

% Here are the macros to parse the string character-by-character:

% This macro will be called on each character of the string:


Here is the result such that token i is scaled by a factor of 6/(i+2): 3.1415926535897932384626

share|improve this answer
add comment

An eTeX based solution

\currentStep = 1

% Do not increment step at 2nd iteration
  {\ifnum\currentStep = 2 
    \else \increment\currentStep


\handletokens 3{\kern-0,2em.\kern-0.1em}1415926535897932384626 \with\Show

alt text

share|improve this answer
You mean a ConTeXt-based solution? –  Will Robertson Jan 23 '11 at 0:46
No. It is essentially identical to Herbert's solution, but using \dimexpr instead of the fp package. I wrote the solution in ConTeXt, just because that is what I know better. It should be easily to replicate it in plain or LaTeX. Doesn't the graphics package have a macro to scale a box to a particular width? –  Aditya Jan 23 '11 at 1:31
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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