Skip to content

Instantly share code, notes, and snippets.

@fmitha
Created June 22, 2023 12:31
Show Gist options
  • Save fmitha/c2e8e730b9a7b2c9e3037658ace85ca9 to your computer and use it in GitHub Desktop.
Save fmitha/c2e8e730b9a7b2c9e3037658ace85ca9 to your computer and use it in GitHub Desktop.
% 12pt default for scrlttr2
\documentclass{scrlttr2}
% \NewDocumentCommand{\foo}{m +m}
% {
% \IfFileExists{./#1}
% {#2}
% {\PackageError{formletterbug}{CONFIG FILE '#1' DOES NOT EXIST - NOT CREATING FORMLETTER}{Check that the config filename (first argument) has been correctly passed to \formletter}}
% %{\PackageError{formletterbug}{CONFIG FILE '#1' DOES NOT EXIST - NOT CREATING FORMLETTER}{Check that the config filename (first argument) has been correctly passed to \foo}}
% }
\ExplSyntaxOn
\NewDocumentCommand{\foo}{m +m}
{
\file_if_exist:nTF{./#1}
{#2}
{\PackageError{foo}{CONFIG~FILE~'#1'~DOES~NOT~EXIST~-~NOT~CREATING~FORMLETTER}{Check~that~the~config~filename~(first~argument)~has~been~correctly~passed~to~\formletter}}
%{\PackageError{foo}{CONFIG~FILE~'#1'~DOES~NOT~EXIST~-~NOT~CREATING~FORMLETTER}{Check~that~the~config~filename~(first~argument)~has~been~correctly~passed~to~\foo}}
}
\ExplSyntaxOff
% Parameters for document commands
\newcommand{\addressesconfigfilename}{fifmacroerr.txt}
\begin{document}
\newcounter{letternum}
\foo{\addressesconfigfilename}
{
Text
}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-engine: luatex
%%% TeX-master: t
%%% End:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment