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 (295,000 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 24, 2015 by enilwir (200 points)
Hello

here is what I did to incorporate this stack overflow answer for clickable nodes: http://tex.stackexchange.com/questions/36109/making-tikz-nodes-hyperlinkable/36111#36111

note that the \n2 calculation has mixed y2 and y1, I needed to swap them in my implementation below:
I also changed from \hyperlink (internal references in doc) to \href for an external url.

----
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc} %required for tikzset
\usepackage{aeguill}
\usepackage{hyperref}

\begin{document}
\tikzset{
    href node/.style={
        alias=sourcenode,
        append after command={
            let     \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\href{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}

% 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] (30pt,38.2969pt) -- (30pt,87.4375pt);
\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (88pt,38.2969pt) -- (88pt,87.4375pt);

% should have a box from (8pt,3pt) to (49pt,33.2969pt) that links to http://www.yahoo.com
% \draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (8pt,3pt) rectangle (49pt,33.2969pt);

%below right crucial for coordinate system.
%minimum width and height calcualted from x_start - x_end
\node at (8pt,3pt) [draw, color=plantucolor0000, line width=1.5pt, fill=plantucolor0001, below right, inner sep=2ex, minimum width=41pt, minimum height=30pt, href node=http://www.duckduckgo.com] {};
\node at (15pt,10pt)[below right]{Bob};
%as it stands the nice red color for border is lost, ought to be easy to fix.


\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (8pt,86.4375pt) rectangle (49pt,116.7344pt);

% should have a box from (8pt,86.4375pt) to (49pt,116.7344pt) that links to http://www.yahoo.com
\node at (15pt,93.4375pt)[below right]{Bob};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (63pt,3pt) rectangle (110pt,33.2969pt);


\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (63pt,86.4375pt) rectangle (110pt,116.7344pt);
\node at (70pt,10pt)[below right]{Alice};
\node at (70pt,93.4375pt)[below right]{Alice};
\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (76.5pt,65.2969pt) -- (86.5pt,69.2969pt) -- (76.5pt,73.2969pt) -- (80.5pt,69.2969pt) -- cycle;
\draw[color=plantucolor0000,line width=1.0pt] (30.5pt,69.2969pt) -- (82.5pt,69.2969pt);
\node at (37.5pt,52.2969pt)[below right]{hello};

\end{tikzpicture}
\end{document}
----


here I have a cliackable box between the first Bob that links to duckduckgo. The link has default border color but that can be changed.

There are several extra lines of overhead needed:
\usetikzlibrary{calc}
\tikzset{ href node .... } (15 lines)

and the clickable box (replacing background rectangle is possible)

\node at (8pt,3pt) [draw, color=plantucolor0000, line width=1.5pt, fill=plantucolor0001, below right, inner sep=2ex, minimum width=41pt, minimum height=30pt, href node=http://www.duckduckgo.com] {};

minimum width is calculated from end - start, only rough calculation in this example but it looks good.

installed a new texlive environment yesterday for up-to-date tikz that was required.




It seems like this technique can also be used in conjunction with (latex library) subfiles to include the diagram in a large pdf and have the nodes link to chapters or so in the larger pdf. I will open a new issue for subfiles integration when I have a working example.

Thank you for your help.
commented Jun 24, 2015 by plantuml (295,000 points)
Thanks for your code!

Using your directive, we've built a new beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

With the following input:

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

We now generate this latex file:

\documentclass{article}
\usepackage{tikz}
\usepackage{aeguill}
\usetikzlibrary{calc}
\usepackage{hyperref}
\begin{document}
% generated by Plantuml 8028beta4
\tikzset{
    href node/.style={
        alias=sourcenode,
        append after command={
            let \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\href{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}
\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);
\node at (8pt,3pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=39pt,minimum height=31.6094pt,href node=http://www.yahoo.com]  {};
\node at (15pt,10pt)[below right]{Bob};
%There should be a link to http://www.yahoo.com on the previous text
\node at (8pt,88.9609pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=39pt,minimum height=31.6094pt,href node=http://www.yahoo.com]  {};
\node at (15pt,95.9609pt)[below right]{Bob};
%There should be a link to http://www.yahoo.com on the previous text
\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};
%There should be a link to http://www.google.com on the previous text
\end{tikzpicture}
\end{document}


The link default border color is still there (no idea about how to remove it, or to change it).

The "hello" message should also point to http://www.google.com but once again, we need support on the exact Latex/Tikz expression for that...

Thanks again,
commented Jun 24, 2015 by enilwir (200 points)
Thank you the boxes work great on my end.

here's adapted code with a link on the "hello" text, exactly the same  can be used for "Bob" if that is needed but here the link box overlaps the word "Bob" so I see little reason to have that word be a link as well.

-----

\nofiles
\documentclass{article}
\usepackage{tikz}
\usepackage{aeguill}
\usetikzlibrary{calc}
\usepackage{hyperref}
\hypersetup{
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={green!50!black},
}

\begin{document}
% generated by Plantuml 8028beta4
\tikzset{
    href node/.style={
        alias=sourcenode,
        append after command={
            let \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\href{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}
\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);
\node at (8pt,3pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=39pt,minimum height=31.6094pt,href node=http://www.yahoo.com]  {};
\node at (15pt,10pt)[below right]{Bob};
%There should be a link to http://www.yahoo.com on the previous text
\node at (8pt,88.9609pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=39pt,minimum height=31.6094pt,href node=http://www.yahoo.com]  {};
\node at (15pt,95.9609pt)[below right]{Bob};
%There should be a link to http://www.yahoo.com on the previous text
\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]{\href{http://www.google.com}{hello} };
%There should be a link to http://www.google.com on the previous text
\end{tikzpicture}
\end{document}

-----


see \hypersetup{} for some settings, this removes the outline and changes the text color of links.

this is the syntax for letting a string/word be a link:

\node at (36.5pt,53.6094pt)[below right]{\href{http://www.google.com}{hello} };

hello is changed to a \href{url}{text} statement.

I presume that it is possible to have the arrow or line below the interaction be a link too, just like the simple boxes but for now that is overkill for me and this is very nice.

since there is different syntax for internal links and external links would it be feasible to either parse the link given in the uml: is it a valid url? or not, and have slightly different output depending on that choice.

I will provide a minimal working example as soon as possible.

Thank you
commented Jun 24, 2015 by plantuml (295,000 points)
Ok, here is a new beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar that handle texts.

About the arrow, the following directive has to be changed to add link:

\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (73pt,67.6094pt) -- (83pt,71.6094pt) -- (73pt,75.6094pt) -- (77pt,71.6094pt) -- cycle;

If you provide the Latex syntax, we would do the implementation (also the outline way be an issue in that case).

Not sure to understand your remark about internal/external link, but we'll wait for your example.

Once again, many thanks for your contribution.
And do not hesitate to post here issue, because all this has not been widely tested.
commented Jun 25, 2015 by enilwir (200 points)
Thanks for the updated text links. Works well. I notice now that only one of the Bob boxes is a link. I'm not too familiar with uml conventions but personally I'd prefer if both Bobs were links, in case the diagram is very large or so.

-- I compiled this plantuml with the newest beta
@startuml
participant Bob [[http://www.yahoo.com]]
Bob -> Alice : [[http://www.google.com]] hello
Bob -> Alice : [[interaction]] interact
@enduml
--

where interaction is given on the link syntax but is not a valid URL so I would like to handle it as a url but instead of \href{url}{text} I want \hyperlink{reference}{text} that points to a \hyperlinktarget{reference}{text} in the bulk of the document.

For stand alone diagram pdfs this is of course not relevant but I have several digrams that need to be in the same report and I'd like to link to sections explaining parts of the diagram, this interaction between bob and alice for example.

This can easily be converted to make link boxes to which was the original question of the SO thread linked above.

To embed the .latex code of the diagram in the large report I use
https://www.ctan.org/pkg/subfiles
http://ctan.uib.no/macros/latex/contrib/subfiles/subfiles.pdf

which has simple syntax that can likely be incorporated into the latex export of plantuml, maybe with a differen flag, -t_latex (standalone) and -t_latex_subfile.

a working example of the subfile document is:

parent.tex ::
\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{aeguill}
\usepackage{hyperref}
\usepackage{subfiles}

\tikzset{
    href node/.style={
        alias=sourcenode,
        append after command={
            let     \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\href{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}

\begin{document}

header text
\subfile{sublink.latex}

\clearpage
\hypertarget{pagetwo}{Page Two}
\subsection{titel}
\label{start}
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
\subsection{Interaction}
here the bob and alice interaction is described, likely some secret message transmission.
\label{interaction}
\hypertarget{interaction}{}
\end{document}

sublink.latex ::
\documentclass{parent}{}
\begin{document}
% generated by Plantuml 8028beta6
\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] (30pt,38.2969pt) -- (30pt,116.5781pt);
\draw[color=plantucolor0000,line width=1.0pt,dash pattern=on 5.0pt off 5.0pt] (104pt,38.2969pt) -- (104pt,116.5781pt);
\node at (8pt,3pt)[draw, color=plantucolor0000,fill=plantucolor0001,line width=1.5pt,below right,inner sep=2ex,minimum width=41pt,minimum height=30.2969pt,href node=http://www.yahoo.com]  {};
\node at (15pt,10pt)[below right]{Bob};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (8pt,115.5781pt) rectangle (49pt,145.875pt);
\node at (15pt,122.5781pt)[below right]{Bob};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (79pt,3pt) rectangle (126pt,33.2969pt);
\node at (86pt,10pt)[below right]{Alice};
\draw[color=plantucolor0000,fill=plantucolor0001,line width=1.5pt] (79pt,115.5781pt) rectangle (126pt,145.875pt);
\node at (86pt,122.5781pt)[below right]{Alice};
\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (92.5pt,65.2969pt) -- (102.5pt,69.2969pt) -- (92.5pt,73.2969pt) -- (96.5pt,69.2969pt) -- cycle;
\draw[color=plantucolor0000,line width=1.0pt] (30.5pt,69.2969pt) -- (98.5pt,69.2969pt);
\node at (37.5pt,52.2969pt)[below right]{\href{http://www.google.com}{hello}};
\draw[color=plantucolor0000,fill=plantucolor0000,line width=1.0pt] (92.5pt,94.4375pt) -- (102.5pt,98.4375pt) -- (92.5pt,102.4375pt) -- (96.5pt,98.4375pt) -- cycle;
\draw[color=plantucolor0000,line width=1.0pt] (30.5pt,98.4375pt) -- (98.5pt,98.4375pt);
\node at (37.5pt,81.4375pt)[below right]{\hyperlink{interaction}{interact}};
\end{tikzpicture}
\end{document}


---- notice the changed document class of the sublink. especially it needs to know which the parent document is so it can still be compiled separately by using the includes form the parent. And the \hyperlink in interaction links to a target that is present in parent.tex. Also the \tikzset is moved from the sublink file, making all the small diagram files less cluttered if many are used.

so the main task is to implement logic that checks whether the link is a valid url or not. Or if you so wish have a prefix to the link so the user can specify that this is a reference inside the document rather than an external link.

here is a compiled pdf so you can see what I mean:
http://www.wikifortio.com/737460/subfiledemo.pdf

Regards, Thanks
commented Jun 25, 2015 by enilwir (200 points)
edit: it would probably be nice to provide the name of the repoprt document as a commandline argument for it to work like

$java -jar $plantuml digrams/* -tlatex_subfile report.tex -o .diagramtex/
for a project directory:
-report.tex
-[diagrams]
------|diagram1.plantuml
------|diagram2.plantuml
-[diagramtexs]
------|diagram1.tex
------|diagram2.tex

and then the report.tex can write \subfile{diagramstexs/diagram1.tex}
to include the converted plantuml diagram with nice working links to \hypertarget{}{}s in report.tex
commented Jun 25, 2015 by plantuml (295,000 points)
Ok, we've built another beta: https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

About interaction, we propose a new syntax for URL, which make sense only in latex context.
For example, you can have:

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

In this example, the last link generates the following line:

\node at (36.5pt,83.9609pt)[below right]{\hyperlink{interaction}{interact}};

Is this what you are looking for ?
commented Jun 26, 2015 by enilwir (200 points)
Thank you that works great,

regarding subfiles, once I get it to work perfectly I'll probably write a short guide since it seems valuable for people to know how to link form uml to stuff in the report.

for now I just took the output generated from the last beta with latex:// and ran it through this script to make it suitable for subfile inclusion

texsubfilesetup.csh
---
# $1 is the input (sub) file that should be altered
# $2 is the parent file that wil include the subfile

# change documentclass{...} to [parent filename]{subfiles}
# note the change of brackets
sed -i  "s/\(\documentclass\){[a-zA-Z]*}\(\)/\1[$2]\2{subfiles}/" $1
# remove usepackages
sed -i "/\\usepackage.*/d" $1
sed -i "/\\usetikzlibrary.*/d" $1
---

One more thing, in to make participant boxes link to a refrence in the report document we need to insert this clause:

\tikzset{
    hyperlink node/.style={
        alias=sourcenode,
        append after command={
            let \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\hyperlink {#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}

it is exactly the same only the two href's have been changed to hyperlink's that take internal references rather than external.

and then to put a link box over alice:

\node at (86pt,10pt)[below right]{Alice};

\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=interaction]  {};

so instead of href node=http://www.google.com
we have hyperlink node=interaction

with latex:// stripped out.

Best regards
commented Jun 26, 2015 by plantuml (295,000 points)
Ok, here is a new beta:
 https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

It should (better) work with:

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

Tell us if the generated file looks ok, and if other modifications are needed.

Thanks for your help!
commented Jun 26, 2015 by enilwir (200 points)
edited Jun 26, 2015 by enilwir
checking now, will return, there seems to be an extra == though in

\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==interact]  {};

and the node should link to interaction and no interact. seems to be a variable exchange.

with those changed manually it works well.
commented Jun 26, 2015 by plantuml (295,000 points)
Oops, typo fixed!
You can download the last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
Thanks!
commented Jun 26, 2015 by enilwir (200 points)
edited Jun 26, 2015 by enilwir
neat.

I am sorry for the confusion about interact[ion] it was an error on my end.

now the boxes work for internal links:

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

works find the boxes over alice correctly link to the interaction hypertarget in the report.

I consider this closed now. thank you
commented Jun 26, 2015 by plantuml (295,000 points)
Ok, great. Do not hesitate to post again here if you find other issues, because there will probably have some!
commented Jun 29, 2015 by anonymous
Hi again

I have now started investigating how to link to different pdf files (compiled at the same time) and realized that the hyperref command is better than hyperlink for references inside the pdf files.

I propose to change the export of
Bob -> Alice : [[latex://resource-interaction]] interact

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

notice the change to [] brackets for the first argument.

likewise for the boxes
the preamble can be changed to
\tikzset{
    hyperref node/.style={
        alias=sourcenode,
        append after command={
            let \p1 = (sourcenode.north west),
                \p2=(sourcenode.south east),
                \n1={\x2-\x1},
                \n2={\y2-\y1} in
            node [inner sep=0pt, outer sep=0pt,anchor=north west,at=(\p1)] {\hyperref [#1]{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
                    %xelatex needs \XeTeXLinkBox, won't create a link unless it
                    %finds text --- rules don't work without \XeTeXLinkBox.
                    %Still builds correctly with pdflatex and lualatex
        }
    }
}

both hyperlink words are changed to hyperref
and the first argument is changed to [ ] brackets in
\hyperref [#1]{\XeTeX...

as an additional bonus this will latch on to regular \label{ } statements in the .tex code rather than requiring \hypertarget{}{} making it more straight forward to use.

----
I changed to resource-interaction from last example but it is not important. just a way to link to labels in another pdf file:
http://tex.stackexchange.com/questions/41539/does-hyperref-work-between-two-files
commented Jun 29, 2015 by plantuml (295,000 points)
Ok, here is the new beta with the requested modification:

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

Hope this helps!
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 (295,000 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 (295,000 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 ?
...