public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Julien Dutant <julien.dutant-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Pandoc 2.14 SVG cannot find file issue still happening on Win?
Date: Mon, 5 Jul 2021 18:53:33 -0700 (PDT)	[thread overview]
Message-ID: <0e5a5f4c-c7bf-44a4-8055-eaa1f91d1287n@googlegroups.com> (raw)
In-Reply-To: <5a4cf93b-4060-46e1-afd0-f00d86a2e12cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 11869 bytes --]

One further test. I looked into the mix of Unix and Win directory 
separators I spotted in the Win log:

[WARNING] Could not convert image ./tex2pdf.-1e0ad2b9dc7e1974\Diagram1.svg: 
conversion from SVG failed

As it happens both of the following *do* work on Windows, if I run them 
from the PWD (the folder in which my source file is and in which I ran 
pandoc; tex2pdf.-1e0...1974 is a subfolder of that):

rsvg-convert ./tex2pdf.-1e0ad2b9dc7e1974\Diagram1.svg > Diagram-test.pdf
rsvg-convert "./tex2pdf.-1e0ad2b9dc7e1974\Diagram1.svg" > Diagram-test.pdf

so the bug isn't due to that pathname. If it's calling these command from 
the PWD they should work. So perhaps it's not calling them from the PWD? It 
looks like on the MacOS side I have absolute paths throughout, though the 
log doesn't leave a clue as to whether rsvg-convert is called on a relative 
or absolute path.

Best,
J  

On Tuesday, July 6, 2021 at 2:33:02 AM UTC+1 Julien Dutant wrote:

> Thanks! I've looked into this, comparing the --verbose log on MacOS and 
> Win. In summary, Pandoc copies the SVG file in a working directory, calls 
> rsvg-convert, but fails to pass the proper path to rsvg-convert. Since 
> there's no PDF version of the image, it leaves the name of the SVG on in 
> its output LaTeX code, and pdflatex exists with an error because it can't 
> handle SVG files.
>
> In particular, if you call rsvg-convert with: 
>
> rsvg-convert wrongpath/Diagram1.svg > rightpath/Diagram1.pdf
>
> but there's no file at wrongpath/Diagram1.svg, rsvg-convert throws the 
> error "Error reading SVG:Error opening file: No such file or directory" in 
> stdout, and an empty PDF file is created at rightpath/Diagram1.pdf. Which 
> is what I get here: the same error, and an empty Diagram1.pdf file in the 
> working directory. So Pandoc seems to pass a wrong path for wrongpath in 
> the call above but the correct path for the working directory to rightpath. 
>
> In the logs below I've replaced my user folders with %USERNAME% and the 
> like where appropriate. The Win run produces an empty pdf output (test.pdf, 
> zero bytes) and leaves behind a temporary folder with (a) a copy the 
> original SVG, Diagram1.svg; (b) an empty PDF file of the same name, 
> Diagram1.pdf (zero bytes), (c) input.log (same LaTeX log as included in 
> Pandoc's verbose output) and (d) input.aux. The MacOS run produces the 
> correct output, test.pdf, and doesn't leave a temporary folder behind. 
>
> Should I file this as an issue on Github? 
>
> All best,
>
> J
>
> Pandoc Log on Windows
> ====================
>
> [INFO] Loaded Diagram1.svg from Diagram1.svg
> Error reading SVG:Error opening file: No such file or directory
>
> [WARNING] Could not convert image 
> ./tex2pdf.-1e0ad2b9dc7e1974\Diagram1.svg: conversion from SVG failed
> [makePDF] temp dir:
> ./tex2pdf.-1e0ad2b9dc7e1974
> [makePDF] Command line:
> pdflatex "-halt-on-error" "-interaction" "nonstopmode" "-output-directory" 
> "./tex2pdf.-1e0ad2b9dc7e1974" "./tex2pdf.-1e0ad2b9dc7e1974/input.tex"
>
> [makePDF] Relevant environment variables:
> ("TEXINPUTS","./tex2pdf.-1e0ad2b9dc7e1974;")
> ("TEXMFOUTPUT","./tex2pdf.-1e0ad2b9dc7e1974")
>
> [makePDF] Source:
> ... TeX source here. relevant line, l.74:
> \includegraphics{./tex2pdf.-1e0ad2b9dc7e1974/Diagram1.svg}
> ...
> \end{document}
>
> [makePDF] Run #1
> This is pdfTeX, Version 3.141592653-2.6-1.40.22 (MiKTeX 21.6.28)
> entering extended mode
> (tex2pdf.-1e0ad2b9dc7e1974/input.tex
> LaTeX2e <2021-06-01> patch level 1
> L3 programming layer <2021-06-18>
>
> (C:\Users\%USERNAME%\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
> Document Class: article 2021/02/12 v1.4n Standard LaTeX document class
> ...
> standard TeX log loading packages up to:
> ...
>
>  (C:\Users\%USERNAME%\AppData\Roaming\MiKTeX\tex/latex/microtype\mt-msa.cfg)
>
> (C:\Users\%USERNAME%\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsb.fd)
>
>  (C:\Users\%USERNAME%\AppData\Roaming\MiKTeX\tex/latex/microtype\mt-msb.cfg)
>
> ! LaTeX Error: Unknown graphics extension: .svg.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...                                              
>                                                   
> l.74 ...{./tex2pdf.-1e0ad2b9dc7e1974/Diagram1.svg}
>                                                   
> !  ==> Fatal error occurred, no output PDF file produced!
> Transcript written on 
> "C:\Users\%USERNAME%\%MARKDOWN-SOURCE-PATH%\tex2pdf.-1e0ad2b9dc7e1974\input.log".
>
> [makePDF] Run #2
> ... exactly identical to Run #1, ends with:
>
>  (C:\Users\Golden 
> Mole\AppData\Roaming\MiKTeX\tex/latex/microtype\mt-msb.cfg)
>
> ! LaTeX Error: Unknown graphics extension: .svg.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...                                              
>                                                   
> l.74 ...{./tex2pdf.-1e0ad2b9dc7e1974/Diagram1.svg}
>                                                   
> !  ==> Fatal error occurred, no output PDF file produced!
> Transcript written on 
> "C:\Users\%USERNAME%\%MARKDOWN-SOURCE-PATH%\tex2pdf.-1e0ad2b9dc7e1974\input.log".
>
> Error producing PDF.
> ! LaTeX Error: Unknown graphics extension: .svg.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...                                              
>                                                   
> l.74 ...{./tex2pdf.-1e0ad2b9dc7e1974/Diagram1.svg}
>
> Pandoc Log on MacOS
> ===================
>
> [INFO] Loaded Diagram1.svg from Diagram1.svg
> [makePDF] temp dir:
>
> /private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e
> [makePDF] Command line:
> pdflatex "-halt-on-error" "-interaction" "nonstopmode" "-output-directory" 
> "/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e" 
> "/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e/input.tex"
>
> [makePDF] Relevant environment variables:
>
> ("TEXINPUTS","/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e:")
>
> ("TEXMFOUTPUT","/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e")
> ("TMPDIR","/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/")
> ("LANG","en_GB.UTF-8")
> ("SHELL","/bin/zsh")
> ("HOME","/Users/%HOME%")
> ("PATH","/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin")
> ("PWD","/Users/%USERNAME%\%MARKDOWN-SOURCE-PATH%")
>
> [makePDF] Source:
> ... TeX source here ... relevant line, l. 74:
>
> \includegraphics{/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e/Diagram1.pdf}
>
> [makePDF] Run #1
> This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded 
> format=pdflatex)
>  restricted \write18 enabled.
> entering extended mode
>
>
> (/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead
> 6e8e/input.tex
> LaTeX2e <2020-10-01> patch level 4
> L3 programming layer <2021-02-18>
> (/usr/local/texlive/2021/texmf-dist/tex/latex/base/article.cls
>
> ... normal LaTeX log ... ends with:
>
> (/usr/local/texlive/2021/texmf-dist/tex/latex/microtype/mt-msa.cfg)
> (/usr/local/texlive/2021/texmf-dist/tex/latex/amsfonts/umsb.fd)
> (/usr/local/texlive/2021/texmf-dist/tex/latex/microtype/mt-msb.cfg) 
> [1{/usr/loc
> al/texlive/2021/texmf-var/fonts/map/pdftex/updmap/pdftex.map} 
> </private/var/fol
>
> ders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead6e8e/Diagram1.pdf
> >]
>
> (/private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2pdf.-44676666dead
> 6e8e/input.aux) 
> ){/usr/local/texlive/2021/texmf-dist/fonts/enc/dvips/lm/lm-ec.e
>
> nc}</usr/local/texlive/2021/texmf-dist/fonts/type1/public/lm/lmr10.pfb></usr/lo
>
> cal/texlive/2021/texmf-dist/fonts/type1/public/lm/lmr12.pfb></usr/local/texlive
> /2021/texmf-dist/fonts/type1/public/lm/lmr17.pfb>
> Output written on 
> /private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/tex2
> pdf.-44676666dead6e8e/input.pdf (1 page, 82224 bytes).
> Transcript written on 
> /private/var/folders/j2/zp5ggjhx12xccgy5_wx32tfw0000gp/T/
> tex2pdf.-44676666dead6e8e/input.log.
>
> [makePDF] Run #2
> ... exactly identical to run #1...
>
>
>
>
> On Monday, July 5, 2021 at 11:18:56 PM UTC+1 John MacFarlane wrote:
>
>>
>> Very likely. Run with --verbose and see if you can get more 
>> clues that way. 
>>
>> Julien Dutant <julien...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: 
>>
>> > One thing that caught my eye: the mix of Unix and Win directory 
>> separator 
>> > in "image ./tex...a4\Diagram1.svg". Could it be that some of the new 
>> > path-related code in Pandoc doesn't handle Win paths properly? 
>> > 
>> > On Monday, July 5, 2021 at 9:06:26 PM UTC+1 Julien Dutant wrote: 
>> > 
>> >> Hi all, 
>> >> 
>> >> With 2.14 there was an issue with converting svg files ( 
>> >> https://github.com/jgm/pandoc/issues/7344 , duplicates #7350, #7359, 
>> >> #7373). This is fixed in 2.14.0.3. But it looks like I'm still getting 
>> it 
>> >> on Windows. Do other users get it on Windows too? Or is my bug due to 
>> >> something else? 
>> >> 
>> >> I'm converting the same .md and .svg files to pdf, on MacOS and on 
>> >> Windows. (I need to have the Win version working for another user.) 
>> The 
>> >> pandoc versions are the same on both machines: 
>> >> 
>> >> pandoc 2.14.0.3 
>> >> Compiled with pandoc-types 1.22, texmath 0.12.3, skylighting 0.10.5.2, 
>> >> citeproc 0.4.0.1, ipynb 0.1.0.1 
>> >> rvsg-convert versions are a bit different but I doubt that's the 
>> source of 
>> >> the problem: 
>> >> MacOS: rsvg-convert version 2.50.4 
>> >> Win: rsvg-convert version 2.40.20 
>> >> 
>> >> The markdown source is simply: 
>> >> 
>> >> ![Example diagram](Diagram1.svg) 
>> >> 
>> >> The file Diagram1.svg is in the same folder. I also have a 
>> Diagram1.png 
>> >> for testing purposes. 
>> >> 
>> >> On MacOS this converts to pdf correctly. On Windows this converts 
>> properly 
>> >> with "Diagram1.png" instead of the .svg above. But with the .svg I get 
>> the 
>> >> following error in the pandoc log: 
>> >> 
>> >> [INFO] Loaded Diagram1.svg from Diagram1.svg 
>> >> Error reading SVG:Error opening file: No such file or directory 
>> >> 
>> >> [WARNING] Could not convert image 
>> >> ./tex2pdf.-bbcd86b3e141c2a4\Diagram1.svg: conversion from SVG failed 
>> >> 
>> >> and down the line the pdf generation fails. If I use a png file 
>> instead 
>> >> (add Diagram1). 
>> >> 
>> >> This looks like the path bug of 2.14 that was solved in later 
>> versions. 
>> >> Are other people getting it on Windows too? Could someone with Windows 
>> >> download a simple svg file (e.g. 
>> >> https://en.wikipedia.org/wiki/File:Circle_-_black_simple.svg ) and 
>> give 
>> >> it a try? 
>> >> 
>> >> Thanks for your help! 
>> >> 
>> >> All best, 
>> >> 
>> >> Julien 
>> >> 
>> >> 
>> >> 
>> >> 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> Groups "pandoc-discuss" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/pandoc-discuss/c30de263-3edd-45d1-b503-5952a80dd236n%40googlegroups.com. 
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/0e5a5f4c-c7bf-44a4-8055-eaa1f91d1287n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 16323 bytes --]

  parent reply	other threads:[~2021-07-06  1:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05 20:06 Julien Dutant
     [not found] ` <3d31df0a-9470-4e15-946d-11f44ecf7375n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-05 21:24   ` Julien Dutant
     [not found]     ` <c30de263-3edd-45d1-b503-5952a80dd236n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-05 22:18       ` John MacFarlane
     [not found]         ` <m2bl7gjtfi.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-06  1:33           ` Julien Dutant
     [not found]             ` <5a4cf93b-4060-46e1-afd0-f00d86a2e12cn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-07-06  1:53               ` Julien Dutant [this message]
2021-07-06 16:23               ` John MacFarlane
     [not found]                 ` <m2y2ajif7g.fsf-jF64zX8BO0+FqBokazbCQ6OPv3vYUT2dxr7GGTnW70NeoWH0uzbU5w@public.gmane.org>
2021-07-06 16:59                   ` Julien Dutant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e5a5f4c-c7bf-44a4-8055-eaa1f91d1287n@googlegroups.com \
    --to=julien.dutant-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).