ltxcmds / babel

  • Follow


Hello,

The following doesn't work:
% ------------------------------------
\documentclass{scrartcl}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\makeatletter

\defineshorthand{-}{%
    \ifhmode
    \ifdim\lastskip>\z@
       \unskip\penalty\@M\thinspace
       \else \FDP@thinspace
    \fi
    \fi
    \string-}%

\begin{document}
\useshorthands-

123-123
\stop
% -------------------------------

Because \useshorthands expands \initiate@active@char (babel)
and then:      \@ifpackagewith{babel}{KeepShorthandsActive}

\@ifpackagewith -> LaTeX error: can be used only in preamble.

And I didn't find the equivalent \ltx@ifpackagewith to be used
inside the document...

Well, this is only a suggestion...
0
Reply GL 11/20/2010 8:29:34 PM

GL <gouailles@gmail.com> wrote:

> The following doesn't work:
> % ------------------------------------
> \documentclass{scrartcl}
> \usepackage[latin1]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage[french]{babel}

Neither the class nor the packages are using package ltxcmds.

> Because \useshorthands expands \initiate@active@char (babel)
> and then:      \@ifpackagewith{babel}{KeepShorthandsActive}
> 
> \@ifpackagewith -> LaTeX error: can be used only in preamble.

Then it's a problem of babel. Or you are limited to the preamble.

-- 
Heiko Oberdiek
0
Reply Heiko 11/20/2010 9:22:14 PM


GL <gouailles@gmail.com> wrote:

> Hello,
> 
> The following doesn't work:
> % ------------------------------------
> \documentclass{scrartcl}
> \usepackage[latin1]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage[french]{babel}
> 
> \makeatletter
> 
> \defineshorthand{-}{%
>     \ifhmode
>     \ifdim\lastskip>\z@
>        \unskip\penalty\@M\thinspace
>        \else \FDP@thinspace
>     \fi
>     \fi
>     \string-}%
> 
> \begin{document}
> \useshorthands-
> 
> 123-123
> \stop
> % -------------------------------
> 
> Because \useshorthands expands \initiate@active@char (babel)
> and then:      \@ifpackagewith{babel}{KeepShorthandsActive}
> 
> \@ifpackagewith -> LaTeX error: can be used only in preamble.
> 
> And I didn't find the equivalent \ltx@ifpackagewith to be used
> inside the document...
> 
> Well, this is only a suggestion...

As Heiko said, \useshorthand is to be used only in the
preamble; the commands to enable and disable shorthands
in the document are \shorthandon and \shorthandoff.

Ciao
Enrico
0
Reply Enrico 11/20/2010 9:50:01 PM

Le 20/11/2010 22:50, Enrico Gregorio a �crit :
> GL<gouailles@gmail.com>  wrote:
>
>> Hello,
>>
>
> As Heiko said, \useshorthand is to be used only in the
> preamble; the commands to enable and disable shorthands
> in the document are \shorthandon and \shorthandoff.

Yes. It's a bit weird however, at least it appears to me:

	\defineshorthand{-}{...}
does not suffice in preamble, you *must* say:
	\useshorthand{-}
(or \initiate@active@char{-} but this is not a
"user interface command" of babel)

And then, - is active \AtBeginDocument so I have to add:
	\AtBeginDocument{\shorthandoff{-}}


Well, I would have found simpler just to say:
	\defineshorthand{-} ... in my preamble

And then, \shorthandon- / \shorthandoff- in my document...


Thanks anyway.

> Ciao
> Enrico

0
Reply GL 11/21/2010 8:44:41 AM

3 Replies
249 Views

(page loaded in 0.114 seconds)

Similiar Articles:




7/25/2012 5:53:07 AM


Reply: