Questions tagged [discretionary]

{discretionary} is for questions about the TeX primitive \discretionary (or variants thereof, such as LaTeX's \- shortcut), used to typeset text conditionally in a line break or otherwise. Questions about {discretionary} may also use the {line-breaking} and/or {hyphenation} tags, if appropriate. Questions about discretionary ligatures should be tagged {ligatures} instead.

Filter by
Sorted by
Tagged with
1 vote
0 answers
105 views

\babelhyphenation: why does rasing a penalty lead to a break?

Feeding \documentclass[ngerman]{article} \textwidth=104.2mm \usepackage{fontspec} \usepackage[ngerman]{babel} \babelprovide[hyphenrules=ngerman-x-latest]{ngerman}%%% according to the documentation of ...
user avatar
2 votes
0 answers
83 views

Guideline on setting hyphenation preferences in German compounds

Let's say we wish to provide different priorities of hyphenation points in long compound words in German. Here is what we tried out for now: \documentclass[ngerman]{article} \usepackage{iftex} \...
user avatar
0 votes
1 answer
89 views

Trying to assign priorities to different breaking points in a word. Discretionary broken?

I try to assign priorities to different breaking points in a word. To this end, I work around the bug Soft hyphens with priority don't change style with their environment but should do so and ...
user avatar
2 votes
2 answers
169 views

Soft hyphens with priority don't change style with their environment but should do so

Feeding \documentclass{article} \pagestyle{empty} \usepackage[ngerman]{babel} %%% The following 3 lines may be uncommented; it doesn't really matter. %\hyphenpenalty=49% one less than the default ...
user avatar
1 vote
1 answer
45 views

Combining internal hyphenation of words with \discretionary

I have been transcribing an old, public-domain novel and am attempting to typeset it using Latex as close as I can to the original formatting of the book. I've taken Memoir template and am modifying ...
regret's user avatar
  • 21
5 votes
1 answer
220 views

the discretionary of the word `difficult'

Is the discretionary of the word difficult di\discretionary{f-}{fi}{ffi}cult equivalent to dif\-ficult (or dif\discretionary{-}{}{})?
yanpengl's user avatar
  • 2,691
2 votes
1 answer
51 views

How to find out if a break occurred at a manually inserted \discretionary?

How to find out if a break occurred at a manually inserted \discretionary? I can't do it by assignments within the arguments of \discretionary—assignments are finished before decision about breaking ...
Jewdokija's user avatar
1 vote
0 answers
73 views

LuaTeX, \discretionary, and tcolorbox

The following MWE renders differently in XeLaTeX and LuaLaTeX: XeLaTeX has a line break, but LuaLaTeX doesn't. pdfLaTeX produces the same result as XeLaTeX. \documentclass{article} \usepackage{...
Clément's user avatar
  • 4,004
0 votes
1 answer
44 views

Nested \discretionary-ies in (Xe)LaTex resulting an error

I want to set an automatic hyphenation for the Armenian word յանդգնել in XeLaTeX with \discretionary. The problem is, that there are four consonants in a row, and the Armenian language has very ...
Quaternion's user avatar
1 vote
0 answers
265 views

LuaTeX: UTF-8 character extraction, is one way more accurate and/or preferable than another

While experimenting ways to extract UTF-8 character strings from TeX boxes, I found a post from user micahl-h21 here: UTF-8 text extraction. After looking at the way glyph data is stored in the ...
codepoet's user avatar
  • 1,316
10 votes
2 answers
2k views

How does `\discretionary` work?

In poking around in someone else's package, I found the \discretionary command being used quite a lot. I wanted to hook into the code being used in one of its arguments, but found that my code got ...
Andrew Stacey's user avatar
5 votes
2 answers
193 views

Typesetting a comma unless before a line break

I'm trying to create a template (.sty file) that will typeset [value of macro 1], [value of macro 2] if this expression does not exceed the length of the line, and [value of macro 1] [value of ...
Sora.'s user avatar
  • 403
2 votes
1 answer
247 views

How to change color inside `\discretionary` with luacolor?

I'm working on applying the answer to my question about color and ligatures and have run into a problem when the color change is supposed to happen inside a discretionary. Boiled down to a MWE and it ...
rpspringuel's user avatar
0 votes
1 answer
343 views

LuaTeX and the minus / hyphen sign

In light of the explanations given in LuaTeX and em dashes "\automatichyphenmode=1 avoids the problem by not converting the hyphen to a discretionary in a number of cases." and the LuaTeX Reference ...
Simon Dispa's user avatar
7 votes
2 answers
390 views

How do I use textcolor inside discretionary?

I'm trying to get long inline code to wrap at points that I specify with \-. I've got it working almost perfectly with this: % !TEX program = xelatex \documentclass[fontsize=11pt,pagesize=auto,...
Kent Boogaart's user avatar
1 vote
1 answer
208 views

Breaking a line only when not doing so would cause an overfull \hbox

In my thesis, I have a subsection title which generates an overfull \hbox in the body of the thesis, but not in the table of contents. So I would like to instruct TeX to break the line in the body, ...
MickG's user avatar
  • 5,406
6 votes
2 answers
432 views

Automatic discretionary hyphenation in ConTeXt

I am trying to make ConTeXt to do the automatic discretionary hyphenations native to the Hungarian language. In fact, a Hungarian word asszonnyal is explicitly included in lang-hyp.lua source code's ...
SZIEBERTH Ádám's user avatar
7 votes
1 answer
109 views

Letters after discretionary disappear (seems an issue of package fontspec)?

For the following case, % !TeX program = xelatex \documentclass[12pt]{article} \usepackage{fontspec} \begin{document} \hsize =2in shelf{}ful shelf{}ful shelf\-ful di\discretionary{f-}{fi}{f\...
Tuff Contender's user avatar
8 votes
0 answers
145 views

Discretionary macro doesn't work with microtype and Adobe Garamond Pro in LuaLaTeX [closed]

I've run into a problem with the combination of microtype package (v2.6a), LuaLaTeX (Version beta-0.80.0 (TeX Live 2015) (rev 5238)) and Adobe Garamond Pro font, when macro \discretionary doesn't work ...
Marcel S.'s user avatar
  • 1,313
2 votes
2 answers
467 views

How to set hyphenation parameters automatically in LuaTeX?

In the following example we need to hyphenate "aa-aa", but not "bbbb". How to set righthyphenmin=2 automatically if all letters of a word are "a", and keep it default for all other cases? \...
Igor Liferenko's user avatar
0 votes
1 answer
289 views

Discretionary hyphens for words in dot-notation

we're working on a technical document with some special requirement identifier, which use a dot-notation. For example: FRQ.SW.MOD.GUI.1 FRQ.DATA.LOG.OUT.PRINT.1 As you might expect we get a lot of ...
aronadaal's user avatar
  • 553
1 vote
1 answer
179 views

Redefinition of \- (discretionary hyphen): does not apply to a minipage?

I would like to redefine \- (discretionary hyphen) as part of several shortcuts for arrows, like \-> = \rightarrow or \<- = \leftarrow, especially useful for the often used equivalence arrow \&...
Zash's user avatar
  • 13
4 votes
0 answers
337 views

Discretionary hyphens don't work in paragraphed footnotes, bug?

I am getting the impression that discretionary hyphens don't work at all in paragraphed footnotes, not really depending on which package is used for the footnotes. I've painfully experienced it with ...
muk.li's user avatar
  • 3,580
9 votes
2 answers
451 views

\- doesn't work in footnote

In the following example the \- in the footnote doesn't work. In Indian languages "dh" is one letter and should not be separated by hyphenation. I know I could use \discretionary here, but I want to ...
muk.li's user avatar
  • 3,580
10 votes
2 answers
2k views

Hyphenation penalty [duplicate]

Say I have done \hyphenation{a-no-ma-ly}. In the text, the word is broken ano-maly. This is (etymologically) displeasing, but may be better than the spacing that would result from barring it. Can I do ...
Toothrot's user avatar
  • 3,346
10 votes
2 answers
300 views

assign penalty to one discretionary (not all paragraph)

For a quite complex problem that would be too long to describe, I need to set different penalties for different discretionaries in the same paragraphe. It doesn't seem to be possible with pdfTeX (and ...
Elie Roux's user avatar
  • 449
6 votes
3 answers
498 views

Line Breaking Question with Polyglossia

I am working with multiple languages (with polyglossia and XeLaTeX), and I am having issues with extra line breaks where I don't expect them, also likely related to an issue of not hyphenating where ...
magicker72's user avatar
19 votes
2 answers
527 views

Is there a way to apply different penalties to hyphenation points in a word?

Background: The quality of hyphenation points within a word can vary by a large amount. Especially in languages that allow rather arbitrary combinations of words, such as German. As an example, ...
Stephan Hennig's user avatar
17 votes
3 answers
2k views

How to break long words after n chars (long genomic sequences)

I have to include relatively small genomic sequences in a Latex document (still, they are words of around 600-900 As Ts Gs and Cs) but I cannot find a way to force line wrapping after a certain number ...
Nisaea's user avatar
  • 173
7 votes
1 answer
203 views

Accessing pointers in LuaTeX

This code writes the subtype of disc nodes to the log file. \documentclass{minimal} \usepackage{fontspec} \directlua{ show_hyph = function(head) while head do if head.id == 0 or head.id == 1 ...
Håkon Malmedal's user avatar
24 votes
1 answer
2k views

Check if at begin of a line

For a list of bullet-separated items, I want the separator to be swallowed if it is the first or last element of the line. That is, I want something like \renewcommand{\and}{% \ifnolinebreak% &...
akobel's user avatar
  • 435
31 votes
2 answers
2k views

Ligature suppression with proper hyphenation and comprehensive word list?

[Update: It's been pointed out that my question(s) here weren't clear (or were too hidden). So I inserted red stars at the points where the questions appear.] In The TeX Book, D.E.K. gives "shelfful" ...
Todd Lehman's user avatar
  • 13.9k
21 votes
3 answers
5k views

Hyphenating hyphens: how to change the default \discretionary

My language, Portuguese, have undergone another orthography reform (those committees simply can't avoid themselves from doing this mess from time to time.) Now we have to adapt, which brings us to my ...
Caio Lopes's user avatar
14 votes
3 answers
4k views

Optional but encouraged line break + \hfill

How would I write a macro (to be placed immediately before every URL in a bibliography) whose effect is to tell TeX This is a good place to insert a line break, but breaking the line here is not ...
zwol's user avatar
  • 2,967