From 2cdb61f72a9c6d19813c8cf6c32693d6bc4f9985 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Wed, 31 Jul 2019 17:13:08 -0400 Subject: [PATCH 1/3] Incomplete broken LaTeX export --- build/build.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/build/build.sh b/build/build.sh index 38185b8b..11a62e60 100755 --- a/build/build.sh +++ b/build/build.sh @@ -124,4 +124,35 @@ if [ "${BUILD_DOCX:-}" = "true" ]; then "$INPUT_PATH" fi +# Create LaTeX output (if BUILD_LATEX environment variable equals "true") +if [ "$BUILD_LATEX" = "true" ]; +then + echo >&2 "Exporting LaTeX manuscript" + pandoc \ + --from=markdown \ + --to=latex \ + --standalone \ + --wrap=preserve \ + --filter=pandoc-fignos \ + --filter=pandoc-eqnos \ + --filter=pandoc-tablenos \ + --bibliography=$BIBLIOGRAPHY_PATH \ + --csl=$CSL_PATH \ + --metadata link-citations=true \ + --number-sections \ + --resource-path=.:content \ + --output=output/latex/manuscript.tex \ + $INPUT_PATH + echo >&2 "Exporting PDF from LaTeX manuscript" + if [ -L output/latex/images ]; then rm output/latex/images; fi # if output/latex/images is a symlink, remove it + ln -s ../../content/images output/latex/images + docker run \ + --rm --interactive --tty \ + --volume "$(pwd)":/home \ + --workdir /home/output/latex \ + dockershelf/latex:full \ + xelatex -interaction=nonstopmode manuscript.tex + rm images +fi + echo >&2 "Build complete" From 24180df745529e26231ccef7d1497067a5c9ff11 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Sun, 4 Aug 2019 18:27:05 -0400 Subject: [PATCH 2/3] Small fixes --- .travis.yml | 2 ++ build/build.sh | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ab7f1609..c211855e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ services: branches: only: - master +env: + - BUILD_LATEX=true before_install: - wget https://repo.continuum.io/miniconda/Miniconda3-4.6.14-Linux-x86_64.sh --output-document miniconda.sh diff --git a/build/build.sh b/build/build.sh index 11a62e60..47529f09 100755 --- a/build/build.sh +++ b/build/build.sh @@ -125,9 +125,10 @@ if [ "${BUILD_DOCX:-}" = "true" ]; then fi # Create LaTeX output (if BUILD_LATEX environment variable equals "true") -if [ "$BUILD_LATEX" = "true" ]; +if [ "${BUILD_LATEX:-}" = "true" ]; then echo >&2 "Exporting LaTeX manuscript" + mkdir -p output/latex pandoc \ --from=markdown \ --to=latex \ From 102c2015301a78a8f039c69d25daff8ac7ddf126 Mon Sep 17 00:00:00 2001 From: Daniel Himmelstein Date: Sun, 4 Aug 2019 23:48:13 -0400 Subject: [PATCH 3/3] More broken code Pandoc can convert to PDF, but not with the PSB documentclass --- build/build.sh | 69 +++++++++++++++++++++++++++++++++++++------ build/environment.yml | 2 +- 2 files changed, 61 insertions(+), 10 deletions(-) diff --git a/build/build.sh b/build/build.sh index 47529f09..9720cfba 100755 --- a/build/build.sh +++ b/build/build.sh @@ -129,6 +129,7 @@ if [ "${BUILD_LATEX:-}" = "true" ]; then echo >&2 "Exporting LaTeX manuscript" mkdir -p output/latex + cd output/latex pandoc \ --from=markdown \ --to=latex \ @@ -137,23 +138,73 @@ then --filter=pandoc-fignos \ --filter=pandoc-eqnos \ --filter=pandoc-tablenos \ - --bibliography=$BIBLIOGRAPHY_PATH \ - --csl=$CSL_PATH \ + --bibliography=../../$BIBLIOGRAPHY_PATH \ + --csl=../../$CSL_PATH \ --metadata link-citations=true \ --number-sections \ - --resource-path=.:content \ - --output=output/latex/manuscript.tex \ - $INPUT_PATH + --metadata=documentclass:ws-procs11x85 \ + --resource-path=.:../../content \ + --extract-media=images \ + --output=manuscript.tex \ + ../../$INPUT_PATH echo >&2 "Exporting PDF from LaTeX manuscript" - if [ -L output/latex/images ]; then rm output/latex/images; fi # if output/latex/images is a symlink, remove it - ln -s ../../content/images output/latex/images + #if [ -L output/latex/images ]; then rm output/latex/images; fi # if output/latex/images is a symlink, remove it + #ln -s ../../content/images output/latex/images docker run \ --rm --interactive --tty \ + --user "$(id -u):$(id -g)" \ --volume "$(pwd)":/home \ - --workdir /home/output/latex \ + --workdir /home/ \ dockershelf/latex:full \ - xelatex -interaction=nonstopmode manuscript.tex + xelatex manuscript.tex rm images fi + +CSL_PATH=build/assets/style.csl +BIBLIOGRAPHY_PATH=output/references.json +INPUT_PATH=output/manuscript.md + +# sudo apt install librsvg2-bin +# https://anaconda.org/conda-forge/librsvg +# texlive-xelatex texlive-full + +pandoc \ + --verbose \ + --from=markdown \ + --wrap=preserve \ + --filter=pandoc-eqnos \ + --filter=pandoc-tablenos \ + --filter=pandoc-fignos \ + --number-sections \ + --metadata=documentclass:ws-procs11x85 \ + --bibliography=../../$BIBLIOGRAPHY_PATH \ + --csl=../../$CSL_PATH \ + --metadata link-citations=true \ + --resource-path=.:../../content \ + --pdf-engine=xelatex \ + --output=manuscript-pandoc-latex.pdf \ + ../../$INPUT_PATH + +# https://github.com/jgm/pandoc/issues/4721 + --pdf-engine-opt=-output-directory=output/latex \ + --metadata=documentclass:ws-procs11x85 \ + + echo >&2 "Build complete" + + docker run \ + --rm --interactive --tty \ + --volume "$(pwd)":/home \ + --workdir /home/output/latex \ + dockershelf/latex:full \ + pandoc --version + +docker run \ + --rm \ + --volume "$(pwd):/data" \ + --user "$(id -u):$(id -g)" \ + --entrypoint which \ + pandoc/latex:2.7.3 \ + pandoc + diff --git a/build/environment.yml b/build/environment.yml index fa807dba..67ebb7c8 100644 --- a/build/environment.yml +++ b/build/environment.yml @@ -9,7 +9,7 @@ dependencies: - jinja2=2.10 - jsonschema=3.0.1 - pandas=0.24.2 - - pandoc=2.7.2 + - pandoc=2.7.3 - pango=1.40.14 - pip=19.1 - psutil=5.6.2