PGFPlots or PGFPlotsX with Docker

Dear @kristoffer.carlsson

I’m currently used to compile latex code within a docker container. The question is, how difficult would it be to have an option for producing the figures with a Docker image instead of using a local MikTex or TexLive?

Thank you very much.

I don’t really use docker so I don’t know how such a setup would look. If you could give an example of how you would use this then it shouldn’t be too hard to add an option to PGFPlotsX for it.

1 Like

I don’t use it in the command line neither. VS extension Latex Workshop does it for me. It is nice that the environment is exatly the same in all my and my colleagues’ computers. Basically it should be something like this

docker run --rm -w <work_dir> -v <host_dir>:<container_dir>  <image_name> pdflatex main.tex

It runs a container (docker run) from an image (<image_name>) and executes pdflatex. Then,

  • --rm removes the container when it exits (finishes).
  • -w <work_dir> sets the working directory inside the container where the pdflatex runs.
  • -v <host_dir>:<container_dir> mounts a directory from the host computer to the container.

Indeed the most common setting is that <work_dir> = <host_dir> = <container_dir> = $PWD, so the command runs as if it was executed in the current path.

In most images there are available almost all LaTeX commands.

Finally, I think that the user of PGFPlots(X).jl package could have the option of choosing the image with which wants to produce the figure. For example (roughly :smiley: )

julia> lateximage() # normal functioning of the package

julia> lateximage!("blang/latex") # the package produces all images using the containerized image 
PGFPlotsX.DOCKER_IMAGE = "blang/latex" 

I think this option should affect basically when the figure is produced and nothing else [https://kristofferc.github.io/PGFPlotsX.jl/stable/man/save/]. Am I right?

Thank you very much.

Maybe I could try to make it work if it’s not that complicated. For the meantime I get the tikz code, and it works.
Where in the codebase should I start? Which parts should I consider?