I am sure this is some basic LaTeX document formatting, but for the sake of me I just can't find the right place in the documentation on the proper way to achieve what I want.
Consider the following MWE:
\documentclass[12pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\sloppypar
\begin{document}
Some normal line followed by a cyrillic long word многодългадуманакирилицабезпренасяне
\end{document}
I know \sloppypar
is a bad practice, but it really did manage most of my warnings and document flaws in an acceptable way, so I'm sticking to that for now.
This example compiles with an Underfull \hbox (badness 10000) in paragraph at lines 9--10
warning, which is understandable since LaTeX doesn't have instructions on how to hyphenate the cyrillic word in question and thus puts it on a whole new line, while trying to stretch the previous line, which ends up as Underfull
. I get this. (And by the way, this is not Russian, but Bulgarian, and I didn't find any hyphenation packages for that... so advices on that note are also welcome).
Essence: I really don't have the time to reformat my whole document right now, so I'd want to instruct LaTeX simply not to try to stretch the previous line (basically break it like with \\
where needed), which satisfies me completely for now. So the document should look as if its content was the following:
\documentclass[12pt]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\sloppypar
\begin{document}
Some normal line followed by a cyrillic long word\\ многодългадуманакирилицабезпренасяне
\end{document}
For now, I'm actually fixing the couple of spots (maybe 10 or 15 lines) where this problem occurs, by manually adding the \\
and I know it's horrible and hardly managable in the long term, so I'd be really glad on some instructions on how to enforce such behaviour (in combination with \sloppypar
if that's possible).
Many thanks in advance!
\documentclass[12pt]{article} \usepackage[T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \sloppypar \begin{document} Some normal line followed by a cyrillic long word \foreignlanguage{bulgarian}{многодългадуманакирилицабезпренасяне} \end{document}
.\usepackage[bulgarian]{babel}
should already result in the expected output.babel
with an appropriate language option, I'd just add discretionary hyphens in appropriate places and let (La)TeX choose the one(s) that give the best breaks. A discretionary hyphen consists of a backslash followed by a hyphen\-
and it works very reliably. (It's sometimes needed in all-English texts for words that should be hyphenated, but automatic hyphenation can't be applied because it's different depending on whether the word functions as a verb or a noun, like "progress".)