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

dvisvgm backend: expose the name of tikz entities in order to assign svg id #1344

Open
severin-lemaignan opened this issue Jun 29, 2024 · 0 comments

Comments

@severin-lemaignan
Copy link

Brief outline of the proposed feature

Issue originally reported in dvisvgm: mgieseki/dvisvgm#270

I'm including the dvisvgm svg output of tikz in an html page, and I would like to be able to refer to some specific elements to eg restyle them or animate them via javascript.

To this end, it would be extremely useful if dvisvgm could add a id attribute matching the named tikz nodes & paths, algonside some class information (for instance, node, the shape -- circle, etc).

For instance,

\documentclass[tikz,dvisvgm]{standalone}

\begin{document}

\begin{tikzpicture}
    \node[draw] (node1) at (0,0) {Hello world};
    \node[draw, shape=circle] (node2) at (1,1) {Hello world 2};
    \path (node1) edge[->,name=edge1] (node2);
\end{tikzpicture}
\end{document}

would generate something like:

<?xml version='1.0' encoding='UTF-8'?>
<svg version='1.1'>
<g id='page1'>
  <g id='node1' class='node'>
    <text class='f0' >...</text>
  </g>
  <path id='edge1' class='edge' d='M-4.06023 21.59477H60.96571V35.31071H-4.06023Z' fill='none'/>
  <g id='node2' class='node circle'>
    <text class='f0'>...</text>
  </g>
</g>
</svg>

This would require tikz to expose the names to the dvisvgm backend. Would it be feasible?

Usage example

No response

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

No branches or pull requests

1 participant