@@ -66,10 +66,6 @@ class SpLatex
6666 return m_lines.scan_for_comment <comment_char>(ln, cprefix);
6767 }
6868
69- // ! escape special latex characters
70- static inline std::string
71- escape (const std::string& str);
72-
7369 // ! Process % SQL commands
7470 void sql (size_t ln, size_t indent, const std::string& cmdline);
7571
@@ -104,23 +100,6 @@ class SpLatex
104100 SpLatex (TextLines& lines);
105101};
106102
107- // ! escape special latex characters
108- inline std::string SpLatex::escape (const std::string& str)
109- {
110- std::string out;
111- out.reserve (str.size ());
112- for (std::string::const_iterator s = str.begin (); s != str.end (); ++s)
113- {
114- if (*s == ' #' || *s == ' $' || *s == ' %' || *s == ' ^' || *s == ' &' ||
115- *s == ' {' || *s == ' }' || *s == ' _' || *s == ' ~' || *s == ' \\ ' )
116- {
117- out += ' \\ ' ;
118- }
119- out += *s;
120- }
121- return out;
122- }
123-
124103// ! Process % SQL commands
125104void SpLatex::sql (size_t /* ln */ , size_t /* indent */ , const std::string& cmdline)
126105{
@@ -295,7 +274,8 @@ void SpLatex::multiplot(size_t ln, size_t indent, const std::string& cmdline)
295274 std::ostringstream os;
296275 for (size_t i = 0 ; i < groupcols.size (); ++i) {
297276 if (i != 0 ) os << ' ,' ;
298- os << escape (groupfields[i]) << ' =' << escape (rowgroup[i]);
277+ os << escape_latex (groupfields[i])
278+ << ' =' << escape_latex (rowgroup[i]);
299279 }
300280 legendlist.push_back (os.str ());
301281 }
0 commit comments