6

Below is an MWE that typesets “AB”, as it should. However, if one uncomments the \group_begin: and \group_end:, the B disappears—i.e., the attachment seems to be performed locally, despite the use of the global attachment command. If gattach is replaced by gjoin, it works, so that command is global. (If one replaces gjoin by join, the B once again disappears, as it should.) Is this an l3coffins bug?

I had a quick look at the l3coffins source, and see that the local/global difference seems to be handled in the same way in both the attach and join commands. When defining \coffin_join:… and \coffin_attach:…, \coffin_set_eq:NN is used, while for \coffin_gjoin:… and \coffin_gattach:…, \coffin_gset_eq:NN is used. It seems this should have worked, but somehow it doesn't seem to?

(Note that I've also included a simple workaround: If the grouping statements are uncommented in the original MWE, so that the B disappears, and one also uncomments the line with \coffin_gset_eq:NN, the B once again reappears, indicating that the attachment is performed correctly, but locally.)

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn
\coffin_new:N \coffin_a
\coffin_new:N \coffin_b

\hcoffin_set:Nn \coffin_a {A}
\hcoffin_set:Nn \coffin_b {B}

% \group_begin: % Hides the attachment
\coffin_gattach:NnnNnnnn \coffin_a H r \coffin_b H l {0pt} {0pt}
% \coffin_gset_eq:NN \coffin_a \coffin_a % Workaround
% \group_end:

\NewDocumentCommand \ShowCoffins { } {
    \coffin_typeset:Nnnnn \coffin_a H l {0pt} {0pt}
}
\ExplSyntaxOff

\begin{document}
\ShowCoffins
\end{document}
4
  • Definitely a bug. In the definition of \__coffin_attach:NnnNnnnnN, the last line should read #9 #1 \l__coffin_aligned_coffin, but instead it is \coffin_set_eq:NN #1 \l__coffin_aligned_coffin. I'll fix Oct 8, 2021 at 12:18
  • Ah, great! If you'd like to make this an answer, I'd be happy to accept it. Also, should I report the bug on GitHub (or would you like to, since you know what's going on)?-) Oct 8, 2021 at 12:33
  • Committed already. My editing skills are restricted right now (using github's web editor :), so at night I'll add some tests and merge, but for the next release this should be fixed. Oct 8, 2021 at 12:43
  • That's great! :-) Oct 8, 2021 at 13:09

1 Answer 1

6

This was a bug in \coffin_gattach:NnnNnnnn. The last line in the definition of \__coffin_attach:NnnNnnnnN should read:

  #9 #1 \l__coffin_aligned_coffin

where #9 is either \coffin_set_eq:NN or \coffin_gset_eq:NN, depending which function you used. However the code was using \coffin_set_eq:NN unconditionally, so the assignment was always local.

This is now fixed, and should work properly in the next release:

--- a/l3kernel/l3coffins.dtx
+++ b/l3kernel/l3coffins.dtx
@@ -1984,7 +1984,7 @@
     \@@_offset_poles:Nnn #4
       { \l_@@_offset_x_dim } { \l_@@_offset_y_dim }
     \@@_update_vertical_poles:NNN #1 #4 \l_@@_aligned_coffin
-    \coffin_set_eq:NN #1 \l_@@_aligned_coffin
+    #9 #1 \l_@@_aligned_coffin
   }
 \cs_new_protected:Npn \@@_attach_mark:NnnNnnnn #1#2#3#4#5#6#7#8
   {

You must log in to answer this question.

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