1

Sometimes I see questions talking about using "=, others just use \hyp{}. Are they the same thing?

For example, on these questions you find both "= and \hyp use:

  1. Hyphenation of words containing slash
  2. LaTeX not hyphenating properly, text running off page
  3. How to hyphenate a reference that has a lastname with a hyphen?

I tried creating this minimal example, but "= is not working:

\documentclass[10pt,a5paper,twoside]{article}
\usepackage{hyphenat}
\usepackage[english]{babel}

\begin{document}

\section{Show font}

    Tests.

    Encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding.

    Encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding.

    Encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding.

\end{document}

enter image description here

  • As your question gives so little explicit information I have no idea but I doubt it. Can you give more details about these "questions" and, ideally, a minimal working example? – Andrew Apr 28 at 2:33
  • I added example questions I could find using both. – user Apr 28 at 2:54
  • For me the equal signs display as = but - and \hyp seem pretty much the same. Looking in hyphenat.sty, from the hyphenat package, the \hyp command is a robust command that is defined to be \ifmmode-\else\BreakableHyphen\fi. So, \hyp and - are the almost same except inside mathematics. – Andrew Apr 28 at 3:04
  • 2
    To get the "= shorthand directive to work, you must replace \usepackage[english]{babel} with \usepackage[ngerman,english]{babel} \useshorthands{"} \addto\extrasenglish{\languageshorthands{ngerman}}. See babel: Adding ngerman' s language shorthands to english as the main document language for more information. – Mico Apr 28 at 6:01
2

To get the "= shorthand directive to work in your document, you must replace

 \usepackage[english]{babel}

with

 \usepackage[ngerman,english]{babel} 
 \useshorthands{"} 
 \addto\extrasenglish{\languageshorthands{ngerman}}

See babel: Adding ngerman' s language shorthands to english as the main document language for more information on this subject.

Once this adjustment is made, it would appear that \hyp{...} and "= perform very similarly. The "= would appear to be a lot easier to use in practice, though.

The vertical frame lines in the following screenshot are placed by the showframe package.

enter image description here

\documentclass[10pt,a5paper,twoside]{article}

\usepackage{hyphenat} % for "\hyp" macro

%% See https://tex.stackexchange.com/q/27198/5001:
\usepackage[ngerman,english]{babel} 
\useshorthands{"} 
\addto\extrasenglish{\languageshorthands{ngerman}}

\usepackage{showframe,microtype} % just for this example
\begin{document}
*

Encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding-encoding.

Encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding"=encoding.

Encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding\hyp{}encoding.

\end{document}
1

There is no predefined behaviour of "= in babel and it's language dependent (but in most cases it's a hard hyphen). Instead of loading ngerman, you can define it directly in the following way:

\useshorthands{"} 
\defineshorthand{"=}{\babelhyphen{hard}}

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.