[Fontinst] table figures?
Philipp Lehman
lehman at gmx.net
Mon May 23 22:30:01 CEST 2005
Am Montag, 23. Mai 2005 17:27 schrieb Ingo Reich:
> >(or did you think about doing that using LaTeX macros? That
> > probably wouldn't be easy to make to work with digits from
> > autogenerated numbers, such as page numbers and the like.)
>
> This is what first came to my mind -- though I do not know (yet),
> what such a macro could look like; in the end it should be possible
> to simply write something like \textmono{123} or
> \textmono[1em]{123} where the first argument determines the width
> of each character.
If the applications you have in mind are really that basic, something
like the following will do:
\documentclass{minimal}
\makeatletter
\newcommand*{\textmono}[2][0.5em]{%
\@monospace{#1}#2\@nil}
\newcommand*{\monocounter}[2][0.5em]{%
\begingroup
\edef\x{\noexpand\textmono[#1]{\arabic{#2}}}%
\expandafter\endgroup\x}
\def\@monospace#1#2#3\@nil{%
\makebox[#1]{#2}%
\ifx\\#3\\\else
\@monospace{#1}#3\@nil
\fi}
\makeatother
\begin{document}
\textmono{1234,6789}
\textmono[0.5em]{0987,4321}
\newcounter{test}
\setcounter{test}{1234}
\monocounter{test}
\end{document}
(You obviously need to switch to a font with proportional numbers to
see the effect.)
> (Sounds a bit like letterspacing to me, so maybe
> I should have a look at uline.sty or letterspacing.sty.
It's a different thing. Letterspacing means inserting additional
space, but the width of the letters is still proportional.
--
Philipp Lehman <lehman at gmx.net>
More information about the fontinst
mailing list