TransWikia.com

Error '! Missing = inserted for ifnum' with cas-dc class

TeX - LaTeX Asked by tjk8000 on April 20, 2021

Background

I am currently working on submitting a journal manuscript and am trying to convert my original manuscript from elsarticle class to cas-dc based on feedback and recommendations from Elsevier. My code will successfully typeset my document every other time. It runs through, creates the following error message, I re-run and then it deletes the .aux file and successfully compiles.

Error message:! Missing = inserted for ifnum.

Normally this would not be an issue but as @PhelypeOleinik pointed out in his answer to my original question, I need to successfully compile the document twice in order to get things like author and title notes to work.

Similar questions

I have looked at the following answer/questions without much success:

MWE

Below is a minimum working example that replicates the issue. I use input a lot to keep separate files clean and have replicated that structure here in case that is somehow related. All of the separate files are in the same folder.

In draft_paper.tex

listfiles

documentclass[sort&compress]{cas-dc} 

input{settings_options_parameters} % contains all of the settings/options that I don't think we'll need to change very often

begin{document}

input{frontmatter} 

end{document}

In settings_options_parameters.tex

usepackage{natbib}
usepackage{lipsum}  

ExplSyntaxOn
keys_set:nn { stm / mktitle } { nologo }
ExplSyntaxOff

In frontmatter.tex

Based heavily on the documentation for cas-dc here.


title[mode=title]{Test Title: 101 Reasons Why I Can't LaTeX}

tnotemark[1]

tnotetext[1]{This document is the result of blood, sweat, tears and taxpayer money.}

author[1]{Dummy Author One}[%
    type=author,
    orcid=]
cormark[1]
fnmark[1]
ead[url]{[email protected], url{fakewebaddress.com}}
credit{Everything}
address[1]{Nowheresville, North America}


author[1]{Dummy Author Two}[%
    type=author,
    orcid=]
cormark[2]
fnmark[2]
ead[url]{[email protected], url{phishingsupplies.com}}
credit{Nothing}


author[1]{Dummy Author Two}[%
    type=author,
    orcid=]
cormark[1,2]
fnmark[1,2]
ead[url]{[email protected], url{hackingsupplies.com}}
credit{Nothing}
address[1]{Nowheresville, North America}

cortext[cor1]{Corresponding author}
cortext[cor2]{Principal corresponding author}
fntext[fn1]{This is the first author footnote. but is commonto third author as well.}
fntext[fn2]{Another author footnote, this is a very longfootnote and it should be a really long footnote. But thisfootnote is not yet sufficiently long enough to make two linesof footnote text.}


% Abstract
begin{abstract}[SUMMARY]
lipsum[1-1]
end{abstract}

% Key words
begin{keywords}
LaTeX sep Science sep Crying
end{keywords}

maketitle

Results

These are images of the end result, the first time it compiles, the second time it throws the error mentioned above and it never shows the title notes tnotemark or author notes cormark

enter image description here
enter image description here

The log file after the error is thrown can be found here. listfiles has been added, but if anything else should be added please let me know.

Many thanks for any help on this issue!

One Answer

els-cas has... issues. You found two.

First: the optional document of cormark must be a number, and it is not optional: if you leave it out you get an error. Yes :-)
cormark[] is invalid, as is cormark[1,2], so in principle you cannot put more than one cormark per author (who knows if it's by design or a bug). Here's a patch to make the optional argument of cormark really optional and allow cormark[1,2] (add it yo your preamble):

ExplSyntaxOn
makeatletter
RenewDocumentCommand process@marks { }
   {
     bool_lazy_or:nnTF
         { cs_if_free_p:c { mark@corautheauthor } }
         { tl_if_empty_p:c { mark@corautheauthor } }
       { ignorespaces }
       { str_set:Nx l_tmpa_str { use:c{ mark@corautheauthor } }
         clist_map_inline:Nn l_tmpa_str
           {
             int_case:nn { ##1 }
               {
                 { 1 } { sep$ast$ }
                 { 2 } { sep$astast$ }
                 { 3 } { sep$ast!ast!ast$ }
               }
               tex_def:D sep{unskip,}
           }
         }
      cs_if_free:cTF { mark@fnautheauthor }
        { ignorespaces }
        { sepuse:c { mark@fnautheauthor }
          tex_def:D sep{unskip,}
        }
      }
makeatother
ExplSyntaxOff

Second: The optional argument of ead does basically nothing. ead[url]{[email protected]} is as valid as ead[mashed potatoes]{[email protected]}. Yes :-)
The only difference is that if the optional argument is not empty, els-cas uses url, otherwise it uses detokenize around the argument. Doesn't make a lot of sense, if you ask me. In any way, ead does not (properly) support more than one address.

The documentation suggests you to use ead{[email protected], [email protected]} and make one single URL out of the whole thing, which is wrong (but probably okay, since your paper will be edited by the Elsevier people and the LaTeX template won't be used in the process, so I'd probably go with that.

Another option is to use ead twice, when you need two addresses:

author[1]{Dummy Author Two}
ead{[email protected]} % e-mail adrress
ead[mashed potatoes]{hackingsupplies.com} % website

Correct answer by Phelype Oleinik on April 20, 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