-----------------------
+2015-05-24 Jürgen Spitzmüller <spitz@lyx.org>
+ * Format incremented to 495: Rename sub: refprefix to subsec: in order
+ to prevent clash of \\subref command with subfloat package.
+
2015-05-24 Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 494: support more layouts in jss.layout
No new parameters.
the GUI (though some menu entries use it) as it is automatically inserted
when needed. See Section 3.4.6 of the User Guide for details.
+* The prefix for subsections in labels and references has been changed from
+ "sub:" to "subsec:" in order to avoid a clash with subfloats (conflicting
+ \subref command, see bug #7550). Files are automatically converted to the new scheme.
+ Please assure that you adapt external refstyle or prettyref definitions and
+ your own layout files.
+
!!!The following pref variables were added in 2.2:
* \save_origin:
LabelType Static
LabelCounter subsection
LabelString "Subsection \arabic{section}.\arabic{subsection}"
- RefPrefix sub
+ RefPrefix subsec
Argument 1
LabelString "Mode"
MenuString "Mode Specification|S"
End
IfStyle Subsection
- RefPrefix sub
+ RefPrefix subsec
End
IfStyle Subsubsection
- RefPrefix sub
+ RefPrefix subsec
End
IfStyle Paragraph
TopSep 0.9
BottomSep 0.5
ParSep 0.5
- RefPrefix sub
+ RefPrefix subsec
Font
Series Bold
Size Large
("1_6", list(range(277,346)), minor_versions("1.6" , 10)),
("2_0", list(range(346,414)), minor_versions("2.0" , 8)),
("2_1", list(range(414,475)), minor_versions("2.1" , 0)),
- ("2_2", list(range(475,495)), minor_versions("2.2" , 0))
+ ("2_2", list(range(475,496)), minor_versions("2.2" , 0))
]
####################################################################
k = k + 1
+def convert_subref(document):
+ " converts sub: ref prefixes to subref: "
+
+ # 1) label insets
+ rx = re.compile(r'^name \"sub:(.+)$')
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset CommandInset label", i)
+ if i == -1:
+ break
+ j = find_end_of_inset(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of Label inset at line " + str(i))
+ i += 1
+ continue
+
+ for p in range(i, j):
+ m = rx.match(document.body[p])
+ if m:
+ label = m.group(1)
+ document.body[p] = "name \"subsec:" + label
+ i += 1
+
+ # 2) xref insets
+ rx = re.compile(r'^reference \"sub:(.+)$')
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset CommandInset ref", i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of Ref inset at line " + str(i))
+ i += 1
+ continue
+
+ for p in range(i, j):
+ m = rx.match(document.body[p])
+ if m:
+ label = m.group(1)
+ document.body[p] = "reference \"subsec:" + label
+ break
+ i += 1
+
+
+
+def revert_subref(document):
+ " reverts subref: ref prefixes to sub: "
+
+ # 1) label insets
+ rx = re.compile(r'^name \"subsec:(.+)$')
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset CommandInset label", i)
+ if i == -1:
+ break
+ j = find_end_of_inset(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of Label inset at line " + str(i))
+ i += 1
+ continue
+
+ for p in range(i, j):
+ m = rx.match(document.body[p])
+ if m:
+ label = m.group(1)
+ document.body[p] = "name \"sub:" + label
+ break
+ i += 1
+
+ # 2) xref insets
+ rx = re.compile(r'^reference \"subsec:(.+)$')
+ i = 0
+ while True:
+ i = find_token(document.body, "\\begin_inset CommandInset ref", i)
+ if i == -1:
+ return
+ j = find_end_of_inset(document.body, i)
+ if j == -1:
+ document.warning("Malformed LyX document: Can't find end of Ref inset at line " + str(i))
+ i += 1
+ continue
+
+ for p in range(i, j):
+ m = rx.match(document.body[p])
+ if m:
+ label = m.group(1)
+ document.body[p] = "reference \"sub:" + label
+ break
+ i += 1
+
+
##
# Conversion hub
#
[491, []],
[492, [convert_colorbox]],
[493, []],
- [494, []]
+ [494, []],
+ [495, [convert_subref]]
]
revert = [
+ [494, [revert_subref]],
[493, [revert_jss]],
[492, [revert_mathmulticol]],
[491, [revert_colorbox]],
"\\newcommand{\\ogonek}[1]{\\mathpalette\\doogonek{#1}}\n");
static docstring const lyxref_def = from_ascii(
- "\\RS@ifundefined{subref}\n"
- " {\\def\\RSsubtxt{section~}\\newref{sub}{name = \\RSsubtxt}}\n"
+ "\\RS@ifundefined{subsecref}\n"
+ " {\\newref{subsec}{name = \\RSsectxt}}\n"
" {}\n"
"\\RS@ifundefined{thmref}\n"
" {\\def\\RSthmtxt{theorem~}\\newref{thm}{name = \\RSthmtxt}}\n"
char const * const known_refstyle_commands[] = { "algref", "chapref", "corref",
"eqref", "enuref", "figref", "fnref", "lemref", "parref", "partref", "propref",
- "secref", "subref", "tabref", "thmref", 0 };
+ "secref", "subsecref", "tabref", "thmref", 0 };
char const * const known_refstyle_prefixes[] = { "alg", "chap", "cor",
"eq", "enu", "fig", "fn", "lem", "par", "part", "prop",
- "sec", "sub", "tab", "thm", 0 };
+ "sec", "subsec", "tab", "thm", 0 };
/**
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 494 // uwestoehr jss layout changes
-#define LYX_FORMAT_TEX2LYX 494
+#define LYX_FORMAT_LYX 495 // spitz: subsection ref prefix change
+#define LYX_FORMAT_TEX2LYX 495
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER