
これは私がxypicで遭遇した問題の例です
\documentclass[10pt,a4paper,french,oneside]{amsbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[applemac]{inputenc}
\usepackage[all,cmtip]{xy}
\begin{document}
\[
\xymatrix@!{
P\ar[r]^{p_{2}}\ar[d]_{p_{1}}&Y\ar[d]^g\\
X\ar[r]^f&Z}
\]
\end{document}
以下は私がタイプセットしたときに発生したエラーです
./essai.tex:16: Xy-pic error: <addop> or <direction> or one of 1RCMLHW*! expect
ed.
\xyerror@ ...#2}\fi \errmessage {Xy-pic error: #1}
}
l.16 \xymatrix@!
{
これは、文字 ! が認識されないようなので、Babel とフランス語のオプションがおかしなことをしているのではないかと強く疑っています (@R は、たとえば問題なく動作します)。これについて、どうすればよいのでしょうか?
答え1
の問題を解決しても、 Xy-pic 構文で!
も使用されているように、十分ではありません。?;:^="
すべての Xy-pic 構造でショートカットを無効にすることで、これをグローバルに解決できます。
\documentclass[10pt,a4paper,french,oneside]{amsbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[all,cmtip]{xy}
\usepackage{etoolbox}
\preto\xy{\shorthandoff{!?;:^="}}
\begin{document}
\[
\xymatrix@!{
P\ar[r]^{p_{2}}\ar[d]_{p_{1}}&Y\ar[d]^g\\
X\ar[r]^f&Z}
\]
\end{document}
それがなければetoolbox
、 の代わりに\preto\xy{...}
、
\toks0=\expandafter{\xy}
\edef\xy{\noexpand\shorthandoff{!?;:^="}\the\toks0 }
答え2
ローカル!
で戻るには、次の操作を実行します\shorthandoff{!}
:
\documentclass[10pt,a4paper,french,oneside]{amsbook}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[applemac]{inputenc}
\usepackage[all,cmtip]{xy}
\begin{document}
\[\shorthandoff{!}
\xymatrix@!{
P\ar[r]^{p_{2}}\ar[d]_{p_{1}}&Y\ar[d]^g\\
X\ar[r]^f&Z}
\]
\end{document}