Difference between revisions of "Command/definebreakpoint"
< Command
Jump to navigation
Jump to search
(Created page with "{{Reference |name={{subst:SUBPAGENAME}} |attributes= }} == Syntax == <table cellspacing="4" cellpadding="2" class="cmd"> <tr> <td colspan="2" class="cmd...") |
(Add disabling hyphenation section) |
||
(6 intermediate revisions by 3 users not shown) | |||
Line 3: | Line 3: | ||
|attributes= | |attributes= | ||
}} | }} | ||
+ | |||
+ | == [[Help:Reference|Syntax]] (autogenerated) == | ||
+ | <syntax>definebreakpoint</syntax> | ||
== [[Help:Reference|Syntax]] == | == [[Help:Reference|Syntax]] == | ||
Line 35: | Line 38: | ||
<tr valign="top" class="third"> | <tr valign="top" class="third"> | ||
<td class="cmd">type</td> | <td class="cmd">type</td> | ||
− | <td> | + | <td> |
+ | {| class="wikitable" | ||
+ | |- | ||
+ | | 1 || {{code|...1...1 / ...}} place breaking character before linebreak | ||
+ | |- | ||
+ | | 2 || {{code|...2... / 2-...}} place breaking character after linebreak, hyphen inside it. (Used if a break happens before the parenthesised part of a word.) | ||
+ | |- | ||
+ | | 3 || {{code|...3...-3 / ...}} place breaking character before linebreak, hyphen inside it. (Used if a break happens after the parenthesised part of a word.) | ||
+ | |- | ||
+ | | 4 || {{code|...4...4 / 4...}} place breaking character on both sides of linebreak | ||
+ | |- | ||
+ | | 5 || specify pattern with {{code|left}}, {{code|middle}}, and {{code|right}}. | ||
+ | |- | ||
+ | |||
+ | |} | ||
+ | </td> | ||
</tr> | </tr> | ||
<tr valign="top" class="third"> | <tr valign="top" class="third"> | ||
<td class="cmd">middle</td> | <td class="cmd">middle</td> | ||
− | <td>'' | + | <td>'''how breaking character should display when no break takes place. Used in combination with {{code|type=5}}.''</td> |
</tr> | </tr> | ||
<tr valign="top" class="third"> | <tr valign="top" class="third"> | ||
<td class="cmd">left</td> | <td class="cmd">left</td> | ||
− | <td>'' | + | <td>''how breaking character should display at break, at end of first line. Used in combination with {{code|type=5}}.''</td> |
</tr> | </tr> | ||
<tr valign="top" class="third"> | <tr valign="top" class="third"> | ||
<td class="cmd">right</td> | <td class="cmd">right</td> | ||
− | <td>'' | + | <td>''how breaking character should display at break, at start of second line. Used in combination with {{code|type=5}}.''</td> |
</tr> | </tr> | ||
</table> | </table> | ||
== Description == | == Description == | ||
− | {{cmd|definebreakpoint| | + | {{cmd|definebreakpoint|2=[''setname''][?][...=...]}} defines a breakpoint at {{code|?}}, and makes it a member of a set that can be activated with {{cmd|setbreakpoints|[''setname'']}}. The set must be initialized with {{cmd|definebreakpoints|[''setname'']}}. |
== Example == | == Example == | ||
Line 62: | Line 80: | ||
\definebreakpoint [compound] [(] [nleft=3,nright=3,type=2] | \definebreakpoint [compound] [(] [nleft=3,nright=3,type=2] | ||
\definebreakpoint [compound] [)] [nleft=3,nright=3,type=3] | \definebreakpoint [compound] [)] [nleft=3,nright=3,type=3] | ||
+ | </texcode> | ||
+ | |||
+ | An illustration of a custom breakpoint of type 5: | ||
+ | <context source="yes"> | ||
+ | \definebreakpoints[test] | ||
+ | |||
+ | \definebreakpoint [test] [?] [type=5,left=L,right=R,middle=M] | ||
+ | |||
+ | \setbreakpoints[test] | ||
+ | |||
+ | \setuppapersize[A7] | ||
+ | |||
+ | \starttext \showframe | ||
+ | xxxx?xxxx?xxxx?xxxx?xxxx?xxxx?xxxx?xxxx\par | ||
+ | \stoptext | ||
+ | </context> | ||
+ | |||
+ | == More Examples == | ||
+ | |||
+ | === Hyphenate at any character === | ||
+ | |||
+ | In some cases, you might need not to break at a hyphen or other breakpoint, but don't have a chance to put {{cmd|unhyphenated}} explicitly. In this case, you may omit the second argument and activate the following breakpoint set instead. | ||
+ | |||
+ | <texcode> | ||
+ | \define[2]\mycommand{ | ||
+ | \startxrow | ||
+ | \startxcell cmd #1 \stopxcell | ||
+ | \startxcell #2 \stopxcell | ||
+ | \stopxrow | ||
+ | } | ||
+ | \starttext | ||
+ | |||
+ | \setupxtable[width=5cm] | ||
+ | \startxtable | ||
+ | \mycommand{A}{lsfkgjfk-gshgkhigewhgajkdkfkalhfdklahfkhaakfakfh} | ||
+ | \stopxtable | ||
+ | |||
+ | Now setting no specific breakpoint character set: | ||
+ | |||
+ | \definebreakpoint[mybreaks][][type=1] | ||
+ | \setbreakpoints[mybreaks] | ||
+ | |||
+ | \setupxtable[width=5cm] | ||
+ | \startxtable | ||
+ | \mycommand{A}{lsfkgjfk-gshgkhigewhgajkdkfkalhfdklahfkhaakfakfh} | ||
+ | \stopxtable | ||
+ | |||
+ | \stoptext | ||
</texcode> | </texcode> | ||
== See also == | == See also == | ||
− | + | {{Hyphenation see also}} | |
− | + | * {{src|typo-brk.mkiv}} | |
− | * {{ | ||
− | |||
− | |||
== Help from ConTeXt-Mailinglist/Forum == | == Help from ConTeXt-Mailinglist/Forum == |
Latest revision as of 08:14, 24 April 2020
\definebreakpoint
Syntax (autogenerated)
\definebreakpoint[...][...][...=...,...] | |
[...] | name |
[...] | character |
type | 1 2 3 4 5 |
nleft | number |
nright | number |
left | command |
middle | command |
right | command |
range | yes no |
language | language |
Syntax
\definebreakpoint[...][...][...=...] | |||||||||||
[...] | name of breakpoint set to add to | ||||||||||
[...] | character at which to break | ||||||||||
language | two-letter code: language for which this breakpoint applies | ||||||||||
nleft | number: minimal characters to left to allow breaking' here' | ||||||||||
nright | number: minimal characters to right to allow breaking here | ||||||||||
type |
|
||||||||||
middle | 'how breaking character should display when no break takes place. Used in combination with {{{1}}} . |
||||||||||
left | how breaking character should display at break, at end of first line. Used in combination with {{{1}}} . |
||||||||||
right | how breaking character should display at break, at start of second line. Used in combination with {{{1}}} . |
Description
\definebreakpoint[setname][?][...=...] defines a breakpoint at ?
, and makes it a member of a set that can be activated with \setbreakpoints[setname]. The set must be initialized with \definebreakpoints[setname].
Example
This is how the compound
breakpoint set is defined in typo-brk.mkiv
\definebreakpoint [compound] [+] [nleft=3,nright=3,type=1] \definebreakpoint [compound] [-] [nleft=3,nright=3,type=1] \definebreakpoint [compound] [/] [nleft=3,nright=3,type=1] \definebreakpoint [compound] [(] [nleft=3,nright=3,type=2] \definebreakpoint [compound] [)] [nleft=3,nright=3,type=3]
An illustration of a custom breakpoint of type 5:
\definebreakpoints[test] \definebreakpoint [test] [?] [type=5,left=L,right=R,middle=M] \setbreakpoints[test] \setuppapersize[A7] \starttext \showframe xxxx?xxxx?xxxx?xxxx?xxxx?xxxx?xxxx?xxxx\par \stoptext
More Examples
Hyphenate at any character
In some cases, you might need not to break at a hyphen or other breakpoint, but don't have a chance to put \unhyphenated explicitly. In this case, you may omit the second argument and activate the following breakpoint set instead.
\define[2]\mycommand{ \startxrow \startxcell cmd #1 \stopxcell \startxcell #2 \stopxcell \stopxrow } \starttext \setupxtable[width=5cm] \startxtable \mycommand{A}{lsfkgjfk-gshgkhigewhgajkdkfkalhfdklahfkhaakfakfh} \stopxtable Now setting no specific breakpoint character set: \definebreakpoint[mybreaks][][type=1] \setbreakpoints[mybreaks] \setupxtable[width=5cm] \startxtable \mycommand{A}{lsfkgjfk-gshgkhigewhgajkdkfkalhfdklahfkhaakfakfh} \stopxtable \stoptext
See also
- Hyphenation
- \hyphenation to define the hyphenation of a specific word
- \startexceptions to define language-specific hyphenations
- \- to define an ad-hoc breakpoint
- \unhyphenated to prevent hyphenation
- \doublehyphendemerits to penalize hyphenation on consecutive lines
- \setupalign justification parameters to tweak the auto-hyphenation algorithm
- \definebreakpoints to initialize a breakpoint set
- \definebreakpoint to add to a breakpoint set
- \setbreakpoints to activate a breakpoint set
- \language to activate a language's settings, including hyphenation
- Wrapping
- typo-brk.mkiv
Help from ConTeXt-Mailinglist/Forum
All issues with: