Latex PDF building?

latex

#1

Has anyone had success with generating Latex files via pdflatex or xelatex?

-Brian


#2

Nope. The latex distribution is too old. For instance, the package nag is missing completely. Now, I’m trying TravisCI based on https://github.com/mgmax/pdflatex-travis-example.

I gave up after I had following circle.yml file

dependencies:
  pre:
    # update and show only important apt output
Trennregeln-nach-hyphsubst&p=344420&viewfull=1#post344420
    # `-o=Dpkg::Use-Pty=0` hint by http://askubuntu.com/a/668859/196423
    - sudo apt-get -qq -o=Dpkg::Use-Pty=0 update
    # remove all texlive related stuff to avoid problems
    #   hint: http://tex.stackexchange.com/a/96977/9075
    - sudo apt-get purge -qq texlive* tex-common*
    # do not install documentation as this causes troubles during installation
    #   build error: https://circleci.com/gh/latextemplates/uni-stuttgart-computer-science-template/4
    #   hint: http://askubuntu.com/a/221275/196423
    # installed pacakges:
    #   * latexmk for building
    #   * texlive-lang-german for dehyph-exptl - see http://www.mrunix.de/forums/showthread.php?73576-
    - sudo apt-get -qq -o=Dpkg::Use-Pty=0 --no-install-recommends install latexmk texlive-lang-german

test:
  override:
    - latexmk document
    - mkdir build
    - mv document.pdf $CIRCLE_ARTIFACTS

#3

This afternoon, I managed to get my Ruby gem Verku to work, which converts Markdown to PDF via LaTeX. This is in Circle 2.0

jobs:
  build:
    machine:
      pre:
        - sudo apt-get install texlive-xetex
    steps:
      - checkout
      - run:
          name: Install Georgia
          command: 'echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections; sudo apt update && sudo apt -y install ttf-mscorefonts-installer'
      - run:
          name: Install Texlive
          command: 'sudo apt update && sudo apt install texlive texlive-xetex texlive-fonts-extra texlive-latex-extra texlive-plain-extra'
      - run:
          name: Install Verku
          command: 'gem install verku'
      - run:
          name: Create pdf.
          command: |
            verku pdf;
            mkdir /tmp/artifacts;
            cp -R builds/* /tmp/artifacts/.

      - store_artifacts:
          path: /tmp/artifacts

#4

Yes, it is very easy using CircleCI 2.0 and docker images. See https://github.com/koppor/docker-texlive

version: 2
jobs:
   build:
     docker:
       - image: koppor/texlive
     steps:
       - checkout
       - run: latexmk document.tex

By using that approach, I also generate PDFs and publish it into gh-pages. Example: http://latextemplates.github.io/scientific-thesis-template/ is generated using https://github.com/latextemplates/scientific-thesis-template/blob/master/.circleci/config.yml


#5

Hey!

Sorry to bump this thread, I’ve just used the textlive image and it worked great!
My question is: how can I install some prerequisites (I have custom fonts I need to install before building)? I tried using

dependencies:
  pre:
    - wget https://github.com/MihailJP/Inconsolata-LGC/releases/download/LGC-1.3.0/InconsolataLGC-1.3.0.tar.xz
  ...

But that didn’t seem to work when using the texlive docker image (I didn’t see any output from those commands, and my build failed for not finding the fonts). I ended up calling each command from steps.run

Is there a better way? Am I holding this wrong? (sorry, very new to CircleCI and/or docker)


#6

Hey @hmemcpy

I’m not familiar with the dependencies key. Are you using Docker 2.0? If so, just put your install command in a run section, as per the entries in Merovex’s post.

Note that fetching the fonts will not install them on its own - you’d need to put them in the right location. It’d be something like:

cd /path/to/fonts/dir && wget https://github.com/MihailJP/Inconsolata-LGC/releases/download/LGC-1.3.0/InconsolataLGC-1.3.0.tar.xz && gunzip InconsolataLGC-1.3.0.tar.xz && tar -xf InconsolataLGC-1.3.0.tar

I’m assuming the .xz is a gzipped file - if not, adjust the gunzip to something more suitable. And of course you’ll need to adjust the fonts dir.


#7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.