I am working on a configuration of the latex build process to use with Anki for compiling cards with latex content. I have some eps figures I want to include on some of my cards. The latest Anki version uses pdflatex which can't handle eps images. I have added the epstopdf to my list of packages and I have ghostscript installed, but I am getting error indicating that ghostscript cannot be opened for piped input. Is there something I can add to the build config to force epstopdf to find ghostscript?
I am able to convert the eps file manually from the command line:
epstopdf --debug /Images/commontriangles.eps commontriangles.pdf
I am on OSX Catalina.
This is what I get when I try which gs:
/usr/local/bin/gs
Here is the error:
Error executing pdflatex.
Generated file: /var/folders/v_/5s080r992cvfltv_256bmxyr0000gp/T/anki_temp/tmp.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
(./tmp.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-03-06>
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/local/texlive/2020/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/amsfonts.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/jknapltx/mathrsfs.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/changepage/changepage.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/ifvtex.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/iftex/iftex.sty)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/pdftex.def)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/infwarerr/infwarerr.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/grfext/grfext.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/kvdefinekeys/kvdefinekeys.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/kvoptions/kvoptions.sty
(/usr/local/texlive/2020/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty)
(/usr/local/texlive/2020/texmf-dist/tex/generic/kvsetkeys/kvsetkeys.sty))
(/usr/local/texlive/2020/texmf-dist/tex/latex/pdftexcmds/pdftexcmds.sty)
(/usr/local/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
(/usr/local/texlive/2020/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)))
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
(./tmp.aux)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/local/texlive/2020/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)epstopdf ($Id: epstopdf.pl 48681 2018-09-16 23:03:58Z karl $) 2.28
!!! Error: Cannot open Ghostscript for piped input: gs -q -dSAFER -dNOPAUSE -dBATCH -dCompatibilityLevel=1.5 -sDEVICE=pdfwrite -sOutputFile=/Images/commontriangles-eps-converted-to.pdf -dPDFSETTINGS#/prepress -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoRotatePages#/None - -c quit
system returned with code 512
Underfull \hbox (badness 10000) in paragraph at lines 14--15
Underfull \hbox (badness 10000) in paragraph at lines 14--15
Underfull \hbox (badness 10000) in paragraph at lines 17--18
! Package pdftex.def Error: File `/Images/commontriangles-eps
-converted-to.pdf' not found: using draft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.23 \includegraphics{commontriangles.eps}
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsa.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/amsfonts/umsb.fd)
(/usr/local/texlive/2020/texmf-dist/tex/latex/jknapltx/ursfs.fd) [1{/usr/local/
texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./tmp.aux) )
(see the transcript file for additional information)</usr/local/texlive/2020/te
xmf-dist/fonts/type1/public/amsfonts/cm/cmbx9.pfb></usr/local/texlive/2020/texm
f-dist/fonts/type1/public/amsfonts/cm/cmmi9.pfb></usr/local/texlive/2020/texmf-
dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/local/texlive/2020/texmf-dis
t/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/local/texlive/2020/texmf-dist/f
onts/type1/public/amsfonts/cm/cmtt9.pfb>
Output written on tmp.pdf (1 page, 53488 bytes).
Transcript written on tmp.log.
Here is my build config:
{
"pngCommands": [
[
"pdflatex",
"--shell-escape",
"-interaction=nonstopmode",
"tmp.tex"
],
[
"dvipng",
"-D",
"200",
"-T",
"tight",
"tmp.dvi",
"-o",
"tmp.png"
]
],
"svgCommands": [
[
"pdflatex",
"--shell-escape",
"-interaction=nonstopmode",
"tmp.tex"
],
[
"dvisvgm",
"--no-fonts",
"-Z",
"2",
"tmp.dvi",
"-o",
"tmp.svg"
]
]
}
Here are the packages I am using on the card:
\documentclass[10pt,letterpaper]{article}
\usepackage{amssymb,amsmath,amsfonts,mathrsfs,changepage}
\usepackage[letterpaper,pass]{geometry}
\usepackage{graphicx}
\usepackage{epstopdf}
\graphicspath{ {/Images/} }
\pagestyle{empty}
\setlength{\parindent}{0in}
\DeclareMathOperator{\sech}{sech}
\DeclareMathOperator{\csch}{csch}
\begin{document}
PATHenvironment variable seems different in your terminal (which gs) and in your session (used by Anki)... – Paul Gaborit Mar 01 '22 at 06:52