On Tuesday 26 March 2002 1:20 pm, Herbert Voss wrote: > Angus Leeming wrote: > > Too late. Not interested anymore ;-) Someone else can do it if they're > > feeling creative. > > here is one with the replace (means subst) from my mail > > > Herbert
Oh, come on, Herbert. What about all the other latex special chars? Can you complete this for me (the '~', '^', '\\' entries)? string const latexify(string const str) { ostringstream out; string::const_iterator it = str.begin(); string::const_iterator end = str.end(); for (; it != end; ++it) { switch (*it) { case ('$'): case ('&'): case ('%'): case ('#'): case ('_'): case ('{'): case ('}'): out << '\\' << *it; break; case ('~'): case ('^'): case ('\\'): break; default: out << *it; break; } } return out.str().c_str(); }