Hello,

Coming back to refstyle again, I wrote a short example to test the recent improvements made by Danie Els to the package (as far as LyX is concerned, mostly relaxation of the requirement to load babel before refstyle).

I've posted the example as the last attachment to bug #6609 (sorry for my German in section 1.3).

While testing, I discovered that the sub: prefix was not correctly dealt with, because the fallback command (used in that case because refstyle does not know about sub: labels):
\AtBeginDocument{\providecommand\subref[1]{\ref{#1}}}
refers to a prefix-stripped label.

I've posted on bug #6609 a patch fixing this.

IMHO, LyX should provide a formatted reference for subsections (such labels must be quite frequent in standard documents) with

--- src/LaTeXFeatures.cpp.orig  2010-11-08 16:51:25.000000000 +0100
+++ src/LaTeXFeatures.cpp       2010-11-08 16:53:17.000000000 +0100
@@ -257,6 +257,9 @@
        "\\newcommand{\\ogonek}[1]{\\mathpalette\\doogonek{#1}}\n");

 static docstring const lyxref_def = from_ascii(
+               "\...@ifundefined{subref}\n"
+               "  {\\def\\RSsubtxt{subsection~}\\newref{sub}{name = 
\\RSsubtxt}}\n"
+               "  {}\n"
                "\...@ifundefined{thmref}\n"
                "  {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = 
\\RSthmtxt}}\n"
                "  {}\n"

Moreover, if I run from the root of the lyx source:
# find lib/layouts -exec grep RefPrefix {} \;|awk '{print $2}'  |sort -u
maybe there are some other prefixes which could be managed with.

As far as translations are concerned, you will notice that I added in the preamble of test_multilingual_refstyle.lyx the lines:

\RSaddto{\RSfrench}{%
\def\RSsubtxt{sous-section~}%}
\def\RSthmtxt{th\'{e}or\`{e}me~}%
}
\RSaddto{\RSgerman}{%taht
\def\RSsubtxt{Unterabschnitt~}%
\def\RSthmtxt{Lehrsatz~}%}
}

The question of how to provide the required translations for the languages is thus raised, if not done by each and every LyX user.

For languages already known to refstyle (afrikaans, danish, english, british, canadian, french, german, ngerman, austrian, naustrian, italian, norwegian, nynorsk, bokmal, norsk, portuges, brazil, swedish as of version 0.5), the \RSaddto command does it: I thought that defining a .inc file containing theses translations (and possibly also the snippet of code introduced in LaTeXFeatures.cpp) would allow translators to add their own translations, but up to now, I couldn't make it work properly.

For languages unknown to refstyle, refstyle.cfg must be changed (or copied to refstyle.def which is loaded instead of refstyle.cfg since version 0.4). Can LyX distribute the refstyle.def file ? I see a tex directory in the LyX distribution which could hold this refstyle.def file.

In that line, I think that it would be better to translate all the strings defined in refstyle (needed for inside a sentence, at the beginning of a sentence and plurals) instead of just translating the most common one. Implementation of plurals in LyX needs to be able to define ranges of references in the menu and thus quite a bit of work, but introducing formatted references at the beginning of sentences is simple (maybe just one more line in the selection of the type of the reference) so it could be implemented soon. Translation of beginning-of-sentence strings from English is NOT a simple capitalization (and I'm not sure that this was well understood by translators, see e.g. the Italian translation in refstyle.cfg).

Lastly, the par/part and cha/chap issue is still open...

--
Jean-Pierre



Reply via email to