paolobrasolin / commutative-diagrams

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

Implement 2-cells #12

Closed paolobrasolin closed 1 year ago

paolobrasolin commented 6 years ago

NOTE: the code should already be sometime in the repo history.

paolobrasolin commented 6 years ago

Found some old code.

Progressive version of chopper: https://github.com/tetrapharmakon/coend-cofriend/blob/master/figures/tikzlibrarykD.balancer.code.tex#L31 https://github.com/paolobrasolin/kodi/blob/master/dev-notes/LEGACY.tex https://github.com/paolobrasolin/kodi/blob/master/dev-notes/nu_chop.tex

Stub of a 2-cell style: https://github.com/tetrapharmakon/coend-cofriend/blob/master/figures/tikzlibrarykD.core.code.tex#L54

paolobrasolin commented 1 year ago

Here is a possible solution, leveraging tikz-cd styles.

\documentclass{standalone}
\usepackage{commutative-diagrams}

% NOTE: see https://github.com/paolobrasolin/commutative-diagrams/issues/37
\usepackage{tikz-cd}
\pgfqkeys{/codi}{every arrow/.append style={/ektropi/add=/tikz/commutative diagrams}}

\begin{document}

\begin{codi}[hexagonal]
  \obj{ A & B & C \\ };
  \mor[swap]:[bend right] A f:-> B i:-> C;
  \mor      :[bend left]  A g:-> B j:-> C;

  % Option 1: use tikz-cd styles (not too shabby if you package it into a custom style named "fatarroW" or "=>" or something)
  \mor f \alpha:[Rightarrow,shorten=2pt] g;
  % Option 2: use tikz styles (use this on the corners of a square to draw the commutation symbol)
  \mor i ["=",mid,rotate=90]:[dashed,draw=none] j;
\end{codi}

\end{document}

image