Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{filecontentsdef}
- usepackage[enable-debug]{expl3}
- usepackage{xparse}
- ExplSyntaxOn
- debug_on:n{check-declarations,deprecation,check-expressions}
- % myscantokens
- NewDocumentCommand{myscantokens}{+m}
- {
- group_begin:
- tl_set:Nn l_tmpa_tl {#1}
- tl_put_right:Nx l_tmpb_tl %
- {
- tex_newlinechar:D = 13
- tex_everyeof:D = { exp_not:N }
- exp_not:N scantokens exp_after:wN { l_tmpa_tl }
- tex_newlinechar:D = 10 scan_stop:
- }
- l_tmpb_tl
- group_end:
- }
- % mytlrescan
- tl_new:N l_tmpc_tl
- cs_generate_variant:Nn tl_set_rescan:Nnn { NnV }
- NewDocumentCommand{mytlrescan}{+m}
- {
- group_begin:
- tl_set:Nn l_tmpa_tl {#1}
- tl_set_rescan:NnV l_tmpb_tl { } l_tmpa_tl
- tl_put_right:Nx l_tmpc_tl %
- {
- tex_newlinechar:D = 13
- tex_everyeof:D = { exp_not:N }
- l_tmpb_tl
- tex_newlinechar:D = 10 scan_stop:
- }
- l_tmpc_tl
- group_end:
- }
- ExplSyntaxOff
- pagestyle{empty} % only for example
- begin{document}
- section{Default texttt{textbackslash filecontentsexec}}
- begin{filecontentsdef*}{jobname.tmp}{macroA}
- Test environment with verb+filecontentsdef*+. verb+macroA+ its global.par
- begin{verbatim}
- A verbatim
- end{verbatim}
- end{filecontentsdef*}
- filecontentsexecmacroA
- section{Using texttt{textbackslash scantokens}}
- myscantokens{macroA}
- section{Using texttt{textbackslash tl_rescan:nn}}
- mytlrescan{macroA}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement