Waldek Hebisch <[EMAIL PROTECTED]> writes:

> I have put version from NAG open source cdrom at:
> 
> http://www.math.uni.wroc.pl/~hebisch/fricas/texbreak.c

Thank you!  Unfortunately, this also contains the patch to look for \[ \]
instead of $$ $$.

I did the following for the moment, which works, but is extremely hackish.

Briefly: I make TexFormat output

\setcounter{equation}{17}
\[
stuff
\]

Note that this is not sensible LaTeX, since \[ AKA \begin{displaymath} is *not*
a numbered environment.  However, texbreaker is able to work on such a snippet.

We then use the redefinitions

\def\[{\begin{equation}}
\def\]{\end{equation}}

in the preamble.

I see the following possibilities:

a) make breqn.sty work as we need it.  That's my preferred solution actually,
   because texbreaker is not going to be maintained, I think.  imaxima uses
   breqn.sty, for example.  See my previous post why it doesn't work for me.
   Remark: I would actually prefer to adapt the pagewidth a little over
   squeezing the output too much.  Furthermore, texbreaker does not seem to
   work correctly on the FriCAS output of integrate(1/sqrt tan x,x)

b) make texbreaker work on $$ again.  I guess that's the easiest solution.

c) make TexForm output
   \setcounter{equation}{42}\begin{equation}...\end{equation} and replace
   \begin{equation}...\end{equation} by \[...\] in fricas.el, and then back
   again.  That's the solution I like least.

I'll send the problematic breqn file to the latex list.

Martin

Index: tex.spad.pamphlet
===================================================================
--- tex.spad.pamphlet   (revision 419)
+++ tex.spad.pamphlet   (working copy)
@@ -210,13 +210,13 @@
 
     new() : $ ==
 --    [["\["]$(L S), [""]$(L S), ["\]"]$(L S)]$Rep
-      [["$$"]$(L S), [""]$(L S), ["$$"]$(L S)]$Rep
+      [["\begin{equation}"]$(L S), [""]$(L S), ["\end{equation}"]$(L S)]$Rep
 
     newWithNum(stepNum: I) : $ ==
 --    num : S := concat("%AXIOM STEP NUMBER: ",string(stepNum)$S)
 --    [["\["]$(L S), [""]$(L S), ["\]",num]$(L S)]$Rep
-      num : S := concat(concat("\leqno(",string(stepNum)$S),")")$S
-      [["$$"]$(L S), [""]$(L S), [num,"$$"]$(L S)]$Rep
+      num : S := concat(["\setcounter{equation}{", string(stepNum)$S, "}"])$S
+      [[num,"\["]$(L S), [""]$(L S), ["\]"]$(L S)]$Rep
 
     coerce(expr : E): $ ==
       f : $ := new()$%

Index: fricas.el
===================================================================
--- fricas.el   (revision 426)
+++ fricas.el   (working copy)
@@ -144,8 +144,10 @@
            "(t (prin1 x)))"
      "(princ #\\Newline))"))
 (defvar fricas-annotate-regexp "\e\\([a-zA-Z\-]*\\)\n")
-(defvar fricas-TeX-preamble (concat "\\documentclass{article}"
+(defvar fricas-TeX-preamble (concat "\\documentclass[leqno]{article}"
                                    
"\\usepackage[active,dvips,tightpage,displaymath]{preview}"
+                                   "\\def\\[{\\begin{equation}}"
+                                   "\\def\\]{\\end{equation}}"
                                    "\\begin{document}"
                                    "\\begin{preview}"))
 (defvar fricas-TeX-postamble "\\end{preview}\\end{document}")
@@ -1154,12 +1156,22 @@
                     (mapcar (function (lambda (v) (/ v 65535.0)))
                             (color-values (face-background 
                                            'fricas-TeX)))))
-        (inhibit-read-only t))
+        (inhibit-read-only t)
+        (fricas-new-TeX-buffer 
+         fricas-TeX-buffer)
+        pos1 pos2)
 
-    (write-region (concat fricas-TeX-preamble 
-                         fricas-TeX-buffer
-                         fricas-TeX-postamble) 
-                 nil fricas-TeX-file)
+    (setq fricas-new-TeX-buffer 
+         (with-temp-buffer
+           (insert fricas-TeX-preamble)
+           (setq pos1 (point))
+           (insert fricas-new-TeX-buffer)
+           (setq pos2 (point))
+           (insert fricas-TeX-postamble)
+           (goto-char pos1)
+           (call-process-region pos1 pos2 "texbreaker" t (list t nil))
+           (buffer-string)))
+    (write-region fricas-new-TeX-buffer nil fricas-TeX-file)
     ;; TeX the file
     (call-process "latex" nil nil nil (concat "-output-directory=" dir) 
                  fricas-TeX-file)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to