3

The tikz externalisation library has a mode called list and make, which instead of forking a new TeX process, will simply list the images that need compiling and generate a makefile that needs to be run separately. A subsequent TeX run is needed to then add the images into the document.

I've been using arara to compile my documents, and this method looks like a solution to my memory issues that bring down my ancient laptop.

How do I integrate the external/mode=list and make with arara?

Arara comes with a make rule, but there's no documentation on how to actually use it. The rule, as included in arara 4.0, looks like this:

!config
# Arara, the cool TeX automation tool
# Copyright (c) 2012, Paulo Roberto Massa Cereda 
# All rights reserved.
#
# This rule is part of arara.
identifier: make
name: Make
authors:
- Marco Daniel
- Paulo Cereda
commands:
- name: The Make program
  command: >
    @{
        if (target != '') {
            if (isList(target)) {
                tasks = [];
                for (entry : target) {
                    tasks.add(getCommand('make', entry));
                }
                return tasks;
            }
            else {
                return getCommand('make', target);
            }
        }
        else {
            return getCommand('make');
        }
    }
arguments:
- identifier: target
  flag: "@{parameters.target}"

The make directive in my document should call make -f \jobname.makefile; adding % arara: make: { target: '-f \jobname.makefile' } into the pre-premable spits out an error, as does basically anything with the make directive.

At the moment I have:

% arara: lualatex: { shell: true, interaction: nonstopmode }
% arara: make: { target: '-f \jobname.makefile' }
% arara: lualatex: { synctex: true, shell: true }

What do I need to do to get it to work?

1

OK, after trying to figure out how arara works by inspection of other provided rules, I've come up with this solution:

!config
# Arara, the cool TeX automation tool
# Copyright (c) 2012, Paulo Roberto Massa Cereda 
# All rights reserved.
#
# This rule is part of arara.
identifier: tikzmake
name: TikZmake
authors:
- Robbie Smith
- Paulo Cereda
commands:
- name: TikZ list-and-make engine
  command: >
    @{
        makefile = getBasename(file).concat('.makefile');
        return getCommand('make', force, options, '-f', makefile);
    }
arguments:
- identifier: force
  flag: >
    @{
        isTrue(parameters.force, '--always-make')
    }
- identifier: options
  flag: >
    @{
        if (isList(parameters.options)) {
            return parameters.options;
        }
        else {
            throwError('I was expecting a list of options.')
        }
    }

It's a bit rough around the edges, and I want to expand upon the options (i.e. add support for a number of jobs), but it works. To use this rule, you need to add \tikzset{external/mode=list and make} somewhere in your preamble (optionally specifying the system call), and tell arara to run this rule after at least one run of TeX, and before at least one run of TeX for the pictures to be rendered and inserted. I have the following, but your use-case may differ.

% arara: lualatex: { shell: true, interaction: nonstopmode }
% arara: tikzmake: { options: ['-j2'] }
% arara: lualatex: { synctex: true, shell: true }
  • As of the next version of Arara (4.0), a tikz-and-make rule will be included out-of-the-box. – Robbie May 21 '18 at 3:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.