footnotemark in description environment generates error
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.
Related videos on Youtube
abyshukla
Updated on December 20, 2020Comments
-
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:
- tried removing
\label{fn:onlyCol}
- tried using
\footnote{available on select models}
- Answer by Lockstep
- 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 almost 7 yearsI 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 almost 7 yearsPlease 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 almost 7 yearsapologies. I will add the preamble too...
-
abyshukla almost 7 yearsLink to the preamble on git added....
- tried removing
-
abyshukla almost 7 yearsYes it did work!! Thanks! Now, how do I know which command needs
\protect
and which doesn't? -
Pieter van Oostrum almost 7 yearsThe 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 almost 7 yearsWould you please move this reasoning to your answer for others to read?
-
abyshukla almost 7 yearsThanks. Would you please look at the details in edit segment of this question?