Skip to main content
added 330 characters in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\def~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \begingroup\catcode`\%=12\relax \def\percentchar{\endgroup\def\percentchar{%}}\percentchar \def\neutralizeoutertoken{% \expandafter\transfiguredRemoveEOFMarkerwithArgAsRelax\noexpand }% \def\transfiguredRemoveEOFMarkerwithArgAsRelax#1{\let#1=\relax\transfiguredRemoveEOFMarker{#1}}% \def\transfiguredRemoveEOFMarker#1{% \endgroup % <- undo \transfigured's catcode-change before \futurelet % "looks ahead" and probably triggers tokenization \begingroup    \let#1=\relax \def\transfiguredRemoveEOFMarker{\endgroup\def#1}% \futurelet\scratchy\transfiguredRemoveEOFMarker }% \def\transfigured{% \begingroup \catcode`|=\active % allows | as command \expandafter\transfiguredRemoveEOFMarker\scantokens\expandafter\catcode`\%=14 % allows % as comment % active | might be defined \outer ... \expandafter\neutralizeoutertoken\scantokens\expandafter{\expandafter|\percentchar}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} {\catcode`|=\active \outer\gdef|{Huh?}} \transfigured{test}% define active | with <replacement text> "test" \begingroup\catcode`|=\active\csname @firstofone\endcsname{\endgroup|}% \subsumed{test}% \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\def~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \begingroup\catcode`\%=12\relax \def\percentchar{\endgroup\def\percentchar{%}}\percentchar \def\transfiguredRemoveEOFMarker#1{% \endgroup % <- undo \transfigured's catcode-change before \futurelet % "looks ahead" and probably triggers tokenization \begingroup  \def\transfiguredRemoveEOFMarker{\endgroup\def#1}% \futurelet\scratchy\transfiguredRemoveEOFMarker }% \def\transfigured{% \begingroup \catcode`|=\active % allows | as command \expandafter\transfiguredRemoveEOFMarker\scantokens\expandafter{\expandafter|\percentchar}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} \transfigured{test}% define active | with <replacement text> "test" \begingroup\catcode`|=\active\csname @firstofone\endcsname{\endgroup|}% \subsumed{test}% \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\def~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \begingroup\catcode`\%=12\relax \def\percentchar{\endgroup\def\percentchar{%}}\percentchar \def\neutralizeoutertoken{% \expandafter\transfiguredRemoveEOFMarkerwithArgAsRelax\noexpand }% \def\transfiguredRemoveEOFMarkerwithArgAsRelax#1{\let#1=\relax\transfiguredRemoveEOFMarker{#1}}% \def\transfiguredRemoveEOFMarker#1{% \endgroup % <- undo \transfigured's catcode-change before \futurelet % "looks ahead" and probably triggers tokenization \begingroup   \let#1=\relax \def\transfiguredRemoveEOFMarker{\endgroup\def#1}% \futurelet\scratchy\transfiguredRemoveEOFMarker }% \def\transfigured{% \begingroup \catcode`|=\active % allows | as command \catcode`\%=14 % allows % as comment % active | might be defined \outer ... \expandafter\neutralizeoutertoken\scantokens\expandafter{\expandafter|\percentchar}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} {\catcode`|=\active \outer\gdef|{Huh?}} \transfigured{test}% define active | with <replacement text> "test" \begingroup\catcode`|=\active\csname @firstofone\endcsname{\endgroup|}% \subsumed{test}% \end{document} 
edited body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\gdef~\endgroup\def~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \begingroup\catcode`\%=12\relax \def\percentchar{\endgroup\def\percentchar{%}}\percentchar \def\transfiguredRemoveEOFMarker#1{% \endgroup % <- undo \transfigured's catcode-change before \futurelet % "looks ahead" and probably triggers tokenization \begingroup \def\transfiguredRemoveEOFMarker{\endgroup\def#1}% \futurelet\scratchy\transfiguredRemoveEOFMarker }%  \def\transfigured{% \begingroup \catcode`|=\active % allows | as command   \begingroup  \scantokens{\def\defcall\expandafter\transfiguredRemoveEOFMarker\scantokens\expandafter{\endgroup\def|}\futurelet\scratchy\defcall\expandafter|\percentchar}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document}  \begingroup  \transfigured{test}% getsdefine desiredactive output | with <replacement text> |%"test"  \begingroup\catcode`|=\active\csname \endgroup@firstofone\endcsname{\endgroup|}%  \subsumed{test}%   \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\gdef~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \def\transfigured{% \catcode`|=\active % allows | as command   \begingroup  \scantokens{\def\defcall{\endgroup\def|}\futurelet\scratchy\defcall}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document}  \begingroup  \transfigured{test}% gets desired output  |%   \endgroup  \subsumed{test}% \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\def~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \begingroup\catcode`\%=12\relax \def\percentchar{\endgroup\def\percentchar{%}}\percentchar \def\transfiguredRemoveEOFMarker#1{% \endgroup % <- undo \transfigured's catcode-change before \futurelet % "looks ahead" and probably triggers tokenization \begingroup \def\transfiguredRemoveEOFMarker{\endgroup\def#1}% \futurelet\scratchy\transfiguredRemoveEOFMarker }%  \def\transfigured{% \begingroup \catcode`|=\active % allows | as command \expandafter\transfiguredRemoveEOFMarker\scantokens\expandafter{\expandafter|\percentchar}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} \transfigured{test}% define active | with <replacement text> "test" \begingroup\catcode`|=\active\csname @firstofone\endcsname{\endgroup|}% \subsumed{test}%   \end{document} 
edited body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\gdef~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renanedrenamed to \@@input:

\documentclass{minimal} \def\transfigured{% \catcode`|=\active % allows | as command \begingroup \scantokens{\def\defcall{\endgroup\def|}\futurelet\scratchy\defcall}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\gdef~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renaned to \@@input:

\documentclass{minimal} \def\transfigured{% \catcode`|=\active % allows | as command \begingroup \scantokens{\def\defcall{\endgroup\def|}\futurelet\scratchy\defcall}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

The main issue might be that | within the replacement text of the definition of \subsumed is not active. You can do \scantokens{|}.

\documentclass{minimal} \def\transfigured#1{\catcode`|=\active% allows | as command \begingroup\endlinechar-1\relax \everyeof{{#1}\endgroup}\scantokens{\gdef|}}% % This entire definition is tokenized while | is _not_ active: \def\subsumed#1{\begingroup \transfigured{#1}% \scantokens{|}% \endgroup}% should simply do the same \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 

By the way: Using the fact that in LaTeX ~ usually is active you can get active | also via \lccode and \lowercase:

\documentclass{minimal} \def\transfigured{% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup\gdef~}% }% \def\subsumed#1{% \transfigured{#1}% \begingroup \lccode`\~=`\|\relax \lowercase{\endgroup~}% }% \begin{document} \transfigured{test}% \begingroup\lccode`\~=`\|\relax\lowercase{\endgroup~}% \subsumed{test}% \end{document} 

Academic info:

You can (ab)use \futurelet for getting rid of end-of-file-markers that come into being due to \scantokens or the \input-primitive— in LaTeX \input is redefined and the \input-primitive is renamed to \@@input:

\documentclass{minimal} \def\transfigured{% \catcode`|=\active % allows | as command \begingroup \scantokens{\def\defcall{\endgroup\def|}\futurelet\scratchy\defcall}% }% \begingroup \catcode`|=\active \csname @firstofone\endcsname{% \endgroup \def\subsumed#1{\transfigured{#1}|}% }% \begin{document} \begingroup \transfigured{test}% gets desired output |% \endgroup \subsumed{test}% \end{document} 
deleted 24 characters in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading
deleted 1 character in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading
deleted 51 characters in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading
added 810 characters in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading
added 540 characters in body
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading
Source Link
Ulrich Diez
  • 32.7k
  • 2
  • 34
  • 63
Loading