2

I changed the commutative diagrams in a LaTeX document from xypic to tikz-cd. I must add that I also have some tikz diagrams with arrows (for example, Dynkin diagrams). Initially I had some problems matching the arrow tips for tikz diagrams and tikz-cd diagrams, but thanks to the comments bellow I was able to fix this.

My question now is how to globally set the arrow tips to something more agreeable (to me), for example with

\tikzset{>=Straight Barb}

(I am not sure about the names of the arrow tips)

Following the comments below I was able to get a minimal running example with the CM arrrow tips:

\documentclass{amsart} 
\usepackage[usenames,dvipsnames]{xcolor} 
\usepackage{tikz} 
%\tikzset{>=latex}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{matrix,arrows,decorations.pathmorphing}%
\tikzcdset{arrow style=tikz}

\begin{document}
\begin{equation*}
\begin{tikzcd}
A \arrow{r}{f} \arrow[two heads]{d}[swap]{x} & C\arrow[two heads]{d} \\
B \arrow{r}[swap]{g}   &  D
\end{tikzcd}
\end{equation*}
\bigskip

\begin{center}
\begin{tikzpicture}[scale=1.2]
\draw[red, thick,->] (2,0) -- (3,0);
\draw[thick,-] (2,0) -- (2,1);
\draw[thick,-] (2,0) -- (1,0);
\draw[thick,-] (2,0) -- (2,-1);
\draw[fill=red] (2,0) circle(.02);  
\draw[red, thick,->] (2,0) -- (2.707,0.707);
\draw[red,thick,->] (2,0) -- (2.707,-0.707);
\draw[thick,->] (2,0) -- (1.293,0.707);
\draw[thick,->] (2,0) -- (1.293,-0.707);
\end{tikzpicture} 
\end{center}
\end{document}
12
  • That is not code for tikz-cd diagrams, and please make your example complete
    – daleif
    Commented Mar 27, 2021 at 18:38
  • In addition to tikz-cd diagrams I use tikz to draw root diagrams and Dynkin diagrams. My document compiles correctly except for the tikz diagrams. I made some edits to the post to clarify this.
    – F Zaldivar
    Commented Mar 27, 2021 at 18:42
  • As mention please complete your code to make something others can just copy and test. Please remove irrelevant packages. Unrelated: there is no need to add and driver to graphicx it has handled that for years. Plus drop latexsym it uses an entire math alphabet for 9 symbols you don't use anyways
    – daleif
    Commented Mar 27, 2021 at 18:47
  • 2
    What we would like to see is a minimal working example, not only your preamble. So, some compilable code that shows your problem and that starts with \documentclass and ends with \end{document}. I don't get an error using the preamble and the code you placed above it. That said, you can style the arrows in tikz-cd environments with \tikzcdset{arrow style=tikz, every arrow/.append style={red, thick}} for example. Commented Mar 27, 2021 at 19:19
  • 1
    Wouldn't what you're looking for be \tikzcdset{arrows=-stealth}?
    – Bernard
    Commented Mar 27, 2021 at 19:29

1 Answer 1

2

I suspect that you after the following:

enter image description here

For changing arrows' heads in tikz-cd diagrams you need to define something like this (for global settings in document's preamble):

\tikzcdset{arrow style=tikz,
           diagrams={>=Straight Barb}
           }

For similar changes in tikzpictures, you need to define them by \tikzset in document preamble for global settings or put its in tikzpicture options for local settings as is done in following MWE:

\documentclass[usenames, dvipsnames]{amsart}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta,        
                decorations.pathmorphing,
                matrix}%
\tikzcdset{arrow style=tikz,
           diagrams={>=Straight Barb}
           }
           

\begin{document}
    \[
\begin{tikzcd}
A   \ar[r,"f"]    
    \ar[d,two heads,"x"]    &   C   \ar[d, two heads, "d"]   \\
B   \ar[r,"g"]              &   D
\end{tikzcd}
    \]
\bigskip
    \[
    \begin{tikzpicture}[scale=1.2,
  arr/.style = {draw=#1, thick, -Straight Barb},
arr/.default = red
                        ]
\draw[arr]  (2,0) -- (3,0);
\draw[thick]    (2,1) -- (2,-1)
                (2,0) -- (1,0);
\draw[arr]  (2,0) -- (2.707,0.707);
\draw[arr]  (2,0) -- (2.707,-0.707);
\draw[arr=black] (2,0) -- (1.293,0.707);
\draw[arr=black] (2,0) -- (1.293,-0.707);
\fill[red]  (2,0) circle[radius=1mm];
    \end{tikzpicture}
    \]
\end{document}

Addendum:

Defining of type of the arrows' heads can be global (with style definitions in documents' preambles, or local, if they are part of figures. An example of combination of the global and local settings is present in the following MWE:

\documentclass[usenames, dvipsnames]{amsart}
\usepackage{tikz-cd}
\usetikzlibrary{arrows.meta,        
                decorations.pathmorphing,
                matrix}%
\tikzcdset{arrow style=tikz,
           diagrams={>=Straight Barb}
           }    % global setting for arrow heads in tikz-cd diagrams
\tikzset{>=Straight Barb
           }    % global settings for arrow heads in tikzpicturres
           

\begin{document}
    \[
\begin{tikzcd}
A   \ar[r,"f"]    
    \ar[d,two heads,"x"]    &   C   \ar[d, two heads, "d"]   \\
B   \ar[r,"g"]              &   D
\end{tikzcd}
    \]
\bigskip
    \[
    \begin{tikzpicture}[
% local settings use global and if needed overwrite global one
       scale = 1.2,
  arr/.style = {draw=#1, thick, ->}, % for the arrowheads is used global setting  
arr/.default = red
                        ]
\draw[arr]  (2,0) -- (3,0);
\draw[thick]    (2,1) -- (2,-1)
                (2,0) -- (1,0);
\draw[arr]  (2,0) -- (2.707,0.707);
\draw[arr]  (2,0) -- (2.707,-0.707);
\draw[arr=black] (2,0) -- (1.293,0.707);
\draw[arr=black] (2,0) -- (1.293,-0.707);
\fill[red]  (2,0) circle[radius=1mm];
    \end{tikzpicture}
    \]
\end{document}

Result is the same as before.

3
  • @ Zarko: Thanks, these are the arrow tips I would like in my document. Is there a way to make a global change to the preamble to get all arrows in my document as in your example as I have quite a few tikz diagrams in it? I this global change were possible, even the arrows in formulas like $A\rightarrow B$ would have the same tips. When I put a global declaration as \tikzset{>=latex} the tips change to the old latex ones.
    – F Zaldivar
    Commented Mar 27, 2021 at 23:03
  • @FZaldivar, see addendum to my answer and corrected explanation in answer.
    – Zarko
    Commented Mar 28, 2021 at 5:41
  • Thanks! That is exactly what I was looking for.
    – F Zaldivar
    Commented Mar 29, 2021 at 2:41

You must log in to answer this question.

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