On Fri, 2017-06-23 at 17:52 +0100, Thomas Widmann wrote:
> On 23 June 2017 at 14:21, Thomas Widmann <[email protected]> wrote:
> > 
> > On 20 June 2017 at 20:33, Hans Hagen <[email protected]> wrote:
> > > 
> > > On 6/20/2017 11:53 AM, Thomas Widmann wrote:
> > > > 
> > > > 
> > > > On 20 June 2017 at 10:41, Henri Menke <[email protected]> wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > On Tue, 2017-06-20 at 09:22 +0100, Thomas Widmann wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > I recently started experimenting with using ConTeXt (mkiv) for
> > > > > > dictionary typesetting. It's a much
> > > > > > more attractive option than plain TeX or LaTeX because of the 
> > > > > > support
> > > > > > for typesetting on a grid.
> > > > > > 
> > > > > > However, grid typesetting can easily result in a large number of 
> > > > > > orphans
> > > > > > and widows, which really
> > > > > > doesn't look good in a dictionary.
> > > > > > 
> > > > > > In an ideal world, I'd want to alter the column width slightly to
> > > > > > prevent them (because most
> > > > > > dictionaries aren't justified, this wouldn't be very noticeable).
> > > > > > 
> > > > > > Would it be possible to use LuaTeX to achieve this?  I.e., could one
> > > > > > write some code that gets
> > > > > > triggered by orphans and widows and then alters the current column 
> > > > > > width
> > > > > > slightly until the
> > > > > > problem disappears?  Has somebody already done this?  Or have the
> > > > > > relevant TeX internals not been
> > > > > > Luafied yet?
> > > > > > 
> > > > > > I'd also be interested in other ways to solve this issue – for 
> > > > > > instance
> > > > > > changing the looseness
> > > > > > dynamically instead of the column width.
> > > > > 
> > > > > Have a look at \widowpenalty and \clubpenalty.  Also use margin 
> > > > > kerning
> > > > > and font expansion.
> > > > 
> > > > \widowpenalty and \clubpenalty are almost useless in this context –
> > > > believe me, I've tried! (I'm typesetting on a grid, with a fixed
> > > > number of lines per page.) Which is why I'm looking for alternatives.
> > > > 
> > > > Margin kerning and font expansion are definitely options, but again,
> > > > my real query would be how to trigger them dynamically to avoid a
> > > > widow or an orphan.
> > > can you make a small example showing the problem
> > Sorry about the delay – here you go!
> > 
> > On my computer, the first column goes on for two lines more than the
> > following column, and it still produces a widow:
> > 
> > %%% document starts here
> > [...]
> > %%% document ends here
> > 
> > The thing is that there simply isn't a good way to break up a
> > three-line dictionary entry, and it would be much better to play
> > around with the column width, the looseness, margin kerning or other
> > tools rather than having to do so.  Doing it manually is easy enough,
> > but it would be much nicer if the one or more of these tools could get
> > triggered automatically.
> Oops, those lines didn't get wrapped very neatly.  Here's a better version:

How about putting every entry into a box, making it unbreakable?  Of course, 
you get unbalanced
columns this way, but I think keeping the entries together is easier for the 
reader.


\mainlanguage[en]

\definefontfeature
  [default][default]
  [
    protrusion=quality,
    expansion=quality,
    onum=yes,
  ]

\definestartstop [negindent] [
  before={%
    \startnarrower[left]%
    \setupindenting[-.5em,yes,first]%
    \setuphead[subject][indentnext=yes]%
  },
  after=\stopnarrower,
]

\setupbodyfont[palatino]

\setupalign[hz,hanging,tolerant]

\startsetups[grid][mypenalties]
    \setdefaultpenalties
    \setpenalties\widowpenalties{2}{10000}
    \setpenalties\clubpenalties {2}{10000}
\stopsetups

\setuplayout[grid=yes, setups=mypenalties]

\righthyphenmin=60
\lefthyphenmin=60

\def\Sblackbold#1{{\bf #1}}
\def\Sdef#1{{#1}}
\def\Sdefrf#1{{\bf #1}}
\def\ShwJNR#1{{\blue\bf #1}}
\def\Spospsmallcaps#1{{\sc #1}}
\def\Spunctuation#1{{#1}}
\def\Sxrefxrhw#1{{\bf #1}}
\def\Sgroupintro#1{{\it #1}}

\def\threeentries{
  \vbox{\hsize=\textwidth
    \ShwJNR{headphones}\page[no]\par\-\hskip .5em
    \Spospsmallcaps{noun}%
    \Spunctuation{ }%
    \Sdef{a pair of small speakers that you wear over your ears}%
  }
  \vbox{\hsize=\textwidth
    \ShwJNR{heard}\page[no]\par\-\hskip.5em
    \Spospsmallcaps{verb}%
    \Spunctuation{ }%
    \Sgroupintro{the past tense and past part.\ of}%
    \Spunctuation{ }%
    \Sxrefxrhw{hear}%
  }
  \vbox{\hsize=\textwidth
    \ShwJNR{hearing}\page[no]\par\-\hskip .5em
    \Spospsmallcaps{noun}%
    \Spunctuation{ }%
    \Sblackbold{2}%
    \Spunctuation{ }%
    \Sdef{If someone gives you a }%
    \Sdefrf{hearing}%
    \Sdef{,they let you give your point of view and listen to you}%
  }
}

\def\thirtyentries{\threeentries\threeentries\threeentries\threeentries\threeentries%
\threeentries\threeentries\threeentries\threeentries\threeentries}

\startdocument

\startmixedcolumns[balance=yes]
\raggedright
\startnegindent

\thirtyentries

\stopnegindent
\stopmixedcolumns
\placefloats
\stopdocument


> 
> \mainlanguage[en]
> 
> \definefontfeature
>   [default][default]
>   [
>     protrusion=quality,
>     expansion=quality,
>     onum=yes,
>   ]
> 
> \definestartstop [negindent] [
>   before={%
>     \startnarrower[left]%
>     \setupindenting[-.5em,yes,first]%
>     \setuphead[subject][indentnext=yes]%
>   },
>   after=\stopnarrower,
> ]
> 
> \setupbodyfont[palatino]
> 
> \setupalign[hz,hanging,tolerant]
> 
> \startsetups[grid][mypenalties]
>     \setdefaultpenalties
>     \setpenalties\widowpenalties{2}{10000}
>     \setpenalties\clubpenalties {2}{10000}
> \stopsetups
> 
> \setuplayout[grid=yes, setups=mypenalties]
> 
> \righthyphenmin=60
> \lefthyphenmin=60
> 
> \def\Sblackbold#1{{\bf #1}}
> \def\Sdef#1{{#1}}
> \def\Sdefrf#1{{\bf #1}}
> \def\ShwJNR#1{{\blue\bf #1}}
> \def\Spospsmallcaps#1{{\sc #1}}
> \def\Spunctuation#1{{#1}}
> \def\Sxrefxrhw#1{{\bf #1}}
> \def\Sgroupintro#1{{\it #1}}
> 
> \def\threeentries{\ShwJNR{headphones}\page[no]\par\-\hskip .5em%
> \Spospsmallcaps{noun}\Spunctuation{ }\Sdef{a pair of small speakers
> that you wear over your ears}\par\ShwJNR{heard}\page[no]\par\-\hskip.5em%
> \Spospsmallcaps{verb}\Spunctuation{ }\Sgroupintro{the past tense and past
> part.\ of}\Spunctuation{ }\Sxrefxrhw{hear}\par\ShwJNR{hearing}\page[no]%
> \par\-\hskip .5em\Spospsmallcaps{noun}\Spunctuation{ }\Sblackbold{2}
> \Spunctuation{ }\Sdef{If someone gives you a }\Sdefrf{hearing}\Sdef{,
> they let you give your point of view and listen to you\par}}
> 
> \def\thirtyentries{\threeentries\threeentries\threeentries\threeentries\threeentries%
> \threeentries\threeentries\threeentries\threeentries\threeentries}
> 
> \startdocument
> 
> \startmixedcolumns[balance=yes]
> \raggedright
> \startnegindent
> 
> \thirtyentries
> 
> \stopnegindent
> \stopmixedcolumns
> \placefloats
> \stopdocument
> 
> Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 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