The Mac editor Latexian has built in methods for compiling using latex+dvips, pdflatex and xelatex. Furthermore, it assumes bibtex and makeindex to deal with bibliographies and indexes, respectively.

How do I customize Latexian to use, e.g. LuaTeX for compiling or Biber for bibliographies?

  • @moewe Should I copy my answer there too? – Alan Munn Mar 5 '15 at 12:42
  • I'm not sure, I just happened to stumble across this question and thought I might add the link such that both questions are (... well ...) linked. Since your question here uses arara it might not be of exactly the kind the other question is after, but if you would add a n explanation as to how to set up Biber with Latexian in the other question that would be awesome. – moewe Mar 5 '15 at 12:48
  • @moewe Unless LaTeXian has changed, using arara is the only way to do it. – Alan Munn Mar 5 '15 at 12:50
  • Ahhh - I hadn't actually read your answer thoroughly, never mind then. – moewe Mar 5 '15 at 12:54

The way Latexian is written, the built-in methods cannot be changed with any user preference. This is, in my opinion, a serious design flaw, but it's not too hard to create a workaround for this limitation.

The workaround has two components: a script which is put in a local folder and which replaces (from Latexian's point of view) one or more of the three TeX engines that Latexian knows about. The script bypasses those engines and instead uses the arara automation tool instead to control all compilation. By using arara you can then specify with very fine control the exact compilation chain you need on a document by document basis.

Introduction to arara

In order to make sense of how this works you first need to understand arara. arara allows you to add comments to your document which tell it how to compile that document. A simple use would be the following:

% arara: pdflatex

which would tell arara to process the document with pdflatex. A slightly more complicated example (but conceptually as simple) would be:

% arara: pdflatex
% arara: bibtex
% arara: pdflatex
% arara: pdflatex

This would compile a document, run bibtex and then compile it twice more to resolve the references.

From these small examples, it should be clear that all of the binaries available in MacTeX will be available to arara, which means that if we can get Latexian to use arara we can get Latexian to use any TeX binary. We turn to this task next.

Getting Latexian to use arara

First we create a local folder which we will point Latexian to. You can do this with the Finder or the Terminal. In this example, we will call the folder latexian-bin.

mkdir ~/latexian-bin

In a text editor, create the following file:

export PATH=/Library/TeX/texbin:/usr/local/bin:${PATH}

arara -v "${@:$#}"

Save this as arara in the latexian-bin folder. You must make the file executable, so in a Terminal window, type:

cd ~/latexian-bin
chmod +x arara

Finally, make symbolic links to this script for the xelatex and pdflatex binaries Latexian knows about. Then make symbolic links to the real latex and dvips (otherwise Latexian will always return an error when using this latex+dvips.)

ln -s arara pdflatex
ln -s arara xelatex
ln -s /Library/TeX/texbin/latex latex
ln -s /Library/TeX/texbin/dvips dvips
ln -s /Library/TeX/texbin/synctex synctex

Now within Latexian, go to the Preferences and choose Preview. In this preference you can choose the Folder for TeX Distribution. By default, this is set to /Library/TeX/texbin (/usr/texbin/ in older MacTeX distributions) but we now want Latexian to use the local folder we created. Use the Browse button to select the latexian-bin folder. If you have done things correctly, you should see the following:

Preferences screen shot

Your actual path will be different from /Users/alan/latexian-bin but should look similar. Don't worry that some of the other binaries are x-ed out and say "Not found". This doesn't actually matter.

You now have a pointed LaTeXian to its own local binary folder, and now instead of compiling with pdflatex you will be compiling with arara. Now for every document you need to provide the correct arara lines at the top of the file to instruct it which binaries to use for that file.

For a basic pdflatex file you should use:

% arara: pdflatex: { synctex: yes }

For xelatex

% arara: xelatex: { synctex: yes }

For lualatex

% arara: lualatex: { synctex: yes }

To also compile your file with bibtex add:

% arara: bibtex

To compile instead with biber add:

% arara: biber

This is all you need to do.

Notes on implementation

Using this method you do not need to ever use the Latexian preferences to specify number of compilations or the subsidiary programs bibtex and makeglossaries or makeindex; these can all be done through arara.

If you don't want to use arara for all compilations, you can just link either the pdflatex or xelatex command to the arara script and the other command to its normal binary in /Library/TeX/texbin. You can then use Latexian's GetInfo menu item to choose the one or the other for each file. This may be the most practical solution if you mainly use one engine most of the time, since using arara will be slightly slower than using the engine directly.

  • Thank you for your answer. But I think a ":" is missing after pdflatex. The code line should be % arara: pdflatex: {synctex: yes} If I'm right may be you can edit your answer. – Nik Jan 17 '16 at 6:34
  • @nik Thanks for catching that. I've fixed the answer. – Alan Munn Jan 17 '16 at 19:26

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.