texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Texmacs-dev] some fixes for the latex converter


From: Kostas Oikonomou
Subject: [Texmacs-dev] some fixes for the latex converter
Date: Thu, 12 Jun 2008 17:47:30 -0400
User-agent: Thunderbird 2.0.0.6 (X11/20071119)

(I sent this to address@hidden on June 1, and I am reposting it here since I did not receive any reply.)

Hello,

I have a couple of improvements to the Latex converter for
TeXmacs 1.0.6.14.

The first has to do with exporting the \S command, which
currently doesn't work: TeXmacs puts an octal 237 character
in the .tex file, which latex ignores.  I made the following
fix in file tmtex.scm:

(define (tmtex-text-list l)
...
    ((== c #\26) (tmtex-text-sub "---" l))
    ; See progs/texmacs/keyboard/latex-kbd.scm, line 169:
    ((== c #\237) (tmtex-text-sub "\\S" l))
...

The other fix allows TeXmacs to use Latex's \bigl, \bigr,
etc. commands when exporting large delimiter constructs such
as <left|(|2>, which right now are all exported as \left(, etc.
So in the same file, I have rewritten tmtex-left and
tmtex-right:


; Parses TeXmacs delimiter constructs like <left|[|3> or
<left|)>.
(define (tmtex-left l)
  (let (
        (s (car l))
        (n (if (> (length l) 1) (string->number (cadr l)) 0))
       )
    (list (string->symbol
      (cond
        ((nstring? (car l)) "left.")
        ((in? s '("(" ")" "[" "]" "{" "}" "|" "/" "."))
          (cond
            ((= n 1) (string-append "\bigl"  s))
            ((= n 2) (string-append "\Bigl"  s))
            ((= n 3) (string-append "\biggl" s))
            ((= n 4) (string-append "\Biggl" s))
            (else (string-append "left" s))
          )
        )
        ((== s "||") "\\|")
        ((== s "\\") "\\backslash")
        (else (string-append "\\" s))
      )
     ))
  )
)

; Same thing, with left -> right.
(define (tmtex-right l)
  (let (
        (s (car l))
        (n (if (> (length l) 1) (string->number (cadr l)) 0))
       )
    (list (string->symbol
      (cond
        ((nstring? (car l)) "right.")
        ((in? s '("(" ")" "[" "]" "{" "}" "|" "/" "."))
          (cond
            ((= n 1) (string-append "\bigr"  s))
            ((= n 2) (string-append "\Bigr"  s))
            ((= n 3) (string-append "\biggr" s))
            ((= n 4) (string-append "\Biggr" s))
            (else (string-append "right" s))
          )
        )
        ((== s "||") "\\|")
        ((== s "\\") "\\backslash")
        (else (string-append "\\" s))
      )
     ))
  )
)

As a result, the function tmtex-large-decode is used only by
tmtex-mid now.

I would also like to modify the function texout-eqn in
texout.scm to output \begin{equation*} and \end{equation*}
instead of \[ and \], but only if the amsmath package is
loaded.  But I don't know how to test for that condition.


                                        Kostas






reply via email to

[Prev in Thread] Current Thread [Next in Thread]