This is because makecourse.sty includes \usepackage{hyperref} (I guess so it can use \url in the PDF version of the embeds). It seems you can load hyperref with options then load it again without options just fine, but loading it without options then loading it with options causes ! LaTeX Error: Option clash for package hyperref.
I'm not sure if there is a LaTeX way to test in makecourse.sty whether the hyperref package is already loaded but I suspect not because there are a lot of known clashes between hyperref and other packages and the documented solutions seem to be via loading the packages in a specific order. I don't understand the \ifplastex stuff and whether something similar could be done.
(Note that including a link or anything using makecourse like an \alttext in the file contents is not needed to trigger the error.)
The output is like this:
Running makecourse for directory /home/.../coursebuilder/to-break
Traceback (most recent call last):
File "/home/.../coursebuilder/coursebuilder_env/bin/makecourse", line 392, in <module>
main()
File "/home/.../coursebuilder/coursebuilder_env/bin/makecourse", line 380, in main
mc.build_with_theme(theme)
File "/home/.../coursebuilder/coursebuilder_env/bin/makecourse", line 336, in build_with_theme
self.process()
File "/home/.../coursebuilder/coursebuilder_env/bin/makecourse", line 248, in process
processor.visit(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 125, in visit
super().visit(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 30, in visit
return fn(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 44, in visit_part
self.visit(subitem)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 125, in visit
super().visit(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 30, in visit
return fn(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 131, in visit_chapter
self.makePDF(item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/process.py", line 151, in makePDF
latex.runPdflatex(self.course, item)
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/latex.py", line 74, in runPdflatex
LatexRunner(item.in_file, in_dir).exec()
File "/home/.../coursebuilder/coursebuilder_env/lib/python3.9/site-packages/makeCourse/latex.py", line 33, in exec
raise Exception("Error: Something went wrong running: {}\n\n{}".format(' '.join(cmd), ''.join(stdout_tail)))
Exception: Error: Something went wrong running: pdflatex -halt-on-error -recorder test-file.tex
Excluding comment 'divEnv' Excluding comment 'HTML')
! LaTeX Error: Option clash for package hyperref.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.4
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on test-file.log.
The problem goes away if I:
remove the hidelinks option.
set \usepackage[hidelinks]{hyperref} before \usepackage{makecourse}, i.e. this compiles just fine:
This is because
makecourse.sty
includes\usepackage{hyperref}
(I guess so it can use\url
in the PDF version of the embeds). It seems you can loadhyperref
with options then load it again without options just fine, but loading it without options then loading it with options causes! LaTeX Error: Option clash for package hyperref.
I'm not sure if there is a LaTeX way to test in
makecourse.sty
whether thehyperref
package is already loaded but I suspect not because there are a lot of known clashes betweenhyperref
and other packages and the documented solutions seem to be via loading the packages in a specific order. I don't understand the\ifplastex
stuff and whether something similar could be done.Background:
If I do this I get a fatal error:
(Note that including a link or anything using
makecourse
like an\alttext
in the file contents is not needed to trigger the error.)The output is like this:
The problem goes away if I:
remove the
hidelinks
option.set
\usepackage[hidelinks]{hyperref}
before\usepackage{makecourse}
, i.e. this compiles just fine: