Scrivener Pandoc Miklatex, > PDF Error on Mac

I have installed Miktex on my Mac because it is the version of LaTex generally used in China to handle Chinese. (I work in Chinese linguistics).

I can write PDF files from the command line of Pandoc, and I can use programs like Latexit. But If I use Scrivener to produce a PDF via Pandoc and Miklatex, I get the following error.

This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6800)
entering extended mode
! I can’t find file `"./visit to khazakstan pandoc.tex"’.
<*> “./visit to khazakstan pandoc.tex”

Please type another input file name
! Emergency stop.
<*> “./visit to khazakstan pandoc.tex”

! ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.

I have made adjustments to path advised by members of the Miktex forum.

Does anyone have any suggestion? Do I have to install MacTex? ( I would rather not as I have used MacTex before I ever heard of Scrivener, and I always have trouble with Chinese type of characters as well as fonts used by linguists.

By the way, I love Scrivener because it works for the way I write. But the whole compiling routine seems to be arcane, even to someone like me who has had experience with Latex.

However I admit ignorance to many things that concern Markdown, Unicode, and LaTex. So if you can help, please do not hesitate dumb down the answer a bit. :slight_smile:


Can you make a minimal Scrivener project that reproduces your error, and I can at least check with MacTeX. If Pandoc > .tex is working it is probably something in the way you are triggering Pandoc from Scrivener… How do you do this?

I’m not sure what MiKTeX is supposed to do that MacTex doesn’t as they should both contain basically identical LaTeX packages — but LaTeX is such a complicated underlying system it doesn’t surprise me there may be some influence of configuration?

And offtopic, but have you tried XeTeX or LuaTeX as both support full unicode range and so in theory should deal with Chinese characters more robustly than pdfTeX?

Hi. I appreciated your response. When I tried using the Pandoc from the terminal command line, MikTex downloaded some additional files by itself, and the problem of working from Scrivener just disappeared.

I am told by a number of people that I should use XeTex or LuaTex. Is there a way to set that up through scrivener ? - I apologize if this is a kind of a dumb question. For me at least the scrivener manual is rough going when it gets to Pandoc-Latex discussions.

BTW, I was very happy to receive a message from you as I have been studying your posts on citation and bibliography workflows. I am not quite ready to ask intelligent questions, but I am trying to use Bookends and Scrivener to produce citations and bibliographies easily portable to different publications and Ebooks. I use Mellel 4 for its languages support ( I work with a variety of language scrips), but I am never satisfied with getting documents out of Mellel. I would prefer to keep my workflow based in Scrivener if I can.

I have not found an easy reference explaining issues of encoding, Unicode, RTF, LaTex, Postscript, and PDFs. Most writers on the subject assume the reader knows much more than I do . This topic does not seem to be covered in the “For Dummies” series of books. My traditional workflow for publication has been Word documents, with prints marked up in pencil. As a certain person likes to say: Sad!

To get XeLaTeX or LuaLaTeX to work, there are several ways (as usual) to do that, but the simplest is that you pass the required PDF engine in as an option to Pandoc when your output format is PDF –pdf-engine=xelatex — as I use pandocomatic to manage my pandoc options I use a templete to do this like so: … .yaml#L218

You can also put % !TEX TS-program = xelatex at the top of your LaTeX templates. Or specify it using -xelatex if you use latexmk.

I think Mellel is a great word processor, and used it for a brief spell alongside Scrivener several years ago. Then I moved to LibreOffice+Scrivener as I could better hack the output. But Pandoc + Scrivener really offers me the best workflow.

And no, there is no real good single source of info out there. I find LaTeX completely overwhelming even though I consider myself a geek. Luckily, my requirements are not so great and I can get what I need out of it — I use it for writing letters from Scrivener {latex template} and generating general articles/reports, but in my field almost all journals require a word doc for final submission. The cool thing about scrivener+pandoc is I can use both a LaTeX PDF and DOCX output from the same project when needed…

Thanks for the kind words! On this last point, though - and without wishing to sound defensive - I would say that the very fact that you are trying to get Pandoc Miklatex working with Scrivener (I’ve never even heard of Miklatex) shows exactly what Compile is almost impossible to make 100% simple for everyone. It has to allow for users to be able to structure their work in any way, and then to put together bespoke formats to get that work out using any number of formatting and structural combinations in a large range of file formats. Some of our biggest ongoing development and design work goes into Compile. It has been redesigned with every major version update and refined with nearly every point update. I doubt we’ll ever get it to a point where users aren’t complaining about friction without turning it into a giant red button that does nothing but puts all of the text into a single document and lets the user worry about how it looks in another app. :slight_smile:

This is probably because we aren’t Pandoc experts ourselves. :slight_smile: These output options are there, and we work with users (such as nontroppo) to test them and help us refine them, but ultimately these more advanced output options are left to those who know how to use Pandoc and such already. This does mean getting to know both Pandoc via whatever documentation is available online and Scrivener separately, which is of course going to cause more friction.

As nontroppo says, though, if you can put together a minimal project that reproduces the error and upload it, then hopefully one of us will be able to work out what is causing the error, and whether it is a Scrivener problem or a setup problem.

All the best,

@nontroppo, et al.:

I’m using Scrivener+LaTeX, and received an error message regarding memory:

TeX capacity exceeded, sorry [main memory size=500000]

On more than one web page including at:

there are comments about using ‘lualatex’ to expand the available memory. I’ve added the code you suggested:

% !TEX TS-program = xelatex

to the Scrivener Text Layout:Document Prefix (after the call to Arara) in an attempt to run ‘lualatex’:

	% !TEX TS-program = Arara 
	% !TEX encoding = UTF-8 Unicode
	[b]% !TEX TS-program = xelatex[/b]

but I’m still seeing the above memory error.

Question: Am I implementing the call to run ‘lualatex’ with Scrivener correctly by adding % !TEX TS-program = xelatex to my Text Layout:Document Prefix?

Thank you,

Hi nontroppo,

Forgive me, but it turned out in my 10K lines of code, I was missing an ‘\end{wrapfigure}’ which threw off almost my entire compilation, resulting in an out-of-memory error.

Everything now is working as it should, with NO memory error.

My apologies for the false alarm.

Thank you,

Ha, LaTeX can indeed be a bit fussy sometimes… :open_mouth:

Hi nontroppo,

Yes, LaTeX can be a bit problematic at times, like when I spent the better part of 2+ days trying to figure out why a call to create a \begin{wrapfigure} … \end{wrapfigure} environment located directly before a call to the Lettrine package (\lettrine[lines=…) caused the Figure inside the wrapfigure environment to not appear, an issue that I could not find documented anywhere. :frowning:

The solution of placing the call to create the wrapfigure environment after the paragraph with the call to the Lettrine package was simple enough. However, as with the earlier out-of-memory error, I can completely understand why errors and omissions [such as missing an ‘\end{wrapfigure}’] can wreak havoc on a LaTeX compiler, and the days spent only point to my lack of debugging skills … :blush:

Nonetheless, such trials and tribulations are minor when compared to the awesome power of Scrivener+LaTeX to construct documents that in years past I could only dream of creating. :smiley:

Thank for responding … apologies for the initial false alarm,