I recently tried to use an svg figure (first externalized from TikZ code to pdf and then converted to svg using Inkscape) in order to be able to use the svg in a webpage and make it somehow interactive; namely, I embedded audio files which are supposed to play while hovering with the mouse cursor on the different parts of the figure.

I recreated a much simpler example of what I'm working on, taken from the TikZ source from here at this link.

Although in the dummy example there are only a few audio files to link to the different bars, in my case the number of audio files to link was much larger. The process was, therefore, not the smoothest; namely, I had to mine the different parts of the svg file corresponding to the different bars, and include an HTML <audio> environment pointing to the right file there. (the possibility of automating the process stems from the fact that I could get the filename for each audio linked to the corresponding bar in the plot from the csv filename that I import to draw each of the bars).

At this link, I saw that someone managed to get a working solution of what I'd like to achieve, but they're using dvisvgm and that doesn't seem to work properly for me. (similarly htlatex didn't work properly either, in my case)

Therefore, I'd like to know if there's any way I could achieve something similar to what is described in the last link I shared, but using pdf2svg instead of dvisvgm. If you have other ideas on how to make this process a bit less painful, please share.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.