0

I tried to include SVG image into the LaTex. My code is as follows:

\documentclass[a4paper,12pt]{book}
\usepackage{svg}
\begin{document}

\begin{figure}[ht] \centering \includesvg[width=0.4\textwidth]{Figures/1} \caption{svg} \label{fig:1} \end{figure} \end{document}

I put all pictures in one file named Figures. When I run this code in Overleaf, there is no error. But if I run this one in TexWorks (on my laptop), there will an issue:

enter image description here

Bernard
  • 271,350
Hermi
  • 231
  • 1
  • 6
  • Presumably that code is missing a \usepackage{svg}. Glancing at the package docs, I think you might need to enable shell-escape: https://tex.stackexchange.com/a/82710/ – Torbjørn T. Apr 30 '21 at 21:42
  • Well, I have included \usepackage{svg} – Hermi Apr 30 '21 at 21:53
  • It shows that Did you run the export with Inkscape? There's no file ./svg-inkscape/fig1_svg-tex.pdf' althoughFigures/fig1.svg' was found. ? – Hermi Apr 30 '21 at 21:55
  • 1
    Only a suggestion: simplify your life. Save your image.svg as image.pdf (without checking omit the text and make a LaTeX file) and use \includegraphics (and yes, I know why one might want to do differently). – Fran Apr 30 '21 at 22:30
  • @Fran But if I save my image.svg as pdf, their notation in $$ in the graph will be disappeared, like $\mathbf{P}$ in the graph. How to deal with that? – Hermi Apr 30 '21 at 22:43
  • @Hermi Not sure of what are you doing, but If I type $\sum$ with the LaTeX extension of Inkscape, what I I see is "∑" in the SVG and in the PDF. Using a draw properly scaled, with the right font and the right font size, this should be enough even if you want to match the font of the image with the font with the main text (that IMHO, t's not even convenient). – Fran May 01 '21 at 14:53
  • @Fran But there is $\sum$ in my SVG and PDF. How to see "∑"? – Hermi May 01 '21 at 19:57
  • You only have to call your preferred LaTeX engine with --shell-escape flag – mrpiggi May 01 '21 at 21:58
  • @Hermi by using the menu "Extensiones" → "Generar" → "LaTeX ..." in the Spanish version. The English menu should be similar or maybe you nned to install the extension. See https://github.com/seebk/LaTeXText – Fran May 01 '21 at 22:12

0 Answers0