Re: Proposal for improving \left and \right handling
Enrico Forestieri <[email protected]> Tue, 22 Nov 2005 22:18:10 +0100 (CET)
| Newsgroups | gmane.comp.tex.latex.latex2rtf.devel |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 21 Nov 2005 20:57:03 -0800, Scott Prahl wrote:
>=20
> On Nov 14, 2005, at 4:43 PM, Enrico Forestieri wrote:
>=20
>> I noticed that latex2rtf does not correctly translate math constructs
>> such as \left\Vert ... \right\Vert or \left\langle ... \right=20
>> \rangle.
>>
>> Example:
>>
>> \documentclass{article}
>> \begin{document}
>> $$
>> y=3D\left\Vert x \right\Vert^2
>> $$
>> \end{document}
>>
>>
>> I include here a patch for evaluation and possible inclusion in the =20
>> sources.
>=20
> Thanks for the test case and patch. I did not use your patch because =20
> it replicated translation of latex code to rtf. Instead I used the =20
> much more general ConvertString(s) function. I also cleaned up the =20
> translation code so that it works correctly with both \left\{ and =20
> \left\lbrace as well as the constructs that you show above.
>=20
> Check out the code from CVS and let me know how it works for you. (I =20
> certainly have some reservations with how well Word handles the \Vert =20
> unicode character as a delimiter.)
Thanks Scott, your fix is cleaner and works fine for me. In Word 2000 and
later the \Vert unicode character is handled quite well as a delimiter.
I don't know if this is also the case with older Word versions, but I
think that it cannot be worse than the old behavior.
However, as regards your fix, I would use ConvertString() also when not
using the EQ field. See the following diff, showing also that the line
g_suppress_equation_number =3D FALSE;
has slipped from the EQN_ARRAY to the EQN_ARRAY_STAR case.
Enrico
--- equation.c.orig 2005-11-22 20:15:52.000000000 +0100
+++ equation.c 2005-11-22 20:28:40.000000000 +0100
@@ -432,7 +432,6 @@
g_show_equation_number =3D FALSE;
g_processing_eqnarray =3D TRUE;
g_processing_tabular =3D TRUE;
- g_suppress_equation_number =3D FALSE;
g_equation_column =3D 1;
fprintRTF("\\par\\par\n\\pard");
fprintRTF("\\tqr\\tx%d\\tqc\\tx%d\\tql\\tx%d", a, b, c);
@@ -445,6 +444,7 @@
g_show_equation_number =3D TRUE;
g_processing_eqnarray =3D TRUE;
g_processing_tabular =3D TRUE;
+ g_suppress_equation_number =3D FALSE;
g_equation_column =3D 1;
fprintRTF("\\par\\par\n\\pard");
fprintRTF("\\tqr\\tx%d\\tqc\\tx%d\\tql\\tx%d\\tqr\\tx%d", a,=
b, c, width);
@@ -1422,9 +1422,15 @@
=20
} else { /* g_fields_use_EQ */
=20
- putRtfChar(ldelim);
+ if (ldelim)
+ putRtfChar(ldelim);
+ else
+ ConvertString(lcommand);
ConvertString(contents);
- putRtfChar(rdelim);
+ if (rdelim)
+ putRtfChar(rdelim);
+ else
+ ConvertString(rcommand);
}
=20
if (lcommand) free(lcommand);
-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click