Jean-Marc Lasgouttes wrote:
I am trying to use fromLaTeXCommand (the version that takes two strings)
in tex2lyx but it does not work very well...
I could be wrong, but what you report certainly seems like a bug. I
think maybe around this part of the function:
// The last added char caused a mismatch, because
// we didn't exhaust the chars in cmd and didn't
// exceed the maximum size of the current unicmd
if (k < cmdend && cur_size > tmp.size())
tmp.resize(tmp.size() - 1);
we ought to check whether that last added char was alpha and, if so,
figure it's a command of some other sort.
Speaking of which, this could be very useful to me. I have just been
playing with the idea of making BibTeX entries like: {\O}ystein Linnebo,
appear correctly in the UI.
rh
When I have a command I do not know about, I try (just in case) to see
whether it is a unicode symbol I know about:
// try to see whether the string is in unicodesymbols
docstring rem;
docstring s = encodings.fromLaTeXCommand(from_utf8(t.asInput()), rem);
if (!s.empty()) {
if (!rem.empty())
cerr << "When parsing " << t.cs()
<< ", result is " << to_utf8(s)
<< "+" << to_utf8(rem) << endl;
context.check_layout(os);
os << to_utf8(s);
p.skip_spaces();
skip_braces(p); // eat {}
}
This code leads to error messages like:
When parsing centering, result is -b̧+entering
When parsing line, result is �+ine
When parsing raisebox, result is �+aisebox
So the code sees '\centering' and since there is no unicode match, it
only translates the start (\c??).
How is this supposed to work? Enrico, are you reading me?
JMarc