Skip to content

Instantly share code, notes, and snippets.

@wtsnjp
Last active September 16, 2017 13:09
Show Gist options
  • Save wtsnjp/bc56617044e89dceb8276ec97e9569f0 to your computer and use it in GitHub Desktop.
Save wtsnjp/bc56617044e89dceb8276ec97e9569f0 to your computer and use it in GitHub Desktop.
The TeXbook exercise 11.5
%#!latex
\documentclass{article}
\makeatletter
\def\demobox{\bgroup\catcode`\ =12\relax\xx@demobox}
\def\xx@demobox#1{%
\fboxsep=0pt\fboxrule=.4pt
\fbox{%
\fboxrule=3\fboxrule
\xx@demob@x#1\relax}%
\egroup}
\def\xx@demob@x#1{%
\ifx#1\relax\else
\if\space#1\relax\space\else\fbox{\phantom{#1}}\fi
\xx@hop\xx@demob@x
\fi}
\@gobbletwo\if\if\def\xx@hop#1\fi{\fi #1}
\makeatother
\begin{document}
\demobox{Tough exercise.}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment