10

Is it possible to create an arara rule which possibly invokes other arara rules?

I've managed to write an arara rule which conditionally executes a command.

!config
# open rule for arara
# author: AEllett
# requires arara 3.0+
identifier: open
name: PREVIEW
commands:
  - <arara>  @{isTrue ( isFile ("./.design/open.pdf.true"), 
                        "open ".concat(getBasename(file)).concat('".pdf"')
                        ""
                      )}
arguments: []

what I would like to do is write a similar rule which would conditionally invoke another arara rule.

A.Ellett
  • 50,533
  • What's your aim? – Marco Daniel Jan 04 '14 at 16:40
  • 2
    @MarcoDaniel arara already comes with a pdflatex directive. I've written a rule for compiling via latex->dvips->ps2pdf. Generally, I compile with pdflatex so I sometimes forget that I need to use the other route when working with pstricks. So I'd like to build an arara rule which checks for the existence of a file .design/use.pstricks.true and if present arara will call the latex->dvips->ps2pdf rule, otherwise it will invoke the pdflatex directive. – A.Ellett Jan 04 '14 at 17:28
  • This can be achieved inside the tex file with arara 4 which is only available via github: https://github.com/cereda/arara/wiki/Features-in-arara-4.0 – Marco Daniel Jan 04 '14 at 20:07

1 Answers1

8

With the current version of arara which is available via CTAN, it's quite difficult. However Paulo provides a new arara version at GitHub which won't be uploaded to CTAN in a short time.

The new version has some nice gimmicks which are well explained in the Wiki.

If you are using arara 4RC3 you can use the following header:

% arara: pdflatex: { shell: true } if missing ('use.pstricks.true')
% arara: pstricks if exists ('use.pstricks.true')

The rule pstricks could be:

!config
# pstricks rule for arara
# author: Marco Daniel
# requires arara 4.0+
identifier: pstricks
name: LATEX-DVIPS-PS2PDF
commands: 
    - <arara> latex @{action} @{draft} @{shell} @{synctex} @{options} "@{file}"
    - <arara> dvips "@{getBasename(file)}.dvi" -o "@{getBasename(file)}.ps" @{dvipsoptions} 
    - <arara> ps2pdf @{ps2pdfoptions} "@{getBasename(file)}.ps" "@{output}.pdf"
arguments:
#arguments for convertion
- identifier: output
  flag: <arara> @{parameters.output}
  default: <arara> @{getBasename(file)}
- identifier: dvipsoptions
  flag: <arara> @{parameters.options}
- identifier: ps2pdfoptions
  flag: <arara> @{parameters.options}
#arguments for latex
- identifier: action
  flag: <arara> --interaction=@{parameters.action}
- identifier: shell
  flag: <arara> @{isTrue(parameters.shell,"--shell-escape","--no-shell-escape")}
- identifier: synctex
  flag: <arara> @{isTrue(parameters.synctex,"--synctex=1","--synctex=0")}
- identifier: draft
  flag: <arara> @{isTrue(parameters.draft,"--draftmode")}
- identifier: options
  flag: <arara> @{parameters.options}
egreg
  • 1,121,712
Marco Daniel
  • 95,681