ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Czech compound word handling
Date: Wed, 02 Feb 2005 15:46:00 +0100	[thread overview]
Message-ID: <4200E7A8.8080607@wxs.nl> (raw)
In-Reply-To: <20050202131641.GA2940@erik.fi.muni.cz>

David Antos wrote:
> 	Hello,
> 
> would it be possible to define || for compound words to act as
> \discretionary{-}{-}{-}? In Czech, the hyphen for compound words should
> be repeated in the following line.

you mean something like this:

\unprotect

\def\activedododotextmodediscretionary#1#2%
   {\convertargument#2\to\discretionarytoken
    \def\textmodediscretionary%
      {\getvalue{\strippedcsname\textmodediscretionary\string#1}}%
    \ifx\discretionarytoken\empty
      \ifx#1\nextnext % takes care of ||| and +++ and ......
        \prewordbreak\discretionary{\hbox{$#1$}}{}{\hbox{$#1$}}%
        \allowbreak\postwordbreak
        \def\nextnextnext{\afterassignment\egroup\let\next=}%
      \else
        \checkafterdiscretionary
        \bgroup
          \checkbeforediscretionary
	 \textmodediscretionary\nextnext
        \egroup
      \fi
    \else\expandafter\ifx\csname\@tmd@\discretionarytoken\endcsname\relax
      \checkafterdiscretionary
      \bgroup
        \checkbeforediscretionary
        \prewordbreak
        \discretionary{\hbox{#2}}{}{\hbox{#2}}%
        \allowbreak\postwordbreak
      \egroup
    \else
      \csname\@tmd@\discretionarytoken\endcsname
    \fi\fi
    \nextnextnext} % can be \egroup so \aftergroup\ignorespaces

\startlanguagespecifics[cz]

   \setvalue{\strippedcsname\textmodediscretionary\string|}%
     {\discretionary{-}{-}{-}}%

\stoplanguagespecifics

\setvalue{\strippedcsname\textmodediscretionary\string|}%
   {\prewordbreak\hbox{\compoundhyphen}\allowbreak\postwordbreak}

\protect

\starttext

\en \dorecurse{100}{test||}test \endgraf
\cz \dorecurse{100}{test||}test \endgraf

\stoptext


so, in principle it is possible but i need to make it a bit nicer; maybe tonight -)

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

  reply	other threads:[~2005-02-02 14:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-02 13:16 David Antos
2005-02-02 14:46 ` Hans Hagen [this message]
2005-02-02 14:59   ` David Antos
2005-02-02 15:21     ` Hans Hagen
2005-02-02 16:42       ` Vit Zyka
2005-02-02 15:19 ` Vit Zyka
2005-02-02 16:26   ` David Antos

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=4200E7A8.8080607@wxs.nl \
    --to=pragma@wxs.nl \
    --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).