2

I have two seq's, one constructed from a clist, another from a prop, whose expansion (with , between items) look the same. They are supposed to contain options to \newwatermark. The use of a prop is to make sure there are no duplicate in the options (and other requirements). The first works as expected, the second fails to compile. Why, and how can it be fixed? I don't get this error with includepdf in place of newwatermark.

enter image description here enter image description here

PS: this is a follow up to this post.

\documentclass{article} \usepackage{mwe} \usepackage{pdfpages} \usepackage{xparse} \usepackage{xwatermark} \ExplSyntaxOn \cs_new_protected:Nn\__erw_pass_option:Nn{#1[#2]} \cs_generate_variant:Nn \__erw_pass_option:Nn {Ne} \ExplSyntaxOff \begin{document} \ExplSyntaxOn \tl_set:Nn\l__Foo_tl{angle=45, scale=0.15} %\tl_set:Nn\l__Baz_tl{page=\thepage,xpos=-20} \seq_set_from_clist:Nn \l__a_seq{page=\thepage,xpos=-20} \prop_set_from_keyval:Nn \l__prop{page=\thepage,xpos=-20} \seq_new:N \l__b_seq \prop_map_inline:Nn \l__prop{\seq_put_right:Nn\l__b_seq{#1=#2}} a:\seq_use:Nn \l__a_seq{,}\\ b:\seq_use:Nn \l__b_seq{,}. \newpage \__erw_pass_option:Ne \newwatermark{\seq_use:Nn\l__a_seq {,}}{DRAFT} % OK %\__erw_pass_option:Ne \newwatermark{\seq_use:Nn\l__b_seq {,}}{DRAFT} %File ended while scanning use of \xwm@ \__erw_pass_option:Ne \includepdf{\l__Foo_tl}{example-image-a} \ExplSyntaxOff \end{document} 
5
  • don't use the xwatermark package. It uses catoptions, and this is incompatible with a current latex. Commented Feb 23, 2021 at 7:25
  • 1
    You’ve been advised several times about the proper conventions on names for variables. Commented Feb 23, 2021 at 7:54
  • @StevenB.Segletes, what's a good replacement for xwatermark, background? Commented Feb 23, 2021 at 15:33
  • @StevenB.Segletes It was pointed out here bakground and pdfpages may clash. tex.stackexchange.com/questions/556935/… Commented Feb 23, 2021 at 18:25
  • @egreg, I fixed that, I hope. Commented Feb 23, 2021 at 19:56

1 Answer 1

2

The sequences are not the same because, in the sequence constructed via the property list, the keys are converted to str (that is to say strings of expl3). The catcodes of the tokens are not the same.

As said in the documentation interface3.pdf:

A TEX string (and thus an expl3 string) is a series of characters which have category code 12 (“other”) with the exception of space characters which have category code 10 (“space”). Thus at a technical level, a TEX string is a token list with the appropriate category codes.

\documentclass{article} \begin{document} \ExplSyntaxOn { \seq_set_from_clist:Nn \l_tmpa_seq { key = smth } \prop_set_from_keyval:Nn \l_tmpa_prop { key = smth } \prop_map_inline:Nn \l_tmpa_prop { \seq_put_right:Nn \l_tmpb_seq { #1 = #2 } } \tl_set:Nf \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } } \tl_set:Nf \l_tmpb_tl { \seq_use:Nn \l_tmpb_seq { } } \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { TRUE } { FALSE } % return FALSE } -- { \str_set:Nn \l_tmpa_str { key } \exp_args:NNx \seq_set_from_clist:Nn \l_tmpa_seq { \l_tmpa_str = smth } \exp_args:NNx \prop_set_from_keyval:Nn \l_tmpa_prop { \l_tmpa_str = smth } \prop_map_inline:Nn \l_tmpa_prop { \seq_put_right:Nn \l_tmpb_seq { #1 = #2 } } \tl_set:Nf \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } } \tl_set:Nf \l_tmpb_tl { \seq_use:Nn \l_tmpb_seq { } } \tl_if_eq:NNTF \l_tmpa_tl \l_tmpb_tl { TRUE } { FALSE } % return TRUE } \ExplSyntaxOff \end{document} 

The first part of that code corresponds to your programmation and the result is FALSE. In the second case, keys are yet strings by construction and the result is TRUE.

1

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.