0

This question already has an answer here:

I managed to setup the SVG package so it would successfully import an SVG file.

Here is the full config:

\RequirePackage[width=\textwidth]{svg}      % In my custom package
\PassOptionsToPackage{svgpath={uml/}}{svg}  % In the file

I then include the SVG file (uml/uml.svg) with:

\includesvg{uml}

This works with no errors or warnings.

However, the original SVG file looked like this:Original file (Sorry this is awful, but you can't upload SVG files directly). Notice the arrows on the top-left.

Here is the resulting file: Resulting file

I'm fine with that, except that the three arrows on the top-left disappeared from some reason.

When reading the doc I found the lastpage option, however it is to fix a bug in Inkscape 0.91, and I'm running 0.92.1 r15371.

The SVG file was generated with UMLet (but that cannot be the problem, the first picture is after the generation). However, the missing arrows are the first I added when creating the diagram, that seems a bit too big of a coincidence -- however I don't know how SVG works so I don't really know if that has an influence or not.

UXF file generated by UMLet | SVG file generated by UMLet | Temporary PDF file generated by the svg package


Minimal working example:

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[width=\textwidth]{svg}

\begin{document}

\includesvg{animaux}

\end{document}

You need to add the file uml.svg in the same folder.

marked as duplicate by user36296, Zarko, Stefan Pinnow, Mensch, Phelype Oleinik Dec 16 '18 at 0:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Can you share the .svg file (for example copy and paste the content of the file to pastebin.com) – user36296 Nov 24 '18 at 19:24
  • As a vector format SVG lines and other features can have several personal attributes. Two of these (visibility and opacity) may have been set for the first few lines then changed after that. Another possibility is Z order where those lines may be prior to a transparent border/frame which is later made opaque then the visible items are in the foreground. Simple solution redraw the missing lines worst case is some minor duplication unless the dead uns appear as zombies later. – user170109 Nov 25 '18 at 16:29
  • @samcarter edited to include links to the files – CLOVIS Nov 26 '18 at 9:46
  • @CLOVIS Thanks for the links to the files. Can you also add a compilable minimal working example (MWE) to your question? – user36296 Nov 26 '18 at 15:42
  • @samcarter added MWE – CLOVIS Dec 13 '18 at 14:43
1

This seems to be a bug of inkscape. After the conversion of svg to pdf all pages above 25 seems to be missing in the ./svg-inkscape/uml_svg-tex.pdf_tex file. You can edit the file and add them like in the code below.

To not accidentally overwrite your file, you might want to change the name and include it with

\def\svgwidth{\textwidth}
\input{YourNewName.pdf_tex}

instead of \includesvg[width=\textwidth]{uml}


%% Creator: Inkscape inkscape 0.91, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'uml_svg-tex.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%% 
%% For more information, please see info/svg-inkscape on CTAN:
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
  \makeatletter%
  \providecommand\color[2][]{%
    \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
    \renewcommand\color[2][]{}%
  }%
  \providecommand\transparent[1]{%
    \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
    \renewcommand\transparent[1]{}%
  }%
  \providecommand\rotatebox[2]{#2}%
  \ifx\svgwidth\undefined%
    \setlength{\unitlength}{592.8bp}%
    \ifx\svgscale\undefined%
      \relax%
    \else%
      \setlength{\unitlength}{\unitlength * \real{\svgscale}}%
    \fi%
  \else%
    \setlength{\unitlength}{\svgwidth}%
  \fi%
  \global\let\svgwidth\undefined%
  \global\let\svgscale\undefined%
  \makeatother%
  \begin{picture}(1,0.48717949)%
    \put(0,0){\includegraphics[width=\unitlength,page=1]{uml_svg-tex.pdf}}%
    \put(0.03036437,0.07219973){\makebox(0,0)[lb]{\smash{Maladie}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=2]{uml_svg-tex.pdf}}%
    \put(0.2780027,0.07137733){\makebox(0,0)[lb]{\smash{Médicament}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=3]{uml_svg-tex.pdf}}%
    \put(0.58164642,0.20633009){\makebox(0,0)[lb]{\smash{Matériel}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=4]{uml_svg-tex.pdf}}%
    \put(0.84075574,0.20633009){\makebox(0,0)[lb]{\smash{Nourriture}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=5]{uml_svg-tex.pdf}}%
    \put(0.57354926,0.07137733){\makebox(0,0)[lb]{\smash{\textit{Stockable}}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=6]{uml_svg-tex.pdf}}%
    \put(0.82726046,0.34128286){\makebox(0,0)[lb]{\smash{Classification}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=7]{uml_svg-tex.pdf}}%
    \put(0.31174089,0.46274035){\makebox(0,0)[lb]{\smash{Rang}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=8]{uml_svg-tex.pdf}}%
    \put(0.28340081,0.20633009){\makebox(0,0)[lb]{\smash{\textit{Événement}}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=9]{uml_svg-tex.pdf}}%
    \put(0.03103914,0.34128286){\makebox(0,0)[lb]{\smash{Contrat}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=10]{uml_svg-tex.pdf}}%
    \put(0.58704453,0.34128286){\makebox(0,0)[lb]{\smash{Animal}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=11]{uml_svg-tex.pdf}}%
    \put(0.2928475,0.34128286){\makebox(0,0)[lb]{\smash{Personne }}}%
    \put(0,0){\includegraphics[width=\unitlength,page=12]{uml_svg-tex.pdf}}%
    \put(0.39676113,0.11740891){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=13]{uml_svg-tex.pdf}}%
    \put(0.98380567,0.31969042){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=14]{uml_svg-tex.pdf}}%
    \put(0.07287449,0.11740891){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=15]{uml_svg-tex.pdf}}%
    \put(0.28879892,0.11740891){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=16]{uml_svg-tex.pdf}}%
    \put(0.23424845,0.04978489){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0.16059379,0.04978489){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=17]{uml_svg-tex.pdf}}%
    \put(0.89608637,0.27245695){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=18]{uml_svg-tex.pdf}}%
    \put(0.95006748,0.38731444){\makebox(0,0)[lb]{\smash{0..1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=19]{uml_svg-tex.pdf}}%
    \put(0.78801876,0.31969042){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=20]{uml_svg-tex.pdf}}%
    \put(0.34278003,0.40740971){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=21]{uml_svg-tex.pdf}}%
    \put(0.42802753,0.2214216){\makebox(0,0)[lb]{\smash{1..n}}}%
    \put(0.49573064,0.28300648){\makebox(0,0)[lb]{\smash{0..1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=22]{uml_svg-tex.pdf}}%
    \put(0.34278003,0.25236167){\makebox(0,0)[lb]{\smash{1..n}}}%
    \put(0.34278003,0.27245695){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=23]{uml_svg-tex.pdf}}%
    \put(0.15770904,0.28228502){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=24]{uml_svg-tex.pdf}}%
    \put(0.23471241,0.31969042){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0.16059379,0.31969042){\makebox(0,0)[lb]{\smash{0..1}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=25]{uml_svg-tex.pdf}}%
    \put(0.43049933,0.31969042){\makebox(0,0)[lb]{\smash{1}}}%
    \put(0.51764926,0.31969042){\makebox(0,0)[lb]{\smash{n}}}%
    \put(0,0){\includegraphics[width=\unitlength,page=26]{uml_svg-tex.pdf}}%
    \put(0,0){\includegraphics[width=\unitlength,page=27]{uml_svg-tex.pdf}}%
    \put(0,0){\includegraphics[width=\unitlength,page=28]{uml_svg-tex.pdf}}%
    \put(0,0){\includegraphics[width=\unitlength,page=29]{uml_svg-tex.pdf}}%
    \put(0,0){\includegraphics[width=\unitlength,page=30]{uml_svg-tex.pdf}}%
    \put(0,0){\includegraphics[width=\unitlength,page=31]{uml_svg-tex.pdf}}%                          
  \end{picture}%
\endgroup%

enter image description here


alternatively you could do the conversion from .svg to .pdf yourself and prevent the creation of separate layers, see e.g. https://tex.stackexchange.com/a/350175/36296

  • I'm not sure I understand. My UML file will be modified often so I want a script that can fix this, and I really don't understand what you're saying here. Are you proposing I add this manually? – CLOVIS Dec 13 '18 at 15:54
  • @CLOVIS yes, I am proposing to do this manually. This is the only possible fix from the latex side. If you want inkscape to be fixed, you should make a bug report for inkscape. – user36296 Dec 13 '18 at 15:55
  • @CLOVIS Another approach: use latex to draw your diagram (e.g. with tikz) – user36296 Dec 13 '18 at 15:56
  • Will the solution you gave work for other files? Since I have ~7 files that might need to be updated about every week – CLOVIS Dec 13 '18 at 15:56
  • I used pgf-umlcd before, but in this case it's not possible because my team doesn't know LaTeX. Worst case scenario, I'll just export to PNG (since that doesn't require Inkscape) and include that, but it's just... ugly – CLOVIS Dec 13 '18 at 15:58

Not the answer you're looking for? Browse other questions tagged or ask your own question.