I want to output a PDF to create a book for my Philosophy students and I need your help

Hi, everyone!

I’ll be very glad if you could suggest me anything that will help me. I am pretty sure the software —including Scrivener— is working fine, but I cannot make it work. I’m just missing something. Thank you very much in advance, good folks at the Literature and Latte forum!

I am a Philosophy teacher at a High School in the Basque Country (Spain). Over the years I’ve written tens of thousands of words for my students, mainly on Philosophy, History of Philosophy and Psychology, and in three different languages. Always in MultiMarkdown. I type my work in a Mac computer, using mainly iA Writer to edit my Scrivener manuscript via the sync option, but confiding in Scrivener itself for the outline and all the research info.

I usually hand out the units or lessons of my classes in 3K-15K word html (via Moodle or Classroom) and the cute PDFs that iA Writer, Marked 2 or MultiMarkdown Composer do. In an awfully distant past I used the then brand new Scrivener to write formatted text, but since I discovered MMD, I haven’t looked back. But I digress.

My goal now is to consolidate my work into three textbooks in Spanish, all of them I have neatly set up in Scrivener. The basque versions of those books will follow if I get the LaTeX PDF version to work. The manuscript of the History of Philosophy subject is 99,000 words long.

The thing is I’d like to take advantage of the LaTeX exporting capabilities o Scrivener. The MultiMarkdown → PDF option could be enough, if I knew how to tailor it a little bit to my needs.

The main problem

After a lot of research and even the help of a colleague —a math teacher, who else?—, and after having tried a lot of things, including Pandoc, here is the point where I am at:

The only almost good PDF output I can get is the one using the compile option in Scrivener, but only if I use the MultiMarkdown → PDF option with the Book (Memoir) o Basic MultiMarkdownformat selected. The Book (Tufte) won’t work —it gives me a sh: kpsewhich: command not found log error—, and the Article won’t have a TOC. It still has the following issues:

  • Tables spread beyond the printable area, so they are useless. Is there any way I could make them fit the page and the regular margins?
  • The headings lack Spanish acute accents (á, é, í, ó and ú). Those titles are the headings of the Scrivener text files, which transfer to the output PDF through the layoutoption Text Section with Heading. The regular accented words (like “fácil”) in the regular paragraphs or body text work just fine. I guess I’d have to add some \usepackage[spanish]{babel}stuff, but I have not been able to succeed in such business. I have read some threads here in the Literature & Latte forum, but I could not make it work. As soon as I add that line to the Book (Memoir)’s LaTeX Options header or Begin Document tabs, the manuscript won’t compile.
  • The running section title in the header of every page in the Book (Memoir) format doesn’t fit when the section title is too long.
  • The “part” and “chapter” prefixes in the PDF are named in english, not in Spanish. Not a surprise, since I don’t know how to tell Scrivener to tell LaTeX to use Spanish as the main language.

I’d love to incorporate other features, like tweaks to the TOC and double column text, but for now I’d be very grateful to just get a default Book (Memoir) PDF.

Other problems

I am willing to put the effort of learning some LaTeX stuff to make changes to my manuscript if I were able to successfully use Scrivener’s compile set to MultiMarkdown → LaTeX (.tex). But only if I had the option of recompiling it in Scrivener whenever I make changes and somehow “paste” the result into a LaTeX typesetting app or service to get all the other stuff, should I get to configure it properly.

This topic is already too long, but I’d be happy to provide more context, information, screenshots or any other thing to anyone willing to help.

Thanks!

1 Like

Welcome to the forum, and greetings from Galicia!

The first thing I would say is that the MMD->PDF option is handy, but in my experience it is usually only good for proofing. The main reason I say that is that the process of typesetting the .tex file itself can often be very useful to be aware of in detail. Having those log files so you can find places where text is spread out too thin or it had trouble word wrapping can be invaluable. Plus with a long document you can make and test small corrections in the .tex file itself without have to go through a long recompile process (once I get it fixed, I take the fix back into Scrivener so I don’t have to do it again).

It is perhaps possible, once a book has been fully proofed and fine-tuned to switch back to straight PDF, but even then I would hesitate. I do much prefer using the XeLaTeX engine these days, and not just because it gives me access to system fonts. The PDF option just uses pdflatex, which is perfectly serviceable, but a bit long in the tooth (ASCII-only without additional packages). But that one is more a matter of taste. If pdflatex works well for you, and you don’t need to perform any additional post-processing to assemble a bibliography or anything like that, straight to PDF could be fine.

The second thing to consider is to duplicate one of these stock LaTeX formats and edit it, and set the LaTeX Options pane to “Custom”. You’ll be starting from scratch that way, so if you want to see a working example, the “Modern” format does that (even though it’s probably not close to what you want, you can see how to get started with your own from it).

The other way of handling this is how I do it: I put my .tex boilerplate files into my texmf folder and tell MMD to use those with the “LaTeX Config” option in the compiler’s metadata pane. The naming convention is simple, and in fact you can see how to follow it by compiling with Modern and observing the .tex files it produces. If your boilerplate is named ‘mmd6-myproject-header’ (to name one of the three files you need), then you would want to set “LaTeX Config” to “myproject”. It’s as easy as that. I prefer this method over embedding the boilerplate into the compile settings as I can edit the .tex files more freely in a dedicated editor like TeXShop, instead of Scrivener’s basic text fields.

To go over each of your main problem points in order:

  • Tables are one reason to use the slightly longer workflow of compiling to .tex. Now the main problem with MultiMarkdown and tables is that it has no built-in way to set the column configuration for the tables. With the user manual, I had to put together a system that allows me to define a table’s column setup in a custom metadata field in Scrivener, which is then inserted into the compiled output as a LaTeX comment. I have a post-processing script that looks for these special comments and formats the table automatically. So I only have to “debug” a table once, once I get things looking nice, I copy the tabulary line into Scrivener and I’m done.

  • With Spanish diacritics, I think this is where XeLaTeX may help you out. I can’t say with confidence, but I use all kinds of obscure Unicode in the manuals and I have no problems with them.

  • I’m not sure how to handle that one off-hand, that may be a question for tex.stackexchange.com.

  • That’s probably something you can sort out with a package, I would imagine. It’s probably another one for the above resource—but in a worst case scenario, Memoir is very configurable. I definitely recommend downloading the documentation for it, so you can learn how to change its stock headings and such. Even if you don’t need it for this, you’ll probably want to change something at some point, so the output doesn’t look so default.

    And that would also help with adjusting how the ToC looks, to what depth it goes, etc.

I am willing to put the effort of learning some LaTeX stuff to make changes to my manuscript if I were able to successfully use Scrivener’s compile set to MultiMarkdown → LaTeX (.tex). But only if I had the option of recompiling it in Scrivener whenever I make changes and somehow “paste” the result into a LaTeX typesetting app or service to get all the other stuff, should I get to configure it properly.

Yeah, hopefully it’s a little more clear now how you could go about doing that with less risk. If you just edit the .tex files Scrivener deploys into the compile folder, they get overwritten every time. Creating your own set of boilerplate files will resolve that.

And to be clear, that approach does not mean you could never use straight-to-PDF. If the .tex files are in texmf, it will find them. It just makes the design phase a lot easier and more efficient in my experience.

I hope that’s enough to get you started. We have a good LaTeX community here, so I imagine if anyone else other opinions or thoughts you’ll get some feedback.

One last thing to check out: the Scrivener user manuals are written in LaTeX, as I mentioned above, and the project for creating them is publicly available. If you are curious to see how the compiler can be used to do more than the basics, it may serve to be a good reference. The project itself is a bit out of date at this point, in terms of content, but the methods are all there.

3 Likes

Thank you very much, @AmberV. There is a lot to unpack here.

I will study your answer and I will try to implement some of the things you suggested. Still a little bit above my current knowledge level, as I am not able even to just add a language package to the Scrivener LaTeX options, which should be a single command line. So, go figure when will I be able to produce a fully working PDF.

I’ll try my best with your comments and I will —hopefully— share my advancements here.

Thanks for the quick and thorough response, I appreciate it very much!

I have sent a private message to you.

1 Like

There is definitely a lot of ground to cover, so I had to be brief here and there, don’t hesitate to ask if anything isn’t making sense.

I think getting the .tex files you will use to make the book into files you can edit, maybe starting with the files the Memoir setting uses, will help you a lot. Those stock built-ins are nice if all you need is something quick and dirty, but if you want to customise anything, you’re going to need to switch over to using a more custom workflow. There is a little learning to get switched over, but once you do, you’ll be set up and ready to start implementing tips you pick up at StackExchange, here and elsewhere.

1 Like

Seja bem-vindo, @eukeni .

To my knowledge, the Tufte Template is broken and it hasn’t been update in ages (which has nothing to do with Literature and Latte).

There is a simple fix though. Just add the following snippet to the preamble.

\renewcommand\allcapsspacing[1]{{\addfontfeature{LetterSpace=15}#1}}  
\renewcommand\smallcapsspacing[1]{{\addfontfeature{LetterSpace=10}#1}}

If you like the style of this template, I would suggest the KaoBook template instead. It does require you to know some LaTeX to customize and edit it, but you could keep it for future reference and return to it once you have learned the basics. Unlike the Tufte template, it works with BibLaTeX which is a significant improvement.

1 Like

That may be worth bringing up in the MultiMarkdown github, as we just provide a front-end to a selection of the examples setups provided by that system.

I myself didn’t have a problem compiling a simple document with it though (using pdflatex, I recall it not ever working with XeLaTeX.)

It’s a nice look, but I do agree it would be nice for MMD to include a more up to date class for something like this.

1 Like

Aha, this must be the reason why it never worked for me. Afinal de contas, a vida de quem usa acentos fica mais fácil com suporte para unicode :wink:

Done :wink:

1 Like