mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] My first non-trivial macro


Chronological Thread 
  • From: "David G. Wonnacott" <address@hidden>
  • To: address@hidden
  • Cc: address@hidden
  • Subject: Re: [TeXmacs] My first non-trivial macro
  • Date: Wed, 12 Jul 2006 15:17:55 -0400 (EDT)
  • Hc-host: Message scanned by NISC4, Networking & Systems, Haverford College, Haverford, PA 19041 [v011]
  • Hc-mailscanner: Found to be clean

In response to my original problem of creating a macro that builds a
file name from several components and then includes it:

Date: Tue, 4 Jul 2006 19:32:17 +0200
From: Joris van der Hoeven <address@hidden>

On Sun, Jul 02, 2006 at 07:25:34PM +0200, Henri Lesourd wrote:

> I just tried what you describe, and it seems that the <include>
> macro doesn't tolerate anything other than constant urls as a
> parameter.

Yes, that is indeed a problem, which I have just corrected on the CVS
version.
Notice however that you also should use the "merge" primitive in order to
concatenate strings.

I have now successfully installed and run the CVS version of texmacs
on our Ubuntu linux system, and also figured out how to use the merge
primitive to concatenate strings. I can now give another macro as the
argument to \include and get it working. However, when I make a macro
that does this, I still get the blank line. In other words, the stuff
that follows "no luck!" in the document below does not work. I did a
quick check to make sure I hadn't just missed something simple;
frob-ex differs from in-ex in that it calls the "frob" macro rather
than "include", and it seems to work fine.

Dave Wonnacott


<TeXmacs|1.0.6.4>

<style|generic>

<\body>
Test.

Here, we set coding language: \
<assign|coding-language|Python><value|coding-language>

Here, we set up the example-file-name macro:
\
<assign|example-file-name|<macro|name|<merge|<coding-language>|/examples/|<arg|name>|.py>>><example-file-name|hello>

Here, I do a very simple include with a literal name -- this has worked for
a long time

<include|Python/examples/hello.py>

Here, I do an include using the example-file-name macro from above -- this
works thanks to Joris' fix:

<include|<example-file-name|hello>>

Here, I try to build (and use!) the in-ex macro to do just what I did above
-- no luck!

<assign|in-ex|<macro|ex-name|<include|<example-file-name|<arg|ex-name>>>>>

<\in-ex>
power

\;
</in-ex>

Now a quick check to make sure I can call on example-file-name within a
useless macro:

<assign|frob|<macro|arg|<merge|FROB |<arg|arg>| NICATE>>>

<assign|frob-ex|<macro|ex-name|<frob|<example-file-name|<arg|ex-name>>>>>

<frob|fie>

<frob-ex|power>

\;
</body>

<\initial>
<\collection>
<associate|page-medium|paper>
<associate|page-type|letter>
<associate|preamble|false>
</collection>
</initial>



Archive powered by MHonArc 2.6.19.

Top of page