1

At first, I thought that hyphenation does not work properly. But then, I fould out that it is normal for (La)TeX and Babel to hyphenate (microtype) text in a different way than software like Word, OpenOffice or Libre Offices does it.

Even when it would be possible to correctly hyphenate a word, (La)TeX sometimes does not do it, because it tries to make some kind of “aesthetic” hyphenation.

The word “hyphenation” could already be a good example. Its syllables are, according to this source, hy-phen-a-tion. (La)TeX may refuse to hyphenate this word as, for example, hy-phenation. But in software like Word, OpenOffice or Libre Office, the software would hyphenate a word wherever it is possible. So, seeing something like hy-phenation in a document created by these computer programmes may be quite common.

I would like to have this kind of hyphenation for (La)Tex, too. That is: Keep a minimum space between words in (justified) text and hyphenate the text wherever it is possible (that is, in terms of hyphenation like in Word, OpenOffice or Libre Office). If I do not like the hyphenation of a particular word, I would like to be able to manually suppress that hyphenation locally but not globally.

I have played around with \pretolerance=0, \hyphenpenalty=-10000 and \setlength\spaceskip{.3em plus .1em minus .1em} as David Carlisle suggested, but nothing has worked so far. I even got some results where correct hyphenation has been totally ignored. For example, the word “standard” has once been hyphenated as stand-ard. I would like to avoid that.

Nemgathos
  • 545
  • 3
  • 15
  • 2
    It would be helpful if you provided a sample paragraph (and geometry settings) that leads to a different hyphenation than you would like. – Teepeemm Jan 20 '18 at 20:41
  • 1
    What set of hyphenation rules are you using? I mean, for what language? \showhyphens{standard} returns stan-dard when the American English hyphention rules are in force. – GuM Jan 20 '18 at 20:42
  • 5
    The linebreaking in Word is acknowledged (even by Word developers) as being far inferior to that in TeX (it is hard to do an optimisation over the entire paragraph in a wysiwyg system like word) why would you want to emulate it in tex? Note it is really the line breaking algorithm that is different, the fact that that has an effect on hyphenation points chosen is rather secondary. – David Carlisle Jan 20 '18 at 20:46
  • 1
    keeping white space stretching to a minimum over the paragraph is exactly what TeX does. If you minimise the stretching one line at a time without considering later lines, then later lines will have less breakpoint possibilities and will therefore require larger inter word spaces. – David Carlisle Jan 20 '18 at 20:49
  • 1
    @GuM -- in the other question cited, british hyphenation is used. this can be quite different from u.s. hyphenation. (i have a copy of the dictionary used to create the british patterns, but am not able to access it at present. i will look up "standard" when i get a chance.) – barbara beeton Jan 20 '18 at 20:50
  • 2
    Besides \setlength{\spaceskip}{.3em plus .1em minus .1em} you could try \pretolerance=-1 (slightly better than =0), hyphenpenalty=-10000, and \looseness=-1000; but best solution of all, if you really want what you asked for, is to avoid using (La)TeX at all and use Word/OpenOffice/Libre Office instead. – GuM Jan 20 '18 at 20:53
  • @barbarabeeton: Indeed, with \usepackage[british]{babel} I get stand-ard from the previous experiment. – GuM Jan 20 '18 at 20:56
  • 2
    You give as a reference for hyphenation a site which gives syllables, that is a guide to pronunciation In English (especially if the British patterns are used) that is only slightly related to hyphenation. – David Carlisle Jan 20 '18 at 20:56
  • I have tried to recreate a working example which would hyphenate stand-ard, but I was not able to recreate it. However, I was able to create another example. Take the code from the example from the linked question and write the following in an enumerate-environment: \item Instead, cases are deliberately selected, based on their properties and on \textbf{theoretical reasons}.. Use these properties: \setlength{\spaceskip}{.3em plus .1em minus .1em}, \pretolerance=-1, \hyphenpenalty=-100 and \looseness=-1000. The result will be reas-ons. – Nemgathos Jan 20 '18 at 21:17
  • I would like to have that kind of hyphenation because I personally find it to be better in some, but not all, cases. Also, as I have mentioned, I would then like to choose what seems to be aesthetic for me. Stretching one line at a time without considering later lines would be a problem. I would not like to have that. | I have tried the manipulated properties from GuM, but the result, unfortunately, is still not what I want. – Nemgathos Jan 20 '18 at 21:17
  • 1
    @Nemgathos but considering one line at a time instead of considering the whole paragraph is the entire difference, that is what you are asking for. Word decides the hyphenation at the first line solely based on the text on that line . TeX does not take that hyphenation if that would result in worse inter word space later in the paragraph. – David Carlisle Jan 20 '18 at 21:21
  • I forgot to suggest, in addition to what I said before (btw: obviously, I meant \hyphenpenalty=-10000, that is, I forgot the backslash), also setting \lefthyphenmin=0 and \righthyphenmin=0; but if you are using the babel package, that won’t have any effect, and you’ll have to read the manual. – GuM Jan 20 '18 at 21:22
  • 1
    @Nemgathos the US English patterns give rea-sons the British English patterns give reas-ons (reas-ons looks better to me) – David Carlisle Jan 20 '18 at 21:26
  • @Nemgathos: I’ve just tried \showhyphens{hyphenation} with the British English hyphenation rules in force, and it gives hy-phen-a-tion, as your source suggests. OT: I recall that, two years ago, I was about to post an “April fool” question asking for a way of emulating Word’s line-breaking algorithm with TeX, but in the end I refrained from doing so: it seems that reality has overcome imagination, and that I should have asked that question! – GuM Jan 20 '18 at 21:33
  • @DavidCarlisle Fair enough. But I would like to change these properties so that I can decide for myself what is “better” or “worse”. If I don’t like some kind of hyphenation in, for example, an OpenOffice document, I’ll just change it. If TeX takes into account a whole paragraph when it comes to finding the best hyphenation, this may often result in an aesthetically hyphenated justified text. I don’t doubt that. But as I have said: Sometimes, I would like to decide that for myself. (I did not know that reas-ons is British; I’d have thought that it is American (or wrong), and not vice versa.) – Nemgathos Jan 20 '18 at 21:36
  • @GuM Well, I would like to give it a try. If the results are worse, I will keep it the old way. – Nemgathos Jan 20 '18 at 21:37
  • 1
    I didn't comment on what is correct just confirming what \showhyphens{reasons} reports if using the British patterns, reas-ons seems better to me. I do not understand your requirement at all: If you do not like a specific break you can always edit the source and add explicit or discretionary hyphens where needed, or use \mbox to prevent hyphenation. You can control every linebreak and every hyphenation individually if you do not like the default – David Carlisle Jan 20 '18 at 21:40
  • @GuM https://tex.stackexchange.com/questions/110133/visual-comparison-between-latex-and-word-output-hyphenation-typesetting-ligat – David Carlisle Jan 20 '18 at 21:46
  • @DavidCarlisle So, if I would not like the word “reasons” to be hyphenated, I would write \mbox{reasons}? And what about forcing a hyphen (wheresoever in the text) and continuing with a linebreak? If I, for example, write Lorem ipsum in a line that is long enough to contain far more words than just these two, I would like to force a hyphen so that the first line contains Lorem ip- and the second line continues with sum. I know that the huge whitespace between Lorem and ip- may look very odd if it is very big, but this shall just be an example. – Nemgathos Jan 20 '18 at 21:48
  • 2
    @Nemgathos ip\-sum adds a discretionary hyphen at that point replacing the discretionary points added by the automatic patterns, ip-\linebreak sum adds a mandatory hyphen and mandatory line break at that point. – David Carlisle Jan 20 '18 at 21:51
  • I don't think this really has any answer other than the answers that would apply to the previous question, so I'm going to suggest closing as duplicate. – David Carlisle Jan 20 '18 at 22:09
  • @DavidCarlisle: I do not agree that this is a duplicate of the previous question. Here the conditions are stated more clearly: is there a way in TeX to break paragraphs into lines so that (a) the interword spaces are minimized and (b) no other demerits are taken into account (in particular, hyphenation can occur at no cost)? As such, the question is of some interest, and that’s why I have upvoted it. – GuM Jan 20 '18 at 22:38
  • @GuM the question is better phrased here than there (and has a better title) but I think it really is the same question. Perhaps the dup closing should be the other way round. It's interesting and generates comments as we see here but such questions really don't fit the format of the site. As there isn't really an answer other than note that different systems have different linebreaking and you shouldn't expect to be able to configure them to be the same. – David Carlisle Jan 20 '18 at 22:44
  • @Nemgathos: The suggestion of setting \looseness=-1000 was rather stupid, since this parameter is reset every time a new paragraph begins. You could try, instead, \linepenalty=5000 \hyphenpenalty=0 \exhyphenpenalty=0 \pretolerance=-1 \tolerance=1000 \doublehyphendemerits=0 \finalhyphendemerits=0 \adjdemerits=0 \setlength\spaceskip{.3em plus .05em minus .05em} \setlength\xspaceskip{.5em plus .1em minus .1em} \setlength\emergencystretch{10pt}, but I wouldn’t expect much from it… – GuM Jan 20 '18 at 23:05
  • There are lots of words in the question, and a lot of comments, but it is not at all clear what the question is. Could you (1) give a concrete example of a TeX input file that has incorrect output, (2) say what's wrong with it, (3) say what you'd like instead, and (4) generalize it? Simply saying “like Word, OpenOffice or Libre Office” is useless without saying in what respect you want similar behaviour. (The one example you gave, of the word “hyphenation” being hyphenated as “hy-phenation”, is quite misleading because LaTeX does allow any of breakpoints in hy-phen-ation.) – ShreevatsaR Jan 21 '18 at 02:44
  • Note that 'hyphenate (microtype)' seems confused. The two things are not related except in some very general sense. Using microtypographical fine-tuning can affect hyphenation indirectly, but only because it sometimes improves line-breaking. (It depends on the options you choose to implement and various other things, such as whether font-specific settings are available and which engine you use to compile.) – cfr Jan 21 '18 at 03:40
  • It is possible that you're asking about Hyphenation anywhere, though your question is unclear about what you mean by “like Word, OpenOffice or Libre Office” so it's not easy to say whether the questions are related. – ShreevatsaR Jan 29 '18 at 08:25
  • (I'm pretty sure Word or OpenOffice or LibreOffice do not really hyphenate words arbitrarily, so unfortunately it was never clear what the question meant.) – ShreevatsaR Jan 29 '18 at 08:36

0 Answers0