Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is the difference between \declare@shorthand and \defineshorthand in babel (v.3.9)? Which of the two macros is preferable in a language definition file?

babel.pdf manual (v.3.9) provides an example

\defineshorthand{"*}{\babelhyphen{soft}}
\defineshorthand{"-}{\babelhyphen{hard}}

and russian.ldf provides similar defintions using \declare@shorthand, e.g.

\declare@shorthand{russian}{""}{\hskip\z@skip}
\declare@shorthand{russian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}
share|improve this question
add comment

2 Answers

In 3.9

\declare@shorthand{russian}{""}{\hskip\z@skip}

is (will be) just an optimized version of

\declareshorthand[russian]{""}{\hskip\z@skip}

This shorthand is defined for russian and is active only when this language has been selected. Without the optional argument, it's a user shorthand, which is always active and takes precedence over language shorthands. In language definition files, the preferred command is the optimized one (ie, \declare@shorthand).

share|improve this answer
    
Can I substitute \declare@shorthand{russian}{""}{\hskip\z@skip} with \declare@shorthand{russian}{""}{\babelhyphen{empty}} in LDF? It might be less effective but will be more clear. –  Igor Kotelnikov Jan 11 '13 at 4:18
    
Javier, I have couple of questions/proposals on development of babel-alpha. How I could contact you? –  Igor Kotelnikov Jan 11 '13 at 5:07
    
Igor, you can either use the LaTeX list (public) or send to me a message using the form in tex-tipografia.com/contact.html (and then to continue by e-mail). I'm finishing the first beta release. (And instead of \babelhyphen you can use the internal \bbl@hy@empty.) –  Javier Bezos Jan 11 '13 at 9:26
add comment

from babel.sty:

\def\defineshorthand{\declare@shorthand{user}}

defines shorthands for the namespace user

\declare@shorthand{ngerman}{"a}{\textormath{\"{a}\allowhyphens}{\ddot a}}
\declare@shorthand{russian}{""}{\hskip\z@skip}

is used internally for the specific language setting. In the above example one for ngerman and the other for russian.

So \defineshorthand{"*}{\babelhyphen{soft}} is the same as

\declare@shorthand{user}{"*}{\babelhyphen{soft}}

If you want to define your own language setting which will be loaded by babel then use the internal definition. If you have only a few new shorthands then use the user definition.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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