ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* horizontal space in \inframed and \hskip
@ 2009-01-15  0:04 Michael Green
  2009-01-15  4:50 ` luigi scarso
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Green @ 2009-01-15  0:04 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-15  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.6617.1231995080.19169.ntg-context@ntg.nl>
2009-01-15  5:44 ` horizontal space in \inframed and \hskip Michael Green
2009-01-15  8:22   ` luigi scarso
2009-01-15  0:04 Michael Green
2009-01-15  4:50 ` luigi scarso

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).