File I/O to create exercise set with tasks package: missing \item

by Scott H.   Last Updated September 24, 2019 22:23 PM - source

Background: I'm attempting to use some exercises from an open text that are distributed across many files. I've rewritten the input mechanism and have it working fine. I can use multicols and enumerate to print exercise sets vertically across two columns, but would like to print them horizontally, thus the tasks package. The problem is as follows:

Problem: When changing from enumerate to tasks, I'm getting a missing \item. error. I assume that this is due to a \par introduced somewhere in the I/O operations being included in a \task (the tasks package documentation lists this as one way that the environment differs from enumerate, no \par's allowed). If this is the case, then I can't find where it's introduced. If not, then I have no idea what's going on.



{$5 - (2+3)$}

{$5 - (2-3)$}


\ior_new:N \l__exread_ior % read exercise
\ior_new:N \l__exsetread_ior % read exercise set
\ior_new:N \l__allread_ior % read all

%Relevant code below
    \ior_open:Nn \l__exread_ior {#1} % open exercise file
    \ior_get:NN \l__exread_ior \l_tmpb_tl % get line
    \task\l_tmpb_tl % add task
    \ior_close:N \l__exread_ior

    \ior_open:Nn \l__exsetread_ior {#1} % open set file
    \ior_map_inline:Nn \l__exsetread_ior {\seq_put_right:Nn \l_tmpb_seq {##1}} % put exercises in a sequence
    % if following changed to enumerate, and line 31 to item then works as expected.
    \begin{tasks}(2) % start tasks
        % seq items are "exinput" (above) and should print \task\blah
        \seq_use:Nn \l_tmpb_seq {}

    \ior_close:N \l__exsetread_ior 
    \seq_clear:N \l_tmpb_seq




Related Questions

Iterate through files in specific directory

Updated April 21, 2017 15:23 PM

Importing pgfplot labels from external files

Updated July 07, 2015 12:49 PM