Using Gregorio with Scribus

This page describes the use of Gregorio within Scribus.

Scribus

Scribus is a free DTP (desktop publishing) software with a simple and accessible graphical user interface. It is possible to include Gregorio scores in a Scribus document, and thus to build a book or a booklet containing Gregorian scores simply.

Installing the additional Scribus files

To be able to use Gregorio in Scribus, you first need to make sure that the extsizes and the filecontents packages are part of the TeX distribution that you installed. If you used TeX Live, this really should only be an issue if you went for a minimal installation, in which case you'll want to use tlmgr to install them. MiKTeX users should only have a problem if automatic installation of needed packages is disabled. For everyone else, check you distribution's documentation to figure out if these packages are installed (and how to make the available if they are not).

There are also some additional files for Scribus which must be installed. These files are available in the contrib/ directory of the Gregorio sources, and also in the Git repository. These files are 900_gregorio.xml and gregorio.png. If you are under Windows, they are in C:\Program Files\Gregorio\contrib (assuming you have gregorio installed here).

If you are under MacOS X, you will need to slightly modify Scribus to make use of these files. These modifications are described below.

Finally, you need to make Scribus use these files. In the Scribus menu, go to File/Preferences. Then, in the External Tools part, under Render Frames, click on Add and select the file 900_gregorio.xml. Something you might want to do is to make gregorio the first item of the list. To do so, click on Up several times. Click on Apply, then OK, and you’re done.

Use in Scribus

The use of gregorio inside Scribus is almost the same as the use of LaTeX within Scribus: click on Insert/Insert Render Frame, then select the area in which you want a score to appear. Right-click on this area and click on Edit Source, and the editor will open.

First select gregorio in the program list (if it’s not selected by default). The left text area allows you to enter the gabc code of the score. Two other tabs are present: one to add some packages to the LaTeX header, and one to enter some GregorioTeX commands.

The rendering result may look strange at first, because the preview has a low quality; this is not the case for the final rendering; which you will see if you export in PDF.

When you try to export a PDF, you will need to check the box Embed EPS & PDF files (EXPERIMENTAL). While exporting, Scribus will output some warnings, but you can ignore them safely. If you cannot check that box (this happens in certain versions, especially under Linux), the scores will be included as images, which can introduce pixelization. To improve the quality of the images, you can change the value of the option Resolution for EPS Graphics; 600dpi is a standard value for desktop printers. Note that in this case the size of the PDF output file will be as much as 10 times greater.

Modifying Scribus on a Mac

As GUI applications on a Mac do not have access to your regular PATH by default, Scribus is unable to find either the lualatex engine or the gregorio executable by default. To fix this we have to change the way Scribus launches in order to change the PATH it accesses. We’re going to do that based on this procedure found on AskDifferent (the Apple StackExchange). For simplicity sake, I’m going to assume that Scribus is installed in /Applications. If you installed it somewhere else, you’ll need to make appropriate changes below.

The first thing to do is to open up the Scribus app so that we can see the contents. To do this right-click on Scribus and select “Show Package Contents” from the pop-up menu.

Now, navigate to the Contents/MacOS subfolder. You should see a single file called “Scribus” here. To this folder you need to add a file: Scribus.sh. An example of this file can be found in the contrib folder where you found 900_gregorio.xml. Copy that file to this folder and then open the new file for editting.

The example file sets the PATH appropriately for users of MacTeX who may have also installed Gregorio using the package installer. If that is your situation, then you actually don’t need to edit the file. If your setup is different, however, then change /Library/TeX/texbin for the path to lualatex and /usr/local/bin for the path to gregorio. If you are not sure where these are, then open Terminal and enter which lualatex and which gregorio-5_1_1 to find out (replace 5_1_1 with the version of gregorio that you installed; tab completion can help with this). Use these folders, being sure to leave off the names of the executables.

Once the file is edited, save it and then use Terminal to check that its executable bit is set. The command to do this is chmod +x /Applications/Scribus.app/Contents/MacOS/Scribus.sh and should be executed from Terminal.

The next step is to edit Info.plist in the Contents folder. This is an XML file, which means it can be edited with any text editor. If you have XCode installed, you can also edit it with that. Find the CFBundleExecutable key and change the string associated with it to Scribus.sh.

At this point Scribus is properly modified, but the application launcher doesn’t know it yet. The last step, therefore, is to register the change by executing the following command in Terminal: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/Scribus.app That should do it. Fire up Scribus, add the tool as described above (if you haven’t already), and test it out to make sure it works. Incidentally this modification should also make the LaTeX render frame that comes with Scribus work without any special customization.