2

It is well known that certain Babel shorthands conflict with some Xy-pic commands and this can be solved by disabling those shorthands. I was using Xy-pic and Babel french with shorthands=off in the options list. That worked.

However, I now must combine a number of files, some written long ago using Xy-pic and some written using tkz-euclide. The tkz-euclide will not work with shorthands=off.

The file below certainly will not compile for me, but it does work when I comment out the babel line, so I believe the shorthands problem is the reason why it does not compile:

\documentclass{amsart}
\usepackage{xy}
\input xy
\xyoption{all}
%\usepackage[french]{babel}
\begin{document}
\xy   ,(100,0);(100,0)
        ,(97,6)="A"
        ,"A"+(-4.5,-1);"A"+(4.5,-1)  *\crv{"A"+(-3.4,-6)&"A"+(3.4,-6)}
\endxy
\end{document}

It produces an error messge

! Xy-pic error: <pos> "A" not defined.
\xyerror@ ...#2}\fi \errmessage {Xy-pic error: #1}

So I tried using \shorthandoff{"} in several places, and I tried "A and "A" and A" but got messages saying they are not shorthands. I tried putting just \shorthandoff in front of the first offending XY-pic in the file and that had no effect.

I suspect the simplest solution would be to identify which shorthands the Xy-pics conflict with and just disable those. But I cannot identify them. I do not know what all the babel french shorthands are. The fullest description I have found so far is the Babel language definition file for French frenchb.dtx v3.3d, 2017/10/19

at http://daniel.flipo.free.fr/frenchb/frenchb.pdf

But it does not list " as a babel french shorthand.

Of course it is possible that tkz-euclide actually requires some specific shorthand that conflicts with some specific Xy-pic command I need to use. But I hope there is some simple solution.

1
  • 2
    ; is a shorthand in french. So use \shorthandoff{;} for your example. Commented Jan 4, 2018 at 8:28

2 Answers 2

3

As Ulrike Fischer points out ; is a shorthand in French. Indeed the babel documentation lists the following symbols as French shorthands:

:;?!

These are used to implement French spacing conventions for these punctuation symbols.

You can turn these off explicitly with \shorthandsoff. Enclose this in group to limit its scope.

Sample output

\documentclass{amsart}

\usepackage[main=french]{babel}
\usepackage[all]{xy}

\begin{document}

{\shorthandoff{:;?!}%
  \xy   ,(100,0);(100,0)
        ,(97,6)="A"
        ,"A"+(-4.5,-1);"A"+(4.5,-1)  *\crv{"A"+(-3.4,-6)&"A"+(3.4,-6)}
\endxy}

\end{document}
1
  • The solution i actually used was to rewrite all the Xy-pics as tkz-euclide, so I need not worry about other surprises down the line. Commented Nov 28, 2018 at 14:56
1

Using proper LaTeX syntax allows doing the \shorthandoff operation automatic inside xy.

For TikZ based packages, remember to \usetikzlibrary{babel}.

\documentclass{amsart}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\usepackage[all]{xy}
\usepackage{etoolbox}

\AtBeginEnvironment{xy}{\shorthandoff{?!:;}}

\begin{document}

\begin{xy}
   ,(100,0);(100,0)
   ,(97,6)="A"
   ,"A"+(-4.5,-1);"A"+(4.5,-1)  *\crv{"A"+(-3.4,-6)&"A"+(3.4,-6)}
\end{xy}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .