2

I am trying to draw an arrow between two labels and even on this example from "XY-pic User's guide" I don't get the normal diagram.

\xymatrix{ A \ar[r] ^a="a" & B \ar[r] ^b="b" & C \ar @/^/ "a";"b" }

It used to work but now I get this:

Here is my preamble. I'm sorry if there is useless info but I don't know what is relevant and what isn't, and I must say I don't understand much of computers!!

\documentclass[10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage[french]{babel}
\usepackage{graphicx}
%\usepackage{wrapfig}
\usepackage[margin=2cm]{geometry}
\usepackage{enumitem}   % Change [leftmargin=*]
\usepackage{amsmath,amssymb}
%\usepackage{fourier}
\usepackage{comment}
\usepackage{eurosym}
\usepackage{wasysym}    % Smiley!!!
\usepackage{tikz}
\usepackage[all]{xy}
\usepackage{xcolor}
\usepackage{hyperref}           % comme pour les equations, utilise \label et \hyperref[key]{text}
 \hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=blue,
    urlcolor=black
 }
\usepackage{xcolor}
    \definecolor{jaunevert}{RGB}{185,185,0}
    \definecolor{bleufonce}{RGB}{0,25,70}
    \definecolor{vertfonce}{RGB}{30,44,37}
    \definecolor{vert}{RGB}{34,139,34}
    \definecolor{marron}{RGB}{55,15,0}
\usepackage{tikz}       % draw geometric figures, \begin{tikzpicture}; place after xcolor because conficts
    \usetikzlibrary{arrows,patterns,decorations.pathreplacing,decorations.markings,shapes.misc} % for arrowhead style ; markings  pour contour integrals, croix
    \tikzset{cross/.style={cross out, draw=black, minimum size=2*(#1-\pgflinewidth), inner sep=0pt, outer sep=0pt},
%default radius will be 1pt. 
cross/.default={1pt}}

\newcommand{\ligne}{
 \noindent\makebox[\linewidth]{\rule{\textwidth}{0.4pt}}
}
\providecommand{\abs}[1]{\left\lvert#1\right\rvert} 
\providecommand{\norm}[1]{\left\lVert#1\right\rVert}

\newcommand{\Crochet}[2][0.7\baselineskip]{\left\lbrace \rule{0mm}{#1} #2 \right\rbrace}
\newcommand{\Klammer}[2][0.7\baselineskip]{\left( \rule{0mm}{#1} #2 \right)}
\newcommand{\Paar}[2][0.7\baselineskip]{\left\langle \rule{0mm}{#1} #2 \right\rangle}

\newcommand{\bracket}[1]{\left[ #1 \right]}

\usepackage{amsthm}             % for \newtheorem
    \theoremstyle{plain}            % "definition" no italic
    \newtheorem{definition}{Definition}[section]
    \newtheorem{lem}[definition]{Lemma} % [definition] means same labelling as definition
    \newtheorem{coro}[definition]{Corollary}
    \newtheorem{prop}[definition]{Property}
    \newtheorem{propos}[definition]{Proposition}
    \newtheorem{thm}[definition]{Theorem}

    \newenvironment{Rem}{\refstepcounter{definition} \par\vspace{0.3\baselineskip} \noindent \textit{Remarque \thedefinition :}  }{\par\vspace{0.5\baselineskip}}% \newenvironment{name}{before text} text {after}

    \newenvironment{Rems}{\refstepcounter{definition} \par\vspace{0.5\baselineskip}\noindent\textit{Remarques \thedefinition :}  \begin{enumerate}[wide]\setlength{\itemindent}{.15in}}{\end{enumerate}}

    \newenvironment{rem}{\refstepcounter{definition} \par\vspace{0.3\baselineskip}\noindent\color{bleufonce}\begin{small}\textit{Remarque \thedefinition :} }{\end{small}\par\vspace{0.5\baselineskip}}% \newenvironment{name}{before text} text {after}

    \newenvironment{rems}{\refstepcounter{definition} \par\vspace{0.5\baselineskip}\noindent\color{bleufonce}\begin{small}\textit{Remarques \thedefinition :} \begin{enumerate}[wide]\setlength{\itemindent}{5pt}}{\end{enumerate} \end{small}}

    \let\proofOld\proof             % comme pour commandes!!
    \renewenvironment{proof}{\begin{small}\color{marron}\begin{proofOld}}{\qed\end{proofOld}\end{small}\par\vspace{0.5\baselineskip}}
Noix07
  • 451
  • Would be C \ar[l] to a left arrow? – Sigur Apr 13 '20 at 22:27
  • ?? what do you mean? The diagram should look like "Exercice 18 p.10" of the "Xy-pic User's guide", i.e. the arrow should go from the label a to b. Independently of the place where we write the command \ar – Noix07 Apr 13 '20 at 22:29
  • The left arrow starting from C should go to where? – Sigur Apr 13 '20 at 22:30
  • 1
    I'm almost sure that the problem is relates to the double quotes use and the \usepackage[french]{babel} package. – Sigur Apr 13 '20 at 22:35
  • Aahhh, very interesting!! let me check in some old files where it worked – Noix07 Apr 13 '20 at 22:36
  • 1
    There is a command \shorthandoff{"} that you can use to change the behaviour of quotes. See here https://tex.stackexchange.com/a/133564/14757 – Sigur Apr 13 '20 at 22:36
  • YEAHHHH, i put \usepackage{babel} in comment and now it works!!! Thanks for this rapid answer! – Noix07 Apr 13 '20 at 22:39
  • 2
    For future reference, to trim a preamble down to a minimal working example, comment out the last half of it and see what happens. If the problem remains, then you don't need that for your example. If the problem goes away, then something in there is contributing to the problem. Iterate that process until you have the ten-ish lines of code needed to reproduce the problem. – Teepeemm Apr 13 '20 at 22:40

1 Answers1

1

The problem is that ; is a shorthand in babel-french.

I also suggest how to draw the diagram with tikz-cd, which I find simpler and as powerful as Xy-pic (if not more powerful).

\documentclass{article}
\usepackage[french]{babel}
\usepackage[all,cmtip]{xy}
\usepackage{tikz-cd}
\usetikzlibrary{babel}

\begin{document}

\[\shorthandoff{;}
\xymatrix{ A \ar[r] ^a="a" & B \ar[r] ^b="b" & C \ar @/^/ "a";"b" }
\]

\[
\begin{tikzcd}
A \arrow[r,"a"{name=a}] & B \arrow[r,"b"{name=b}] & C
\arrow[from=a,to=b,bend left]
\end{tikzcd}
\]

\end{document}

enter image description here

egreg
  • 1,121,712