5

Can I make a non-standard arrow stretch automatically? I'm hoping not to have to apply a \scalebox manually every time.

Approach to generating non-standard symbols is taken from here.

enter image description here

Code

\documentclass{article} 
\usepackage{tikz-cd}  
\tikzset{
    symbol/.style={
        draw=none,
        every to/.append style={
        edge node={node [sloped, allow upside down, auto=false]{$#1$}}}
    }
}

\begin{document} [ \begin{tikzcd}[row sep= 2ex, column sep=0.8em] aaaaa \arrow[d, equals] & bbbbb \arrow[d, equals] \ c \arrow[symbol={\neq}]{r} & d \end{tikzcd} ] \end{document}

mjc
  • 745

2 Answers2

7

Just add the \not instead of \ne.

\documentclass{article} 
\usepackage{tikz-cd}  
\tikzset{
    not/.style={
        every to/.append style={
        edge node={node [sloped, allow upside down, auto=false]{$\not{}~$}}}
    }
}

\begin{document} [ \begin{tikzcd}[row sep= 2ex, column sep=0.8em] aaaaa \arrow[d, equals] & bbbbb \arrow[d, equals] \ c \arrow[equals,not]{r} & d \end{tikzcd} ] \end{document}

enter image description here

2

Just a consideration: I like xy package (used to create commutative-diagram) an old package that I believe that is still used sometimes. It is true: the code is cryptic but it is fascinating because with the option cmtip you can create to a 60% commutative diagram similar to tikz-cd.

\documentclass[a4paper,12pt]{article}
\usepackage[cmtip,all]{xy}
\begin{document}
\xymatrix@R=1pc{
aaaaa \ar@{=}[d] & bbbbb \ar@{=}[d] \\
c \ar@{=}[r] \ar@{}[r] |{/} & d}
\end{document}

enter image description here

The advantage is the equal arrow does not have the vertical line in the tail and in the tip. Look the output of the @user237299 and zoom in the figure. To put the negation equal arrow you can use \ar@{}[r] |{/} code (or insert {/}, or any other symbol e.g. {\backslash}). You can decrease or increase the distance of the rows using the parameter @R=1pc.

Definitely if you look at the commands of tikz-cd and xy package there are many analogies.

If you want to decrease the length of the equal arrow you can use \xymatrix@R=1pc@C=.5pc (for example) (R=row and C=column).

mjc
  • 745
Sebastiano
  • 54,118