5

Simple question: How do you read a line from terminal to a token list variable in expl3?

The following is what I tried:

\documentclass{article}
\usepackage{expl3}

\begin{document}
\ExplSyntaxOn

\read \c_term_ior to \l_tmpa_tl
\tl_show:N \l_tmpa_tl

\ior_get:NN \c_term_ior \l_tmpa_tl
\tl_show:N \l_tmpa_tl

\ExplSyntaxOff
\end{document}

resulting in the expected behavior for the \read version, but in \q_no_value for the \ior_get:NN version.

1 Answer 1

5

You are looking for \ior_get_term:nN (or perhaps \ior_str_get_term:nN), added as candidates in March 2019. You'd do something like

\documentclass{article}
\usepackage{expl3}

\begin{document}
\ExplSyntaxOn
\ior_get_term:nN { Foo ~ bar } \l_tmpa_tl
\tl_show:N \l_tmpa_tl

\ExplSyntaxOff
\end{document}

Due to an internal change of how input streams are managed, to make the check whether they are open more robust, the effect is that \ior_get:NN no longer works with \c_term_ior and for this reason \ior_get_term:Nn has been introduced. Unfortunately, the documentation wasn't updated to reflect this.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .