Skip to content

Commit 36942f2

Browse files
committed
HTML export/Mathjax: Dont remove 1st/last label char (#2003).
The \tag{} character adds parentheses, an automatic label has them already, remove them only in the case of automatic labels. Before the first and last char was removed for all labels.
1 parent 809b014 commit 36942f2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cells/TextCell.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,13 @@ wxString TextCell::ToTeX() const {
960960
if (GetPrevious())
961961
conditionalLinebreak = wxS("\\]\n\\[");
962962
text.Trim(true);
963-
wxString label = text.SubString(1, text.Length() - 2);
963+
// A automatically generated output label contains a "(" and ")", the "\tag{}" does also add them,
964+
// remove them in the case of standard label "(%onn)".
965+
wxString label = text;
966+
if (GetTextStyle() == TS_LABEL) {
967+
label.Replace(wxS("("), wxS(""));
968+
label.Replace(wxS(")"), wxS(""));
969+
}
964970
text = conditionalLinebreak + wxS("\\tag{") + label + wxS("}");
965971
label.Replace(wxS("\\% "), wxS(""));
966972
// Would be a good idea, but apparently breaks mathJaX

0 commit comments

Comments
 (0)