Getting fountain-mode in Emacs working with imenu-list-mode and writeroom-mode

So I was playing around in Emacs recently [insert obligatory joke here] and saw a working environment that looked kinda like the following:

Emacs fountain-mode with olivetti-mode and imenu-list-minor-mode

I wanted to try it out, but some of the documentation for how to do so was missing. I did some searching around and contacted the people who run that site and was able to get my system to look the same, at least in all the ways that were relevant to me.

So, I wrote it all down, mostly for my own reference later, but maybe you will find it useful too.

My setup: elementary OS v 5.0 (based on Ubuntu 18.04) and Emacs v 25.2.1.

I’m going to assume that the reader knows how to use Emacs as a regular text editor already. There’s a tutorial built into Emacs that is better than what I would write anyway, so if this is your first time using this text editor, I recommend going through it.

Fountain is a markup language for screenwriting. Similar to Markdown, it is unformatted text that many common text editors can parse to apply a simple set of formatting rules. This allows one to focus on writing the story, rather than the details of making sure that Microsoft Word or whatever is correctly applying your stylesheets.

Installing Emacs packages

From inside Emacs, type:

M-x package-install RET fountain-mode RET

This will install the major mode for editing .fountain files. Now, if you open an example .fountain file, it should be parsed with the appropriate markup rules and have syntax-appropriate highlighting and formatting applied.

At this point, you can also already export the .fountain file as a file to be typset by LaTeX into a PDF, or an HTML file to publish online or a couple other formats.

M-x package-install RET olivetti RET

This command will install olivetti-mode, a minor mode which allows one to constrain the width of column in which you’re typing, regardless of the width of the window in which it is contained. This also eliminates distractions in one’s writing environment, as the number of characters you will see across a text file are consistent. This also reduces eye strain, because you can now maximize the window to cover your entire screen without having to follow a line of text that is hundreds of characters long.

M-x package-install RET imenu-list RET

This command installs imenu-list, a plugin that creates an automatically updated index for an Emacs buffer. This will help with navigating your document while you’re editing it.

M-x package-install RET writeroom-mode RET

This command installs a minor mode that makes Emacs go full-screen, and provides a “distraction-free” editing environment.

Installing Courier

Download Courier Prime Emacs, and install on your computer.

To make this work with fountain-mode, go to: Fountain > Customize Faces from the menu bar.

Fountain > Customize Faces in Emacs

This will bring up a page where you can customize the formatting applied in fountain-mode. Scroll down to the first “Fountain face / Default base-level face for ‘fountain-mode’ buffers.” Click on the disclosure triangle to the left of where it says “Fountain” and then click on “Show All Attributes.”

Click the “Font Family” box and then type “Courier Prime Emacs,” then click the “Height” box, change the units to 1/10 pt and enter “120.”

Now click the “State” button and “Save for future sessions.”

When you open fountain-mode, the font will now be 12pt Courier!

Turning these modes on automatically

Right now, fountain-mode should already start automatically when you open a .fountain file, but we want to have olivetti-mode too, as well as an imenu buffer for ease of navigation.

To have fountain-mode start other minor modes when it starts, go to: Fountain > Customize Mode from the menu bar.

Fountain > Customize Mode in Emacs

This will bring up an editor with a lot of options. Scroll down until you find “Fountain Mode Hook / Hook run after entering Fountain mode,” then click the disclosure triangle.

You can uncheck turn-on-visual-line-mode, because this is done by olivetti-mode.

Click the “INS” button and type “olivetti-mode” in the grey text box.

Click “INS” again and type “imenu-list-minor-mode” in the grey text box.

Click “State” and then “Save for future sessions.”

When you’re done editing it, it should look like the following:

Fountain Mode Hook editor

Now when you open a .fountain file, olivetti-mode and imenu-list-minor-mode will start.

I did not tell it to start writeroom-mode automatically, because I personally don’t always want that. If you want to start writeroom-mode, type the following command:

M-x writeroom-mode RET

This will make the current buffer full-screen, and it will hide the imenu buffer. If you want to see the navigation again, the following commands will work:

C-x 3
C-x o
C-x b

The first command listed above splits the window vertically, the second moves the focus to the new window (optional) and the third one prompts you to choose which buffer to switch to.

Type *Ilist* to select the buffer with the scenes and sections menu. Drag the vertical column divider to your liking and enjoy your distraction-free workspace!

But wait, I want to export to PDF

To export your screenplay, Go to Fountain > Export > Buffer to LaTeX.

If your .fountain file is named screenplay.fountain, then it will make a new file in the same directory named screenplay.tex.

LaTeX is not a PDF, but it’s a step in the right direction.

Open the terminal and type the following:

$ sudo apt install texlive-xetex

It will ask for your admin password, and then start installing some software. Once it finishes (it may take a while), in the terminal, navigate to the directory where your .tex file is saved and type the following:

$ xelatex screenplay.tex

This will produce a new file called screenplay.pdf, which will be your printable, final output. Note that section headings (if you used them in your .fountain file, they would have started with #’s) and comments are not included in the final PDF. They are for the writer’s reference only.

Published by

The Grey Literature

This is the personal blog of Benjamin Gregory Carlisle PhD. Queer; Academic; Queer academic. "I'm the research fairy, here to make your academic problems disappear!"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.