I have a few places where I would like to have the name of the label output 
instead of the location
of the label.  I noticed when I looked at the script_form.lyx (from the 
examples directory) that it
did do references this way.  However I don't want all of my references done 
this way (hollywood
redefines \ref).

Is there a way to massage prettyref.sty[1] or some other style into doing the 
above when "formatted
reference" is chosen, when using article class?
Note: I am not above hacking most of the stuff out of prettyref and replacing 
with a working
solution, because I did not grab prettyref for anything other than to see if I 
could make this work.
[LyX 1.6.4]

Update while writing this email and searching... I figured it out, so in case 
someone else would
like to do this here is how I did it.

found out about \nameref [2].
Fortunately I already use hyperref.
make the changes found in prettynamepatch.txt (replace "something \ref" with 
"\nameref")
put the resulting prettyref.sty in the directory with the lyx file
use "Formatted reference" with any section, subsection or tdb labels (tdb was 
just for me testing,
but hey have fun) where you want name for the labeled section, i.e. it puts the 
labeled
[sub]section's name in where the cross reference is.

Hope this helps someone else.
Thanks to the LyX and LaTeX community for making this not to painful.

[1] I started with this one which is a bit fuller than the CTAN prettyref.
http://www-math.mit.edu/~lesha/lyx/
http://www-math.mit.edu/~lesha/lyx/prettyref.sty

[2] http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref
-- 
Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter
--- prettyref.sty.orig  2010-04-01 19:23:04.000000000 -0400
+++ prettyref.sty       2010-04-01 20:41:37.000000000 -0400
@@ -25,6 +25,7 @@
 \newrefformat{cha}{Chapter \ref{#1}}
-\newrefformat{sec}{Section \ref{#1}}
+\newrefformat{tdb}{\nameref{#1}}
+\newrefformat{sec}{\nameref{#1}}
 \newrefformat{rem}{Remark \ref{#1}}
 \newrefformat{fac}{Fact \ref{#1}}
-\newrefformat{sub}{Subsection \ref{#1}}
+\newrefformat{sub}{\nameref{#1}}
 \newrefformat{cor}{Corollary \ref{#1}}

Reply via email to