However, I am having trouble creating a macro that builds a file nameI just tried what you describe, and it seems that the <include>
and then includes it. I would like to do this because I am working on
course notes for an introductory CS course that can be delivered in
either C++ or Python (we need a multi-paradigm language), and I'd like
to have one central text in which I define the variable
coding-language to be, say, Python, and then write something like
<in-code|foo> to include the file Python/code/foo.py where I want an
example. Then by switching coding-language to C++ we would then be
including the file C++/code/foo.py.
I have tried the following (copied right from my document while in
"Edit source tree" mode, and then formatted for easy reading -- delete
all spaces, tabs, and newlines to get exactly what came from TeXmacs):
<assign|code-file|
<macro|basename|
<value|coding-language>
/code/
<arg|basename>
<case|<equal|<value|coding-language>|Python>|.py|
<equal|<value|coding-language>|C++>|.cc>>>
I can use this successfully to build the desired file name:
<code-file|temp-test>
gives me
Python/code/temp-test.py
(I had to re-type that, since copying out of the document in normal
mode just gave me exactly what I got in "Edit source tree" mode). I
can use a regular
<include|
Python/code/temp-test.py>
to view the file, but when I use
<include|
<code-file|temp-test>>
I just get a blank line rather than the file. Needless to say, my
in-code macro that does this doesn't work either.
P.S. Is there any way to tell TeXmacs that I want to create a macroThe following trick works (try it !) :
but be given a warning if that name is already in use? This would be
like \newcommand in LaTeX. I have been just trying out names to see if
they are already taken, but of course that is no defense against
collisions with other style files I may choose to work with in the
future.
P.P.S. I find myself missing the "C-h c" describe-key-briefly featureSuch a feature is planned, but it doesn't exists yet in TeXmacs.
of emacs, which is incredibly helpful for both learning to program and
also figuring out what's wrong with your modifier keys.
Other thanThanks !
that, I've really enjoyed working with TeXmacs.
Archive powered by MHonArc 2.6.19.