% 2026, by J. A. Múgica.

\count255=\catcode`@
\catcode`@=11

{\catcode`\^^M=13 \global\def\ReplaceEndLineCharMJ{\catcode`\^^M\active \def^^M{^^J}}}

%We need only change the characters that cannot be converted to a token and back into
%a character. Braces need to remain with their usual meaning.
\def\make@others{%
  \count@=12 %
  \catcode`\#\count@  \catcode`*\count@
  \catcode`\ \count@  \catcode`\^^I\count@
  \catcode`\\\count@  \catcode`\/\count@
  \catcode`\^^@\count@ \catcode`\^^?\count@ \catcode`\%\count@ 
  \catcode`\^^M=\active
}

\def\cprotect#1{\begingroup\make@others\cprot@@#1}
\def\cprot@@#1#2{\endgroup %Normal catcodes back.
  \count@\catcode`\^^M
  \ReplaceEndLineCharMJ\edef\next{#2}% Replacing ^^M by ^^J
  \catcode`\^^M\count@
  #1{\scantokens\expandafter{\next}}%
}

\catcode`@=\count255