我正在尝试将图表构建器包与 LaTeX 一起使用,以便在线生成图表。按照此处的教程,我有一个名为的文件test.tex
,其内容如下:
\documentclass[10pt]{article}
\usepackage[backend=ps, extension=eps, outputdir=diagrams]{diagrams-latex}
\usepackage{graphicx}
\begin{document}
\begin{diagram}[width=300,height=200]
{-# LANGUAGE FlexibleContexts #-}
dia = circle 1
\end{diagram}
\end{document}
我创建了一个名为并尝试编译的空目录diagrams
,却被告知在看起来是由diagrams-builder-ps
.
$ pdflatex --enable-write18 --shell-escape test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo))
(/Users/nhalford/Library/texmf/tex/diagrams-latex.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/moreverb/moreverb.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/tools/verbatim.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/xkeyval/xkeyval.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkeyval.tex
(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/xkvutils.tex
(/usr/local/texlive/2016/texmf-dist/tex/generic/xkeyval/keyval.tex))))
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2016/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2016/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
No file test.aux.
(/usr/local/texlive/2016/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/local/texlive/2016/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
Opening diagrams-latex stream diagrams/test-diagrams-latex-fig1.hs Error while compiling diagrams/test-diagrams-latex-fig1.hs
/var/folders/2g/_6mplpfn4fl338wr3cj949440000gn/T/Diagram58258-0.hs:3:20: error:
parse error on input ‘-’
Package diagrams-latex Warning: Conversion of diagrams/test-diagrams-latex-fig1
.hs failed.
Package diagrams-latex Warning: Please convert diagrams/test-diagrams-latex-fig
1.hs manually.
(./test.aux) )
No pages of output.
Transcript written on test.log.
尝试直接运行diagrams-builder-ps
或diagrams-builder-cairo
在.hs
文件上运行时,我也会收到此错误:
$ cd diagrams
$ ls
test-diagrams-latex-fig1.hs
$ diagrams-builder-ps -w 300 -h 200 test-diagrams-latex-fig1.hs
Error while compiling test-diagrams-latex-fig1.hs
/var/folders/2g/_6mplpfn4fl338wr3cj949440000gn/T/Diagram58289-0.hs:3:20: error:
parse error on input ‘-’
$ diagrams-builder-cairo -w 300 -h 200 test-diagrams-latex-fig1.hs
Error while compiling test-diagrams-latex-fig1.hs
/var/folders/2g/_6mplpfn4fl338wr3cj949440000gn/T/Diagram58294-0.hs:3:20: error:
parse error on input ‘-’
$ cat test-diagrams-latex-fig1.hs
{-# LANGUAGE FlexibleContexts #-}
dia = circle 1
$
不幸的是,系统立即删除了带有解析错误的临时.hs
文件,因此我无法检查该文件以查看究竟是什么导致了这个问题。
谢谢你的帮助!