Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User-defined compile engines #52

Open
lgallindo opened this issue Jun 10, 2018 · 7 comments
Open

User-defined compile engines #52

lgallindo opened this issue Jun 10, 2018 · 7 comments

Comments

@lgallindo
Copy link

It would be nice to be able to pass a R function as compile engine. My goal is to be able to reuse some old makefiles and DOS-style bat files via system calls.

They are still more general than rubber, arara and latexmk, in particular if you need OS integration.

@surmann
Copy link

surmann commented Feb 3, 2023

I would like to use arara to create png files out of TikZ TeX files.

@yihui
Would you accept a pull request with this feature?

@yihui
Copy link
Member

yihui commented Feb 3, 2023

@surmann Yes, and could you show me a brief example so that I can understand this problem better? I don't have any experience with arara. Thanks!

@surmann
Copy link

surmann commented Feb 6, 2023

@yihui This is an MWE TeX file:

% arara: lualatex: { shell: yes }
% arara: ghostscript: { resolution: 300 , allpages: true }
% Magic comments for TeXstudio
% !TeX spellcheck = en_GB
% !TeX program = lualatex

\documentclass[border=1pt, tikz]{standalone}

% additional packages
\usepackage{fontspec, lualatex-math}
\usepackage{pgfplots, tikz}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
\draw (0,0) circle (2cm);
\end{tikzpicture}
\end{document}

Using tinytex::lualatex(file.tex) results in a pdf file. Sometime my collegues want to use this graphik in PowerPoint or other MS products. A know all the disadvantages but I don't want to exclude them from my graphics. Hence, I use arara, and compile the document currently via system2("arara.exe", args = "file.tex") which results in a png file.
Is it possible to use arara via TinyTeX because currently, I have to switch my working directory etc.

Do you have an idea of my thoughts?

@yihui
Copy link
Member

yihui commented Feb 6, 2023

@surmann Thanks for the example! I feel the support for arara would be very similar to how tectonic is supported in https://github.com/rstudio/tinytex/blob/main/R/latex.R which should be simple enough to implement. However, I wonder what advantage tinytex::latexmk('file.tex', 'arara') has over system2("arara", "file.tex").

@lgallindo Similarly, I wonder the advantage of supporting a custom R function as the engine in tinytex::latexmk() vs just calling the function directly.

@surmann
Copy link

surmann commented Feb 10, 2023

The advantage is the error handling by TinyTeX. However, my last compile test causes a TeX error but pdflatex does not handle it. It waits until I manually stop it. Currently, I use system2 and have a small handling for TeX errors.
Hence, I see your point not to have an advantage for tinytex over system2.

@yihui
Copy link
Member

yihui commented Feb 10, 2023

The advantage is the error handling by TinyTeX.

I see. That makes sense.

However, my last compile test causes a TeX error but pdflatex does not handle it. It waits until I manually stop it.

I don't know why, since I don't know anything about arara.

Anyway, if you can figure out how to make arara work with TinyTeX's error handling, please feel free to submit a pull request. Thanks!

@surmann
Copy link

surmann commented Feb 11, 2023

However, my last compile test causes a TeX error but pdflatex does not handle it. It waits until I manually stop it.

I don't know why, since I don't know anything about arara.

That doesn't happen with arara but with tinytex::pdflatex, and I don't know why. If this is not the expected behaviour, I would create an additional issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants