Skip to content

Commit

Permalink
fix: adding include hook that fails when a file is missing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Brand committed Feb 6, 2024
1 parent e00f418 commit 6287891
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions slides/common/preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,15 @@
% the style to all pictures.
\tikzstyle{every picture}+=[remember picture]
\tikzstyle{na} = [baseline=-.5ex]

% Add an include hook to error when a file is missing,
% to be able to recognize missing \include files on the
% CI.
% from: https://tex.stackexchange.com/questions/620515/how-to-force-latex-to-error-when-an-include-file-is-missing-misspelled
\makeatletter
\def\mkfilename#1{%
\if\relax\detokenize\expandafter{#1}\relax\else#1/\fi}
\AddToHook{include/before}%
{\IfFileExists{\mkfilename\CurrentFilePath\CurrentFile}{}
{\GenericError{}{Error: File \mkfilename\CurrentFilePath\CurrentFile.tex not found!}{\@gobble}{}}}
\makeatother

0 comments on commit 6287891

Please # to comment.