File path as argument of script-input tag

Is it possible to use a file path as an argument of the script-input tag ?

I’ve a bunch of Tikz sketches that I’ll like to reuse in Texmacs with the nice graph plugin and prefer to have the up-to-date version of the sketch in a separate .tex file for use in different documents.

Perhaps something like <script-input | graph| default| %pdflatex| file_path_of_tikz_sketch>

The next question associated to this is the exact opposite: is it possible to concatenate the content of one or multiple script-input tags inside a file ?

Many thanks and happy Texmacsing

I don’t think that’s currently possible. The easiest way is probably to put

%pdflatex
\documentclass[tikz, border=10pt]{standalone}
\input{file.tex}

in your tag.

1 Like

That’s indeed a very nice and clean workaround for my Tikz sketches, I must admit that I don’t even thought at this … my bad.
Many thanks !

Perhaps not as simple as it may look like at first.
The graph plugin is infinitely busy for me …
I’ve tried also with

%pdflatex
\documentclass[border=1pt]{standalone}
\usepackage{tikz}
\begin{document}
\input{file.tex}
\end{document}

Where the file.tex contains only the tikzpicture code:

\begin{tikzpicture}
...
\end{tikzpicture}

Same behavior with this for me also.

Hmm… Does it work if you paste the contents of file.tex there?

Thanks @jeroen :slight_smile:

I’ve made the test before posting to ensure that was not indeed a pb with the interpretation of the Tikz code. Everything works perfectly with the content of file.tex put inside the:

\begin{document}
...
\end{document}

I’ve noticed by the way that after the first graph executable fold is busy, all the other graph executable folds are in the same infinite busy loop if I want to evaluate them again. Perhaps because they share the same “default” session. They all start with <script-input|graph|default|...

If I start TeXmacs again they all work fine except of course the one with the \input{file.tex]

file.tex might need the full path.

Yes, it seems like it. That’s what I did in my tests. The graph executable is probably started in another directory.

I’ve tried with just the current working directory like ./file.tex but forget to try with the full path.
I’ll try and come back

The Graph plugin just make a call on pdflatex and then load the generated pdf via python, if you are familiar with python you do not really need the plugin, you can use any scripting language which is supported by TeXmacs to call out to pdflatex to generate the TikZ image and then load it into TeXmacs with an appropriate command. This last depends on the specific plugin, but for Python should be pdf_out (with the name of the file).

Thanks @pireddag and @jeroen that’s it

Code:

And Voilà !

THANK YOU :+1:

3 Likes

Note that in TeXmacs there is also the possibility to call out to TikZ in another way. This is used when e.g. importing LaTeX files with TikZ images: the images are imported via their TikZ code and they remain editable. I discovered this once, but I do not remember how it worked. To check if it is again the case I would try to import a LaTeX file with a TikZ image and then check what TeXmacs does with the image.

@mgubi excellent

It does this with me :


1 Like

The code of the picture is not there?

Nope, not for me at least:

Then maybe there is a conversion bug. What happens if you change the TikZ code there. It is the picture regenerated? (I believed that this was a build-it mechanism to call out TikZ)

Ok, then maybe I’m wrong. It seems that upon conversion it generated the image (calling out pdflatex) and then just keeps track of the LaTeX code. I’m looking at the source code of TeXmacs and there seems indeed not be mechanism to regenerate the picture. So the only way seems to be via the Graphs plugin.

Thanks for your feedback @mgubi.
I’ve tried to modify the tikz code inside the .tex file and nothing is changed inside TeXmacs.

2 Likes

Ok, then it is really an intert tag.