1

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!

2
  • 1
    Small nitpick: You say “Error message [...] Normally this would not be an issue”. It would. Error messages in a macro expansion language like TeX (especially low-level messages like that one) normally mean that something worse will happen down the road and you can't trust the output. Fix the errors! :-) Commented Sep 17, 2020 at 16:43
  • Ha, I guess I am finally running up against the limitations of my 'ignore it and it will go away' approach!
    – tjk8000
    Commented Sep 17, 2020 at 18:06

2 Answers 2

4

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@corau\theauthor } }
         { \tl_if_empty_p:c { mark@corau\theauthor } }
       { \ignorespaces }
       { \str_set:Nx \l_tmpa_str { \use:c{ mark@corau\theauthor } }
         \clist_map_inline:Nn \l_tmpa_str
           {
             \int_case:nn { ##1 }
               {
                 { 1 } { \sep$\ast$ }
                 { 2 } { \sep$\ast\ast$ }
                 { 3 } { \sep$\ast\!\ast\!\ast$ }
               }
               \tex_def:D \sep{\unskip,}
           }
         }
      \cs_if_free:cTF { mark@fnau\theauthor }
        { \ignorespaces }
        { \sep\use:c { mark@fnau\theauthor }
          \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
2
  • Worked like a charm! Although it will take me a good deal of time to parse out what your change to cormark actually does. Thanks again for all your help on this! It's a shame they're asking authors to use this class before ironing out all the bugs ...
    – tjk8000
    Commented Sep 17, 2020 at 18:14
  • 2
    @tjk8000 Yeah, I really don't see the point of this els-cas thingy, mainly because they use their own typesetting system (definitely not LaTeX), so elsarticle was good enough (and I doubt bugs will be fixed: the development seems to be stalled). As for the patch, the original version treats the whole mark@corau\theauthor as a single number, so it breaks when you feed 1,2 to it. I just added a \clist_map_inline:Nn around the \int_case:nn, so it processes 1 and 2 separately. Commented Sep 17, 2020 at 18:22
0

I had the exact same issue. It was caused due to a missing year field in one of the BibTeX entries. I was able to fix the issue by adding the year field like this:

@online{arXiv,
    title = {arXiv.org e-Print archive},
    url = {https://arxiv.org/},
    author = {arXiv},
    year= {2023},
    urldate = {2023-08-07}
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .