Fix Comic Sans MS font error in LaTeX compilation workflow #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The GitHub Actions workflow was failing with the following error when compiling LaTeX documents:
This occurred because the Ubuntu runners don't have the Comic Sans MS font installed by default, which is required by the LaTeX documents (specifically used in
sty/3_Loesung.sty
for solution text styling with\fontspec{Comic Sans MS}
).Solution
Replaced the unreliable Microsoft Core Fonts installation with a robust font solution:
Comic Sans MS.ttf
(with spaces)ComicSansMS.ttf
(without spaces - the internal name luaotfload searches for)Technical Details
The fix works by:
fonts-comic-neue
package for the actual font filesluaotfload-tool --update --force
to rebuild the font databasetexlive-lang-german
for German language support required by the documentsThis approach is more reliable than the previous Microsoft Core Fonts installer, which often failed due to network issues or licensing problems.
Testing
main.tex
compilation - successful.gitignore
to prevent LaTeX build artifacts from being committedThe workflow now compiles all LaTeX documents successfully without font errors, while maintaining visual consistency by using Comic Neue as a Comic Sans MS substitute.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
downloads.sourceforge.net
/usr/lib/apt/methods/http
(dns block)esm.ubuntu.com
/usr/lib/apt/methods/https
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
I still get the following error. Please fix it!
luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: Font "Comic Sans MS" not found.
./_Hefteintraege/H01_LoesungsfelderTeil1.tex:37: Package fontspec Error:
(fontspec) The font "Comic Sans MS" cannot be found; this may
(fontspec) be but usually is not a fontspec bug. Either there
(fontspec) is a typo in the font name/file, the font is not
(fontspec) installed (correctly), or there is a bug in the
(fontspec) underlying font loading engine (XeTeX/luaotfload).
For immediate help type H .
...
l.37 }
23740 words of node memory still in use:
172 hlist, 17 vlist, 16 rule, 195 disc, 15 local_par, 4 dir, 8 math, 487 glu
e, 57 kern, 60 penalty, 1636 glyph, 715 attribute, 104 glue_spec, 395 attribute
_list, 4 temp, 5 if_stack, 15 write, 3 save_pos, 278 pdf_literal, 8 pdf_start_l
ink, 8 pdf_end_link, 2 pdf_dest, 4 pdf_action, 102 pdf_colorstack nodes
avail lists: 2:3,3:17,4:145,5:5,6:6,8:39,9:189,10:3
./_Hefteintraege/H01_LoesungsfelderTeil1.tex:37: ==> Fatal error occurred, no
output PDF file produced!
Transcript written on presentation-full.log.
Error: Process completed with exit code 1.
The following is a snapshot of a chat conversation between a user and an AI coding assistant. Prioritize later messages in the conversation.
User: Error: File 'main.tex' cannot be found from the directory '/home/runner/work/FancyScript/FancyScript'.
Error: Process completed with exit code 1.
AI: The error indicates that the GitHub Actions workflow cannot find
AI: in the working directory
/home/runner/work/FancyScript/FancyScript
. This usually happens if the file is not at the root of the repository or if the working directory is not set correctly.Given your workspace structure,
AI: is at the root of the repository, so the issue is likely with the working directory in the workflow.
Solution:
You need to ensure that the workflow is running in the correct directory where
AI: is located. By default, GitHub Actions checks out the repository into the root of the workspace, so unless you change directories, it should work. However, if your workflow or the action is running in a subdirectory, you may need to specify the
working_directory
or adjust theroot_file
path.How to fix:
root_file
to the correct relative path (e.g.,../main.tex
if you are in a subfolder).working_directory
input for the action if supported.Would you like me to update your workflow to ensure the correct path is used for
AI: ? If so, should the workflow always run from the repository root, or do you want to specify a different directory?
User: When Github runs the Release-Workfow it gives me that exception. Fix it!
AI: I can see the issue! In your workflow, the
compile
job is missing the checkout step. Theprepare
job checks out the repository, but thecompile
job runs on a separate runner and doesn't have access to the repository files.Let me fix this by adding the checkout step to the
compile
job:AI:
AI: The issue was that each job in GitHub Actions runs on a separate runner instance. Even though the
prepare
job checked out the repository, thecompile
job didn't have access to those files because it's running on a different runner.By adding the
checkout
step to thecompile
job, the repository files (includingAI: ) will be available in the working directory when the LaTeX compilation runs.
The workflow should now work correctly!
User: Extend the workflow to run a Latex build for every *.tex file in the directory ./Demo_PDFs and attach the resulting PDFs with the same name as the .tex file to the workflow run. Make sure that the builds can run parallely to save time.
AI: I need to first check what
.tex
files are in theAI: directory to understand the structure better.
AI: Perfect! I can see there are 6
.tex
files in theAI: directory. I'll modify the workflow to:
.tex
fileAI:
AI: Wait, I need to fix the PDF path in the upload step. The LaTeX action will generate the PDF with the same name as the
.tex
file, but I need to remove the.tex
extension and add.pdf
:AI:
AI: Actually, let me fix this properly by extracting the basename without the extension:
AI:
AI: Perfect! I've extended the workflow with the following changes:
What I added:
compile-demo-pdfs
: Runs in parallel with the main compile job.tex
file...💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.