ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* problems with vertical spacing and boxes
@ 2010-11-09  9:12 Thomas A. Schmitz
  2010-11-09  9:19 ` Thomas A. Schmitz
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas A. Schmitz @ 2010-11-09  9:12 UTC (permalink / raw)
  To: mailing ConTeXt users list for

Hi all,

I need a somewhat unusual vertical setup for typesetting a play. Here is some ASCII art that may show what I want:

SP XXXXXXXXXXX
   XXXXXX        15

So: beginning of the line has a fixed space for the abbreviation of the speaker (if there is a speaker designation attached to the line). Then comes the line itself, which fills ca. 80 % amount of the linewidth and needs to be broken as a normal paragraph if it is longer than this space. At the end of the line, another fixed space with the line number, flushright; this number needs to be at the bottom of the paragraph. I have tried three different approaches, but all of them have some problem. One thing to keep in mind: there will be around 3000 such lines, so this might affect processing time. So here are the three approaches:

1. low-level, with boxes. Problem: messes up vertical spacing. (I have set the interlinespace to an absurd dimension because this shows the problem in a clearer way). I tried using \strut s at a few places, but couldn't get this to work:

2. tabulate: nice, but I can't get the number to be aligned to the bottom. Is there any parameter or trick for that?

3. baseline between columns is not aligned (maybe I'm missing the right parameter?), extra vertical space is added.

Eagerly awaiting your suggestions!

All best

Thomas

\setupbodyfont[termes,12pt]

\setupinterlinespace[line=4.5ex]

\startbuffer
\MyLine{5}{Fa.}{This line is short.}

\MyLine{10}{Me.}{This line is slightly longer, so it will be broken into
  two lines in the output.}

\MyLine{15}{Fa.}{This line is short again.}

\MyLine{20}{Me.}{Another longer line that will be broken into
  two lines in the output.}

\MyLine{25}{Fa.}{And the last line.}
\stopbuffer
\starttext

\def\MyLine#1#2#3%
  {\setbox\scratchbox\vbox{\hsize=6cm #3}\hbox{\vbox to \ht\scratchbox{\hbox to 1cm{\bf #2}\vfill}\vbox{\hsize=6cm #3\par}\vbox to \ht\scratchbox{\vfill\hbox to 1cm{\hfill #1}}}}

\getbuffer

\definetabulate[ELine][|Blw(0.65cm)|p(5.8cm)|rw(0.8cm)|]

\def\MyLine#1#2#3%
  {\startELine
    \NC #2 \NC #3 \NC #1 \NR
   \stopELine}

\getbuffer

\setupTABLE[column][1][width=1cm,frame=off,offset=0pt,,align={right}]
\setupTABLE[column][2][width=6cm,frame=off,align={normal}]
\setupTABLE[column][3][width=1cm,frame=off,align={left,low}]

\def\MyLine#1#2#3%
  {\bTABLE
    \bTR\bTD \bf #2 \eTD\bTD #3 \eTD\bTD #1 \eTD \eTR
   \eTABLE}

\getbuffer

\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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-11-09 17:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-09  9:12 problems with vertical spacing and boxes Thomas A. Schmitz
2010-11-09  9:19 ` Thomas A. Schmitz
2010-11-09 14:47   ` Wolfgang Schuster
2010-11-09 15:05     ` Thomas A. Schmitz
2010-11-09 15:53       ` Wolfgang Schuster
2010-11-09 17:08         ` Thomas A. Schmitz
2010-11-09 15:54       ` Wolfgang Schuster

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