I need to create some hyperlinks in the PDF version of my LyX document.
Basically, they're cross references, but none of the available
cross-reference formats do what I want.

One portion of my document (article class) has \paragraphs containing chunks
of legal code.  The paragraph title is the code section and title, like:

\paragraph{53-5-703.  Board -- Membership -- Compensation -- Terms --
Duties}

Then from other places in the text I reference the statues by code section
(e.g. 53-5-703) and sometimes by sub-paragraph (e.g. 53-5-703(3)(a)).
Ideally, I'd like all those references to be hyperlinks to the text of the
statute.

The portion of the document that contains all of the statutes is an included
LaTeX file which is programmatically generated, so I can easily add labels
to every section and paragraph.  The problem is how to reference them and to
get the references formatted the way I'd like.

What I'd really like is for something like:

------------begin example----------------
\label{code:53-5-703}\paragraph{...}...
...
As can be seen in \hyperlink{code:53-5-703}{53-5-703}, the composition of
the board is...
-------------end example-----------------

where the first parameter to my hypothetical hyperlink function is the label
to be referenced and the second is the text of the reference.

I can almost make formatted references do what I want.  If I define:

\newrefformat{code}{#1}

and insert Formatted Reference cross references, then I get "code:53-5-703"
-- but it's not a hyperlink and I need to remove the "code:".  If I define:

\newrefformat{code}{\ref{#1}}

then I get a hyperlinked reference to the section containing the relevant
paragraph but (a) it's not to the paragraph itself, and the sections can be
several pages long, and (b) the text of the hyperlink is the section number
(e.g. 4.3), rather than the code section number.

Any suggestions?

Thanks,

--
Shawn