Good morning,
I return to my wish to include a text file (python or other…) in texmacs.
And I also want to be able to then edit the text directly in texmacs.
I have several ways to do it but they work more or less well.
I would like some advice and some help.
- My first way is the following (I use it with a keyboard shortcut):
(begin (make-include “/home/biz/Bureau/TEXMACS/mes-fichiers-texmacs/Exercice.tm”) (buffer-expand-includes))
However, the (buffer-expand-includes) statement seems finicky. Sometimes it doesn’t work and the text file that is included in texmacs is not editable.
- My second solution is the following:
(tree-load-inclusion (string->url “/home/biz/Documents/fichier.tex” ))
either
(tm-define (mon-inclusion chemin-fichier) (tree-load-inclusion (string->url chemin-fichier )))
(mon-inclusion “/home/biz/Documents/equation2.tex”)
It works well but I have the impression that by using it locally in a procedure, it may not work.
- My third solution uses a python script which copies the content of my text file to the clipboard and writes this content to texmacs with the statement
(clipboard-paste-import “python” “primary”).
It seems to me that it works well in all situations but I avoided using scheme…
- I searched and found this solution in scheme which I can’t get to work:
define (fichier-texte-dans-liste filename)
(with-input-from-file filename (lambda ()
(let loop ((l (read-line))
(r '()))
(if (eof-object? l)
(reverse r)
(loop (read-line) (cons l r)))))))
I think this should give me what it takes to get the text file in texmacs but it doesn’t work?
(insert ’ (stm-list->document (fichier-texte-dans-liste “/home/biz/Documents/file.txt”)))
L’instruction ci-dessus ne veut pas me donner ce qu’il me faut pour retrouver mon fichier texte dans texmacs:
(insert ’ (document “ligne 1” “ligne2” “ligne3” “ligne4”))
I progress little by little and I try to create my own functions…
Thanks for your help.