# Latex and linebreaks: Why does it not hyphenate?

\documentclass[12pt, a4paper]{article}
\usepackage[margin=1in]{geometry}

\begin{document}

This text should not be indented.

This tex should be indented.

This text is veeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr yyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyyQ long, but should not be broken tween 'y'' and 'long''.
This is not going too well.\  How do I know where the linebreak on the page should go?\ Is there a magic index that I cannot see?\ What is the issue, and where does it appear?\
\centerline{This is the center.}
\end{document}


Firstly, Hello and salutations. Secondly, I do not understand why the above input does not hyphenate the extremely long goulash that I intentionally put in. (Yes, I know the quotations are wrong, but I don't think that is the issue.)

The capital Y and the Qs are in the text only for aiding in counting the characters, and they do not appear in the document.

I am three days new to LaTex, and I have been going through the books and articles; no answers.

So, Why?

P.S. I put the \ in my sentences for a reason. But again, they can't be the error.

• TeX uses a database of hyphenation patterns. It can't hyphenate gibberish, unless you tell it how to do so. – Ian Thompson Sep 14 '17 at 19:58
• Maybe you have a reason for \ , but it's wrong nonetheless. You should declare \frenchspacing in the preamble if you don't want extended space after punctuation. – egreg Sep 14 '17 at 20:21
• Where, in your opinion, should hyphenation points be allowed in the stringyyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyylong? (Aside: I find it quite surprising that LaTeX found even one hyphenation point.) – Mico Sep 14 '17 at 20:27
• The \  are incorrect also \centerline should not be used in LaTeX, the text This text should not be indented. should be indented (latex does not indent the first paragraph after a heading, but you have no heading) – David Carlisle Sep 14 '17 at 20:37
• Thank you for the fast responses. The whole of the input text was running multiple experiments together to see the output. I know that it is not scientific, but I was trusting that the trials would not affect each other. – user143484 Sep 14 '17 at 21:15

TeX is not able to hyphen gibberish, unless by chance it finds one or more of the preloaded patterns in the pseudowords.

You can check TeX's idea of hyphenation with the testhyphen package. If no good point is found, you have to help TeX by adding \- in appropriate spots or by defining hyphenation exceptions.

\documentclass[12pt, a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{testhyphens}

\begin{document}

\section{Check hyphens}

\begin{checkhyphens}
veeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyyQ
\end{checkhyphens}

\section{Text}

This text should not be indented.

This tex should be indented.

This text is veeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyyQ long, but should not be broken 'tween
y'' and long''. This is not going too well.  How do I know where the
linebreak on the page should go? Is there a magic index that I cannot see?
What is the issue, and where does it appear?
\begin{center}
This is the center.
\end{center}

\end{document}


Example:

\documentclass[12pt, a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{testhyphens}

\hyphenation{
veeeeeeee-eeeeeeeeeeeeerrrrrr-rrrrrr-rrrrrr-rrrrrrrrr-rrrrrrrrrrrrrr
yyyyyyyyy-yyyyyyy-yyyyyy-YyQyy-yyyyyyyyyyQ
}

\begin{document}

\section{Check hyphens}

\begin{checkhyphens}
veeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyyQ
\end{checkhyphens}

\section{Text}

This text should not be indented.

This tex should be indented.

This text is veeeeeeeeeeeeeeeeeeeeerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
yyyyyyyyyyyyyyyyyyyyyyYyQyyyyyyyyyyyyQ long, but should not be broken 'tween
y'' and long''. This is not going too well.  How do I know where the
linebreak on the page should go? Is there a magic index that I cannot see?
What is the issue, and where does it appear?
\begin{center}
This is the center.
\end{center}

\end{document}


A few other points.

1. The first paragraph after a sectional title is not indented.
2. Opening quotes are input with , not with '.
3. The apostrophe before twen should be '.
4. \centerline is not a LaTeX command.
5. If you don't want extended space after punctuation, declare \frenchspacing in the preamble.

Since it has not been mentioned: You can declare hyphenation pattern for unusual words. For example, here is the start of my custom hyphenation.tex, which I \input into all my documents:

\hyphenation{
acet-a-mi-no-phen
ace-tyl-cho-lin-ester-ase
ace-tyl-cho-line
ace-tyl-glu-cos-amine