0

This question has been asked a few times for LaTeX (e.g. here) and I remember vaguely that I read somewhere that the technique is basically the same in ConTeXt. Alas, it doesn't seem to work too well.

In a nutshell: I would like to prevent hyphenation of specific words, say for proper names or brands. I know that I can use \unhyphenated for each instance, but I would rather prevent hyphenation of these words globally.

Using \hyphenation seems to be the method that is suggested most often, but it doesn't seem to work reliably. E.g. in the following MWE

\defineframedtext[secondary][
  frame=off,
  leftframe=on,
  framecolor=lightgray,
  rulethickness=6pt,
  offset=none,   % 0pt,
  loffset=6pt,
  indenting=no,
  align=flushleft,
  style=\em,
]

% ----------

\hyphenation{improvements largescale experiments}

% ----------

\starttext

\section{Testing hyphenation}

\startsecondary

\input{knuth}

\stopsecondary

\input{knuth}

\stoptext

...the command \hyphenation prevents the words improvements and experiments from being hyphenated (try commenting out the \hyphenation{...} command), but seems to have no effect at all on the word largescale:

\hyphenation doesn't seem to work reliably

I suspect that this might have something to do with the framedtext that I set up, but I can't quite put my finger on it. Can anybody help me understand, what I am missing here? Thanks in advance!

Marcus C.
  • 755
  • 1
    your output shows that the word largescale is not in the source, it appears as large-scale even in the wide text – David Carlisle Sep 11 '22 at 12:39
  • Ah, thanks, I hadn't noticed that. Now, that explains the problem here – and makes my example a rather bad one. :) I chose knuth merely for this MWE, however, in the book that I'm typesetting this happens with quite a few words, such as Tatjana. Do I have to assume then that these words are rewritten (by some hyphenation algorithm somewhere) to contain hyphens...? – Marcus C. Sep 11 '22 at 12:46
  • most likely you are specifying hyphenation rules for the wrong language. \hyphenation is the primitive, but in latex you would use babel to control laguage settings, context will have something equivalent but I do not know the details – David Carlisle Sep 11 '22 at 12:59

1 Answers1

1

Let's see knuth.tex (just the first paragraph):

Thus, I came to the conclusion that the designer of a new
system must not only be the implementer and first
large||scale user; the designer should also write the first
user manual.

That's how you specify a discretionary hyphen in ConTeXt, I guess.

egreg
  • 1,121,712
  • Ah, thank you, I hadn't noticed that. So, I might add the question, how to override these discretionary hyphens... :) Anyway, using knuth.tex was only an example (a bad one, as I now realize). I noticed that the algorithm is ignoring quite a few specific words in my own text, such as Tatjana. Does that mean that all of these words have discretionary hyphens defined somewhere...? – Marcus C. Sep 11 '22 at 12:35
  • @MarcusC. Make an example showing the real issue in a new question. – egreg Sep 11 '22 at 12:46
  • Thanks for your help. In the meantime I found the root of the problem: I had used the \hyphenation command over and over hoping that would allow me to prevent further words from being hyphenated. As it turns out, this seems to have overridden previous definitions. I already posted another question regarding this problem: https://tex.stackexchange.com/questions/656832/how-to-use-the-hyphenation-command-in-context-to-add-further-definitions – Marcus C. Sep 11 '22 at 13:25