1

This question follows-on from a previous one ...similar but different Arara... I've created a configuration file according to what I understand from the Arara Reference Manual, and I have appended it below.

The configuration file itself does not (after some tweaking...!) flag any error messages about itself during run-time. Arara appears to recognize and accept my newly created file-extension *.mkiv .

However, at runtime, Arara tells me It looks like no directives were found in the provided file. Make sure to include at least one directive and try again. That is not true, the file does have a directive. As a test, I added a default preamble to my configuration file defaultPreamble: onecontext. This did not help, and has since been removed from the configuration file (as it interferes with non-ConTeXt executions)

In fact, Arara runs without error on this file (which has an arara directive) if I don't have the configuration file in place, or if I append the file name with *.tex, such as myfilename.mkiv.tex

The arara logs don't provide any useful information.

So, what am I missing here?

 1 !config
 2 filetypes:
 3   - extension:  ins 
 4   - extension:  drv
 5   - extension:  ltx
 6   - extension:  dtx
 7   - extension:  tex
 8   - extension:  mkiv
 9      pattern: ^\s*//\s*
10 paths:
11     - '/usr/local/texlive/2023/texmf-dist/scripts/arara/rules'
12 loops: 5
13 verbose: true
14 logging: true
15 header: true
16 logname: my_arara_log
17 preambles:
18     onecontext: |
19         % arara: context
20 defaultPreamble: onecontext      [<-- added for testing, then deleted]

1 Answer 1

4

We cannot know what you are missing if you only provide half of the truth. In this case, you did not provide your ConText file. When I read your config file and file patterns, I assume your average ConTeXt file looks like

// arara: context
\starttext
Hello world
\stoptext

Well, assuming that you have not reinvented ConTeXt and its syntax, this is a syntax error. But please note that with ^\s*//\s* you will not get anywhere with valid ConTeXt syntax.

Obviously, you have copied and pasted the pattern from the documentation without understanding the regular expression. And you did not look up two lines to try the default pattern which works in basically all TeX files (and is used by default): ^\s*%\s*.

Hence, assuming you want to feed a valid ConTeXt document like

% arara: context
\starttext
Hello world
\stoptext

into arara, you can use a configuration file with an appropriate pattern. If you use your original pattern, it is quite self-explanatory that arara would not find directives in the document because there is no // arara line anywhere in that file.

!config
filetypes:
  - extension:  ins 
  - extension:  drv
  - extension:  ltx
  - extension:  dtx
  - extension:  tex
  - extension:  mkiv
    pattern: ^\s*%\s*
8
  • You are correct: I am in a muddle about patterns. When you say "you did not look up two lines...", do you mean the first indented paragraph on page 47 (which is two sentences and 6 lines)? Page 47 indicates that the pattern ^\s*%\s* is for the 5 default file types. The explanation goes on to talk about "new file types", and then gives ^\s*//\s* as the example of a pattern, which I presumed was to be used for every user-defined file type (....more to follow...)
    – Birdman
    May 11, 2023 at 20:35
  • ... which is, of course, what I used in my config file. Now, you are also correct: If I change the preamble in my ConTeXt file to // arara: context, it successfully compiles. So now, if I understand correctly, the pattern key such as the default ^\s*%\s*, defines how arara will recognize those lines in the TeX-file's preamble that are arara directives'' . The leading character in the directive's line is whatever character(s) that are placed in the position of the underscore, here: ^\s*_\s* `` (..more...)
    – Birdman
    May 11, 2023 at 20:44
  • If I wanted my TeX -file directive to look like this $$ arara: context my YAML pattern key would be `` ^\s*$$\s* ``
    – Birdman
    May 11, 2023 at 20:48
  • @Birdman No, I mean two lines, technically one (I counted a blank line) because I have started counting from the bullet's start but this discussion about counting is pointless, you obviously understood where I was pointing to. And your presumption about the pattern is wrong because it is as much an example as the extension: c for the extension key (you can define other custom extensions than just c). Pattern does what it says it does in the documentation (there is no clear single sentence to quote but the paragraph describes that the pattern is used to identify lines containing directives).
    – TeXnician
    May 11, 2023 at 20:53
  • Your understanding of the pattern key about leading character etc. pp. is not wrong but far too restrictive. You are not required to have things at line start (^), you do not have to allow whitespace \s*, you do not need to allow whitespace afterwards. AbC would be a perfectly valid (even though practically useless) pattern matching all lines in the document which contain AbC anywhere in the line. Therefore, I cannot describe it more succinctly than by provide a pattern to match like you would in the regex search function of your editor or in other software with regex support.
    – TeXnician
    May 11, 2023 at 20:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .