paolobrasolin / commutative-diagrams

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

Package pgfkeys Error: I do not know the key '/tikz/hexagonal', to which you u misspelled it. ^^I^^I}; #38

Closed ZijianFelixWang closed 1 year ago

ZijianFelixWang commented 2 years ago

Is there an existing issue for this?

Current behaviour

When I compile this code:

\documentclass{article}
\usepackage{tikz}
\usepackage{commutative-diagrams}
\usetikzlibrary{positioning, commutative-diagrams}
\begin{document}
    \begin{tikzpicture}[codi]
        \obj [hexagonal=horizonal side 1.5em angle 60]{
            A
        };
    \end{tikzpicture}
\end{document}

I get an error: Package pgfkeys Error: I do not know the key '/tikz/hexagonal', to which you u misspelled it. ^^I^^I};

Expected behaviour

It should be compiled normally and produce a pdf file.

Steps to reproduce

Using the following XELATEX version:

XeTeX 3.141592653-2.6-0.999994 (TeX Live 2022)
kpathsea version 6.3.4
Copyright 2022 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 70.1; using 70.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.11.1; using 2.11.1
Compiled with Graphite2 version 1.3.14; using 1.3.14
Compiled with HarfBuzz version 3.4.0; using 3.4.0
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with pplib version v2.05 less toxic i hope
Compiled with fontconfig version 2.13.96; using 2.13.96

I installed the latest version of commutative-diagrams from tlmgr.

Additional context

I searched and found an issue say that using tikz library positioning can help, but it doesn't work for me.

paolobrasolin commented 1 year ago

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

There are two problems with the code \obj [hexagonal=horizonal side 1.5em angle 60]{A};.

  1. There's a typo, i.e.. "horizonal" instead of "horizontal".
  2. To use layout keys with \obj you need to be passing the specification for a matrix (e.g. \obj{ A & B \\ C & D \\ };), not for a single node (e.g. \obj{ A };). The reason is that \obj secretly detects which is the case and exposes only relevant keys in scope.

There are two possible fixes.

  1. Don't use the key (which would have no effect anyways with a single "node"): \obj{ A };.
  2. Specify a matrix with one row and one column (which makes sense if you're building up from that): \obj [hexagonal=horizonal side 1.5em angle 60]{ A \\ };.

I'm inclined towards not considering this a bug, but I also think the error message is completely misleading. I think it should be sufficient to clarify in the manual that a matrix should be passed to \obj for layout keys to be in scope.

LMK what you think and whether you need further help!