mailing-list for TeXmacs Users

Text archives Help


How can i call Python/Shell from a macro ?


Chronological Thread 
  • From: "Dr. Nicola Mingotti" <address@hidden>
  • To: address@hidden
  • Subject: How can i call Python/Shell from a macro ?
  • Date: Wed, 17 Jan 2024 11:41:41 +0100

Hi,

I am able to write simple macros in the preamble.

I wish to define a macro that takes in a TeXmacs text and does some computations with
Python (or other, actually my favorite is Ruby) then prints out the result of Python execution. 

I have tried to copy from what: Insert -> Fold -> Executable -> Python does, but unsuccessfully.
<script-input|python|default|123+1>    => nope, does not run as I expect.

My aim is this, i have a lot of very easy calculation steps in an engineering document, i wish
to be able to write the _expression_ to compute e.g. $123.4_[m] / 1.2_[m]$ then call the macro above it
and have it become
$123.4_[m] / 1.2_[m]$ = <RESULT_OF_PYTHON_EATING_THE_FORMULA>.

It could be fine for me to call the shell.

At the moment I think every call to the Shell/Python/xxx can be independent, that is, i
don't need/want to memorize previous calculations outcome to do the next.


bye
Nicola







  • How can i call Python/Shell from a macro ?, Dr. Nicola Mingotti, 01/17/2024

Archive powered by MHonArc 2.6.24.

Top of page