Re: Bug #3221: nameref support

2010-08-04 Thread Richard Heck

On 08/03/2010 12:13 PM, Jean-Pierre Chrétien wrote:

Richard Heckrgheckat  comcast.net  writes:

   

On 07/16/2010 09:41 AM, Uwe Stöhr wrote:
 

So let's remove \Nameref support then.

   

Done.
 

The reference to Textual reference pluspage is still there today,
and creates an error:

insets/InsetCommandParams.cpp(256): InsetCommand: Incompatible command name .
Warning: InsetCommand Error:

Incompatible command name.

   

Fixed, I think. Thanks.

rh



Re: Bug #3221: nameref support

2010-08-04 Thread Richard Heck

On 08/03/2010 12:13 PM, Jean-Pierre Chrétien wrote:

Richard Heck  writes:

   

On 07/16/2010 09:41 AM, Uwe Stöhr wrote:
 

So let's remove \Nameref support then.

   

Done.
 

The reference to "Textual reference plus" is still there today,
and creates an error:

insets/InsetCommandParams.cpp(256): InsetCommand: Incompatible command name .
Warning: InsetCommand Error:

Incompatible command name.

   

Fixed, I think. Thanks.

rh



Re: Bug #3221: nameref support

2010-08-03 Thread Jean-Pierre Chrétien
Richard Heck rgheck at comcast.net writes:

 
 On 07/16/2010 09:41 AM, Uwe Stöhr wrote:
 
  So let's remove \Nameref support then.
 
 Done.

The reference to Textual reference plus page is still there today, 
and creates an error:

insets/InsetCommandParams.cpp(256): InsetCommand: Incompatible command name .
Warning: InsetCommand Error:

Incompatible command name.

-- 
Jean-Pierre




Re: Bug #3221: nameref support

2010-08-03 Thread Jean-Pierre Chrétien
Richard Heck  comcast.net> writes:

> 
> On 07/16/2010 09:41 AM, Uwe Stöhr wrote:
> >
> > So let's remove \Nameref support then.
> >
> Done.

The reference to "Textual reference plus " is still there today, 
and creates an error:

insets/InsetCommandParams.cpp(256): InsetCommand: Incompatible command name .
Warning: InsetCommand Error:

Incompatible command name.

-- 
Jean-Pierre




Re: Bug #3221: nameref support

2010-07-16 Thread Uwe Stöhr

Am 16.07.2010 05:28, schrieb Richard Heck:


I'm starting to think that maybe \Nameref isn't worth supporting and we
should just support \nameref.


I agree. It is impossible to support \Nameref for all languages. As it 
is, the output is only correct for (British) English documents and 
cannot be corrected for all languages we support.


 If we have \nameref, the people can of

course fake \Nameref themselves. I only put \Nameref in because it
seemed simple enough. Turns out it isn't.


So let's remove \Nameref support then.

regards Uwe


Re: Bug #3221: nameref support

2010-07-16 Thread Richard Heck

On 07/16/2010 09:41 AM, Uwe Stöhr wrote:


So let's remove \Nameref support then.


Done.

rh



Re: Bug #3221: nameref support

2010-07-16 Thread Uwe Stöhr

Am 16.07.2010 05:28, schrieb Richard Heck:


I'm starting to think that maybe \Nameref isn't worth supporting and we
should just support \nameref.


I agree. It is impossible to support \Nameref for all languages. As it 
is, the output is only correct for (British) English documents and 
cannot be corrected for all languages we support.


> If we have \nameref, the people can of

course fake \Nameref themselves. I only put \Nameref in because it
seemed simple enough. Turns out it isn't.


So let's remove \Nameref support then.

regards Uwe


Re: Bug #3221: nameref support

2010-07-16 Thread Richard Heck

On 07/16/2010 09:41 AM, Uwe Stöhr wrote:


So let's remove \Nameref support then.


Done.

rh



Re: Bug #3221: nameref support

2010-07-15 Thread Jean-Pierre Chrétien
Jean-Pierre Chrétien jeanpierre.chretien at free.fr writes:


  This will use all variants of varioref page handling.
 
 Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
 here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).
 

And to be cosnisten wit the original Nameref command

  {'\nameref{#1}` \vpageref{#1}}

which raised a new i18n issue: in French babel, this should read

 {\og \nameref{#1} \fg{} \vpageref{#1}}

As \nameref does not add quotes, nameref is itself inconsistent anyway,
so your option to remove them may be logical in fact.

-- 
Jean-Pierre








Re: Bug #3221: nameref support

2010-07-15 Thread Uwe Stöhr

 Why not

   {\nameref{#1}~\vpageref{#1}}

 This will use all variants of varioref page handling.

 Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
 here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).

Yes, this is the better solution. Thanks for having a look at this.

 And to be cosnisten wit the original Nameref command
   {'\nameref{#1}` \vpageref{#1}}
 which raised a new i18n issue: in French babel, this should read
  {\og \nameref{#1} \fg{} \vpageref{#1}}
 As \nameref does not add quotes, nameref is itself inconsistent anyway,
 so your option to remove them may be logical in fact.

Yes, we should omit the single quotes as single quotes are in many languages only allowed within 
double quotes. Quotes are also often only allowed for quotations, citations and proper names. There 
is moreover no reason why the name of the referenced section should be highlighted by quotes.


So this is the code we need to add to the preamble when \Nameref is used (not when only \nameref is 
used in the document):


\...@ifundefined{vref}{\usepackage{varioref}}{}
\AtBeginDocument{
 \renewcommand*{\Nameref}[1]
   {\nameref{#1} \vpageref{#1}}
}

Richard, can you please implement this since I don't have time for this right now and are soon in 
vacation?


thanks in advance and regards
Uwe


Re: Bug #3221: nameref support

2010-07-15 Thread Richard Heck

On 07/15/2010 09:26 PM, Uwe Stöhr wrote:


Yes, we should omit the single quotes as single quotes are in many 
languages only allowed within double quotes. Quotes are also often 
only allowed for quotations, citations and proper names. There is 
moreover no reason why the name of the referenced section should be 
highlighted by quotes.


I'm less sure about the quotes. In English, certainly, names of sections 
should definitely be in quotes. I gather that is why nameref.sty does it 
how it does it. Whether the quotes should be single or double is less 
clear and will depend upon specific conventions. So they ought to be 
customizable somehow, but this looks complicated.


I'm starting to think that maybe \Nameref isn't worth supporting and we 
should just support \nameref. If we have \nameref, the people can of 
course fake \Nameref themselves. I only put \Nameref in because it 
seemed simple enough. Turns out it isn't.


Richard



Re: Bug #3221: nameref support

2010-07-15 Thread Jean-Pierre Chrétien
Jean-Pierre Chrétien  free.fr> writes:

>
> > This will use all variants of varioref page handling.
> 
> Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
> here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).
> 

And to be cosnisten wit the original Nameref command

  {'\nameref{#1}` \vpageref{#1}}

which raised a new i18n issue: in French babel, this should read

 {\og \nameref{#1} \fg{} \vpageref{#1}}

As \nameref does not add quotes, nameref is itself inconsistent anyway,
so your option to remove them may be logical in fact.

-- 
Jean-Pierre








Re: Bug #3221: nameref support

2010-07-15 Thread Uwe Stöhr

>> Why not
>>
>>   {\nameref{#1}~\vpageref{#1}}
>>
>> This will use all variants of varioref page handling.
>
> Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
> here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).

Yes, this is the better solution. Thanks for having a look at this.

> And to be cosnisten wit the original Nameref command
>   {'\nameref{#1}` \vpageref{#1}}
> which raised a new i18n issue: in French babel, this should read
>  {\og \nameref{#1} \fg{} \vpageref{#1}}
> As \nameref does not add quotes, nameref is itself inconsistent anyway,
> so your option to remove them may be logical in fact.

Yes, we should omit the single quotes as single quotes are in many languages only allowed within 
double quotes. Quotes are also often only allowed for quotations, citations and proper names. There 
is moreover no reason why the name of the referenced section should be highlighted by quotes.


So this is the code we need to add to the preamble when \Nameref is used (not when only \nameref is 
used in the document):


\...@ifundefined{vref}{\usepackage{varioref}}{}
\AtBeginDocument{
 \renewcommand*{\Nameref}[1]
   {\nameref{#1} \vpageref{#1}}
}

Richard, can you please implement this since I don't have time for this right now and are soon in 
vacation?


thanks in advance and regards
Uwe


Re: Bug #3221: nameref support

2010-07-15 Thread Richard Heck

On 07/15/2010 09:26 PM, Uwe Stöhr wrote:


Yes, we should omit the single quotes as single quotes are in many 
languages only allowed within double quotes. Quotes are also often 
only allowed for quotations, citations and proper names. There is 
moreover no reason why the name of the referenced section should be 
highlighted by quotes.


I'm less sure about the quotes. In English, certainly, names of sections 
should definitely be in quotes. I gather that is why nameref.sty does it 
how it does it. Whether the quotes should be single or double is less 
clear and will depend upon specific conventions. So they ought to be 
customizable somehow, but this looks complicated.


I'm starting to think that maybe \Nameref isn't worth supporting and we 
should just support \nameref. If we have \nameref, the people can of 
course fake \Nameref themselves. I only put \Nameref in because it 
seemed simple enough. Turns out it isn't.


Richard



Re: Bug #3221: nameref support

2010-07-14 Thread Jean-Pierre Chrétien
Uwe Stöhr uwestoehr at web.de writes:

 
 There is another issue: The text on page is not yet translated to the
document language.
 One manually has to add this preamble code:
 
 \renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}
 
 auf Seite is hereby the German translation of on page.
 
 As this is no solution for us I propose this code instead:
 
 \...@ifundefined{vref}{\usepackage{varioref}}{}
 \AtBeginDocument{
   \renewcommand*{\Nameref}[1]
 {\nameref{#1}~\reftextfaraway{#1}}
 }

Why not

  {\nameref{#1}~\vpageref{#1}}

This will use all variants of varioref page handling.

-- 
Jean-Pierre



Re: Bug #3221: nameref support

2010-07-14 Thread Jean-Pierre Chrétien
Jean-Pierre Chrétien jeanpierre.chretien at free.fr writes:


 
 Why not
 
   {\nameref{#1}~\vpageref{#1}}
 
 This will use all variants of varioref page handling.

Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).

-- 
Jean-Pierre





Re: Bug #3221: nameref support

2010-07-14 Thread Uwe Stöhr

Am 13.07.2010 23:10, schrieb Richard Heck:


So now we just have to figure out the translation issue. Are you sure the 
nameref folks have no
interest in fixing this?


Yes, because I asked them to add this feature some time ago when i met the hyperref developer 
personally. But it is OK that the package authors don't provide this feature since they develop for 
plain LaTeX users and not LyX users. LyX users expect automatic translations as we already provide 
this feature in all other cases now.


regards Uwe

p.s. sorry for my harsh words in my previous email


Re: Bug #3221: nameref support

2010-07-14 Thread Richard Heck

On 07/14/2010 04:05 PM, Uwe Stöhr wrote:


p.s. sorry for my harsh words in my previous email

No problem, Uwe. I know you get over-animated sometimes. But you do owe 
me a beer.


rh

ps thanks for the apology, anyway.


Re: Bug #3221: nameref support

2010-07-14 Thread Uwe Stöhr

Am 14.07.2010 22:41, schrieb Richard Heck:


p.s. sorry for my harsh words in my previous email


No problem, Uwe. I know you get over-animated sometimes. But you do owe me a 
beer.


What, what, what?
You do the mistakes, I correct them, I'm the brave one speaking out the truth, fix all problems, 
propose the patches - and you call this over-animated?


OK, just joking ;-)

regards Uwe


Re: Bug #3221: nameref support

2010-07-14 Thread Jean-Pierre Chrétien
Uwe Stöhr  web.de> writes:

> 
> There is another issue: The text "on page" is not yet translated to the
document language.
> One manually has to add this preamble code:
> 
> \renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}
> 
> "auf Seite" is hereby the German translation of "on page".
> 
> As this is no solution for us I propose this code instead:
> 
> \...@ifundefined{vref}{\usepackage{varioref}}{}
> \AtBeginDocument{
>   \renewcommand*{\Nameref}[1]
> {\nameref{#1}~\reftextfaraway{#1}}
> }

Why not

  {\nameref{#1}~\vpageref{#1}}

This will use all variants of varioref page handling.

-- 
Jean-Pierre



Re: Bug #3221: nameref support

2010-07-14 Thread Jean-Pierre Chrétien
Jean-Pierre Chrétien  free.fr> writes:


> 
> Why not
> 
>   {\nameref{#1}~\vpageref{#1}}
> 
> This will use all variants of varioref page handling.

Rather  {\nameref{#1} \vpageref{#1}}, the unbrealkable space is not necessary
here (nor with \reftextfaraway in fact, page~xxx can be on the nest line).

-- 
Jean-Pierre





Re: Bug #3221: nameref support

2010-07-14 Thread Uwe Stöhr

Am 13.07.2010 23:10, schrieb Richard Heck:


So now we just have to figure out the translation issue. Are you sure the 
nameref folks have no
interest in fixing this?


Yes, because I asked them to add this feature some time ago when i met the hyperref developer 
personally. But it is OK that the package authors don't provide this feature since they develop for 
plain LaTeX users and not LyX users. LyX users expect automatic translations as we already provide 
this feature in all other cases now.


regards Uwe

p.s. sorry for my harsh words in my previous email


Re: Bug #3221: nameref support

2010-07-14 Thread Richard Heck

On 07/14/2010 04:05 PM, Uwe Stöhr wrote:


p.s. sorry for my harsh words in my previous email

No problem, Uwe. I know you get over-animated sometimes. But you do owe 
me a beer.


rh

ps thanks for the apology, anyway.


Re: Bug #3221: nameref support

2010-07-14 Thread Uwe Stöhr

Am 14.07.2010 22:41, schrieb Richard Heck:


p.s. sorry for my harsh words in my previous email


No problem, Uwe. I know you get over-animated sometimes. But you do owe me a 
beer.


What, what, what?
You do the mistakes, I correct them, I'm the brave one speaking out the truth, fix all problems, 
propose the patches - and you call this over-animated?


OK, just joking ;-)

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 05:13, schrieb Richard Heck:


I did some test and your implementation works fine for me except of
these:

1. insert a reference, select the style Textual reference and press
APPLY (don't close the dialog)
2. change the style to e.g. Textual reference plus page
Result: the apply button is not activated although you just have made
a change.


This appears to be the intended behavior, set by the disconnectOnApply()
function in GuiRef.h. It was introduced at r2786, apparently.


This is nevertheless a bug. When the user changes something in a dialog, 
the apply button must be enabled. What we currently have is illogic.



I don't understand. Why is it not possible to revert them to ERT as I
did e.g. for \makebox and flex insets?


It's a different problem. \nameref{mysec} prints the content of the
\section command to which mysec is attached---or whatever sectioning
command was active then, if one was. It would be a pain to try to figure
out which section that was supposed to be, and it is impossible, in the
general case, if we don't know what the sectioning commands are---which
we don't if we don't have layout information. And then, even if we did
know, we'd have to hardcode the name.


I still don't get it. LyX 2.0 creates this LaTeX code:

\begin_inset CommandInset ref
LatexCommand nameref
reference sec:dsf
\end_inset

We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset

That's what I have done for \makebox and other insets.

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 05:23, schrieb Richard Heck:


There is another issue: The text on page is not yet translated to
the document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

auf Seite is hereby the German translation of on page.


This looks like a bug of sorts in nameref.sty.


This is not a bug but a missing feature. nameref doesn't provide 
translations and will also not do this in future versions. So it's up to 
us to do this.


In contrary to nameref, varioref provides translations and my proposed 
code uses varioref's translation feature.


I'm not happy that you already applied your patch because there are 
still 2 open issues we must fix:


1. the lyx2lyx issue
2. the translation issue

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 13:59, schrieb Uwe Stöhr:


We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset


Sorry, I meant to convert it to

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
nameref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 08:11 AM, Uwe Stöhr wrote:

Am 13.07.2010 13:59, schrieb Uwe Stöhr:


We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset


Sorry, I meant to convert it to
[...snip...]

Again, this isn't the issue. What I do has the same effect, is simpler, 
and doesn't use ERT: I just convert the command from \nameref to \ref or 
\Nameref to \vref. The point is that this does not produce the same 
output as \nameref does and there is no reasonable way to do this.


Richard



Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 08:06 AM, Uwe Stöhr wrote:

Am 13.07.2010 05:23, schrieb Richard Heck:


There is another issue: The text on page is not yet translated to
the document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

auf Seite is hereby the German translation of on page.


This looks like a bug of sorts in nameref.sty.


This is not a bug but a missing feature. nameref doesn't provide 
translations and will also not do this in future versions. So it's up 
to us to do this.


In contrary to nameref, varioref provides translations and my proposed 
code uses varioref's translation feature.


I'm not happy that you already applied your patch because there are 
still 2 open issues we must fix:


1. the lyx2lyx issue
2. the translation issue

There's no lyx2lyx issue, and the translation issue can be addressed 
independently. You're welcome to add your code if you wish, though I'd 
like to hear from other people on the issue first. Could you post the 
relevant patch for comment?


Richard



Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 15:47, schrieb Richard Heck:


Again, this isn't the issue. What I do has the same effect,


No, it has not, the suer gets a number instead of the name of the reference.


is simpler,
and doesn't use ERT: I just convert the command from \nameref to \ref or
\Nameref to \vref. The point is that this does not produce the same
output as \nameref does and there is no reasonable way to do this.


But this is the reason why this is no option. lyx2lyx has to produce the 
same output if possible. And it is possible - by reverting to ERT.


regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 15:50, schrieb Richard Heck:


There's no lyx2lyx issue,


There is, see my previous mail! OK, I'll change the lyx2lyx routine so 
that the result gives the same output for the user.



and the translation issue can be addressed
independently. You're welcome to add your code if you wish,


Sorry, but I have the feeling that you are a bit lazy with your patch. 
If we are not able to translate the reference text, the new feature 
turns into a bug as it then only works for English documents. I 
therefore wanted to solve this issue before applying.



Could you post the relevant patch for comment?


I already sent you the code we need to add to the preamble.

 I'd like to hear from other people on the issue first.

Ditto.

Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Pavel Sanda
Uwe Stöhr wrote:
 is simpler,
 and doesn't use ERT: I just convert the command from \nameref to \ref or
 \Nameref to \vref. The point is that this does not produce the same
 output as \nameref does and there is no reasonable way to do this.

 But this is the reason why this is no option. lyx2lyx has to produce the 
 same output if possible. And it is possible - by reverting to ERT.

imho the main point of lyx2lyx is to be _backward_ compatible.  while we allow
forward compatibility in some cases i understand it as above-standard care -
anybody should understand that older versions of sofware don't support new
features of later versions.

if the reversion is a simple thing why not, if its some ERT beast i don't see
it as essential. in some cases this can bring more compatibility problems than
we are trying to solve - we had this dicussion already for hyperref support
where i considered filling hyperref stuff into preamble for 1.5 documents as
more harmful than helpful.

what 'simple' means is of course matter of flames ;)

pavel


Re: Bug #3221: nameref support

2010-07-13 Thread Pavel Sanda
Uwe Stöhr wrote:
 Sorry, but I have the feeling that you are a bit lazy with your patch. If 
 we are not able to translate the reference text, the new feature turns into 
 a bug as it then only works for English documents. I therefore wanted to 
 solve this issue before applying.





 Could you post the relevant patch for comment?

 I already sent you the code we need to add to the preamble.

  I'd like to hear from other people on the issue first.

disclaimer first - i know nothing about the subtleties of varisous XXXref
commands... anyway tend to agree here with Richard to consider this as nameref
bug. if nameref devs do not plan to fix/advance their work its question whether
our dependency on this package was good move(?).

how this translation should be supplied by the way?

pavel


Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 12:13 PM, Pavel Sanda wrote:


disclaimer first - i know nothing about the subtleties of varisous XXXref
commands... anyway tend to agree here with Richard to consider this as nameref
bug. if nameref devs do not plan to fix/advance their work its question whether
our dependency on this package was good move(?).

   
We already have it, because it's part of hyperref. I can remove the 
support for \Nameref, if this seems a big deal. The \nameref command was 
what I really wanted (what some users really wanted, that is). \Nameref 
is just: \nameref{#1} on page \pageref{#1}.



how this translation should be supplied by the way?

   

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg160696.html

Via the validation mechanism, I'd suppose.

rh



Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 11:30 AM, Uwe Stöhr wrote:

Am 13.07.2010 15:47, schrieb Richard Heck:


Again, this isn't the issue. What I do has the same effect,


No, it has not, the suer gets a number instead of the name of the 
reference.


Sorry, I missed the difference between your first proposal and your 
second one. The first had \vref (as I did) instead of \nameref, so you 
can see why I was confused. I see what you had in mind now, and it's a 
sensible idea. I've done it. Note that it's actually easier than with 
makebox since it's all LaTeX code already.


So now we just have to figure out the translation issue. Are you sure 
the nameref folks have no interest in fixing this?


Richard



Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 05:13, schrieb Richard Heck:


I did some test and your implementation works fine for me except of
these:

1. insert a reference, select the style "Textual reference" and press
APPLY (don't close the dialog)
2. change the style to e.g. "Textual reference plus "
Result: the apply button is not activated although you just have made
a change.


This appears to be the intended behavior, set by the disconnectOnApply()
function in GuiRef.h. It was introduced at r2786, apparently.


This is nevertheless a bug. When the user changes something in a dialog, 
the apply button must be enabled. What we currently have is illogic.



I don't understand. Why is it not possible to revert them to ERT as I
did e.g. for \makebox and flex insets?


It's a different problem. \nameref{mysec} prints the content of the
\section command to which mysec is attached---or whatever sectioning
command was active then, if one was. It would be a pain to try to figure
out which section that was supposed to be, and it is impossible, in the
general case, if we don't know what the sectioning commands are---which
we don't if we don't have layout information. And then, even if we did
know, we'd have to hardcode the name.


I still don't get it. LyX 2.0 creates this LaTeX code:

\begin_inset CommandInset ref
LatexCommand nameref
reference "sec:dsf"
\end_inset

We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset

That's what I have done for \makebox and other insets.

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 05:23, schrieb Richard Heck:


There is another issue: The text "on page" is not yet translated to
the document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

"auf Seite" is hereby the German translation of "on page".


This looks like a bug of sorts in nameref.sty.


This is not a bug but a missing feature. nameref doesn't provide 
translations and will also not do this in future versions. So it's up to 
us to do this.


In contrary to nameref, varioref provides translations and my proposed 
code uses varioref's translation feature.


I'm not happy that you already applied your patch because there are 
still 2 open issues we must fix:


1. the lyx2lyx issue
2. the translation issue

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 13:59, schrieb Uwe Stöhr:


We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset


Sorry, I meant to convert it to

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
nameref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset

regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 08:11 AM, Uwe Stöhr wrote:

Am 13.07.2010 13:59, schrieb Uwe Stöhr:


We can easily convert this to:

\begin_inset ERT
status collapsed
\begin_layout Plain Layout
\backslash
vref{
\end_layout
\end_inset

sec:dsf
\begin_inset ERT
status collapsed
\begin_layout Plain Layout
}
\end_layout
\end_inset


Sorry, I meant to convert it to
[...snip...]

Again, this isn't the issue. What I do has the same effect, is simpler, 
and doesn't use ERT: I just convert the command from \nameref to \ref or 
\Nameref to \vref. The point is that this does not produce the same 
output as \nameref does and there is no reasonable way to do this.


Richard



Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 08:06 AM, Uwe Stöhr wrote:

Am 13.07.2010 05:23, schrieb Richard Heck:


There is another issue: The text "on page" is not yet translated to
the document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

"auf Seite" is hereby the German translation of "on page".


This looks like a bug of sorts in nameref.sty.


This is not a bug but a missing feature. nameref doesn't provide 
translations and will also not do this in future versions. So it's up 
to us to do this.


In contrary to nameref, varioref provides translations and my proposed 
code uses varioref's translation feature.


I'm not happy that you already applied your patch because there are 
still 2 open issues we must fix:


1. the lyx2lyx issue
2. the translation issue

There's no lyx2lyx issue, and the translation issue can be addressed 
independently. You're welcome to add your code if you wish, though I'd 
like to hear from other people on the issue first. Could you post the 
relevant patch for comment?


Richard



Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 15:47, schrieb Richard Heck:


Again, this isn't the issue. What I do has the same effect,


No, it has not, the suer gets a number instead of the name of the reference.


is simpler,
and doesn't use ERT: I just convert the command from \nameref to \ref or
\Nameref to \vref. The point is that this does not produce the same
output as \nameref does and there is no reasonable way to do this.


But this is the reason why this is no option. lyx2lyx has to produce the 
same output if possible. And it is possible - by reverting to ERT.


regards Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Uwe Stöhr

Am 13.07.2010 15:50, schrieb Richard Heck:


There's no lyx2lyx issue,


There is, see my previous mail! OK, I'll change the lyx2lyx routine so 
that the result gives the same output for the user.



and the translation issue can be addressed
independently. You're welcome to add your code if you wish,


Sorry, but I have the feeling that you are a bit lazy with your patch. 
If we are not able to translate the reference text, the new feature 
turns into a bug as it then only works for English documents. I 
therefore wanted to solve this issue before applying.



Could you post the relevant patch for comment?


I already sent you the code we need to add to the preamble.

> I'd like to hear from other people on the issue first.

Ditto.

Uwe


Re: Bug #3221: nameref support

2010-07-13 Thread Pavel Sanda
Uwe Stöhr wrote:
>> is simpler,
>> and doesn't use ERT: I just convert the command from \nameref to \ref or
>> \Nameref to \vref. The point is that this does not produce the same
>> output as \nameref does and there is no reasonable way to do this.
>
> But this is the reason why this is no option. lyx2lyx has to produce the 
> same output if possible. And it is possible - by reverting to ERT.

imho the main point of lyx2lyx is to be _backward_ compatible.  while we allow
forward compatibility in some cases i understand it as above-standard care -
anybody should understand that older versions of sofware don't support new
features of later versions.

if the reversion is a simple thing why not, if its some ERT beast i don't see
it as essential. in some cases this can bring more compatibility problems than
we are trying to solve - we had this dicussion already for hyperref support
where i considered filling hyperref stuff into preamble for 1.5 documents as
more harmful than helpful.

what 'simple' means is of course matter of flames ;)

pavel


Re: Bug #3221: nameref support

2010-07-13 Thread Pavel Sanda
Uwe Stöhr wrote:
> Sorry, but I have the feeling that you are a bit lazy with your patch. If 
> we are not able to translate the reference text, the new feature turns into 
> a bug as it then only works for English documents. I therefore wanted to 
> solve this issue before applying.




>
>> Could you post the relevant patch for comment?
>
> I already sent you the code we need to add to the preamble.
>
> > I'd like to hear from other people on the issue first.

disclaimer first - i know nothing about the subtleties of varisous XXXref
commands... anyway tend to agree here with Richard to consider this as nameref
bug. if nameref devs do not plan to fix/advance their work its question whether
our dependency on this package was good move(?).

how this translation should be supplied by the way?

pavel


Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 12:13 PM, Pavel Sanda wrote:


disclaimer first - i know nothing about the subtleties of varisous XXXref
commands... anyway tend to agree here with Richard to consider this as nameref
bug. if nameref devs do not plan to fix/advance their work its question whether
our dependency on this package was good move(?).

   
We already have it, because it's part of hyperref. I can remove the 
support for \Nameref, if this seems a big deal. The \nameref command was 
what I really wanted (what some users really wanted, that is). \Nameref 
is just: \nameref{#1} on page \pageref{#1}.



how this translation should be supplied by the way?

   

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg160696.html

Via the validation mechanism, I'd suppose.

rh



Re: Bug #3221: nameref support

2010-07-13 Thread Richard Heck

On 07/13/2010 11:30 AM, Uwe Stöhr wrote:

Am 13.07.2010 15:47, schrieb Richard Heck:


Again, this isn't the issue. What I do has the same effect,


No, it has not, the suer gets a number instead of the name of the 
reference.


Sorry, I missed the difference between your first proposal and your 
second one. The first had \vref (as I did) instead of \nameref, so you 
can see why I was confused. I see what you had in mind now, and it's a 
sensible idea. I've done it. Note that it's actually easier than with 
makebox since it's all LaTeX code already.


So now we just have to figure out the translation issue. Are you sure 
the nameref folks have no interest in fixing this?


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 06:00 PM, Richard Heck wrote:


The attached patch implements nameref support in cross-references. The 
only thing I'm not sure about, which Uwe mentioned in the bug, is the 
precise loading order of packages. If we're loading hyperref anyway, 
then there's no issue, since it loads nameref. But if we aren't, then 
maybe nameref should be loaded after babel. Any views?


One other thing. I propose to revert \nameref to \ref and \Nameref to 
\vref. I don't see any way to revert them to anything better without a 
lot of effort, and even then we couldn't do it in a generally reliable 
fashion without access to layout information, which we don't have in 
lyx2lyx.


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Uwe Stöhr

There is another issue: The text on page is not yet translated to the 
document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

auf Seite is hereby the German translation of on page.

As this is no solution for us I propose this code instead:

\...@ifundefined{vref}{\usepackage{varioref}}{}
\AtBeginDocument{
 \renewcommand*{\Nameref}[1]
   {\nameref{#1}~\reftextfaraway{#1}}
}


regards Uwe


Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 10:04 PM, Uwe Stöhr wrote:
 The only thing I'm not sure about, which Uwe mentioned in the bug, 
is the precise loading order of packages.


This doesn't seem to be an issue with the new nameref version because 
the former conflicts with memoir and varioref are resolved.



OK, good.

I did some test and your implementation works fine for me except of 
these:


1. insert a reference, select the style Textual reference and press 
APPLY (don't close the dialog)

2. change the style to e.g. Textual reference plus page
Result: the apply button is not activated although you just have made 
a change.


This appears to be the intended behavior, set by the disconnectOnApply() 
function in GuiRef.h. It was introduced at r2786, apparently.


Besides this, the 2 new styles don't appear in the reference context 
menu while all other styles do.



I'll fix that.

 One other thing. I propose to revert \nameref to \ref and \Nameref 
to \vref.
 I don't see any way to revert them to anything better without a lot 
of effort, and even then we
 couldn't do it in a generally reliable fashion without access to 
layout information, which we

 don't have in lyx2lyx.

I don't understand. Why is it not possible to revert them to ERT as I 
did e.g. for \makebox and flex insets?


It's a different problem. \nameref{mysec} prints the content of the 
\section command to which mysec is attached---or whatever sectioning 
command was active then, if one was. It would be a pain to try to figure 
out which section that was supposed to be, and it is impossible, in the 
general case, if we don't know what the sectioning commands are---which 
we don't if we don't have layout information. And then, even if we did 
know, we'd have to hardcode the name.


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 10:51 PM, Uwe Stöhr wrote:
There is another issue: The text on page is not yet translated to 
the document language.

One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

auf Seite is hereby the German translation of on page.

This looks like a bug of sorts in nameref.sty. Shouldn't we instead try 
to get them to fix it? That's what I've usually been told when I run 
across this sort of thing.


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 06:00 PM, Richard Heck wrote:


The attached patch implements nameref support in cross-references. The 
only thing I'm not sure about, which Uwe mentioned in the bug, is the 
precise loading order of packages. If we're loading hyperref anyway, 
then there's no issue, since it loads nameref. But if we aren't, then 
maybe nameref should be loaded after babel. Any views?


One other thing. I propose to revert \nameref to \ref and \Nameref to 
\vref. I don't see any way to revert them to anything better without a 
lot of effort, and even then we couldn't do it in a generally reliable 
fashion without access to layout information, which we don't have in 
lyx2lyx.


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Uwe Stöhr

There is another issue: The text "on page" is not yet translated to the 
document language.
One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

"auf Seite" is hereby the German translation of "on page".

As this is no solution for us I propose this code instead:

\...@ifundefined{vref}{\usepackage{varioref}}{}
\AtBeginDocument{
 \renewcommand*{\Nameref}[1]
   {\nameref{#1}~\reftextfaraway{#1}}
}


regards Uwe


Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 10:04 PM, Uwe Stöhr wrote:
> The only thing I'm not sure about, which Uwe mentioned in the bug, 
is the precise loading order of packages.


This doesn't seem to be an issue with the new nameref version because 
the former conflicts with memoir and varioref are resolved.



OK, good.

I did some test and your implementation works fine for me except of 
these:


1. insert a reference, select the style "Textual reference" and press 
APPLY (don't close the dialog)

2. change the style to e.g. "Textual reference plus "
Result: the apply button is not activated although you just have made 
a change.


This appears to be the intended behavior, set by the disconnectOnApply() 
function in GuiRef.h. It was introduced at r2786, apparently.


Besides this, the 2 new styles don't appear in the reference context 
menu while all other styles do.



I'll fix that.

> One other thing. I propose to revert \nameref to \ref and \Nameref 
to \vref.
> I don't see any way to revert them to anything better without a lot 
of effort, and even then we
> couldn't do it in a generally reliable fashion without access to 
layout information, which we

> don't have in lyx2lyx.

I don't understand. Why is it not possible to revert them to ERT as I 
did e.g. for \makebox and flex insets?


It's a different problem. \nameref{mysec} prints the content of the 
\section command to which mysec is attached---or whatever sectioning 
command was active then, if one was. It would be a pain to try to figure 
out which section that was supposed to be, and it is impossible, in the 
general case, if we don't know what the sectioning commands are---which 
we don't if we don't have layout information. And then, even if we did 
know, we'd have to hardcode the name.


Richard



Re: Bug #3221: nameref support

2010-07-12 Thread Richard Heck

On 07/12/2010 10:51 PM, Uwe Stöhr wrote:
There is another issue: The text "on page" is not yet translated to 
the document language.

One manually has to add this preamble code:

\renewcommand*\Nameref[1]{`\nameref{#1}' auf Seite~\pageref{#1}}

"auf Seite" is hereby the German translation of "on page".

This looks like a bug of sorts in nameref.sty. Shouldn't we instead try 
to get them to fix it? That's what I've usually been told when I run 
across this sort of thing.


Richard