Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] detecting the amsmath package

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] detecting the amsmath package


Chronological Thread 
  • From: Henri Lesourd <address@hidden>
  • To: Kostas Oikonomou <address@hidden>
  • Cc: address@hidden
  • Subject: Re: [TeXmacs] detecting the amsmath package
  • Date: Fri, 05 Sep 2008 02:10:11 +0200

Kostas Oikonomou wrote:

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".

Problem is: the first argument (i.e., "doc") is the
datastructure containing the document: you need to
know which "doc" you want to pass to the function,
thus you need to know where is the document in your
modified tmtex.scm.

Once you know it (let's say its contained inside
a variable "x"), then the function call is simply
written as:
(latex-use-package-command x)



Archive powered by MHonArc 2.6.19.

Top of Page