%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     author          = "David Carlisle",
%%%     version         = "1.01",
%%%     date            = "04 May 1993",
%%%     time            = "13:48:42 BST",
%%%     filename        = "makerobust.sty",
%%%     address         = "Computer Science Department
%%%                        Manchester University
%%%                        Oxford Road
%%%                        Manchester
%%%                        England
%%%                        M13 9PL",
%%%     telephone       = "+44 61 275 6139",
%%%     FAX             = "+44 61 275 6236",
%%%     checksum        = "63663 112 477 4231",
%%%     email           = "carlisle@cs.man.ac.uk (Internet)",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "LaTeX, fragile, robust",
%%%     supported       = "yes",
%%%     docstring       = "
%%%
%%%     makerobust.sty
%%%
%%%     A LaTeX style option defining the \makerobust command.
%%%     \makerobust{\cs} makes the control sequence \cs robust.
%%%
%%%     If you put \makerobust{\cite} in the preamble, you can write:
%%%        \caption{Taken from \cite{foo}} rather than
%%%        \caption{Taken from \protect\cite{foo}}
%%%
%%%     The checksum field above was produced by
%%%     Robert Solovay's checksum utility.",
%%%  }
%%% ====================================================================
%
% Version 1.00: 19 May 1991
% Version 1.01: 04 May 1993 (Xiaoming Cai) remove `\` from the internal
%                           command names, so that they work when read
%                           from a file.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%<*x>
% This file may be used without modification as a style (.sty) file.
%
% If you have Mittelbach's doc.sty, this file may be formatted with a
% command like:
%                latex makerobust.sty
%
% If you have the Mittelbach/Duchier/Braams docstrip utility, you may
% produce a faster loading .sty file.
% Rename this file to: makerobust.doc
% Then run this file through *plain* TeX:
%                tex makerobust.doc
% This should produce the file makerobust.sty.
% If you do not have plain TeX on your system, you can trick LaTeX into
% doing the work as follows:
%                latex \def\fmtname{plain} \input makerobust.doc
% Note that you may need to quote the arguments here to stop your
% operating system treating the \ characters incorrectly.
%
%                latex makerobust.doc
% Will produce a typeset version of the documentation, as above.
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\plain{plain}\ifx\fmtname\plain\csname fi\endcsname
     \def\batchfile{makerobust.doc}
     \input docstrip
     \preamble

     Do not distribute the stripped version of this file.
     The checksum in the header refers to the documented version.

     \endpreamble
     \generateFile{makerobust.sty}{t}{\from{makerobust.doc}{}}
     \endinput
\fi
%
\ifcat a\noexpand @\let\next\relax\else\def\next{%
    \documentstyle[doc]{article}\MakePercentIgnore}\fi\next
%
%\def\eatmodule<#1>{}\eatmodule
%</x>
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \textwidth=355pt   ^^A Allow macrocode text with 72 columns.
% \CodelineIndex     ^^A Code lines numbered.
% \DisableCrossrefs  ^^A No Cross references.
% \MakeShortVerb{\|} ^^A |\foo| works like \verb+\foo+
%
% \title{makerobust.sty}
% \author{D. P. Carlisle}
% \date{04 May 93}
% \begin{document}
% \maketitle
%
% \begin{macro}{\makerobust}
% |\makerobust| may be used to make a fragile command robust.\\
% So if in the preamble you have |\makerobust{\cite}| then you may use
% |\cite| rather than |\protect\cite| in a moving argument, like
% that of |\caption|.
%    \begin{macrocode}
\def\makerobust#1{%
  \@ifundefined{fr@gile\expandafter\@gobble\string#1}%
  {\expandafter
    \let\csname fr@gile\expandafter\@gobble\string#1\endcsname#1%
   \edef#1{\noexpand\protect\expandafter\noexpand
               \csname fr@gile\expandafter\@gobble\string#1\endcsname}}%
  {\@warning{\string#1 is already robust (command ignored)}}}%
%    \end{macrocode}
% \end{macro}
% \end{document}
\endinput