mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
LaTeXName tag for counters. Layout format change.
This commit is contained in:
parent
4f8cfca117
commit
ae2ce7a86a
@ -138,6 +138,7 @@ logicalmkup
|
||||
\docbook_table_output 0
|
||||
\author -970929547 "Thibaut Cuvelier"
|
||||
\author -712698321 "Jürgen Spitzmüller"
|
||||
\author -584632292 "Richard Kimberly Heck"
|
||||
\author -495245474 "Jean-Marc Lasgouttes"
|
||||
\author 5863208 "ab"
|
||||
\author 232239728 "Owner"
|
||||
@ -22877,7 +22878,7 @@ string
|
||||
\end_inset
|
||||
|
||||
=
|
||||
\begin_inset Quotes erd
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
@ -22895,6 +22896,51 @@ LabelString
|
||||
\end_inset
|
||||
|
||||
, but for use in the Appendix.
|
||||
\change_inserted -584632292 1607202551
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
||||
\change_inserted -584632292 1607202682
|
||||
\begin_inset Flex Code
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
LaTeXName
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
[
|
||||
\begin_inset Flex Code
|
||||
status open
|
||||
|
||||
\begin_layout Plain Layout
|
||||
|
||||
\change_inserted -584632292 1607202576
|
||||
string
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\end_inset
|
||||
|
||||
=
|
||||
\begin_inset Quotes eld
|
||||
\end_inset
|
||||
|
||||
|
||||
\begin_inset Quotes erd
|
||||
\end_inset
|
||||
|
||||
] The counter name as used in \SpecialChar LaTeX
|
||||
.
|
||||
(E.g., in \SpecialChar LyX
|
||||
, there is a counter named `theorem', but it is output to \SpecialChar LaTeX
|
||||
as `thm'.)
|
||||
\change_unchanged
|
||||
|
||||
\end_layout
|
||||
|
||||
\begin_layout Description
|
||||
|
@ -11,7 +11,7 @@
|
||||
# This script will update a .layout file to current format
|
||||
|
||||
# The latest layout format is also defined in src/TextClass.cpp
|
||||
currentFormat = 88
|
||||
currentFormat = 89
|
||||
|
||||
|
||||
# Incremented to format 4, 6 April 2007, lasgouttes
|
||||
@ -301,6 +301,9 @@ currentFormat = 88
|
||||
# Incremented to format 88, 28 November 2020 by tcuvelier
|
||||
# New tag DocBookNotInPara.
|
||||
|
||||
# Incremented to format 89, 5 December 2020 by rkh
|
||||
# New tag LaTeXName for counters
|
||||
|
||||
# Do not forget to document format change in Customization
|
||||
# Manual (section "Declaring a new text class").
|
||||
|
||||
@ -551,7 +554,7 @@ def convert(lines, end_format):
|
||||
i += 1
|
||||
continue
|
||||
|
||||
if 87 <= format <= 88:
|
||||
if 87 <= format <= 89:
|
||||
# nothing to do.
|
||||
i += 1
|
||||
continue
|
||||
|
@ -59,6 +59,7 @@ bool Counter::read(Lexer & lex)
|
||||
CT_PRETTYFORMAT,
|
||||
CT_INITIALVALUE,
|
||||
CT_GUINAME,
|
||||
CT_LATEXNAME,
|
||||
CT_END
|
||||
};
|
||||
|
||||
@ -68,6 +69,7 @@ bool Counter::read(Lexer & lex)
|
||||
{ "initialvalue", CT_INITIALVALUE},
|
||||
{ "labelstring", CT_LABELSTRING },
|
||||
{ "labelstringappendix", CT_LABELSTRING_APPENDIX },
|
||||
{ "latexname", CT_LATEXNAME },
|
||||
{ "prettyformat", CT_PRETTYFORMAT },
|
||||
{ "within", CT_WITHIN }
|
||||
};
|
||||
@ -120,6 +122,10 @@ bool Counter::read(Lexer & lex)
|
||||
lex.next();
|
||||
guiname_ = lex.getDocString();
|
||||
break;
|
||||
case CT_LATEXNAME:
|
||||
lex.next();
|
||||
latexname_ = lex.getDocString();
|
||||
break;
|
||||
case CT_END:
|
||||
getout = true;
|
||||
break;
|
||||
@ -374,6 +380,22 @@ docstring const & Counters::guiName(docstring const & cntr) const
|
||||
}
|
||||
|
||||
|
||||
docstring const & Counters::latexName(docstring const & cntr) const
|
||||
{
|
||||
CounterList::const_iterator it = counterList_.find(cntr);
|
||||
if (it == counterList_.end()) {
|
||||
lyxerr << "step: Counter does not exist: "
|
||||
<< to_utf8(cntr) << endl;
|
||||
return empty_docstring();
|
||||
}
|
||||
|
||||
docstring const & latexname = it->second.latexName();
|
||||
if (latexname.empty())
|
||||
return cntr;
|
||||
return latexname;
|
||||
}
|
||||
|
||||
|
||||
void Counters::reset()
|
||||
{
|
||||
appendix_ = false;
|
||||
|
@ -69,6 +69,8 @@ public:
|
||||
docstring const & prettyFormat() const { return prettyformat_; }
|
||||
///
|
||||
docstring const & guiName() const { return guiname_; }
|
||||
///
|
||||
docstring const & latexName() const { return latexname_; }
|
||||
|
||||
/// Returns a map of LaTeX-like strings to format the counter.
|
||||
/** For each language, the string is similar to what one gets
|
||||
@ -101,6 +103,8 @@ private:
|
||||
docstring prettyformat_;
|
||||
///
|
||||
docstring guiname_;
|
||||
/// The name used for the counter in LaTeX
|
||||
docstring latexname_;
|
||||
/// Cache of the labelstring with \\the<counter> expressions expanded,
|
||||
/// indexed by language
|
||||
mutable StringMap flatlabelstring_;
|
||||
@ -177,6 +181,8 @@ public:
|
||||
std::string const & lang) const;
|
||||
///
|
||||
docstring const & guiName(docstring const & cntr) const;
|
||||
///
|
||||
docstring const & latexName(docstring const & cntr) const;
|
||||
/// Are we in appendix?
|
||||
bool appendix() const { return appendix_; }
|
||||
/// Set the state variable indicating whether we are in appendix.
|
||||
|
@ -59,7 +59,7 @@ namespace lyx {
|
||||
// You should also run the development/tools/updatelayouts.py script,
|
||||
// to update the format of all of our layout files.
|
||||
//
|
||||
int const LAYOUT_FORMAT = 88; // tcuvelier: add DocBookNotInPara
|
||||
int const LAYOUT_FORMAT = 89; // rkh: LaTeXName for counters
|
||||
|
||||
|
||||
// Layout format for the current lyx file format. Controls which format is
|
||||
|
Loading…
Reference in New Issue
Block a user