Skip to content

Instantly share code, notes, and snippets.

@fmitha
Created June 22, 2023 12:31
Show Gist options
  • Select an option

  • Save fmitha/c2e8e730b9a7b2c9e3037658ace85ca9 to your computer and use it in GitHub Desktop.

Select an option

Save fmitha/c2e8e730b9a7b2c9e3037658ace85ca9 to your computer and use it in GitHub Desktop.

Revisions

  1. fmitha created this gist Jun 22, 2023.
    37 changes: 37 additions & 0 deletions fifmacroerr.tex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    % 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: