annProg/PanBook

编译Book demo无法使用画图引擎

Closed this issue · 5 comments

已按照说明装好了gnuplot,graphviz等,并将其加入msys2 PATH环境变量,art,book, slide样例都能编译通过,但就是提示找不到画图引擎,而画图引擎在msys2中运行都是没有问题的,提示信息如下。
$ panbook book --style=elegantbook
[NOTE] Welcome to PanBook!
[NOTE] use -V device:(pc|mobile|kindel) to produce different size of pdf
[NOTE] use -V cover:path to use custom cover image
[NOTE] use -V logo:path to use custom logo image
The system cannot find the path specified.
Plot Warning: dot not installed!
The system cannot find the path specified.
Plot Warning: ditaa not installed!
The system cannot find the path specified.
Plot Warning: goseq not installed!
The system cannot find the path specified.
Plot Warning: a2s not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: asy not installed!
The system cannot find the path specified.
Plot Warning: abcm2ps not installed!
The system cannot find the path specified.
Plot Warning: xelatex not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: ditaa not installed!

所使用工具版本如下:
$ gnuplot --version
gnuplot 5.4 patchlevel 1

$ dot -V
dot - graphviz version 2.44.1 (20200629.0846)

$ pandoc --version
pandoc.exe 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.1, skylighting 0.8.3.2
Default user data directory: C:\Users\xufl8\AppData\Roaming\pandoc
Copyright (C) 2006-2020 John MacFarlane
Web: https://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/texlive/2019/bin/win32:/c/Program Files/Pandoc:/d/Latex/PanBook:/c/Program Files/gnuplot/bin:/c/Program Files/Graphviz:/c/texlive/2019/bin/win32:/c/Program Files/Pandoc:/d/Latex/PanBook:/c/Program Files/gnuplot/bin:/c/Program Files/Graphviz 2.44.1/bin

执行

$ which dot
/mingw64/bin/dot

看下有结果没

可以直接安装 msys2 版本的 graphviz

pacman -S mingw64/mingw-w64-x86_64-graphviz

之前用的是windows下的gnuplot和graphviz,which dot都能显示。现在安装了msys2的gnuplot和graphviz,问题还是和之前一样。

$ which gnuplot
/mingw64/bin/gnuplot

$ which dot
/mingw64/bin/dot

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/c/texlive/2019/bin/win32:/e/Latex/PanBook:/c/Program Files/Pandoc:/mingw64/bin

$ panbook book
[NOTE] Welcome to PanBook!
[NOTE] use -V device:(pc|mobile|kindle) to produce different size of pdf
[NOTE] use -V cover:(1-60|R|N|filepath) select cover background.R=random,N=no cover,filepath=custom cover file
[NOTE] use -V pagestyle:style to set pagestyle
The system cannot find the path specified.
Plot Warning: dot not installed!
The system cannot find the path specified.
Plot Warning: ditaa not installed!
The system cannot find the path specified.
Plot Warning: goseq not installed!
The system cannot find the path specified.
Plot Warning: a2s not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: asy not installed!
The system cannot find the path specified.
Plot Warning: abcm2ps not installed!
The system cannot find the path specified.
Plot Warning: xelatex not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: gnuplot not installed!
The system cannot find the path specified.
Plot Warning: ditaa not installed!
Latexmk: This is Latexmk, John Collins, 17 March 2019, version: 4.63b.
Latexmk: All targets () are up-to-date
[NOTE] book Compile SUCCESSFUL

$ dot -V
dot - graphviz version 2.44.1 (20201127.1712)

$ gnuplot --version
gnuplot 5.4 patchlevel 1

cd test/lua-filters/dot2image
make latex

看看结果

按照以下代码 修改 extensions/plot/plot.lua ,然后执行,看看输出的结果

diff --git a/extensions/plot/plot.lua b/extensions/plot/plot.lua
index dd8d8a1..da77409 100644
--- a/extensions/plot/plot.lua
+++ b/extensions/plot/plot.lua
@@ -32,7 +32,7 @@ function file_exists(filename)
 end

 function which(command)
-       return os.execute("which " .. command .. ' >/dev/null 2>&1')
+       return os.execute("which " .. command)
 end

 function rsvg(svg, output, format)

按照上述方法修改后之前找不到的程序的问题消失了,但是编译到最后出现了如下错误:
** WARNING ** No valid name object found.
** WARNING ** Could not find a value in dictionary object.
** WARNING ** Didn't find "endobj".
** ERROR ** pdf_link_obj(): passed invalid object.

不过我根据dockfile,在WSL1 Linux下使用各个程序的linux版本成功配置好了环境,可以成功编译各个demo,包括各种plot扩展。
不想折腾msys2了,非常感谢耐心解答。

另外,根据我的折腾,使用新版本的pandoc和texlive也会有各种问题,texlive 2019和pandoc 2.9.x是可以的。