TransWikia.com

How to check whether the fields of maketitle command is empty

TeX - LaTeX Asked on February 22, 2021

As some people know,i insert tags for command maketitle and it fields ()@author,@date,thanks and title). All works ok,but for @thanks it show,that variable is empty,but it is not empty. I tryed to use tl_if_empty ctf|ntf|Ntf,but it fix this issue,but show not empty @author and @thanks,even if i haven’t it in my document. Help me please,how i can correct check,whether this variable empty. For example if i haven’t author,variable @author should be empty. Thanks everybody for the help.

documentclass{article}
usepackage{tagpdf}
tagpdfsetup{tabsorder=structure,uncompress,activate-all,add-new-tag=Title/P,interwordspace=true,tagunmarked=false,log/all}
pagestyle{empty}
ExplSyntaxOn
prop_set_from_keyval:Nn l__kozlovskiy_data_of_title_prop
  {
    @author = H1 ,
    @date   = H1 ,
    @thanks = H1 ,
    @title  = H1 ,
  }
  makeatletter
DeclareRobustCommandthanks[1]{footnotemark
    protected@xdeforig@@thanks{orig@@thanks
        protectfootnotetext[thec@footnote]{#1}}}
makeatother
cs_new_protected:Npn kozlovskiy_maketitle:
  {
    tagstructbegin{tag=Title}
prop_map_inline:Nn l__kozlovskiy_data_of_title_prop{
cs_set_eq:cc { orig@##1 } { ##1 }
tl_if_empty:cTF{##1}
{
use:c { orig@##1 }
}
{
cs_gset_protected:cpn { ##1 } {
tagstructbegin{tag=##2}
tagmcbegin{tag=##2}
use:c { orig@##1 } 
tagmcend
tagstructend
}
}
}
__kozlovskiy_original_maketitle:
    tagstructend
  }
cs_new_eq:NN __kozlovskiy_original_maketitle: maketitle
cs_gset_protected:Npn maketitle { kozlovskiy_maketitle: }
ExplSyntaxOff
%
author{alexandr Kozlovskiy}
date{today}
title{test document%
  thanks{Alexandr Kozlovskiy}
  }
begin{document}
tagstructbegin{tag=Document}
maketitle
tagstructbegin{tag=P}
tagmcbegin{tag=P}
Test
tagmcend
tagstructend
tagstructend
end{document}

One Answer

thanks doesn't store its contents like author, date and title do. Instead, it appears in the arguments to those commands and then produces the footnote when the title is output. The default behavior is to populate the macro @thanks with a series of footnotemark commands, but this does not happen until the title is typeset, so you won't see anything in the command until the values set by author etc. are expanded. It's not entirely clear what you're trying to accomplish, but I suspect part of your difficulty lies in not wanting to dig into the code of maketitle which is not only where @thanks gets populated, but also where @thanks gets cleared.

Answered by Don Hosek on February 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP