There are a few approaches one could use. If it's a simple one-shot where you just want that piece of text, then something like
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\tl_new:N \l_my_tl
\NewDocumentCommand { \dostuff } { }
{
\tl_if_empty:NTF \l_my_tl
{ \tl_use:N \c_my_tl }
{ \tl_use:N \l_my_tl }
}
\use:n
{
\ExplSyntaxOff
\tl_const:Nn \c_my_tl
}
{Here is a large block of default text that I would like use.}
\begin{document}
\dostuff
\end{document}
is probably easiest. The idea here is that \use:n tokenizes the input, but I leave the text part 'after' that so it is read with document catcodes.
Another approach is simply to alter the behaviour of , either using grouping:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\tl_new:N \l_my_tl
\NewDocumentCommand { \dostuff } { }
{
\tl_if_empty:NTF \l_my_tl
{ \tl_use:N \c_my_tl }
{ \tl_use:N \l_my_tl }
}
\group_begin:
\char_set_catcode_space:n {`\ }%
\tl_const:Nn\c_my_tl{Here is a large block of default text that I would like use.}%
\group_end:
\ExplSyntaxOff
\begin{document}
\dostuff
\end{document}
or otherwise:
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\tl_new:N \l_my_tl
\NewDocumentCommand { \dostuff } { }
{
\tl_if_empty:NTF \l_my_tl
{ \tl_use:N \c_my_tl }
{ \tl_use:N \l_my_tl }
}
\char_set_catcode_space:n {`\ }%
\tl_const:Nn\c_my_tl{Here is a large block of default text that I would like use.}%
\char_set_catcode_ignore:n{`\ }%
\ExplSyntaxOff
\begin{document}
\dostuff
\end{document}
(It's not clear if the text asked for is a constant: if not then I'll modify the above.)
I'd strongly recommend not using a rescan method. To be honest, I've found rescanning to be a good way to break things, and would be extremely cautious about using it in any new code (to the point where I'd probably be happy if we dropped the \tl_rescan: family entirely!).
kantlipsum; perhaps\char_set_catcode_space:n {`\ }is better as it avoids the need of%to end the line. – egreg Apr 10 '13 at 08:19nversion is probably preferable (as it's more general). I'm keeping the%as my feeling is that once you start messing with the normalexpl3set up you should use 'traditional' commenting-end-of-lines. – Joseph Wright Apr 10 '13 at 08:22