auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] Checking whether a package is loaded


From: Mosè Giordano
Subject: Re: [AUCTeX] Checking whether a package is loaded
Date: Sun, 6 Mar 2016 15:15:58 +0100

Hi Jason,

2016-03-06 13:37 GMT+01:00 Alexander,J <address@hidden>:
> Are there any functions provided by AUCTeX that allow one to check whether a 
> particular package is loaded?  I've written a yasnippet which inserts a 
> payoff matrix using the "game" environment as defined by sgame.sty or 
> sgamevar.sty -- except these two macro packages use slightly different 
> syntax. The first uses "&" as the column separator (just like tabular) but 
> the latter uses "\>". It would be nice to be able to automatically detect 
> which package was loaded via \usepackage so as to just do the right thing 
> without any further input from the user.

The list of loaded packages is hold in `TeX-active-styles', you want
to do something like

--8<---------------cut here---------------start------------->8---
(cond ((member "sgame" TeX-active-styles)
       ;; do something with "sgame" package
       )
      ((member "sgamevar" TeX-active-styles)
       ;; do something else with "sgamevar" package
       ))
--8<---------------cut here---------------end--------------->8---

Note that you can also test package options with
`LaTeX-provided-package-options-member' function, whose syntax is

    (LaTeX-provided-package-options-member PACKAGE OPTION)

but this isn't useful to test whether a package is loaded, just for its options.

Bye,
Mosè



reply via email to

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