Add support for \Nameref alongside \NameRef

Udicoudco udifoglle at gmail.com
Sun Oct 2 23:04:27 UTC 2022


On Mon, Oct 3, 2022 at 1:19 AM madmurphy <madmurphy333 at gmail.com> wrote:
>
> Hi Udi,
>
> I was mistaken because LyX shows it as NameRef: chap:duis-feugiat-facilisis, but in reality the example attached, if exported to LaTeX, uses \nameref{...} (all lowercase). What I often find more useful however is \Nameref{...} (with a capital “N”) – you can find it too in the example attached (no need to include packages).
>
> --madmurphy

Hi madmurphy,

I've attached two files that can solve this problem with one line of
code in the preamble of the documents (in one of the attachments it's
four lines), I hope it will help.

I think that to add a support for \Nameref would be  a bit
problematic, as it's definition contains the words "on page"
explicitly, independently of the main language of the document, which
can cause unexpected results for some LyX users (especially if the
main language is a RTL language, which will cause \Nameref to output
"page on" instead of "on page").

It might be possible to define a new, rather similar command, say
\lyxNameref, that is defined as

   \newcommand\lyxNameref#1{`\nameref{#1}' \lyxonpage~\pageref{#1}}

where LyX should define \lyxpageon depending on the language the
reference is written on.

There might be another problem concerning the quotation marks in this
definition, as some languages use different quotation marks (for
instance, I usually use a Hebrew font that does not contain the glyph
`, so I would get an error using \Nameref).

Best Regards,
Udi
> lyx-devel mailing list
> lyx-devel at lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nameref_example_ref.lyx
Type: application/lyx
Size: 16488 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20221003/a92d8377/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nameref_example_nameref.lyx
Type: application/lyx
Size: 16584 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20221003/a92d8377/attachment-0003.bin>


More information about the lyx-devel mailing list