I have a LaTeX document with sections/labels, and I want to create links to these from a SVG image. This SVG file is created in Inkscape and exported to PDF, and I'm not satisfied with the export option "Omit text in PDF and create LaTeX file" (because the result has to be included as a figure, not as a background or standalone page, and I also want to keep the fonts in my SVG).

Using LuaLaTeX and newpax, I am able to include PDFs (\includepdf[pages=-]{svg.pdf}). And if I have created URL links in the SVG (exported as svg.pdf), the LuaLaTeX-compiled pdf will contain these clickable URL links. All good for those links.

But how can I refer to sections/labels in my document from my SVG (or can I?), that is, create internal clickable links from my image? Is there a naming scheme I can use in Inkscape's href:? I tried using #my-latex-label in Inkscape, but no link is created, not even a highlight box. This is also true for the standalone svg.pdf.

  • 1
    Possibly related: tex.stackexchange.com/questions/176280/… Mar 20 at 20:33
  • 1
    @telephone: You could convert your text to path before exporting to PDF with LaTeX support and just process the label references. BTW: do you know LaTeX package svg? Otherwise, you would have to create some overlay above the picture with the references placed manually as the link resolution is done by LaTeX package hyperref. Meaning, if you are providing just a ordinary PDF, there is no way for LaTeX to find your references.
    – mrpiggi
    Mar 20 at 21:38
  • @mrpiggi I haven't heard about latex svg package, but it looks like it just processes svg trough Inskcape in the background to something LaTeX enjoys. Nice to know about. I've thought about the idea to convert text to paths and create overlays just for links. My first experience was not positive. But I may go for this solution in the end. I can use something like \newgeometry{margin=0mm} to set up a full page and use \def\svgwidth{\paperwidth} before \input{<filename>.pdf_tex} to fill the whole page. It could be possible to include an ordinary PDF using newpax. Thanks!
    – telephone
    Mar 21 at 23:18
  • @JohnKormylo : Interesting - thanks!
    – telephone
    Mar 21 at 23:32
  • @telephone With package svg you could make references to native LaTeX labels within an text box with \ref{my-latex-label} in the SVG file and would not need to create overlays by yourself as the package would invoke Inkscape automatically.
    – mrpiggi
    Mar 22 at 9:06

1 Answer 1


I tried with a simply svg with an internal link:

 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  version="1.1" 
 width="100%" height="100%">
     <a xlink:href="#target">
       <text x="10" y="25">Zoom in on shape below</text>
     <view id="target" viewBox="600 600 50 50"/>
     <rect x="600" y="600" width="50" height="50"/>

When I export that with inkscape 1.3.2 to a PDF and uncompress the PDF, there is a link but it has an URI action instead of the needed GoTo action (the destination is missing too, but that it not relevant for you if you want to link to other locations in your PDF):

/A << /S /URI /Type /Action /URI (#target) >>

This means that if one applies newpax to the PDF you get this in the newpax file:

\[{annot}{1}{Link}{7 91.5 111 101.5}{URI}{
  BS={<</W 0>>},

but for an internal link you would need something like this

\[{annot}{1}{Link}{7 91.5 111 101.5}{GoTo}{

It would be theoretically possible to post process the newpax file to replace e.g. all URI entries starting with # by a GoTo, but it would be better if inkscape would improves its PDF export and create GoTo links from such internal targets (and add also destinations if there is an id.)

  • Thank you! Adding this feature to Inkscape sounds like a good solution. I could not find any documentation about links in PDFs. I'll set this as the accepted answer, I guess few other have better knowledge about newpax than you :) I hope LaTeX incorporates the necessary requirements in the future so newpax can be used easier for more users.
    – telephone
    Mar 21 at 23:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .