mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] detecting the amsmath package


Chronological Thread 
  • From: Kostas Oikonomou <address@hidden>
  • To: address@hidden
  • Cc: address@hidden
  • Subject: Re: [TeXmacs] detecting the amsmath package
  • Date: Thu, 04 Sep 2008 17:37:55 -0400
  • Organization: AT&T Labs Research

Henri,

I see in progs/convert/latex/latex-tools.scm a definition

(tm-define (latex-use-package-command doc)
(:synopsis "Return the usepackage command for @doc")
(set! latex-uses-table (make-ahash-table))
(latex-use-which-package doc)
(let* ((l1 (map car (ahash-table->list latex-uses-table)))
(l2 (sort l1 latex-use-package-compare))
(l3 (map force-string l2))
(l4 (list-intersperse l3 ","))
(s (apply string-append l4)))
(if (== s "") "" (string-append "\\usepackage{" s "}\n"))))

If I understand it correctly, this returns the \usepackage command (as a string) that TeXmacs inserts in the LaTeX document when it creates it. So that solves half of the problem.

Since I know almost no Scheme, how would I call this function "latex-use-package-command" from code inside my modified tmtex.scm?
If I knew that, I could figure out how to parse the \usepackage string and see if it contains "amsmath".

Kostas

Henri Lesourd wrote:

First approach: look at the code, and find exactly the
variable (or the combination of variables) which prompts
inserting the amsmath package ;

Second approach (probably easier): just before the output
of the exporter (which is an s-expression) is sent back
to the function which writes the actual LaTeX code, scan
this output, and (set-cdr!)-ize it to insert amsmath in
the list of included packages (if it's what you want) ;




Archive powered by MHonArc 2.6.19.

Top of page