6

In Portuguese, many words are explicitly hyphenated, such as "anti-inflamatório".

According to Portuguese hyphenation rules, if the line is broken at the hyphen, another hyphen should be added to be beginning of the next line (otherwise we do as everyone else…).

Example 1: An example of "normal" hyphenation:

Necessito de pensar em tomar um anti-infla-
matório e bem depressa.

Example 2: An example of hyphenation at the hyphen (notice the extra hyphen in the next line):

Necessito de pensar em tomar um anti-
-inflamatório e bem depressa.

How can I achieve the behaviour of Example 2? (Babel does not add the extra hyphen in the next line by default…)

Thank you.

João Lourenço

  • I just noticed that the line breaks in the examples didn't show as expected! :( Below, <NL> represents a line break! NORMAL: Necessito de pensar em tomar um anti-infla-<NL>matório e bem depressa. HYPHEN: Necessito de pensar em tomar um anti-<NL>-inflamatório e bem depressa. – João Lourenço Oct 6 '16 at 15:53
  • 1
    do you need this to work from a normal - as in anti-inflamatório or would it be OK to introduce a new command as in anti\myhyphen inflamatório which would be a lot less likely to break other uses of - for example in lengths and numbers. – David Carlisle Oct 6 '16 at 16:03
  • Hi João, nice finding! :) Out of curiosity, I decided to investigate about our line wrapping rules (for Portuguese speakers, the term is coined as translineação, in case one wants to search about it) and was shocked to discover the 2009 reform now makes mandatory the redundant hyphen in the beginning of the new line! Personally, I'd rather rewrite my sentence in order to avoid this situation than use another hyphen (I am definitely not used with this notation). Oh my. – Paulo Cereda Oct 6 '16 at 16:51
  • @David Carlisle, the best would be for it to work for normal hyphen, as for long documents (e.g., a PhD thesis written in Portuguese) a solution based in a macro is admissible but very inconvenient. – João Lourenço Oct 6 '16 at 21:37
  • as you will have seen I left it with a macro, you could make - active \catcode`\-=\active\def-{\disccretionary...} but then \hspace{-2pt} will fail, as would \input{foo-bar} you could make the code more complicated to avoid those failures but something else would break. It should be easy in any text editor to occasionally do a global replace of [letter]-[letter] to \1\\x-\2 so really you don't need to worry about this while doing the main typing. – David Carlisle Oct 7 '16 at 11:24
4

enter image description here

\documentclass{article}

\usepackage[portuguese]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\newcommand\x[1]{\discretionary{#1}{#1}{#1}}
\begin{document}

Necessito de pensar em tomar um anti\x-inflamatório e bem depressa.

zzz zzz zzz zzz zzz zzz zzz zzz zzz
Necessito de pensar em tomar um anti\x-inflamatório e bem depressa.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.