ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
Subject: Re: character width
Date: Tue, 24 Oct 2006 20:45:57 +0200	[thread overview]
Message-ID: <20061024204557.0a06517b.schuster.wolfgang@googlemail.com> (raw)
In-Reply-To: <85FDEEB1-451F-4435-87DE-F3E9CAF2E028@st.estfiles.de>

On Tue, 24 Oct 2006 18:39:22 +0200
Steffen Wolfrum <context@st.estfiles.de> wrote:

> Yes, that's it. Thank you!
> 
> But can it also be defined in a more handy   \MySpace[999]   ?
> Sorry, I tried some \def ... but didn't succeed.
> 
> Steffen
> 
> 
> 
> Am 24.10.2006 um 14:55 schrieb Taco Hoekwater:
> 
> >
> >
> > Steffen Wolfrum wrote:
> >> Hi,
> >>
> >> for fine-adjusting I need to have a variable horizontal space
> >> sometimes the width of "999" sometimes of "1", for example.
> >> Is there a command that reads the width of a character so it can be
> >> used in some kind of horizontal space?
> >
> > There is a \fontcharwd primitive to measure the width of a single
> > character is a specific font:
> >
> >    \hskip \the\fontcharwd \font `1
> >
> > but it may be easier to put the number(s) in a box and measure the
> > width of that:
> >
> >    \setbox\scratchbox=\hbox{999}%
> >    \hskip \the\wd \scratchbox
> >
> > Greetings, Taco

Hi Steffen,

your solution based on the method provided by Taco.

\def\MySpace
  {\dosingleempty\doMySpace}

\def\doMySpace[#1]%
  {\setbox\scratchbox=\hbox{#1}%
   \unskip\hskip \the\wd \scratchbox}

\starttext

Text\MySpace[999]Text

Text\MySpace[999] Text

Text \MySpace[999]Text

Text \MySpace[999] Text

\stoptext

Wolfgang

  reply	other threads:[~2006-10-24 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-24 11:31 Steffen Wolfrum
2006-10-24 12:55 ` Taco Hoekwater
2006-10-24 16:39   ` Steffen Wolfrum
2006-10-24 18:45     ` Wolfgang Schuster [this message]
2006-10-24 19:31       ` Peter Münster
2006-10-24 20:01         ` Wolfgang Schuster
2006-10-25 20:38           ` Hans Hagen
2006-10-25  9:02         ` Steffen Wolfrum
2006-10-30 18:56           ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061024204557.0a06517b.schuster.wolfgang@googlemail.com \
    --to=schuster.wolfgang@googlemail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).