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
4
votes
2answers
137 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 ...
5
votes
2answers
121 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 ...
2
votes
1answer
95 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 ...
1
vote
1answer
119 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 ...
6
votes
2answers
289 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,...
1
vote
1answer
88 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, ...
6
votes
2answers
261 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 ...
8
votes
1answer
94 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\...
8
votes
0answers
124 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 ...
2
votes
2answers
255 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? \...
0
votes
1answer
198 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 ...
1
vote
1answer
94 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 \&...
4
votes
0answers
257 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 ...
8
votes
0answers
255 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 ...
10
votes
1answer
803 views

Hyphenation penalty

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 ...
10
votes
2answers
218 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 ...
6
votes
3answers
312 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 ...
16
votes
1answer
379 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, ...
16
votes
3answers
1k 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 ...
7
votes
1answer
181 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 ...
23
votes
1answer
1k 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% &...
31
votes
2answers
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" ...
21
votes
3answers
4k 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 ...
11
votes
1answer
3k 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 ...