I am not especially facile with ConTeXt, and it has been years since I did 
anything complex with TeX, so I am hoping someone could help me with this.  The 
following is probably not great code, but it shows what I am trying to do.
The problems are twofold: a benign problem is that I get underfull hbox errors 
(\dontcomplain notwithstanding).  But the other problem is that with text of a 
certain size, the final line is much shorter than the others.  Is there some 
clever way to repeatedly typeset the text (e.g., put it in an hbox, measure the 
width, and repeatedly try .5, .333, .25 of the hbox width until it fits in the 
allocated space)?  How to go about this?



\defineblank[EpigraphDistance][3pt]

\definestartstop[EpigraphText][
   style=\ssa,
   before={\blank[EpigraphDistance]
      \setupnarrower[left=.25\textwidth,right=0pt]
      \startnarrower[left,right]
      \setupalign[flushright,nothyphenated,broad]
      \dontcomplain
      \noindent},
   after={\stopalignment\stopnarrower
      \blank[EpigraphDistance]
      \indenting[next]}]


\long\def\epigraph#1#2#3{%
 \startEpigraphText #1 \par \stopEpigraphText
 \ifx\hfuzz#3\hfuzz
  \rightaligned{\ssa\sl --- #2}
 \else
  \rightaligned{\ssa\sl --- #2, \tf\ssa\symbol[leftquote]#3\symbol[rightquote]}
 \fi
}

\starttext
Testing epigraph

\epigraph{% para
\quotation{My birthday-present!} he whispered to himself, as he had often done
in the endless dark days. \quotation{That's what we\unknown}
}{J.R.R. Tolkien}{The Hobbit}

That was an epigraph.

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to