PHPirates / travis-ci-latex-pdf

Overview of different methods to build LaTeX with GitHub Actions or Travis-CI (idea by @jackolney but completely rewritten by @PHPirates and contributors).
https://tex.stackexchange.com/a/398831/98850
MIT License
110 stars 23 forks source link

How to Run Travis CI Build with Minted #22

Closed jrg94 closed 5 years ago

jrg94 commented 5 years ago

After looking over this repo a handful of times, it looks like option 4 is the way to go. However, I've played now with 3-5 for a few hours now, and I can't get my LaTeX to build because of the minted package.

In particular, I get the following errors:

Package ifplatform Warning: 
    shell escape is disabled, so I can only detect \ifwindows.
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.
! Package minted Error: You must have `pygmentize' installed to use this packag
! Package minted Error: Missing Pygments output; \inputminted was
probably given a file that does not exist--otherwise, you may need 
the outputdir package option, or may be using an incompatible build tool,
or may be using frozencache with a missing file.

Maybe someone can help me out. I've linked to one of many builds using these YAML files. Feel free to browse and see if you can figure out what I'm doing wrong.

jrg94 commented 5 years ago

After fighting with the existing scripts, I've tried to leverage latexmk, but it seems to be relying on the texlive-latex-extra for minted which isn't up to date as far as I can tell. Overall, this is pretty frustrating as I'd like to use the /setminted global settings which were added in minted 2.0.

! Undefined control sequence.
l.37 \setminted
               {frame=lines}

To add insult to injury, I can generate the PDF just fine locally, but I'm running MikTex on Windows. I don't see a clean way of getting that setup in Travis CI. Overall, just ugh. 😩

PHPirates commented 5 years ago

Thanks for letting me know! Feedback is important to keep the instructions up to date and fix any errors.

Without looking at your specific setup, you say you have these two errors, which many people run into (see for example https://tex.stackexchange.com/questions/146264/i-cant-get-minted-package-to-work-under-ubuntu-pygments-error)

! Package minted Error: You must invoke LaTeX with the -shell-escape flag.

Usually you would replace pdflatex main.tex with pdflatex -shell-escape main.tex as you probably have guessed, but I see that the .travis.yml for method 4 uses texliveonfly in an incorrect way! The texliveonfly -shell-escape ./main.tex should be replaced by texliveonfly --arguments="-shell-escape" ./main.tex. Will fix this, thanks for noticing.

! Package minted Error: You must havepygmentize' installed to use this package`

So, I see in the .travis.yml that python-pygments is installed, which I think should be enough. But maybe this error is also solved by solving the other one, should try that first.

Edit: I just see I have a minted.tex file in this repo which uses the minted package, I think I have tested this previously but for some reason this test seems to have been removed at some point. I will re-add a test with the texlive method so we can be sure it still works.

Edit 2: It looks like for some reason texliveonfly hangs on installing the minted package (and also the caption package, locally on my machine). This is unfortunate, because without texliveonfly you'll have to list packages you want to install manually. I'll have a look at your setup.

Not sure how I'm going to write this in the instructions. Maybe I should say to switch to pdflatex when texliveonfly fails.

PHPirates commented 5 years ago

I fixed it in jrg94/CSE6431#2, let me know if something is unclear.

jrg94 commented 5 years ago

Great stuff! I appreciate the help and the calmness through my frustration. 😄