GNU TeXmacsUser manualReferenceAboutEnglishยทDeutsch
Miscellaneous style-sheet primitives
<extern|scheme-foo|arg-1|\(\cdots\)|arg-n>
(apply extern typesetting macro)

This primitive allows the user to implement macros in Scheme. The primitive applies the Scheme function or macro scheme-foo (a string, which is evaluated) to the arguments arg-1 until arg-n. The result of the Scheme function is converted back into a TeXmacs tree, which is evaluated and typeset. For instance, the code <extern|(lambda (name) ‘(concat "hi " ,name))|dude> yields “hi dude”.

The arguments arg-1 until arg-n are evaluated and then passed as trees to scheme-foo. When defining a macro which relies on extern scheme code, it is therefore recommended to pass the macro arguments using the quote-arg primitive:

<assign|inc-div|

<macro|x|y|

<\extern|

(lambda (x y) ‘(frac ,x (concat "1+" ,y)))

|

<quote-arg|x>

|

<quote-arg|y>

>

>

>

It has been foreseen that the accessibility of the macro arguments x and y is preserved for this kind of definitions. However, since TeXmacs does not heuristically analyze your Scheme code, you will have to manually set the D.R.D. properties using drd-props.

Notice also that the Scheme function scheme-foo should only rely on secure scheme functions (and not on functions like system which may erase your hard disk). User implemented Scheme functions in plug-ins may be defined to be secure using the :secure option. Alternatively, the user may define all Scheme routines to be secure in Edit\(\rightarrow\)Preferences\(\rightarrow\)Security\(\rightarrow\)Accept all scripts.

<use-package|package-1|\(\cdots\)|package-n>
(load style packages)

Load the style packages package-1 until package-n and execute their definitions in the current environment. The package names are literal strings; they are looked up (with the suffix .ts) in the style path and in the directory of the current document. This primitive is mainly used in style files, in order to build upon other packages.

<use-module|module-1|\(\cdots\)|module-n>
(load Scheme modules)

Load Scheme modules on which a style file depends. Each argument is evaluated and is either a module name like (dynamic fold-edit), which is loaded with use-modules, or the name of a plug-in, which is initialized. The loaded modules are recorded in the the-modules environment variable.

<with-package|package|body>
(local package)

Typeset body in an environment in which the definitions of the style package have been loaded. Contrary to use-package, the definitions are local to body: the tag is rewritten into a with which sets all variables assigned at the top level of the package (only plain assign statements are taken into account).

<write|aux|content>
(write auxiliary information)

Adds content to the auxiliary section aux of the document. This tag is used for instance by <nocite|citekey> to add entries to the automatically generated bibliography at the end of the document, without inserting a citation in the text.

<flag|content|color>

<flag|content|color|var>
(display an informative flag)

This tag is used to in order to inform the user about information which is present in the document, but not visible when printed out. TeXmacs displays such informative flags for labels, formatting directives such as page breaks, and so on. In Document\(\rightarrow\)Informative flags, the user may specify how the informative flags should be rendered.

The two-argument variant displays an informative flag with a given content and color. The content is only rendered when selecting Document\(\rightarrow\)Informative flags\(\rightarrow\)Detailed. For instance, <flag|warning|red> is rendered as . The optional var argument may be used in order to specify that the flag should only be visible if the macro argument var corresponds to an accessible part of the document. For instance, TeXmacs automatically generates labels for section titles (so as to include them in the table of contents), but it is undesirable to display informative flags for such labels.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".