Skip to content

Commit 53716c6

Browse files
committed
ci(build): support building inkscape figures in CI
Signed-off-by: Jonas Dujava <[email protected]>
1 parent 6d3a798 commit 53716c6

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
uses: xu-cheng/latex-action@v3
2323
with:
2424
root_file: thesis.tex
25+
texlive_version: latest # must be `2024` or later (`latest` chosen by default)
26+
extra_system_packages: coreutils icu inkscape # `coreutils` for `mktemp`, `icu` for `uconv`
2527
- name: Upload the artifact
2628
uses: actions/upload-artifact@v4
2729
with:

figures/Inkscape/inkscape-export-to-latex

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ if [ -f "$directory/add-watermark" ]; then
1818
author_name=$(sed -n 's/^[^%].*ThesisAuthorPlaintext}{}{\(.*\)}$/\1/p' preamble/data.tex)
1919
## if the `\ThesisAuthorPlaintext` command is commented out, extract from the `\ThesisAuthor` command
2020
[ -z "$author_name" ] && author_name=$(sed -n 's/.*ThesisAuthor}{}{\(.*\)}$/\1/p' preamble/data.tex)
21+
## use just ASCII characters, see https://unix.stackexchange.com/a/653210
22+
author_name=$(echo "$author_name" | uconv -x Latin-ASCII)
2123

22-
author_name=$(printf "%s" "$author_name" | iconv -f utf8 -t ascii//TRANSLIT) # use just ASCII characters
23-
watermark_string="$(date +%Y) $author_name" # prepend the year
24+
watermark_string="$(date +%Y) $author_name" # prepend the year
25+
# watermark_string="$(date +%Y) Author's Name" # NOTE: or manually edit the watermark string here
2426

25-
# watermark_string="$(date +%Y) Author's Name" ## NOTE: or manually edit the watermark string here
27+
## use the `add-watermark` script to insert the watermark into the PDF
2628
"$directory"/add-watermark "$1-fixed.pdf" "$watermark_string"
2729
fi
2830

preamble/misc/inkscape.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
\usepackage{filemod}
77
\NewDocumentCommand{\exportInkscapeSVG}{O{./figures/Inkscape/} m}{%
88
\filemodCmp{#1#2.pdf}{#1#2.svg}{}{% regenerate PDF+LaTeX code if SVG is newer
9+
\ClassNote{TeXtured}{(Re)generating Inkscape SVG to PDF+LaTeX figure:\MessageBreak #1#2.svg}%
910
\ShellEscape{#1inkscape-export-to-latex "#1#2"}% use `inkscape-export-to-latex` script in the same directory
1011
}%
1112
}

0 commit comments

Comments
 (0)