export to tikz loses links

0 votes
asked Jun 22, 2015 in Bug by enilwir (200 points)
Hello

I am trying to export a diagram into tikz with links.

using the link example from http://plantuml.sourceforge.net/qa/?qa=90/web-links-in-generated-images-e-g-using-image-maps

@startuml
participant Bob [[http://www.yahoo.com]]
Bob -> Alice : [[http://www.google.com]] hello
@enduml

 

and running in a script

java -jar $PLANTUMLJAR $1 -o ../latexs/ -tlatex

 

yields a .latex file with a nice diagram but the links are lost in the process.

i e we get a line \node at (15pt,93.4375pt)[below right]{Bob};

where I would like to replace "Bob" with \href{http://www.yahoo.com}{Bob};

and add \usepackage{hyperref} in the preamble.

 

-

I tried replacing "Bob" in the diagram with "\href{http://www.google.com}{Bob}" and manually added the \usepackage{hyperref} to the top of the .latex file which generated a diagram with links saying bob, but the node size is then based on the full  string length of the href statement (like 6 times to large).

 

Thanks in advance

1 Answer

0 votes
answered Jun 22, 2015 by plantuml (277,020 points)
selected Jun 26, 2015 by enilwir
 
Best answer

Unfortunatly, we are not Latex nor Tikz expert here.

However, we have build a new beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

This beta adds some information when links are present in the source.

With you example, this beta generates the following file:

\documentclass{article}
\usepackage{tikz}
\usepackage{aeguill}
\usepackage{hyperref}
\begin{document}
% generated by Plantuml 8028beta1
\definecolor{plantucolor0000}{RGB}{168,0,54}
\definecolor{plantucolor0001}{RGB}{254,254,206}
\begin{tikzpicture}[yscale=-1]
\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (29pt,39.6094pt) -- (29pt,89.9609pt);
\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (85pt,39.6094pt) -- (85pt,89.9609pt);
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (8pt,3pt) rectangle (47pt,34.6094pt);
% should have a box from (8pt,3pt) to (47pt,34.6094pt) that links to http://www.yahoo.com
\node at (15pt,10pt)[below right]{Bob};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (8pt,88.9609pt) rectangle (47pt,120.5703pt);
% should have a box from (8pt,88.9609pt) to (47pt,120.5703pt) that links to http://www.yahoo.com
\node at (15pt,95.9609pt)[below right]{Bob};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (61pt,3pt) rectangle (105pt,34.6094pt);
\node at (68pt,10pt)[below right]{Alice};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (61pt,88.9609pt) rectangle (105pt,120.5703pt);
\node at (68pt,95.9609pt)[below right]{Alice};
\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (73pt,67.6094pt) -- (83pt,71.6094pt) -- (73pt,75.6094pt) -- (77pt,71.6094pt) -- cycle;
\draw[color=plantucolor0000,line width=1.0pt] (29.5pt,71.6094pt) -- (79pt,71.6094pt);
\node at (36.5pt,53.6094pt)[below right]{hello};
\end{tikzpicture}
\end{document}

 

We need now to have some help : if anyone knows how to change the lines:

% should have a box from (8pt,3pt) to (47pt,34.6094pt) that links to http://www.yahoo.com

To some valid Tikz expression, please post here!

Regards,

commented Jun 30, 2015 by anonymous
yes. the preamble is nice now,

only when the calling statements also need hyperref rather than hyperlink:

\node at (37.5pt,81.4375pt)[below right]{\hyperlink{resource-interaction}{interact}};

should be

\node at (37.5pt,81.4375pt)[below right]{\hyperref[resource-interaction]{interact}};

and

\node at (79pt,115.5781pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=47pt,minimum height=30.2969pt,hyperlink node=resource-interaction]  {};

should be

\node at (79pt,115.5781pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=47pt,minimum height=30.2969pt,hyperref node=resource-interaction]  {};

in both hyperlink was changed to hyperref, note the [ ] brackets in the first.

Thanks

//// this is the plantuml file I have
@startuml
participant Bob [[http://www.yahoo.com]]
participant Alice [[latex://resource-interaction]]
Bob -> Alice : [[http://www.google.com]] hello
Bob -> Alice : [[latex://resource-interaction]] interact
@enduml
commented Jun 30, 2015 by plantuml (277,020 points)
Ok, thanks for the feedback. Please find the new beta here:
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
Regards,
commented Jun 30, 2015 by anonymous
Thank you that works.
commented Jun 30, 2015 by enilwir (200 points)
It seems that when this beta is used to export svg files the latex links are still included.

I would make this toggleable with default disable of these latex links, I have seen references to ways to catch these links when importing to pdfs or larger latex documents, but unless the svg file is just a stepping stone in a longer conversion chain those latex links are unnecessary.

The inkscape installation here is too old but I'd be interested in seeing how latex:// links work with http://ctan.uib.no/info/svg-inkscape/InkscapePDFLaTeX.pdf
commented Jun 30, 2015 by plantuml (277,020 points)
In last beta, latex links are not exported to SVG (they are just ignored).

https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

Sounds better ?
...