Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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
\documentclass[a4paper]{memoir}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{xcoffins}
\nonzeroparskip
\setlength{\parindent}{0pt}
\isopage
\checkandfixthelayout
\begin{document}
\NewCoffin \tpage
\NewCoffin \tbar
    \SetHorizontalCoffin \tbar 
        {\color{blue} \rule{\textwidth}{1pc}}
\NewCoffin \kim
    \SetHorizontalCoffin \kim 
        {\includegraphics[width=2in]{ubiquitous-surveillance-warning.png}}
\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
\end{document}

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

share|improve this question
    
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
add comment

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
    
Excellent, thank you. –  Brent.Longborough May 10 '12 at 16:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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