ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Michael Green <merely.ridiculous@gmail.com>
To: ntg-context@ntg.nl
Subject: horizontal space in \inframed and \hskip
Date: Wed, 14 Jan 2009 16:04:46 -0800	[thread overview]
Message-ID: <43ED6776-6BDB-48DE-AB6F-C68BA298B400@gmail.com> (raw)

I am having some trouble with horizontal spacing. I'm trying to set  
one width for \inframed and \hskip but the two are coming out different.

Here is an example. It is a syllabus for a college course. I would  
like the entries for topics (e.g. “Glaucon’s challenge”), descriptions  
(e.g. “Glaucon poses …”), and readings (e.g. “{\it Republic} …”) to  
start at the same horizontal point on the page so that their left  
edges will be aligned.

I use the longest date on which class will be held to define a  
horizontal length (longestdate). I use that length to set the width of  
a frame for text that precedes ClassTopic and an hskip that precedes  
both ClassDesc and Reading. I expected the horizontal space to be  
equal. But ClassTopic is a couple points to the right of the other two.

Thanks!

%% Start example file

%% Horizontal length of longest date -- taken from http://archive.contextgarden.net/message/20070314.120612.adab0a8b.en.html

\def\setwidthof#1\to#2%
{\bgroup
\setbox\scratchbox\hbox{#1}%
\expanded{\egroup\def\noexpand#2{\the\wd\scratchbox}}}

\setwidthof{{\it Wednesday, January 28.\hskip 1em}}\to\longestdate

%% Definitions

\def\ClassDate#1{\item \inframed[width= 
\longestdate,frame=off,align=right]{\it #1. }}%
\def\ClassTopic#1{{\WORD #1}}%
\def\ClassDesc#1{\hskip \longestdate #1}%
\def\Reading{\hskip \longestdate {\sc reading} }%


\starttext
\title{Syllabus test}

\startitemize[n]


\ClassDate{Monday, January 26} \ClassTopic{glaucon’s challenge}

	\ClassDesc{Glaucon poses a challenge for justice. We’ll talk about  
the nature of his test. What must Socrates prove about justice in  
order to satisfy the challenge? Do we really have to meet such a  
demanding test?}

	\Reading{{\it Republic}, Bk. II, 357a–369b, pp. 38–44.}

\ClassDate{Wednesday, January 28} \ClassTopic{origins of the state}

	\ClassDesc{What problem does the state solve? That is, why would  
people who didn’t have a state want one? What did Plato believe was  
the primary cause of conflict in human affairs?}

	\Reading{{\it Republic}, Bk. II, 368e–376e, pp. 43–52.}


\stopitemize


\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


             reply	other threads:[~2009-01-15  0:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-15  0:04 Michael Green [this message]
2009-01-15  4:50 ` luigi scarso
     [not found] <mailman.6617.1231995080.19169.ntg-context@ntg.nl>
2009-01-15  5:44 ` Michael Green
2009-01-15  8:22   ` luigi scarso

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=43ED6776-6BDB-48DE-AB6F-C68BA298B400@gmail.com \
    --to=merely.ridiculous@gmail.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).