When I use \JoinCoffin to build a page, and add more than one instance of the same coffin, ongoing references to that coffin appear to behave "sensibly". That is, any reference to the coffin is made to its latest instance.

I realise this usage "works in my case", but would like to know if it is "correct". Is this behaviour a supported feature of xcoffins, or should I avoid it?

Here's a CWE (Compact Working Example!):

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode
\NewCoffin \tpage
\NewCoffin \tbar
    \SetHorizontalCoffin \tbar 
        {\color{blue} \rule{\textwidth}{1pc}}
\NewCoffin \kim
    \SetHorizontalCoffin \kim 
\JoinCoffins \tpage \tbar
\JoinCoffins \tpage[\tbar-b,\tbar-r] \kim[t,r]
\JoinCoffins \tpage[\kim-b,\kim-r] \tbar[t,r]
% ===================================================================
\JoinCoffins \tpage[\tbar-b,\tbar-l] \kim[t,l] % <-- This is the line
% ===================================================================
\TypesetCoffin \tpage

and its result, in which you can see that the second copy of the graphic is "correctly" placed relative to the second instance of the \tbar coffin:

xcoffins output

  • This is the design behaviour: not sure if that really counts as an answer :-)
    – Joseph Wright
    May 10 '12 at 13:53
  • @JosephWright maybe you could add an answer saying that this is the correct behaviour, and maybe mentioning how to join something to an earlier instance of a coffin?
    – Seamus
    May 10 '12 at 14:03

The poles of 'subsidiary' coffins joined onto a main coffin remain available as <subcoffin>-<pole>, so in the example the l pole of coffin \kim remains available as \kim-l after the \kim coffin has been joined to \tpage. This is part of the coffin design concept: complex alignments may require that objects are joined to each other relative to 'internal' structures.

If the same coffin is joined to a 'main' coffin more than once, only the poles most recent join remain available. Thus in example the poles of the first \kim coffin are 'lost'. Thus any coffin which you will later refer to should have a unique name within the set of 'coffins joined together'.

You can see what poles are available using \ShowCoffinStructure <coffin>, which will list all of the known poles.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.