5

I have given an answer on a question with this MWE, and I am not see an evident hole created when I insert a symbol into an arrow. The labels also overlapped to the symbols. How to solve the problem?

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage[all,cmtip]{xy}
 
\begin{document}
\xymatrix@R=4pc@C=4pc{ A \ar@{=}|{/}[r]^a \ar[d]_{c}|{\subset} & B 
\ar[d]^b|{\cong} \\
 C \ar[r]_d|{\cong} & D;}
\end{document}

2 Answers 2

7

Very nice MWE! :-) I suggest you use \mathstrut -- where necessary, augmented with \smash[t] or \smash[b] -- and \, (thinspace) directives to fine-tune the placement of the symbols and letters.

enter image description here

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath} % for \smash[t] and \smash[b] macros
\usepackage[all,cmtip]{xy}
 
\begin{document}
\xymatrix @R=4pc @C=4pc { 
  A \ar@{=}|{/}[r]^{a\smash[t]{\mathstrut}} % smashed \mathstrut
    \ar[d]_{c\,}|{\subset\mathstrut}    % full-height \mathstrut
& B \ar[d]^{\,b}|{\cong\mathstrut} \\   % full-height \mathstrut
  C \ar[r]_{d\smash[b]{\mathstrut}}|{\,\cong\,} % smashed \mathstrut
& D ;
}
\end{document}
1
  • 1
    Thank you very very much...........................grazieeeeeeeeeeeeeeeeeeeeee....accepted answer.
    – Sebastiano
    Feb 20, 2023 at 11:55
4

I know you are a big fan of xy, so this is just for comparison with tikz-cd.

enter image description here

A new style is created for the special labels for use inside the arrow command: \arrow[r, "<main label>"{special=<direction>:<secondary label>}], where <direction> can be provided as an angle or compass direction.

\documentclass{article}

\usepackage{tikz-cd}
\tikzcdset{special/.style={description, label={[label distance=-5pt, font=\scriptsize]#1}}}

\begin{document}

\begin{tikzcd}[sep=1.5cm]
A\arrow[r, equals, "/"{special=90:$a$}]\arrow[d, "\subset"{special=180:$c$}] & B\arrow[d, "\cong"{special=0:$b$}]\\
C\arrow[r, "\cong"{special=270:$d$}] & D
\end{tikzcd}

\end{document}
0

You must log in to answer this question.

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