]> git.lyx.org Git - features.git/commitdiff
Use LaTeXName of counter in LaTeX output.
authorRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 5 Dec 2020 21:23:27 +0000 (16:23 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Sat, 5 Dec 2020 21:46:33 +0000 (16:46 -0500)
Fixes an oversight noticed by Scott.

src/insets/InsetCounter.cpp

index 9c27979cf7dd3e720d50d35cd28f9885bc12bcbc..a43bc60662f435e249484bdc464c8bdf97fba7f5 100644 (file)
@@ -96,23 +96,25 @@ void InsetCounter::latex(otexstream & os, OutputParams const &) const
                return;
 
        string const cmd = getCmdName();
-       docstring cntr = getParam("counter");
+       docstring const & cntr = getParam("counter");
        Counters & cnts = buffer().params().documentClass().counters();
+       docstring const & latexname = cnts.latexName(cntr);
+
        if (cmd == "set") {
                docstring const & val = getParam("value");
-               os << "\\setcounter{" << cntr << "}{" << val << "}";
+               os << "\\setcounter{" << latexname << "}{" << val << "}";
        } else if (cmd == "addto") {
                docstring const & val = getParam("value");
-               os << "\\addtocounter{" << cntr << "}{" << val << "}";
+               os << "\\addtocounter{" << latexname << "}{" << val << "}";
        } else if (cmd == "reset") {
-               os << "\\setcounter{" << cntr << "}{0}";
+               os << "\\setcounter{" << latexname << "}{0}";
        } else if (cmd == "save") {
                cnts.saveValue(cntr);
                os << "\\setcounter{" << lyxSaveCounter()
-                  << "}{\\value{" << cntr << "}}";
+                  << "}{\\value{" << latexname << "}}";
        } else if (cmd == "restore") {
                cnts.restoreValue(cntr);
-               os << "\\setcounter{" << cntr
+               os << "\\setcounter{" << latexname
                   << "}{\\value{" << lyxSaveCounter() << "}}";
        }
 }