Skip to content

Commit

Permalink
v0.15
Browse files Browse the repository at this point in the history
  • Loading branch information
cgnieder committed Nov 2, 2019
1 parent 382b039 commit a457454
Show file tree
Hide file tree
Showing 8 changed files with 132 additions and 88 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--------------------------------------------------------------------------
XSIM 2019/10/19 v0.14a
XSIM 2019/11/02 v0.15

eXercise Sheets IMproved

Expand Down
52 changes: 44 additions & 8 deletions code/xsim.auxfile.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,67 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% ----------------------------------------------------------------------------
\XSIMmodule{auxfile}{writing stuff to the aux file}
\XSIMmodule{auxfile}{writing stuff to an auxiliary file}

\prg_new_conditional:Npnn \xsim_if_use_aux: {p,T,F,TF}
{
\bool_if:NTF \g_xsim_use_aux_bool
{ \prg_return_true: }
{ \prg_return_false: }
}

\cs_new_protected:Npn \xsim_write_to_aux:n #1
{ \iow_now:Nn \@auxout {#1} }
{
\legacy_if:nT {@filesw}
{
\xsim_if_use_aux:TF
{ \iow_now:Nn \@auxout {#1} }
{ \iow_now:Nn \l__xsim_aux_file_iow {#1} }
}
}
\cs_generate_variant:Nn \xsim_write_to_aux:n {x}

% --------------------------------------------------------------------------

\cs_new_protected:Npn \XSIM #1 { \use:c {XSIMaux#1} }

\cs_new_protected:Npn \xsim_new_aux_cs:cpn #1
{ \cs_new_protected:cpn {XSIMaux#1} }

\cs_new_protected:Npn \xsim_add_cs_to_aux:nn #1#2
{
\xsim_verbose:n { Writing~ command~ \XSIM {#1}~ to~ aux~ file }
\xsim_write_to_aux:x { \token_to_str:N \XSIM {#1} #2 }
}

\AtBeginDocument
{
\xsim_write_to_aux:x
\iow_now:Nx \@auxout
{ \token_to_str:N \providecommand \token_to_str:N \XSIM [1] {} }
}

\cs_new_protected:Npn \xsim_new_aux_cs:cpn #1
{ \cs_new_protected:cpn {XSIMaux#1} }
% ----------------------------------------------------------------------------

\cs_new_protected:Npn \xsim_add_cs_to_aux:nn #1#2
\xsim_if_use_aux:F
{
\xsim_verbose:n { Writing~ command~ \XSIM {#1}~ to~ aux~ file }
\xsim_write_to_aux:x { \XSIM {#1} #2 }
\iow_new:N \l__xsim_aux_file_iow
\AtBeginDocument
{ \iow_open:Nn \l__xsim_aux_file_iow { \c_sys_jobname_str .xsim } }
}

\cs_new_protected:Npn \xsim_close_aux:
{
\xsim_if_use_aux:F
{
\iow_close:N \l__xsim_aux_file_iow
\legacy_if:nT {@filesw}
{ \iow_now:Nx \@auxout { \token_to_str:N \XSIM {readaux} } }
}
}

\xsim_new_aux_cs:cpn {readaux}
{ \file_input:n { \c_sys_jobname_str .xsim } }

% ----------------------------------------------------------------------------
% list for recording values that need to be written to the aux file and
% updated at begin document
Expand Down
26 changes: 16 additions & 10 deletions code/xsim.sty
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@

\ExplSyntaxOn

\tl_const:Nn \c_xsim_date_tl {2019/10/19}
\tl_const:Nn \c_xsim_date_tl {2019/11/02}
\tl_const:Nn \c_xsim_version_major_number_tl {0}
\tl_const:Nn \c_xsim_version_minor_number_tl {14}
\tl_const:Nn \c_xsim_version_subrelease_tl {a}
\tl_const:Nn \c_xsim_version_minor_number_tl {15}
\tl_const:Nn \c_xsim_version_subrelease_tl {}
\tl_const:Nx \c_xsim_version_number_tl
{
\c_xsim_version_major_number_tl .
Expand All @@ -58,15 +58,19 @@
\bool_new:N \g_xsim_final_bool
\bool_new:N \g_xsim_verbose_bool
\bool_new:N \g_xsim_clear_aux_bool
\bool_new:N \l__xsim_write_to_file_bool
\bool_new:N \g__xsim_write_to_file_bool
\bool_new:N \g_xsim_use_aux_bool
\bool_new:N \g__xsim_rerun_bool

\keys_define:nn {xsim/package}
{
final .bool_gset:N = \g_xsim_final_bool ,
verbose .bool_gset:N = \g_xsim_verbose_bool ,
clear-aux .bool_gset:N = \g_xsim_clear_aux_bool ,
no-files .bool_gset_inverse:N = \g__xsim_write_to_file_bool ,
no-files .initial:n = false
no-files .initial:n = false ,
use-aux .bool_gset:N = \g_xsim_use_aux_bool ,
use-aux .initial:n = false
}

\ProcessKeysPackageOptions {xsim/package}
Expand All @@ -87,12 +91,10 @@
synchronized.
}

\msg_new:nnn {xsim} {verbose} { #1 ~(\msg_line_context:) }
\msg_new:nnn {xsim} {verbose} { #1 ~( \msg_line_context: ) }

% --------------------------------------------------------------------------

\bool_new:N \g__xsim_rerun_bool

\cs_new_protected:Npn \xsim_do_rerun:
{ \xsim_if_rerun:T { \msg_warning:nn {xsim} {rerun} } }

Expand All @@ -105,6 +107,10 @@
% --------------------------------------------------------------------------
\xsim_load_modules:n {definitions}

\AtEndDocument { \xsim_do_rerun: }

\AtEndDocument
{
\xsim_do_rerun:
\xsim_close_aux:
}

\file_input_stop:
14 changes: 7 additions & 7 deletions code/xsim.verbwrite.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

\xsim_load_modules:n {base}

\iow_new:N \l__file_contents_iow
\iow_new:N \l__xsim_file_contents_iow
\tl_new:N \l_xsim_file_begin_tl
\tl_new:N \l_xsim_file_end_tl
\int_new:N \l_xsim_line_gobble_int
Expand Down Expand Up @@ -129,12 +129,12 @@
\xsim_if_final:TF %
{ \xsim_verbose:x { Not~ (re-)writing~ file~ `#1'. } } %
{ \xsim_verbose:x { (Re-)writing~ file~ `#1'. } } %
\__xsim_open_stream:Nn \l__file_contents_iow {#1} %
\__xsim_open_stream:Nn \l__xsim_file_contents_iow {#1} %
\tl_if_blank:VF \l_xsim_file_begin_tl %
{ %
\xsim_if_final:F %
{ %
\iow_now:Nx \l__file_contents_iow %
\iow_now:Nx \l__xsim_file_contents_iow %
{ \l_xsim_file_begin_tl } %
} %
} %
Expand All @@ -150,13 +150,13 @@
} %
{ %
\tl_if_blank:nTF {##3} %
{ \__xsim_write_to_stream:Nn \l__file_contents_iow {##1} } %
{ \__xsim_write_to_stream:Nn \l__xsim_file_contents_iow {##1} } %
{ %
\cs_set:Npx \__xsim_M:w { \exp_not:N \end {\@currenvir} } %
\char_set_active_eq:nN {13} \__xsim_M:w %
% the last line is `##1 \end{\@currenvir} ##2':
\tl_if_blank:nF {##1} %
{ \__xsim_write_to_stream:Nn \l__file_contents_iow {##1} }%
{ \__xsim_write_to_stream:Nn \l__xsim_file_contents_iow {##1} }%
\tl_if_blank:nF {##2} %
{} %
} %
Expand Down Expand Up @@ -184,11 +184,11 @@
{
\xsim_if_final:F
{
\iow_now:Nx \l__file_contents_iow
\iow_now:Nx \l__xsim_file_contents_iow
{ \l_xsim_file_end_tl }
}
}
\__xsim_close_stream:N \l__file_contents_iow
\__xsim_close_stream:N \l__xsim_file_contents_iow
\group_end:
}

Expand Down
25 changes: 22 additions & 3 deletions doc/xsim-manual.cls
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,9 @@
tables.}
}

\newcommand*\environ{\@ifstar\environ@star\environ@nostar}
\newcommand*\environ@star[1]{\beginenv*\Marg{\env*{#1}}}
\newcommand*\environ@nostar[1]{\beginenv*\Marg{\env{#1}}}
\providecommand*\environ{\@ifstar\environ@star\environ@nostar}
\providecommand*\environ@star[1]{\beginenv*\Marg{\env*{#1}}}
\providecommand*\environ@nostar[1]{\beginenv*\Marg{\env{#1}}}

\RequirePackage{tcolorbox}
\tcbuselibrary{skins,breakable}
Expand Down Expand Up @@ -857,6 +857,25 @@
\xsim@add@version{0.12} {2019-09-26}
\xsim@add@version{0.13} {2019-10-06}
\xsim@add@version{0.14} {2019-10-13}
\xsim@add@version{0.15} {2019-11-02}

% ----------------------------------------------------------------------------
\newrobustcmd*\xsimauxfileinfo{%
\xsim\ writes a lot of stuff to an auxiliary file called
\cs*{jobname}\code{.xsim} (or the common \cs*{jobname}\code{.aux} if you use
option \option{use-aux}) for re-using information on subsequent
compilations. If you add exercises, change properties \etc\ it might happen
that wrong information is staying in the auxiliary file and is wrongly used
by \xsim. In such cases deleting the auxiliary file and doing a few fresh
compilations may resolve your problems.

Sometimes the \emph{existence of exercise or solution files from earlier
compilations} may lead to wrong lists of exercises or solutions. In such
cases it can be useful to delete all those files and doing a fresh
compilation. It may be helpful to use a subfolder for those exernal files
which will make deleting them a little bit easier. (Don't forget to both
create the subfolder and set \option{path} accordingly then.)

Using the \option{clear-aux} option might help to reduce erroneous exercises.%
}
\endinput
16 changes: 9 additions & 7 deletions doc/xsim.history
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,17 @@ HISTORY:
v0.13 2019/10/06 - experimental package option `no-files'
v0.14 2019/10/13 - new exercise parameters `exercise-heading' and
`solution-heading'
- new options `exercise/heading' and `solution/heading' as
- new options `exercise/heading' and `solution/heading' as
interface for setting the new parameters
- new command \GetExerciseHeadingF for using the new
- new command \GetExerciseHeadingF for using the new
parameters in environment templates
- change the environment template `default' to use the new
- change the environment template `default' to use the new
\GetExerciseHeadingF and output a \par at the end
- make argument of \xsimsetup long
- new template `minimal'
- new option `load-style'
- new example `texwelt-23968' (long and short solutions)
- make argument of \xsimsetup long
- new template `minimal'
- new option `load-style'
- new example `texwelt-23968' (long and short solutions)
v0.14a 2019/10/19 - fix \xsim_if_exercise_exist:nnTF to obey the `no-files'
option
v0.15 2019/11/02 - use own auxiliary file per default and add option
`use-aux'
Binary file modified doc/xsim_manual.pdf
Binary file not shown.
Loading

0 comments on commit a457454

Please sign in to comment.