On Thu, Jan 15, 2009 at 1:04 AM, Michael Green <merely.ridiculous@gmail.com> wrote:
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

There is a space in between \ClassDate{..} and \ClassTopic{..}:
\ClassDate{Monday, January 26} \ClassTopic{glaucon's challenge}

Is my pdf right ?

--
luigi