Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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:

#!/bin/bash
export PATH=/usr/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 a 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 /usr/texbin/latex latex
ln -s /usr/texbin/dvips dvips
ln -s /usr/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 /usr/texbin 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 /usr/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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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