我試圖使用LaTeX圖表生成器包來生成圖表。繼教程here,我有一個文件名爲test.tex
具有以下內容:解析Haskell圖表生成器錯誤
\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.
嘗試在.hs
文件直接運行diagrams-builder-ps
或diagrams-builder-cairo
時,我也得到這個錯誤:
$ 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
立即用解析錯誤,所以我無法檢查該文件,看看究竟是什麼導致了這個問題。
感謝您的幫助!
您可以嘗試使用Ctrl + Z來暫停進程。這可以幫助您查看臨時文件。 – arrowd
我試過你的'test.tex',但不能重現錯誤。你能粘貼'test-diagrams-latex-fig1.hs'的內容嗎? –
順便提一下,你可能不想在'ps'或'cairo'後端使用'input'標誌(這會導致'.eps'文件的內容直接包含在LaTeX源文件中合理)。它旨在用於'pgf'後端。但在任何情況下,這不是導致你的問題。 –