Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG images are not included properly #952

Open
lyh16 opened this issue Sep 2, 2021 · 17 comments
Open

SVG images are not included properly #952

lyh16 opened this issue Sep 2, 2021 · 17 comments

Comments

@lyh16
Copy link
Contributor

lyh16 commented Sep 2, 2021

Steps to Reproduce

  1. Add '\usepackage{svg}' in the preamble of the document.
  2. Try to include an SVG type image by adding:
    \begin{figure}[!htb]
    \centering
    \includesvg[width=\textwidth]{images/plot.svg}
    \end{figure}

Expected Behaviour

  1. The selected SVG type image is correctly included in the document.

Observed Behaviour

  1. Only the captions set for the images are displayed, and the SVG type images themselves are not rendered.

Context

I am trying to compile my research on my self-hosted Overleaf server. While EPS type images load without issue using the '\includegraphics[]{}' command, SVG type images will not load with the '\includesvg[]{}' command. Both work perfectly on the online version of Overleaf. I would prefer to be able to include SVG images directly, as in the online version, because 'matplotlib' is able to smoothly preserve transparency in plots using the SVG format but faces many issues in doing so if I try to save plots into an EPS format file directly. Using third party converters for SVG to EPS conversion is not practical in my case as the file size is quite large. Also, since the online version of Overleaf works without problem, I don't see why it should be any different in the self-hosted Docker version.

Technical Info

[Client]

  • Browser Name and version: Google Chrome v92.0.4515.159 (64-bit)
  • Operating System and version (desktop or mobile): Microsoft Windows 10 Education v10.0.19042 / Desktop

[Server]

  • Browser Name and version: Firefox v.91.0.1 (64-bit)
  • Operating System and version (desktop or mobile): Ubuntu 20.04 LTS / Desktop

[Copy of Error Message in Logs]

Package svg Error: File `plot_svg-tex.pdf' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.341 ...h=\textwidth]{images/plot.svg}
                                                  
Did you run the export with Inkscape? There's no file
`./svg-inkscape/plot_svg-tex.pdf'
although `images/plot.svg' was found.

[Similar Issues]
This issue in the 'mrpiggi/svg' repository seems to be the same issue as mine, but was closed without a conclusive answer due to lack of details. Also, I ruled out the possibility of a bug in the 'svg' package itself as the whole described process works flawlessly on the online version of Overleaf. And yes I have installed all packages using docker exec sharelatex tlmgr install scheme-full.

@drwilkins
Copy link

would love an answer to this. Running into the same problem here.

@StavrosPan
Copy link

Same here.

@kajoshua
Copy link

kajoshua commented Aug 6, 2022

Including the *.svg file in the same folder as my main.tex seemed to work, at least for the online version of Overleaf.

@marv1913
Copy link

Same here.

@rroepke
Copy link

rroepke commented Aug 23, 2022

Same here :)

@marv1913
Copy link

marv1913 commented Aug 23, 2022

I have found a workaround: including a latexmkrc file with the content $pdflatex = 'pdflatex --shell-escape'; in the same folder as my main.tex fixes the problem. Maybe there's a way to add --shell-escape as a default argument to pdflatex.

@mserranom
Copy link
Contributor

Which version of Overleaf CE are you using? We recently published a new 3.2.2 version, fixing some issues with TexLive packages, is the problem still there?

@marv1913
Copy link

I built the latest image yesterday and the workaround is still necessary.

@Haschtl
Copy link

Haschtl commented Nov 6, 2022

For the official Docker-Image you also need to run apt update && apt install inkscape inside the container (docker exec -it sharelatex /bin/sh)

@marv1913
Copy link

marv1913 commented Nov 7, 2022

Yes, but after installing linkscape inside the sharelatex container it is still necessary to add the latexmkrc file beside the tex files to be able to include SVG files.

@mserranom
Copy link
Contributor

From the latest version release notes:

(starting 3.3.0), for CE users, and Server Pro users that don't run Sandboxed Compiles there is a change in how Latex packages are installed, now requiring to run tlmgr path add again after every use of tlmgr install in order to correctly symlink all the binaries into the system path.

https://github.com/overleaf/overleaf/wiki/Release-Notes-3.x.x#server-pro-330

@Anieway
Copy link

Anieway commented May 8, 2023

marv1913 commented on Aug 23, 2022: I have found a workaround: including a latexmkrc file with the content $pdflatex = 'pdflatex --shell-escape'; in the same folder as my main.tex fixes the problem. Maybe there's a way to add --shell-escape as a default argument to pdflatex.

Adding this line to the latexmkrc did not work for me.
Are there any other known workarounds?

@thiagoeustakio
Copy link

Same issue here, adding the latexmkrc did not work for me.

@marv1913
Copy link

marv1913 commented Jan 15, 2024

I set up a clean environment and tried reproducing the issue using the Docker image sharelatex/sharelatex:4.2.0.
The problem still persists.

I found a workaround by running these commands inside the sharelatex container's bash:

  • tlmgr update --self
  • tlmgr install scheme-full
  • apt update && apt install inkscape

Include the latexmkrc file in the same folder as my main.tex.

Unfortunately, I've found no way way to tell pdflatex to use the '--shell-escape' option.
This problem has been around for a while, as documented in this: overleaf/docker-image#45

@wixaw
Copy link

wixaw commented Jan 18, 2024

I would have the same request, would it be possible to integrate Inkscape into the Docker container? Thank you.

@R-Gaurav
Copy link

R-Gaurav commented May 26, 2024

I set up a clean environment and tried reproducing the issue using the Docker image sharelatex/sharelatex:4.2.0. The problem still persists.

I found a workaround by running these commands inside the sharelatex container's bash:

  • tlmgr update --self
  • tlmgr install scheme-full
  • apt update && apt install inkscape

Include the latexmkrc file in the same folder as my main.tex.

Unfortunately, I've found no way way to tell pdflatex to use the '--shell-escape' option. This problem has been around for a while, as documented in this: overleaf/docker-image#45

Still facing the same issue, above workaround helps (as per #952 (comment))

@wixaw
Copy link

wixaw commented Jun 26, 2024

Hello, @mserranom
I'm having issues with adding SVG functionality in version 5 with my method working correctly in version 4 and this prevents my update.

#!/bin/bash

docker-compose exec sharelatex /bin/bash -c "tlmgr path add xetex"
docker-compose exec sharelatex /bin/bash -c "tlmgr path add epstopdf"
docker-compose exec sharelatex /bin/bash -c "tlmgr path add biber"

# Inkscap pour les SVG
docker-compose exec sharelatex /bin/bash -c "apt update"
docker-compose exec sharelatex /bin/bash -c "apt install inkscape -y"

cat /usr/local/texlive/2023/texmf.cnf
shell_escape = t

Could you help me debug the problem? When I compare the raw logs between the production server running version 4 and the test server running version 5, I only see this difference:

log v4 : ( i have same result on overleaf.com )

(/usr/local/texlive/2023/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))
Package svg Info: Last page of `./svg-inkscape/example_svg-tex.pdf' is 1 on inp
ut line 8.
(./svg-inkscape/example_svg-tex.pdf_tex
<./svg-inkscape/example_svg-tex.pdf, id=5, page=1, 378.9613pt x 378.9628pt>
File: ./svg-inkscape/example_svg-tex.pdf Graphic file (type pdf)
<use ./svg-inkscape/example_svg-tex.pdf, page 1>
Package pdftex.def Info: ./svg-inkscape/example_svg-tex.pdf , page1 used on inp
ut line 56.
(pdftex.def)             Requested size: 378.96129pt x 378.98499pt.
)
Overfull \hbox (33.96129pt too wide) in paragraph at lines 8--9
 [][] 
 []

[1

{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map} <./svg-i
nkscape/example_svg-tex.pdf>] (./output.aux)

log v5 :

(/usr/local/texlive/2023/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
))

! Package svg Error: File `example.svg' is missing.

See the svg package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.8   \includesvg{example}
                          
There's no file `example.svg'
neither in the current directory nor any other searched
path given by \svgpath or \graphicspath.
No additional path was given.

[1

{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./outp
ut.aux)

Source project :
svg (1).zip

Thanks you in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests