Changes

Jump to navigation Jump to search
3,376 bytes added ,  10:58, 2 July 2020
m
drop navbox
<code> :header "~/foo/foo-preamble.tex")</code>
===Exercise: how to use Thomas A. Schmitz's "taspresent" presentation module===
 
Thomas has recently offered a very useful module with several styles for presentations. I won't describe
it here but I will just let you know how I use it with muse.
 
Some special code has to appear in the preamble, so I have to define a special variable for muse,
which I call <code>muse-context-tas-header</code>:
 
<pre> (defvar muse-context-tas-header
"\\usemodule[taspresent][style=<lisp>(if (string-equal (muse-publishing-directive \"style\") nil) \"blueframe\"
(muse-publishing-directive \"style\"))</lisp>,font=Pagella,size=17pt]
\\setvariables [taspresent]
[author={<lisp>(muse-publishing-directive \"author\")</lisp>},
title={<lisp>(muse-publishing-directive \"title\")</lisp>}]
\\starttext \n \\Maketitle \n \\page \n \\lecback \n"
)</pre>
 
You can see that the first line says to use the module with various options; in particular the default style
is blueframe; the author and title are the ones written in the muse file. Then this "header" goes beyond the
preamble as it includes the <code>\Maketitle</code> macro and what follows it (<code>\lecback</code>).
 
Another variable <code>muse-context-tas-markup-strings</code> is defined to take care of text structure
(which is simple for presentations). In the taspresent module, you typically use <code>\Slidetitle{}</code>
for a new slide; we want to use muse's first-level title, i.e. a star+space at the beginning of a line
containing the title of the slide. For this I define a working variable:
 
<pre>(defvar muse-context-tas-markup-strings
(nconc
'((section . "\\Slidetitle {")
muse-context-markup-regexps)))</pre>
 
Now we're ready to define two new styles, which are derived respectively from the context and context-pdf styles:
 
 
<pre>(muse-derive-style "tas" "context"
:header 'muse-context-tas-header
:strings 'muse-context-tas-markup-strings)
 
(muse-derive-style "tas-pdf" "context-pdf"
:header 'muse-context-tas-header
:strings 'muse-context-tas-markup-strings
)</pre>
 
This code defines two muse styles, "tas" and "tas-pdf" (Thomas I hope you don't mind I use your initials!);
as you easily guess, the former produces a tex file, while the latter produces the pdf output.
 
Of course this code has to be evaluated by emacs (either at its start if
it is written in the .emacs file, or after that using usual elisp
methods).
 
You may see here that this code defines a muse "style" directive, to
be used if you want to use another taspresent style than blueframe. To
do that, just write at the top of the muse file, after the title and
author directives, eg:
 
<code>#style blackblue</code>
 
Of course you can modify various things, especially in the header; as for me I
add <code>\\usemodule[french]</code> in the first defvar, so the french module is loaded.
 
The only small problem I have is that if I want to use the <code>\PicHoriz</code> or
<code>\PicVert</code> macros I have to manipulate tex code to change the background
(<code>\picback</code> is needed there to replace <code>\lecback</code>); which can de done
in the muse file with the literal tag, or by editing the tex file.
 
But this is only a minor inconvenient compared to the advantages of preparing a presentation so easily!
==For those who won't use emacs :-( ==
in batch mode, and you can use a script for that (or a makefile);
examples are given in the muse distribution.
 
 
[[Category:Text Editors]]

Navigation menu