After this question answer How to use the standard - (hyphen) as the \hyp{} command from the hyphenat package?, I decided to not use that hack. Then, I am looking for an alternative to that.
On my case, using "=
is almost as hard as \hyp{}
because I write latex code on Sublime Text, and I use this package https://github.com/r-stein/sublime-text-latex-smart-quotes which does this:
i.e., when I press "
is sends ``
and ''
according to where I am on the word: https://github.com/r-stein/sublime-text-latex-smart-quotes/issues/4
The only way to send "
is by pressing Ctrl+L
, L
, "
, which is as hard as have to type \hyp{}
.
I love this feature of because I never have to use "
unless I would like to do "=
, but I prefer to keep the https://github.com/r-stein/sublime-text-latex-smart-quotes feature and use something else other than "=
.
Can I bind it to something as handly as ´=
(not `=
)? Or do you suggest something else?
Then, I can use it like this something´=hyphenated
, instead of something"=hyphenated
I tried doing this: \newcommand{´=}{\hyp{}}
but latex did not liked it:
test1.tex: LaTeX Error: Missing \begin{document}.
Update 1
I found this question How to hyphenate a reference that has a lastname with a hyphen? suggesting this, but it had no effect:
\documentclass[10pt,a5paper,twoside]{article}
\usepackage{hyphenat}
\usepackage[english]{babel}
\defineshorthand{´=}{\hyp{}}
\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}
Update 2
After reading http://linorg.usp.br/CTAN/macros/latex/required/babel/base/babel.pdf I managed to get this working:
\documentclass[10pt,a5paper,twoside]{article}
\usepackage{hyphenat}
\usepackage[english]{babel}
\useshorthands{"}
\defineshorthand{"=}{\hyp{}}
\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´=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}
But when using something like:
\useshorthands{´}
\defineshorthand{´=}{\hyp{}}
Latex throws this error:
Package babel Info: Making an active character on input line 5.
test1.tex:5: LaTeX Error: Missing \begin{document}.
newcommand
must be a macro. Hence the error. Have you considered using the packagecsquotes
instead of using that plugin? – Weijun Zhou Apr 28 '19 at 2:04thing''
– user Apr 28 '19 at 2:11\MakeOuterQuote{"}
and I can type all the double quotes without problem. They are automatically matched and replaced with the correct (opening or closing) one. I seldom use single quotes but there is something similar in the document. – Weijun Zhou Apr 28 '19 at 2:12\useshorthands*
before you define a shorthand. – Weijun Zhou Apr 28 '19 at 3:40´
is not an ascii char, it is U+B4, which in utf8 is encoded with two bytes (0xC2 0xB4). You can't use it for a shorthand. – Ulrike Fischer Apr 28 '19 at 10:00