Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot access fields on user-defined functions #65

Closed
cristobaltapia opened this issue Oct 24, 2024 · 3 comments
Closed

cannot access fields on user-defined functions #65

cristobaltapia opened this issue Oct 24, 2024 · 3 comments
Labels
📚 documentation Improvements or additions to documentation

Comments

@cristobaltapia
Copy link

Hi, I was trying the examples in the manual, but could not compile any of them. I get the following error:

error: cannot access fields on user-defined functions
   ┌─ test.typ:12:11
   │
12 │       plot.add(domain: (0, calc.pi), calc.sin)
   │            ^^^

I am using the following code:

#import "@preview/cetz:0.3.0"
#import "@preview/cetz-plot:0.1.0": plot, chart

#cetz.canvas({
  import cetz.draw: *
  import cetz.plot: *

  plot.plot(
    size: (5, 5),
    axis-style: "scientific",
    {
      plot.add(domain: (0, calc.pi), calc.sin)
    },
  )

})

What might be the problem? It seems I am the only one having this issue.

@johannes-wolf
Copy link
Member

Remove the import cetz.plot: * line. I guess you accidentally overwrote the plot module by importing it from cetz (which contains a stub-function).

@johannes-wolf johannes-wolf added the ❓ question Further information is requested label Oct 24, 2024
@cristobaltapia
Copy link
Author

Oh, thanks. That was it. In that case, there is a bug in the pdf manual (see page 3).

@johannes-wolf
Copy link
Member

Fixed with #69.

@johannes-wolf johannes-wolf added 📚 documentation Improvements or additions to documentation and removed ❓ question Further information is requested labels Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants