co1emi11er2 / Handcalcs.jl

Julia package for converting Julia calculations into rendered latex.
https://co1emi11er2.github.io/Handcalcs.jl/stable/
MIT License
69 stars 1 forks source link

Vectors do not work #11

Closed DrDanon closed 4 months ago

DrDanon commented 4 months ago

I like this package and I am testing to see if I can use it in class together with Unitful. I hit several problems one is: I use Jupyter in vscode @handcalcs x = [1, 2]; @handcalcs a = x[1] * 2

MethodError: no method matching convert_subscript(::LaTeXStrings.LaTeXString; function_name::Bool, convert_unicode::Bool, env::Symbol)

The first command works, but the second gives the error above @handcalcs x = [1, 2];

@handcalcs a = x[1] * 2

image
co1emi11er2 commented 4 months ago

Good catch. I think the issue is my package is trying (somewhat) to do:

@latexdefine a = $x[1] * 2

This will error. However, this works:

@latexdefine a = $(x[1]) * 2

So I think it is just a matter of wrapping it in parenthesis correctly. I will try to find some time this week to fix this.

co1emi11er2 commented 4 months ago

As far as Unitful goes, that should be coming soon. Latexify.jl has a fix for the bug I mention in the documentation. However, it is taking some time for them to release it. I have some good enhancements ready once they release the update.

co1emi11er2 commented 4 months ago

Hi @DrDanon. I have released a patch for the bug mentioned above. Do you want to try out the new release and see if that fixes it?

DrDanon commented 4 months ago

It works well thank you.