- From: Giovanni Piredda <address@hidden>
- To: address@hidden
- Subject: Re: macro with table
- Date: Fri, 20 May 2022 14:24:21 +0000
(Following up further)
Hi Julien,
the basics: take a TeXmacs snippet that you want to insert in your
document and Copy as -> TeXMacs Scheme. It will be a Scheme list, that
is something within round parentheses.
Place it in the following construct
(insert 'copy-pasted-snippet)
where you have to "quote it", that is prepend a quote sign, which is
interpreted by Scheme as "do not try and interpret the following, but
quote it".
Then place the construct in either a kbd-map or a tm-menu form, or both,
which then you place in a Scheme file. Examples:
(tm-menu (insert-table-menu) ; this adds a menu item in the
"Insert->Table" menu---you can get more info on the Scheme names of the
menus looking at TeXmacs source code
(former)
---
("Insert table from cvs file" (insert '(tabular (tformat (table
(row (cell "") (cell "") (cell "")) (row (cell "") (cell "") (cell ""))))))
))
(kbd-map
("t a b l e tab"
(insert '(tabular (tformat (table (row (cell "") (cell "") (cell
"")) (row (cell "") (cell "") (cell ""))))))))
They worked in the test I did now, although the cursor does not stay
inside the table after insertion.
Finally you need to let TeXmacs know that the Scheme file exists. For
this I write the Scheme file as a TeXmacs module (please see the TeXmacs
Scheme developer guide at
http://www.texmacs.org/tmweb/documents/manuals/texmacs-scheme.en.pdf to
see how to write the texmacs-module form which you need at the beginning
of your Scheme file), then I use a package file in a plugin, which
contains the line
<use-module|(path-to-the-scheme-module)>
which links to the module (I think that here the TeXmacs Scheme
developer guide could help you as well).
Please let me know if you need more details on any of the points.
G.
On 20.05.22 10:06, Julien Frontisi wrote:
You are right. That is a much more natural direction. But for that I
need to write something in scheme.
I would appreciate if you could help me start with a simple table.
Thanks
Julien
Le 19 mai 2022 à 16:14, Giovanni Piredda <address@hidden> a écrit :
I experimented with this a bit by writing a small package that inserts
file contents as a table, and I think that you could write instead of a
macro (that typesets) a command that inserts the table, assigned to
either a keyboard shortcut or a menu item. If you are interested I could
give you more details.
G.
On 19.05.22 15:36, Julien Frontisi wrote:
Hi all,
I would like to write a macro that creates a table (among other things),
such that each cell could be accessible after the table is created.
Do I need to add an argument to each of the cell, that is, if for
example the table is 5 by 5, make a macro with 25 arguments
or is there another way to make the content of these cells accessible ?
Thank you in advance for your answers
Julien
<assign|mytable|<macro|<block|<tformat|<table|<row|<cell|>>>>>>> <- no
args, cell not accessible
<assign|mytable|<macro|<arg|aa>|<block|<tformat|<table|<row|<cell|<arg|aa>>>>>>>>
<- with arg, cell accessible
Archive powered by MHonArc 2.6.24.