footnotemark in description environment generates error

1,069

This seems to be a case of a fragile command (\footenotemark) in a moving argument (\item). So put \protect before the \footnotemark.

 \item[A brilliant feature\protect\footnotemark]\footnotetext{\label{fn:onlyCol}available on select models} It helps spawn a new civilization.

The LaTeX book gives some information about fragile commands. At least every command that has an optional argument or a * form is fragile. \footnotemark (and \footnote) have an optional argument and so they are fragile. Normally the \item in a list is a safe place, but apparently due to your customization with \setlist is has become a moving place that is unsafe for fragile commands. Usually the kind of error message you get:

Use of \@xfootnotemark doesn't match its definition

gives me a hunch that there are fragile commands involved.

Anyway, putting \protect before a command when it is not really needed is usually harmless.

Share:
1,069

Related videos on Youtube

abyshukla
Author by

abyshukla

Updated on December 20, 2020

Comments

  • abyshukla
    abyshukla almost 3 years

    I am writing a manual for a product, which has additional features only on select models. I, obviously, try to use footnotes to indicate the same.

    Please use this Preamble

    MWE:

    \begin{description}
        \item[] \screenshot{figure name}{figure caption}
        \item[A brilliant feature\footnotemark]\footnotetext{\label{fn:onlyCol}available on select models} It helps spawn a new civilization.
        \item[Activate brilliant feature]\textsuperscript{\ref{fn:onlyCol}} Activates the above mentioned brilliant feature.
    \end{description}
    

    Errors:

    Use of \@xfootnotemark doesn't match its definition. ... A brilliant feature \footnotemark]

    Argument of \stepcounter has an extra }. ... A brilliant feature \footnotemark]

    Paragraph ended before \stepcounter was complete. ... A brilliant feature \footnotemark]

    Steps taken so far:

    1. tried removing \label{fn:onlyCol}
    2. tried using \footnote{available on select models}
    3. Answer by Lockstep
    4. Answer by Uriel CP

    Class used: Article

    Package: Hyperref and others.

    Compiler: XeLaTeX

    IDE: Texstudio

    Note: The suggested Similar Questions do not indicate that this question is a duplicate.

    EDIT:

    This works

    \item[Activate brilliant feature]\textsuperscript{\ref{fn:onlyCol}} Activates the above mentioned brilliant feature.
    

    But this doesn't

    \item[Activate brilliant feature\textsuperscript{\ref{fn:onlyCol}}] Activates the above mentioned brilliant feature.
    

    May I ask why? or will that be another question?

    • Werner
      Werner almost 7 years
      I can't replicate your particular problem. Please provide a minimal but complete example of code. It should start with \documentclass and end with \end{document}.
    • jon
      jon almost 7 years
      Please provide a minimal example (or see here). I cannot reproduce that error if I stick that block of code between \documentclass{article} \usepackage{hyperref} \begin{document} and \end{document}, though the command \screenshot will generate an error.
    • abyshukla
      abyshukla almost 7 years
      apologies. I will add the preamble too...
    • abyshukla
      abyshukla almost 7 years
      Link to the preamble on git added....
  • abyshukla
    abyshukla almost 7 years
    Yes it did work!! Thanks! Now, how do I know which command needs \protect and which doesn't?
  • Pieter van Oostrum
    Pieter van Oostrum almost 7 years
    The LaTeX book gives some information about fragile commands. At least every command that has an optional argument or a * form is fragile. \footnotemark (and \footnote) have an optional argument and so they are fragile. Normally the \item in a list is a safe place, but apparently due to your customization with \setlist is has become a moving place that is unsafe for fragile commands. Usually the kind of error message you get ("Use of \@xfootnotemark doesn't match its definition") gives me a hunch that there are fragile commands involved.
  • abyshukla
    abyshukla almost 7 years
    Would you please move this reasoning to your answer for others to read?
  • abyshukla
    abyshukla almost 7 years
    Thanks. Would you please look at the details in edit segment of this question?