pdf build script
Closed this issue · 8 comments
Hi,
Thanks for the book.
Your pdf build script in the readme doesn't set the two variables: $toc
and $alignment
.
Also, my version of markdown2pdf doesn't have the --listings
option, which cause the script to fail.
I removed toc an alignment.
I'm really not a latex or anything expert..pandoc, which is what I used, describes the flag as "Use listings package for LaTeX code blocks". I just checked MikTeX markdow2pdf and it also supports the same flag.
Where did you get your version? maybe I can install it and play with it.
I'm using Ubuntu 10.10 which packages pandoc 1.5.1.1
. I see the latest is 1.8.2, so Ubuntu is some way behind. But https://github.com/jgm/pandoc/blob/master/changelog shows that --listings
was added in 1.8, so that'll be the problem.
I uninstalled Ubuntu's version of pandoc and installed via cabal; so I now have pandoc 1.8.2.1. But now I get (stripping back parameters to simplify):
$ markdown2pdf --xetex --template=template/xetex.template en/mongodb.markdown -o test.pdf
markdown2pdf: ! Undefined control sequence.
l.6 \ifxetex
So, it appears that markdown2pdf can't find xetex. xetex is installed; I use it almost every day.
$ which xetex
/usr/bin/xetex
Looking at the documentation, --xetex
does not appear as an option (http://johnmacfarlane.net/pandoc/README.html), although it is in the man page.
Any ideas?
I got it to build by removing the \ifxetex
statement in xetex.template
. This appears to be unnecessary according to the pandoc docs:
Deprecated `--xetex` option in `pandoc`. It is no longer needed,
since the LaTeX writer now produces a file that can be processed by
`latex`, `pdflatex`, `lualatex`, or `xelatex`.
I also had problems with the link to title.png
, as the build couldn't find it, even though it's there in the same directory as the markdown file.
$ ./build_pdf.sh
markdown2pdf: ! Unable to load picture or PDF file 'title.png'.
<to be read again>
}
l.71 ...}{}{2cm}{}{}{} \includegraphics{title.png}
~
However, by changing the image location to:
![The Little MongoDB Book, By Karl Seguin](en/title.png)\
the build worked. So I guess the image location is relative to the build location, and not the markdown source file's location.
Happily, the listings
package is now being used, which makes things look a lot better.
I was able to reproduce some of the problems that you were having with MiKTex (windows). I didn't change the document (it still links to en/title.png, but moving the image up one folder, to where I ran markdown2pdf, worked (for some reason). Mind trying?
Moving title.png
to the root folder (leaving the markdown alone) also works for me.
Btw, note that the script you give uses en/mongodb.markdown
, so if you run within en
, then it doesn't find the source. Obvious, I know, but just in case we're getting our wires crossed regarding relative paths.
I've been running in the same issues as @auxbuss. Removed the \ifxetex statement and added path to the title.png. However I am now getting this:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
!
! The fontspec package requires either XeTeX or LuaTeX to function.
!
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
!
! See the fontspec documentation for further information.
! For immediate help type H <return>.
!...............................................
I should mention that I am running the following command:
pandoc -N --template=template/xetex.template \
-V paper=$paper -V hmargin=$hmargin -V vmargin=$vmargin \
-V mainfont="$mainfont" -V sansfont="$sansfont" -V monofont="$monofont" \
-V geometry=$geometry -V alignment=$alignment -V columns=$columns \
-V fontsize=$fontsize -V nohyphenation=$nohyphenation \
-V toc=$toc --listings it/mongodb.markdown -o mongodb.pdf
Ok I sorted it out and am posting here the exact command line since it could help other translators as well. The most recent versions of MacTex do not include markdown2pdf and do not support --xetex command line argument:
pandoc -N --template=template/xetex.template --latex-engine=xelatex \
-V paper=$paper -V hmargin=$hmargin -V vmargin=$vmargin \
-V mainfont="$mainfont" -V sansfont="$sansfont" -V monofont="$monofont" \
-V geometry=$geometry -V alignment=$alignment -V columns=$columns \
-V fontsize=$fontsize -V nohyphenation=$nohyphenation \
-V toc=$toc --listings it/mongodb.markdown -o mongodb.pdf
I got it compiled without errors. The PDF seems fine except for some weird bottom margin issue on the PNG image on the cover page.
It was a long time ago but anyone has problems with the current building scheme? If everything is fine this issue could be closed I think.