CTAN Comprehensive TeX Archive Network

Directory support/runtexshebang

README.md

runtexshebang: Lua script running document files with -style shebang

Lua script running document files with a -style shebang (%#!)

What is a -style shebang (%#!)

In short, a -style shebang (%#!) is a special kind of comment that you include in your / document file to tell the operating system's shell how to run the file for the rest of the file:

%#!lualatex foo.tex
\documentclass{article}
\begin{document}
Hello, {\LaTeX} World!

Happy {\TeX}ing.
\end{document}

If you are using a -style shebang, it must appear on the line that matched 20 lines or less in your document, and it has to start with a comment symbol (%) followed by a hash sign (#) and an exclamation mark (!), colloquially known as the bang, hence the name shebang for /.

Getting started

  1. Install runtexshebang.lua in your Live system.
cp runtexshebang.lua /some/where/TEXMFDIST_or_TEXMFLOCAL/scripts/runtexshebang/runtexshebang.lua

cd TEXLIVE_BIN_DIRECTORY
ln -s ../../TEXMFDIST_or_TEXMFLOCAL/scripts/runtexshebang/runtexshebang.lua runtexshebang
  1. Make a sample file with a -style shebang.

Make the following document.

%#!lualatex foo.tex
\documentclass{article}
\begin{document}
Hello, {\LaTeX} World!

Happy {\TeX}ing.
\end{document}
  1. Run the sample file.
runtexshebang foo.tex

Then, it will run lualatex foo.tex.

Examples

works

Settings

  1. Open "Typesetting" tab in works Preferences.
  2. Add the tool configuration "runtexshebang" in "Processing tools" as below.
    • Name: runtexshebang
      • Program: runtexshebang
        • Arguments: $fullname
        • ☑ View PDF after running (if necessary)

document in the internal editor of work

% !TEX program = is a magic comment of works. You can set one processing tool as % !TEX program = <your choice of tool configuration>.

% !TEX program = runtexshebang
%#! lualatex --synctex=1 foo

Workshop: Visual Studio Code

Settings

Nothing!

document in Visual Studio Code

% !TEX program = is a magic comment of Workshop. You need another magic comment to the target document file as below.

% !TEX program = runtexshebang
% !TEX options = "%DOC%".tex
%#! lualatex --synctex=1 foo

Shop

Settings

There the “Engine” settings for the command lines "+dvipdfmx / +dvips+distiller" as follows.

  • : runtexshebang
  • : runtexshebang

document in the internal editor of Shop

% !TEX program = is a magic comment of Shop.

% !TEX program = runtexshebang
%#! lualatex --synctex=1 foo

Applications

What does the PATH variable set in my editor?

%#! echo $PATH

How about general configuration information for the activated Live version and its configuration in my editor?

%#! tlmgr conf

Otherwise

You can run any command line on your OSs. For example, you can use any build tools as follows: make, rake, llmk, latexmk, and so on.

%#! make foo.pdf

% #! rake foo.pdf
% #! llmk
% #! latexmk foo
%% and so on.

You can typeset a document file in a Docker container as below.

%#! docker run -i --rm --workdir /data --mount type=bind,src=$(pwd)/,dst=/data/   bar/foo     lualatex foo

References

Commentary

Tools supporting %#!

  • Ya: Yet Another mode for Emacs
  • llmk: Light Make

Enjoy Happy ing!

License

This program is licensed under the terms of the MIT License.


Munehiro Yamamoto https://github.com/munepi

Download the contents of this package in one zip archive (4.2k).

runtexshebang – A Lua script running document files with -style shebang

In short, a -style shebang (%#!) is a special kind of comment that you include in your / document file to tell the operating system’s shell how to run the file for the rest of the file:

      %#!lualatex foo.tex
      \documentclass{article}
      \begin{document}
        Hello, {\} World!
Happy {\}ing. \end{document}

If you are using a -style shebang, it must appear on the line that matched 20 lines or less in your document, and it has to start with a comment symbol (%) followed by a hash sign (#) and an exclamation mark (!), colloquially known as the bang, hence the name shebang for /.

Packageruntexshebang
Home pagehttps://github.com/munepi/runtexshebang
Bug trackerhttps://github.com/munepi/runtexshebang/issues
Repositoryhttps://github.com/munepi/runtexshebang.git
Version0.5 2023-11-17
LicensesMIT License
Copyright2021–2023 Munehiro Yamamoto
MaintainerMunehiro Yamamoto
Contained inTeX Live as runtexshebang
MiKTeX as runtexshebang
TopicsCompilation
...
Guest Book Sitemap Contact Contact Author