ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
To: mailing ConTeXt users list for <ntg-context@ntg.nl>
Subject: problems with vertical spacing and boxes
Date: Tue, 9 Nov 2010 10:12:21 +0100	[thread overview]
Message-ID: <BE78B603-DFAD-4B51-95B6-0EBF532006FC@uni-bonn.de> (raw)

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
___________________________________________________________________________________


             reply	other threads:[~2010-11-09  9:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  9:12 Thomas A. Schmitz [this message]
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

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=BE78B603-DFAD-4B51-95B6-0EBF532006FC@uni-bonn.de \
    --to=thomas.schmitz@uni-bonn.de \
    --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).