From: Tomas Hala <tomas.hala@mendelu.cz>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to repeat the hyphen?
Date: Fri, 22 Mar 2019 15:38:55 +0100 [thread overview]
Message-ID: <20190322143855.GA13926@akela.mendelu.cz> (raw)
In-Reply-To: <AC7DE4C2-98B2-4713-9A18-F0028B92CB3F@elvenkind.com>
Hi Taco,
good idea, I tried it but the problem is that it does not switch itself off
automatically when the language is changed again.
The following code works but I guess that must be some more sophisticated
ConTeXt way.
Best wishes,
Tomáš
%%%%%%%%%%%%%%
\def\myboxik#1#2{\start\setuphyphenation[cz][method=#1]\startframedtext[width=1dd]\hbox{{\bf#1}}\crlf#2\stopframedtext\stop\par}
\def\mybox#1{\myboxik{traditional}{#1}\myboxik{default}{#1}\myboxik{expanded}{#1}\myboxik{original}{#1}\myboxik{tex}{#1}\myboxik{hyphenate}{#1}\myboxik{none}{#1}\par\thinrule}
\starttext
\definebreakpoints[czcompound]
\let\oldlanguage=\language
\def\language[#1]{\oldlanguage[#1]
\ifx\mylanguage\currentlanguage \definebreakpoint[czcompound][-][nleft=3,nright=3,type=4] \setbreakpoints[czcompound]
\else \definebreakpoint[czcompound][-][nleft=3,nright=3,type=1] \setbreakpoints[czcompound]
\fi} %%%% and the same for \mainlanguage
\def\mylanguage{cs}
\language[en] \mybox{modro-zelený}
\language[cz] \mybox{modro-zelený}
\language[en] \mybox{modro-zelený}
\stoptext
%%%%%%%%%%%%%%%%%%%%
Fri, Mar 22, 2019 ve 01:56:40PM +0100 Taco Hoekwater napsal(a):
# Hi Tomáš,
#
# Sorry but I do not know. I *do* know that you can do this:
#
# \definebreakpoints [czcompound]
# \definebreakpoint [czcompound] [-] [nleft=3,nright=3,type=4]
# \setbreakpoints [czcompound]
#
# And perhaps hook that into a language switch. Does that help?
#
#
#
# > On 22 Mar 2019, at 10:37, Tomas Hala <tomas.hala@mendelu.cz> wrote:
# >
# > Hi,
# >
# > thanks, that's it. I did some tests and no side-effects appeared.
# > Moreover, it seems that it has no influence on \hyphentatedurl which is also ok.
# >
# > But only one point I do not understand -- when I used the key
# > language=cz, repeated hyphens disappeared. It would by fine if one
# > can set it only for the given language(s), eg. for cz+sk yes and for en no.
# > Is there any way for this?
# >
# > Best wishes,
# >
# > Tomáš
# >
# >
# > \definebreakpoint [compound] [-] [nleft=3,nright=3,type=4, language=cz]
# > \setbreakpoints[compound]
# >
# >
# > Thu, Mar 21, 2019 ve 04:45:49PM +0100 Taco Hoekwater napsal(a):
# > # Hi,
# > #
# > # \definebreakpoint [compound] [-] [nleft=3,nright=3,type=4]
# > # \setbreakpoints[compound]
# > #
# > # But also check the wiki, there can be side-effects to \setbreakpoints[compound]
# > #
# > # https://wiki.contextgarden.net/Compound_words
# > #
# > #
# > # Best wishes,
# > # Taco
# > #
# > # > On 21 Mar 2019, at 16:23, Tomas Hala <tomas.hala@mendelu.cz> wrote:
# > # >
# > # > Hi all,
# > # >
# > # > in composed words with hyphen inside (e.g. modro-zelený = blue-green), the
# > # > hyphen character must be repeated at the beginning of the new line
# > # > (modro-/-zelený). This rule is obligatory for Czech and Slovak typesetting.
# > # >
# > # > I am able to implement this feature by defining a new command (see \def\= below)
# > # > but it means that all appearances of "-" must be replaced (manually) in the source
# > # > text. I tried all options of \setuphyphenation but no one gives the correct
# > # > result.
# > # >
# > # > Is there any way in ConTeXt how to set it by default?
# > # >
# > # > Best wishes,
# > # >
# > # > Tomáš
# > # >
# > # > %%%%%% MWE:
# > # >
# > # > \starttext\mainlanguage[cz]
# > # > \def\myboxik#1#2{\start\setuphyphenation[cz][method=#1]\startframedtext[width=1dd]\hbox{{\bf#1}}\crlf#2\stopframedtext\stop\par}
# > # > \def\mybox#1{\myboxik{traditional}{#1}\myboxik{default}{#1}\myboxik{expanded}{#1}\myboxik{original}{#1}\myboxik{tex}{#1}\myboxik{hyphenate}{#1}\myboxik{none}{#1}}
# > # >
# > # > \mybox{modro-zelený}
# > # >
# > # > \def\={\discretionary{-}{-}{-}}
# > # > \mybox{modro\=zelený}
# > # > \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
# > # > ___________________________________________________________________________________
# > #
# > # Taco Hoekwater
# > # Elvenkind BV
# > #
# > #
# > #
# > #
# > # ___________________________________________________________________________________
# > # 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
# > # ___________________________________________________________________________________
# >
# > Tomáš Hála
# > --------------------------------------------------------------------
# > Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
# > Zemědělská 1, CZ-613 00 Brno, tel. +420 545 13 22 28
# > --------------------------------------------------------------------
# > http://akela.mendelu.cz/~thala
# > ___________________________________________________________________________________
# > 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
# > ___________________________________________________________________________________
#
# Taco Hoekwater
# Elvenkind BV
#
#
#
#
# ___________________________________________________________________________________
# 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
# ___________________________________________________________________________________
Tomáš Hála
--------------------------------------------------------------------
Mendelova univerzita, Provozně ekonomická fakulta, ústav informatiky
Zemědělská 1, CZ-613 00 Brno, tel. +420 545 13 22 28
--------------------------------------------------------------------
http://akela.mendelu.cz/~thala
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2019-03-22 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-21 15:23 Tomas Hala
2019-03-21 15:45 ` Taco Hoekwater
2019-03-22 9:37 ` Tomas Hala
2019-03-22 12:56 ` Taco Hoekwater
2019-03-22 14:38 ` Tomas Hala [this message]
2019-03-22 15:16 ` Taco Hoekwater
2019-03-22 15:57 ` Tomas Hala
2019-03-26 5:24 ` Sam May
2019-03-26 5:54 ` Alan Braslau
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=20190322143855.GA13926@akela.mendelu.cz \
--to=tomas.hala@mendelu.cz \
--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).