commit 394ad5a57cf415480f90842a7f29b46d28bca998 Author: Knut Ahlers Date: Fri Apr 15 14:15:54 2016 +0200 Initial version diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..55df041 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM ubuntu + +MAINTAINER Knut Ahlers + +ENV PACKAGES \ + texlive-xetex \ + texlive-latex-extra \ + texlive-latex-recommended \ + texlive-fonts-recommended \ + texlive-lang-european \ + texlive-lang-german + +RUN apt-get update \ + && apt-get install -y $PACKAGES \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +ADD ./generate-pdf /usr/local/bin/generate-pdf + +VOLUME ["/src"] +WORKDIR /src + +ENTRYPOINT ["/usr/local/bin/generate-pdf"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..315975e --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# Luzifer / xetexgen + +This container is intended as a replacement for a local TeX installation. The purpose mainly is to have a working TeX environment on a Mac without having to deal with all the implications a local TeX installation brings on OSX. + +## Usage + +The container contains a simple script with basic commands to generate a PDF from your TeX file. So you can use this command if for example your TeX file is named `letter.tex`: + +```bash +# docker run --rm -ti -v $(pwd):/src luzifer/xetexgen letter.tex +This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013/Debian) + restricted \write18 enabled. +entering extended mode +This is XeTeX, Version 3.1415926-2.5-0.9999.3 (TeX Live 2013/Debian) + restricted \write18 enabled. +entering extended mode +Rendering was successful. Cleaning up... +``` + +Alternatively you can change parameters by overwriting the `ENTRYPOINT`: + +```bash +# docker run --rm -ti -v $(pwd):/src --entrypoint=xelatex luzifer/xetexgen --help +Usage: xetex [OPTION]... [TEXNAME[.tex]] [COMMANDS] + or: xetex [OPTION]... \FIRST-LINE + or: xetex [OPTION]... &FMT ARGS +[...] +``` diff --git a/generate-pdf b/generate-pdf new file mode 100755 index 0000000..0a8656f --- /dev/null +++ b/generate-pdf @@ -0,0 +1,22 @@ +#!/bin/bash + +TEXFILE=$1 + +if ! [ -f ${TEXFILE} ]; then + echo "You need to specify the file to render." + exit 1 +fi + +if ! ( xelatex -interaction=batchmode ${TEXFILE} ); then + echo "An error occurred while processing ${TEXFILE}. Please see the log." + exit 1 +fi + +# Do a second run in order to render page numbers etc +if ! ( xelatex -interaction=batchmode ${TEXFILE} ); then + echo "An error occurred while processing ${TEXFILE}. Please see the log." + exit 1 +fi + +echo "Rendering was successful. Cleaning up..." +rm -f ${TEXFILE/.tex/.log} ${TEXFILE/.tex/.aux}