В настоящее время я пытаюсь автоматически создавать файлы PDF с помощью GitLab CI. Основываясь на этом, у меня работает основная вещь, однако pdflatex не может найти мои включенные рисунки/изображения:
! Unable to load picture or PDF file 'graphics/.../image.png'.
<to be read again>
Latexmk: Missing input file: 'graphics/.../image.png' from line
'LaTeX Warning: File `graphics/.../image.png' not found on input line 802.'
Мой .gitlab-ci.yml выглядит так:
stages: # List of stages for jobs, and their order of execution
- compile
compile_pdf:
stage: compile
image: tianon/latex
script:
- latexmk -pdf -pdflatex = "xelatex -interaction=nonstopmode" -use-make thing.tex
artifacts:
paths:
- thing.pdf
и мой makefile выглядит так:
# From DevSolar https://tex.stackexchange.com/a/40759/201491
# You want latexmk to *always* run, because make does not have all the info.
# Also, include non-file targets in .PHONY so they are run regardless of any
# file of the given name existing.
.PHONY: thing.pdf all clean
# The first rule in a Makefile is the one executed by default ("make"). It
# should always be the "all" rule, so that "make" and "make all" are identical.
all: thing.pdf
# CUSTOM BUILD RULES
# In case you didn't know, '$@' is a variable holding the name of the target,
# and '$<' is a variable holding the (first) dependency of a rule.
# "raw2tex" and "dat2tex" are just placeholders for whatever custom steps
# you might have.
# %.tex: %.dat
# ./dat2tex $< > $@
# MAIN LATEXMK RULE
# -pdf tells latexmk to generate PDF directly (instead of DVI).
# -pdflatex = "" tells latexmk to call a specific backend with specific options.
# -use-make tells latexmk to call make for generating missing files.
# -interaction=nonstopmode keeps the pdflatex backend from stopping at a
# missing file reference and interactively asking you for an alternative.
thing.pdf: thing.tex
latexmk -pdf -pdflatex = "xelatex -interaction=nonstopmode" -use-make --shell-escape thing.tex
clean:
latexmk -CA
Оба основаны на этом репо . Как правильно добавить изображения и рисунки? Во всех уроках, которые я нашел, которые используют рисунки (например, это), это просто сработало. Или я что-то упускаю?
Спасибо!
Я обнаружил, что ctornau/latex
Docker Image работает из коробки.
У меня есть небольшой репозиторий шаблонов, настроенный на https://gitlab.com/WaldemarLehner/latex-starter
Встроенный PDF-файл можно найти по адресу https://waldemarlehner.gitlab.io/latex-starter
А вот мой gitlab.ci.yml:
build:
image: ctornau/latex
stage: build
artifacts:
paths:
- main.pdf
script:
# This is needed for colored code blocks. If you dont need
# them, you can remove this section
- apt-get -y update
- apt-get -y install python3-pip
- pip3 install pygments
# section end
- latexmk -shell-escape -pdf main.tex
# This will host the PDF w/ Gitlab Pages
pages:
image: alpine:latest
stage: deploy
dependencies:
- build
script:
# Feel free to change the mv target to something else. You will need to update the index.html though
# Everything inside public will be hosted by Pages
- mv main.pdf public/main.pdf
artifacts:
paths:
- public
ты прав! Виноват. Исправил в моем ответе
Спасибо за ваш вклад, теперь это работает! Однако на изображении есть опечатка, по-видимому, это: ctornau/latex.