paolobrasolin / commutative-diagrams

CoDi: Commutative Diagrams for TeX
https://paolobrasolin.github.io/commutative-diagrams/
MIT License
28 stars 3 forks source link

missing in manual : using arbitrary arrow tips #37

Closed morfismo closed 10 months ago

morfismo commented 2 years ago

Is there an existing issue for this?

Original problem

Create arbitrary arrow tips using tikzcd styles directly.

For example to create an arrow that starts like (_____ ... (head is "hook")

hook

you can't use

A [->, hook] B

since hook style is not found

Solution is to invoke the style directly from tikzcd. you need to use

$$\begin{codi}
    \obj{0 & A & B & C & |(0')| 0\\};
   \mor 0 -> A f:[->,commutative diagrams/hook] B g:->> C -> (0');
    \end{codi}
$$

and then the "hook" style from tikzcd is applied to the arrow head. This solution is not mentioned on the manual, and often head/tips on commutative diagrams are needed beyond simple > or >>

there are many many head/tip styles on page 3-4 from tikz-doc manual that can be used here arrows

took me about an hour to find out how, should be a note perhaps in the manual

Proposed solution

add small example on manual explaining how to call styles from tikzcd

Alternatives considered

I gave the solution on the issue text, I guess tikzcd needs to be loaded?

Additional context

No response

morfismo commented 2 years ago

perhaps there's another way that only uses tikz/arrows? (no need for tikzcd) I just couldn't find it

paolobrasolin commented 1 year ago

Hi @morfismo! Thanks for your interest (and sorry for the delay)!

At the moment commutative-diagrams is lacking a library of default styles beyond the ones provided by arrows.meta.

To piggyback on tikz-cd your solution is perfectly fine, but there's a simpler way using commutative-diagrams internals:

\pgfqkeys{/codi}{every arrow/.append style={/ektropi/add=/tikz/commutative diagrams}}
% this makes CoDi expose all keys defined in /tikz/commutative diagrams in the scope available to its arrows

This affords you what I think you wanted to write:

\documentclass{article}

\usepackage{commutative-diagrams}

\usepackage{tikz-cd}
\pgfqkeys{/codi}{every arrow/.append style={/ektropi/add=/tikz/commutative diagrams}}

\begin{document}

\begin{codi}
    \obj{0 & A & B & C & |(0')| 0\\};
    \mor 0 -> A f:->,hook B g:->> C -> (0');
\end{codi}

\end{document}

This is very close to a mechanism I originally devised to implement "mix-and-match" style libraries.

In any case, given the popularity of tikz-cd this will make a great addition to the manual! 🤩

LMK what you think and whether you need further help!

morfismo commented 1 year ago

seems like a good alternative, thank you