From f6a8b3116201038b77dad74cef0e2e7f44294b32 Mon Sep 17 00:00:00 2001 From: Deyan Ginev Date: Mon, 30 Dec 2024 21:30:24 +0200 Subject: [PATCH] better deactivation for frontmatter macros after \maketitle --- lib/LaTeXML/Engine/LaTeX.pool.ltxml | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/LaTeXML/Engine/LaTeX.pool.ltxml b/lib/LaTeXML/Engine/LaTeX.pool.ltxml index 0eae2e7b0..e77ea4b9e 100644 --- a/lib/LaTeXML/Engine/LaTeX.pool.ltxml +++ b/lib/LaTeXML/Engine/LaTeX.pool.ltxml @@ -1231,20 +1231,22 @@ DefMacro('\@add@conversion@date', '\@add@frontmatter{ltx:date}[role=creation]{\t # Doesn't produce anything (we're already inserting frontmatter), # But, it does make the various frontmatter macros into no-ops. DefMacroI('\maketitle', undef, - '\lx@frontmatterhere' - . '\@startsection@hook' - . '\global\let\thanks\relax' - . '\global\let\maketitle\relax' - . '\global\let\@maketitle\relax' - . '\global\let\@thanks\@empty' - . '\global\let\@author\@empty' - . '\global\let\@date\@empty' - . '\global\let\@title\@empty' - . '\global\let\title\relax' - . '\global\let\author\relax' - . '\global\let\date\relax' - . '\global\let\keywords\relax' - . '\global\let\and\relax', locked => 1); + '\lx@frontmatterhere\@startsection@hook\lx@deactivate@frontmatter'); +DefPrimitive('\lx@deactivate@frontmatter', sub { + Let('\maketitle', '\relax', 'global'); + Let('\@maketitle', '\relax', 'global'); + Let('\@thanks', '\@empty', 'global'); + Let('\@author', '\@empty', 'global'); + Let('\@date', '\@empty', 'global'); + Let('\@title', '\@empty', 'global'); + DefMacro('\thanks[]{}', Tokens(), scope => 'global'); + DefMacro('\title[]{}', Tokens(), scope => 'global'); + DefMacro('\author[]{}', Tokens(), scope => 'global'); + DefMacro('\date{}', Tokens(), scope => 'global'); + DefMacro('\keywords{}', Tokens(), scope => 'global'); + Let('\and', '\relax', scope => 'global'); + return; +}); DefMacro('\@thanks', '\@empty'); # make a throwaway optional argument available for OmniBus use