Use LaTeXName of counter in LaTeX output.

Fixes an oversight noticed by Scott.
This commit is contained in:
Richard Kimberly Heck 2020-12-05 16:23:27 -05:00
parent ae2ce7a86a
commit d31891c6bf

View File

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