Closed ben-dyer closed 2 years ago
Hi Ben,
Good on you for trying to do it yourself!
The way you would try running pandoc-plot
from source is to run cabal install
instead of cabal build
. cabal install
will build the executable and set up your environment so that you can call pandoc-plot
on the command line.
Alternatively, I have some time today but I'm not familiar with Sage. Can you share a plotting script that can be executed from the command line?
I've got a branch (#45) which adds support for Sage. When it gets merged, you'll be able to do something like:
# Title
Paragraph
```{.sageplot}
G = plot(sin, 1, 10)
The one caveat I have found is that unless each plotting command is assigned to a variable name (e.g. `G = ...`), the graphical objects are shown on screen and a reference to them is lost. For example, the following script would fail:
````markdown
# Title
Paragraph
```{.sageplot}
plot(sin, 1, 10)
I don't know sage very well, so maybe there is a runtime option for sage to prevent this behavior? Otherwise, you'll need to make sure to always name your graphical objects, e.g.
````markdown
# Title
Paragraph
```{.sageplot}
G1 = plot(sin, 1, 10)
G2 = plot(cos, 1, 10)
(...)
Version 1.5.0 was just released, which adds support for sage. It might take a few hours for executables to be uploaded to GitHub Releases.
Please give it a try, and don't hesitate to reopen this issue if there's any problem
I don't know sage very well, so maybe there is a runtime option for sage to prevent this behavior? Otherwise, you'll need to make sure to always name your graphical objects, e.g.
I'm not aware of a way to do it differently in sage, I was thinking something along the same lines as using a variable G
similar to their docs. I'm not that deep of a sage user so I can't say for sure though.
Thank you for implementing this, I'm excited to try it out! Will let you know if I find any issues.
Thanks for creating this filter, it's really convenient! I would be interested in using Sage with this filter (e.g. https://doc.sagemath.org/html/en/reference/plotting/sage/plot/plot_field.html) if it could be added.
I might be able to work on it, but I don't have haskell/pandoc experience. I saw that one can pass a path to executable to the
pandoc
CLI. I triedpandoc --filter ./executable/Main.hs
unsuccessfully, and wanted to try building the pandoc-plot binary and using that but I couldn't find it after runningcabal build
.