JuliaTeX / TikzPictures.jl

Creating PGF/TikZ pictures and saving them in various formats
Other
89 stars 28 forks source link

Added custom environments to support tikz-cd #59

Closed mehalter closed 4 years ago

mehalter commented 4 years ago

Takes a stab at #58. Currently all I have done is added a new field in the TikzPicture struct for the environment where the default is tikzpicture so that it doesn't break any past TikzPictures.jl code. I also added a couple tests to verify that the environment is working correctly and that it successfully outputs a pdf of a TikzPicture and a TikzDocument that uses tikz-cd. Didn't add too many tests for this to not have too much duplicate code, I think there could be a new function here to generate tests for both a tikzpicture and a tikzcd example.

Heres a working example using the new code:

julia> using TikzPictures
julia> tp = TikzPicture("A\\arrow[rd]\\arrow[r, \"\\phi\"] & B \\\\& C", environment="tikzcd", preamble="\\usepackage{tikz-cd}")
julia> save(SVG("test"), tp)
epatters commented 4 years ago

Thank you @mehalter!

mykelk commented 4 years ago

Great! It looks like the test is failing?

mehalter commented 4 years ago

Yeah, I'm taking a look at this now to try and figure out what's going on. It seems like the tikz-cd doesn't like my latex code i provided. with the error

! Package tikz-cd Error: Arrow direction argument must contain only the charact

ers u, d, l, r.

See the tikz-cd package documentation for explanation.

Type  H <return>  for immediate help.

 ...                                              

l.5 A\arrow[rd]\arrow

                   [r] & B \\& C
mehalter commented 4 years ago

It seems like the version of tikz-cd that is being installed is a very old version in Travis and uses an outdated sytnax. Hopefully this change will get the test to pass at least for the CI/CD

https://tex.stackexchange.com/questions/393944/tikzcd-package-error-arrow-direction-argument

mykelk commented 4 years ago

I'm happy to merge if you think it's good to go!

mehalter commented 4 years ago

Yeah I think this looks good!