I have a LaTeX document that has to be compiled several times to include all the toc, references, glossaries, pagenotes, general index, and author index with links to the locations in the book. I can create a pdf fine with the correct formats and links, but when I convert it to epub with pandoc all I have are the text and headings. I looked at the documentation for some examples of how I would go about adding the other things, but it wasn't clear how to proceed and I haven't found anything yet in searching.

As I understand it, I need to create a template file for the process. I'm not sure how to do that. Some examples would be good. For some reason pandoc doesn't like some of my environments when I run it from the command line, but if I run it in emacs it at least creates the epub document with the text, missing little environments I set up. I use ArArA to set up the compiling process for xelatex, biber, and makeglossaries. Everything works fine compiling into a pdf.

Perhaps a feature suggestion for ArArA would be to include pandoc with options. That would be nice, but a command prompt example would do. I believe I could make an ArAra yaml file for it if I knew the pandoc commands. A better guide or tutorial for using pandoc like that would be helpful if someone knows a good link. Or is there a better program for that? Pandoc seems to be the best I've found. . Perhaps someone could give some clues about how to proceed.

Here is the compiling process for the pdf:

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = arara
% arara: xelatex
% arara: biber
% arara: makeglossaries
% arara: xelatex
% arara: xelatex: { synctex: yes }

% some of the header
\documentclass[ebook, showtrims, 11pt, draft]{memoir}

\makeindex[intoc, name=general, title=General Index, columns=2]
\makeindex[intoc, name=aut,title=Authors Index,columns=2]


\usepackage[natbib,style=philosophy-modern,backend=biber, backref]{biblatex}


\usepackage[unicode=true, bookmarks=true, bookmarksnumbered=false,
bookmarksopen=false, breaklinks=false, pdfborder={0 0 1}, colorlinks=false]

\printpagenotes \printbibliography \printglossaries
\printindex[general] \printindex[aut]

I'm not sure if that extra compile of xelatex is needed now that I look at it. I must have put it in there at some point. I like ArArA because I can easily disable certain compile processes when I am working on the document and do not have to go through the whole process.

Ideally, I would like to have just lines like these added to the ArArA section:

% arara: pandoc: { ..options, epub, html, etc... }
% arara: pandoc: { ..options, html, etc... }

That I could just turn them off by adding this -

-% arara: pandoc: { ..options, epub,, etc... }}
-% arara: pandoc: { ..options, html, etc... }

Then have these after that:

 % arara: clean: { files: [ *.aux, *.bbl ] }
 % arara: clean: { files: [ *.bcf, *.cod ] }
 % arara: clean: { files: [ *.blg, *.lof ] }
 % arara: clean: { files: [ *.lot, *.out ] }
 % arara: clean: { files: [ *.toc, *.log ] }
 % arara: clean: { files: [ *.acr, *.alg ] }
 % arara: clean: { files: [ *.ent, *.glg ] }
 % arara: clean: { files: [ *.glo, *.gls ] }
 % arara: clean: { files: [ *.nlg, *.acn ] }
 % arara: clean: { files: [ *.xdy, *.idx ] } 
 % arara: clean: { files: [ aut.ilg, aut.ind ] }
 % arara: clean: { files: [ general.idx, general.ilg ] }
 % arara: clean: { files: [ general.ind, *.run.xml ] }

It makes it easy to control the whole compile process with just one ArArA command. Turning things on an off with one key at the top of the document. On a long document I may not need to generate everything or an ebook just for a preview of a few sections in a pdf for example, but it makes it easy to have it there if I want it.

Then it would be nice to have an araramk running that executes the compile when I save a change to the .tex file. That would be easier than reconfiguring and running different commands for different ways of compiling. I could work on it with help, but I don't know the correct way to use pandoc to get started and what is already available with the existing options.

I posted an emacs question on stack overflow about tangling sections using latex with org-mode that is related.


I suppose it would be easier to create some emacs commands for various compile configurations using arara or instead of using arara (if I could run them consecutively after finishing each build with a simple log output when things are running smoothly). It would be a little easier than jumping to the top and disabling the compile operation I do not want to run, now that I think of it. It was just easy to use arara at the top of the file before, jump up to the top tick off the ones I wanted to run if I wanted to change it.

Perhaps I could just tangle different arara compile configurations in source blocks and toggle on with a macro which then runs org-babel-tangle. When the .tex file changes from that, I'll set up a something to watch the file to trigger the arara command on it. That's even better with emacs. I won't need to jump to the top if I want to change it to compile with different options, just use a different keystroke or command where I am in the document. I don't change them that often though so that may be going overboard. I enjoy doing stuff like that in emacs though. I still have the issue with creating the pandoc commands with the right options, which was my new purpose in life. lol

Much thanks for any help you can provide.

I don't see a tag for pagenotes.

  • About the any templates, they reside in $HOME/.pandoc and can be modified by outputting them with pandoc -D epub > default.epub. – blue_tiger300 Mar 7 '16 at 12:58
  • 1
    pandoc supports only subset of LaTeX, you need converter which uses LaTeX itself for the conversion. tex4ebook for example. see this answer of mine for some features – michal.h21 Mar 7 '16 at 16:48
  • Okay. Thanks for the feedback. I'll give it a try and get back. – Dan Boice Mar 8 '16 at 0:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.