[Tex/LaTex] Draw better identity arrows in tikz

tikz-arrows

I work on TexMaker, and I would like to insert an identity arrow shaped like a long equal in a tikz diagram, and to do so people on internet often suggest to use the edge style "double". The problem is that I don't find the output very appealing (It has lateral edges that make it look like a box):

\documentclass[tikz,10pt]{article}

\usepackage{tikz}
\usetikzlibrary{matrix,arrows}

\begin{document}

\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=3em,
column sep=2.5em, text height=1.5ex, text depth=0.25ex]
{ X & X \\ };
\path[-,font=\scriptsize]
(m-1-1) edge[double,thick,double distance=5pt] (m-1-2);
\end{tikzpicture}

\end{document}

enter image description here

I also tried the "transform canvas" option to draw a pair of parallel arrows, but it's very messy and the distance between the two edges doesn't seem to be constant. Is there an easier way to get a nice output?

Best Answer

You can use the equal "arrow" from tikz-cd.

  1. Using directly tikz-cd (if you are planning to draw a commutative diagram):

    \documentclass[10pt]{article}
    \usepackage{tikz-cd}
    
    \begin{document}
    
    \begin{tikzcd}
     X \ar[r,equal] & X 
    \end{tikzcd}
    
    \end{document}
    

enter image description here

  1. Using the tikz-cd features (in particular, equal) with your TikZ matrix:

    \documentclass[10pt]{article}
    \usepackage{tikz-cd}
    \usetikzlibrary{matrix,arrows}
    
    \begin{document}
    
    \begin{tikzpicture}[commutative diagrams/every diagram]
    \matrix (m) [matrix of math nodes, row sep=3em,
    column sep=2.5em, text height=1.5ex, text depth=0.25ex]
    { X & X \\ };
    \path[commutative diagrams/.cd, every arrow, every label,font=\scriptsize]
    (m-1-1) edge[commutative diagrams/equal] (m-1-2);
    \end{tikzpicture}
    
    \end{document}
    

enter image description here

The minimal class is so minimal that it's better not to use it except for test documents containing no much more than "Hello world!"