bugGNU TeXmacs - Bugs: bug #60448, Customization of the LaTeX output...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #60448: Customization of the LaTeX output for math formulae

Submitter:  Aeh9quu9 <ohnie0ai>
Submitted:  Fri 23 Apr 2021 03:09:39 PM UTC
 
Category:  Conversion Priority:  5 - Normal
Item Group:  Wishlist Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  None Release:  1.99.19
Fixed Release:  None Fixed Release: 
Keywords: 

Fri 23 Apr 2021 04:42:38 PM UTC, comment #2: 

Alternative solution: if you do not want to modify TeXmacs source files you can override the scheme function texout (see the same file, line 440, for the original definition) to use your own math output. For example you can redefine it as

(tm-define (texout x)
  (if  (== (car x) '!math) (my-texout-math (cadr x))
        (former x)))

which uses your own function in the first case and otherwise call the former (i.e. the original) implementation of texout, in this way you override the output for this tag.




Massimiliano Gubinelli <mgubi>
Project Administrator
Fri 23 Apr 2021 04:35:48 PM UTC, comment #1: 

Until a reasonable solution could be found you can customise yourself the coverter, since it is written in Scheme. The relevant file I think is 'TeXmacs/progs/convert/latex/texout.scm' where you find the function

(define (texout-math x)
  (cond ((texout-empty? x) (noop))
((texout-double-math? x) (texout x))
((match? x '((!begin "center") :%1))
(texout `((!begin "equation") ,(cadr x))))
((and (output-test-end? "$") (not (output-test-end? "\\$")))
(output-remove 1)
(output-tex " ")
(texout x)
(output-tex "$"))
(else
(output-tex "$")
(texout x)
(output-tex "$"))))


where you see what is output for certain math tags. You can for example replace it with

(define (texout-math x)
  (cond ((texout-empty? x) (noop))
((texout-double-math? x) (texout x))
((match? x '((!begin "center") :%1))
(texout `((!begin "equation") ,(cadr x))))
((and (output-test-end? "$") (not (output-test-end? "\\$")))
(output-remove 1)
(output-tex " ")
(texout x)
(output-tex "$"))
(else
(output-tex "\\(")
(texout x)
(output-tex "\\)"))))
 

or else of your choice. (Warning: I have not tested the solution, it is also wise to make a backup copy of the scheme source file before modifying it).

Massimiliano Gubinelli <mgubi>
Project Administrator
Fri 23 Apr 2021 03:09:39 PM UTC, original submission:  

I hope that there is a way to customize the LaTeX output for math formulae.

Current, the delimiter of inline formulae are converted into $...$. There are several parser which does not support $...$ (such as that on Moodle STACK). I hope that the users are allowed to customize this conversion by at least the following variants:

1. $...$
2. \(...\)
3. \begin{math} ... \end{math}

Similarly, for displayed formulae, it is better to have the following options (unnumbered versions):

1. \[...\]
2. \begin{displaymath} ... \end{displaymath}

Aeh9quu9 <ohnie0ai>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mgubi (Posted a comment)
  • -email is unavailable- added by ohnie0ai (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

     

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.11