1

After setting

\tikzcdset{
arrow style=tikz,
diagrams={>={Straight Barb[scale=0.7]}}
}

the bar tail of the arrow gets bigger than the tip.

I thought perhaps I could scale the tail in a similar manner, by specifying something like |={Bar[scale=0.7] in the diagrams options, but that was to no effect. I did not find further information on the tikz-cd manual. enter image description here

1 Answer 1

3

I am not entirely convinced that it is a good idea to use scale here but I keep it and focus on the bar. The bar gets called in mapsto, so here I am going to define a variation, my mapsto, which differs in the bar that is going to be used, named my bar. The bar is now much longer than what you want it to be, but this is just to illustrate which parameter you need to adjust. BTW, this kind of stuff is not so much described in the tikz-cd manual, rather the foundations can be found in section 16 of the pgf manual.

\documentclass{article}
\usepackage{tikz-cd} 
% the original bar has 8.2 instead of 20.2
\pgfset{my bar/.tip={Bar[width=+0pt 20.2 0.89,line cap=round]}}
\tikzcdset{my mapsto/.code={\pgfsetarrows{my bar-tikzcd to}},
arrow style=tikz,
diagrams={>={Straight Barb[scale=0.7]}}}
\begin{document}
\begin{tikzcd}
 A \arrow[r,my mapsto]& B
\end{tikzcd}
\end{document}

enter image description here

5
  • Thank you. My intention was really to make the tail bar smaller so as to match the tip, and not bigger. The image shows the result I got after using \tikzcdset in that manner, which is present at tikz-cd manual. Precisely that code but with scale 0.8 instead of 0.7.
    – Tera
    Commented Nov 6, 2021 at 2:58
  • 1
    @Tera To make the bar shorter, you have to reduce the value after 0pt, e.g. \pgfset{my bar/.tip={Bar[width=+0pt 4.2 0.89,line cap=round]}}.
    – user255043
    Commented Nov 6, 2021 at 3:00
  • Why isn't using scale as suggested in tikz-cd manual a good idea? @ABC
    – Tera
    Commented Nov 6, 2021 at 16:37
  • @Tera You can set the dimensions of every aspect of the arrow explicitly. If this is the only place where you set the scale, this is fine, but if you later decide to use more scale transformations, you may be better off if you just set the dimensions to what you want them to be. Yet this is just my personal opinion.
    – user255043
    Commented Nov 6, 2021 at 17:48
  • Understood. It makes sense.
    – Tera
    Commented Nov 6, 2021 at 21:46

You must log in to answer this question.

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