[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KFormula LaTex patch
From:       Raphael Langerhorst <raphael-langerhorst () gmx ! at>
Date:       2005-04-28 8:59:06
Message-ID: 200504281059.08601.raphael-langerhorst () gmx ! at
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Monday 25 April 2005 21:53, Brian Bockelman wrote:
> Sorry about that.  The attached patch was done in the proper
> format; I tested it against the current CVS, and it applied cleanly
> for me.
> 
> This is what it took for me to apply it:
> Changed directory to (koffice root)/lib
> patch -p3 < kformula-latex.patch
> 
> Is this the correct way to do things?  Sorry for any inconvenience.
> 
> Brian

Hi Brian,

yes, this is the right way to do it. I also looked through the patch now \
and have a question about this change:

@@ -1441,16 +1441,14 @@ bool SequenceElement::isFirstOfToken( Ba
 QString SequenceElement::toLatex()
 {
     QString content;
-    content += "{";
     uint count = children.count();
     for ( uint i = 0; i < count; i++ ) {
         BasicElement* child = children.at( i );
         if ( isFirstOfToken( child ) ) {
-            content += " ";
+            content += "";
         }
         content += child->toLatex();
     }
-    content += "}";
     return content;
 }


In particular: content +="" doesn't change content in any way (AFAIK). \
Couldn't we remove this if condition altogether?


Another change I have a question about is:

@@ -416,8 +416,8 @@ QString BracketElement::toLatex()
 {
     QString ls,rs,cs;
     cs=getContent()->toLatex();
-    ls="\\left"+latexString(leftType);
-    rs="\\right"+latexString(rightType);
+    ls="\\left"+latexString(leftType) + " ";
+    rs=" \\right"+latexString(rightType);
 
     return ls+cs+rs;
 }


I have NO idea about the Tex format, so I just wanted to ask if the \
additional " " for the "ls" is ok. I assume that these two changes \
corrolate to each other, right? so since the \left adds an additional " ", \
it can be omitted for the isFirstOfToken(), right again?


Anyway, I HAVE COMMITTED THE PATCH TO CVS, and I HAVE commented out the \
following in the source code.

          if ( isFirstOfToken( child ) ) {
            content += "";
         }

I have tested this with a 12 pages report I have written some time ago in \
KWord, it included lots of formulas. The output of KWord is just as correct \
as it was before (nothing broke AFAICS) but the formulas look a bit better \
in the Tex output since the formatting is nicer.

Commenting out the if condition didn't change the Tex output, so I \
committed it with the if condition commented out.

Let me know if this was right and if the questions I raised are fine as \
well.

Regards,
Raphael


[Attachment #5 (text/html)]

<html><head><meta name="qrichtext" content="1" /></head><body \
style="font-size:12pt;font-family:Luxi Sans"> <p>On Monday 25 April 2005 \
21:53, Brian Bockelman wrote:</p> <p><span style="color:#008000">&gt; Sorry \
about that.  The attached patch was done in the proper</span></p> <p><span \
style="color:#008000">&gt; format; I tested it against the current CVS, and \
it applied cleanly</span></p> <p><span style="color:#008000">&gt; for \
me.</span></p> <p><span style="color:#008000">&gt;</span></p>
<p><span style="color:#008000">&gt; This is what it took for me to apply \
it:</span></p> <p><span style="color:#008000">&gt; Changed directory to \
(koffice root)/lib</span></p> <p><span style="color:#008000">&gt; patch -p3 \
&lt; kformula-latex.patch</span></p> <p><span \
style="color:#008000">&gt;</span></p> <p><span style="color:#008000">&gt; \
Is this the correct way to do things?  Sorry for any \
inconvenience.</span></p> <p><span style="color:#008000">&gt;</span></p>
<p><span style="color:#008000">&gt; Brian</span></p>
<p></p>
<p>Hi Brian,</p>
<p></p>
<p>yes, this is the right way to do it. I also looked through the patch now \
and have a question about this change:</p> <p></p>
<p>@@ -1441,16 +1441,14 @@ bool SequenceElement::isFirstOfToken( Ba</p>
<p> QString SequenceElement::toLatex()</p>
<p> {</p>
<p>     QString content;</p>
<p>-    content += &quot;{&quot;;</p>
<p>     uint count = children.count();</p>
<p>     for ( uint i = 0; i &lt; count; i++ ) {</p>
<p>         BasicElement* child = children.at( i );</p>
<p>         if ( isFirstOfToken( child ) ) {</p>
<p>-            content += &quot; &quot;;</p>
<p>+            content += &quot;&quot;;</p>
<p>         }</p>
<p>         content += child-&gt;toLatex();</p>
<p>     }</p>
<p>-    content += &quot;}&quot;;</p>
<p>     return content;</p>
<p> }</p>
<p></p>
<p></p>
<p>In particular: content +=&quot;&quot; doesn't change content in any way \
(AFAIK). Couldn't we remove this if condition altogether?</p> <p></p>
<p></p>
<p>Another change I have a question about is:</p>
<p></p>
<p>@@ -416,8 +416,8 @@ QString BracketElement::toLatex()</p>
<p> {</p>
<p>     QString ls,rs,cs;</p>
<p>     cs=getContent()-&gt;toLatex();</p>
<p>-    ls=&quot;\\left&quot;+latexString(leftType);</p>
<p>-    rs=&quot;\\right&quot;+latexString(rightType);</p>
<p>+    ls=&quot;\\left&quot;+latexString(leftType) + &quot; &quot;;</p>
<p>+    rs=&quot; \\right&quot;+latexString(rightType);</p>
<p> </p>
<p>     return ls+cs+rs;</p>
<p> }</p>
<p></p>
<p></p>
<p>I have NO idea about the Tex format, so I just wanted to ask if the \
additional &quot; &quot; for the &quot;ls&quot; is ok. I assume that these \
two changes corrolate to each other, right? so since the \left adds an \
additional &quot; &quot;, it can be omitted for the isFirstOfToken(), right \
again?</p> <p></p>
<p></p>
<p>Anyway, I HAVE COMMITTED THE PATCH TO CVS, and I HAVE commented out the \
following in the source code.</p> <p></p>
<p>          if ( isFirstOfToken( child ) ) {</p>
<p>            content += &quot;&quot;;</p>
<p>         }</p>
<p></p>
<p>I have tested this with a 12 pages report I have written some time ago \
in KWord, it included lots of formulas. The output of KWord is just as \
correct as it was before (nothing broke AFAICS) but the formulas look a bit \
better in the Tex output since the formatting is nicer.</p> <p></p>
<p>Commenting out the if condition didn't change the Tex output, so I \
committed it with the if condition commented out.</p> <p></p>
<p>Let me know if this was right and if the questions I raised are fine as \
well.</p> <p></p>
<p>Regards,</p>
<p>Raphael</p>
</body></html>



_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic