5

at the moment I'm working on a personal project where I want to use several grids and I thought it would be nice trying xcoffins to realise this. I can define a coffin for the text body, define poles for the grid and join ONE additional coffin wherever I want to. But when joining a second coffin, I always get the error "pole does not exist". It doesn't matter if I use the normal join or the starred version, or if I use [\BodyGrid-PoleColC, ...], only redefining the poles works. As this is quite exhausting (I could easier use offsets) I would like to ask if I misunderstood the implementation of poles and should use a different approach.

\documentclass[a4paper,twoside,10pt]{scrbook}%

\setlength{\parindent}{0mm}%
\pagestyle{empty}%
\usepackage[width=176mm,height=250mm,left=19mm,top=19mm]{geometry}%
\usepackage{xcolor,xcoffins}%

\begin{document}%

\NewCoffin \BodyGrid%
\SetVerticalCoffin \BodyGrid {176mm} {\color{green!10!white}\rule{176mm}{236mm}}%

\SetVerticalPole \BodyGrid {PoleColA} {0mm}%
\SetVerticalPole \BodyGrid {PoleColB} {30mm}%
\SetVerticalPole \BodyGrid {PoleColC} {60mm}%
\SetVerticalPole \BodyGrid {PoleColD} {90mm}%
\SetVerticalPole \BodyGrid {PoleColE} {120mm}%
\SetVerticalPole \BodyGrid {PoleColF} {150mm}%

\SetHorizontalPole \BodyGrid {PoleRowA} {236mm}%
\SetHorizontalPole \BodyGrid {PoleRowB} {206mm}%
\SetHorizontalPole \BodyGrid {PoleRowC} {176mm}%
\SetHorizontalPole \BodyGrid {PoleRowD} {146mm}%
\SetHorizontalPole \BodyGrid {PoleRowE} {116mm}%
\SetHorizontalPole \BodyGrid {PoleRowF} {86mm}%
\SetHorizontalPole \BodyGrid {PoleRowG} {56mm}%
\SetHorizontalPole \BodyGrid {PoleRowH} {26mm}%

\NewCoffin \CoffinFC%
\SetVerticalCoffin \CoffinFC {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [PoleColF,PoleRowC] \CoffinFC [l,t]%

\SetVerticalPole \BodyGrid {PoleColA} {0mm}%
\SetVerticalPole \BodyGrid {PoleColB} {30mm}%
\SetVerticalPole \BodyGrid {PoleColC} {60mm}%
\SetVerticalPole \BodyGrid {PoleColD} {90mm}%
\SetVerticalPole \BodyGrid {PoleColE} {120mm}%
\SetVerticalPole \BodyGrid {PoleColF} {150mm}%

\SetHorizontalPole \BodyGrid {PoleRowA} {236mm}%
\SetHorizontalPole \BodyGrid {PoleRowB} {206mm}%
\SetHorizontalPole \BodyGrid {PoleRowC} {176mm}%
\SetHorizontalPole \BodyGrid {PoleRowD} {146mm}%
\SetHorizontalPole \BodyGrid {PoleRowE} {116mm}%
\SetHorizontalPole \BodyGrid {PoleRowF} {86mm}%
\SetHorizontalPole \BodyGrid {PoleRowG} {56mm}%
\SetHorizontalPole \BodyGrid {PoleRowH} {26mm}%

\NewCoffin \CoffinCG%
\SetVerticalCoffin \CoffinCG {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [PoleColC,PoleRowG] \CoffinCG [l,t] %

\TypesetCoffin \BodyGrid%

\end{document}%
3
  • Welcome to the site. If I knew more about your underlying problem, I might suggest an alternative using stackengine. Mar 10 '20 at 13:28
  • Hi Steven, in my opinion (as a layperson) the problem is, that the definied poles get lost after a join. And probably it is not intended to repeat the pole definition every time I use a join. Of course I can define a function for pole setting, and include it in a function for coffin setting ... but is this the way it should be? Jens
    – Jensolig
    Mar 10 '20 at 14:10
  • Sorry I can't offer more help. Still squeamish about working with something called "coffins". Don't want to earn the "undertaker" moniker. Mar 10 '20 at 14:12
5

After a join or attach operation, the poles of the original coffins are kept as \<coffin name>-<pole name>, so that possibly duplicate poles are not overwritten. You can see that by examining the coffin structure using \ShowCoffinStructure \BodyGrid.

Note, for example, that if you compare the output of \ShowCoffinStructure after the first \JoinCoffins (joining \BodyGrid with \CoffinFC), and after the second \JoinCoffins (joining \BodyGrid+\CoffinFC with \CoffinCG), you'll see the poles \CoffinCG-... added to the structure. Also, if you join \CoffinCG in a way that displaces \BodyGrid+\CoffinFC, like:

\JoinCoffins \BodyGrid [\BodyGrid-l,\BodyGrid-T] \CoffinCG [r,B] %

then all the poles of the original \BodyGrid and \CoffinFC coffins are updated (inside \BodyGrid, of course) to match the new position of the entire thing.

The following code produces the same typeset output as yours. I just removed the second bunch of poles you added, and in the second join operation I changed:

\JoinCoffins \BodyGrid [PoleColC,PoleRowG] \CoffinCG [l,t] %

to

\JoinCoffins \BodyGrid [\BodyGrid-PoleColC,\BodyGrid-PoleRowG] \CoffinCG [l,t] %
\documentclass[a4paper,twoside,10pt]{scrbook}%

\setlength{\parindent}{0mm}%
\pagestyle{empty}%
\usepackage[width=176mm,height=250mm,left=19mm,top=19mm]{geometry}%
\usepackage{xcolor,xcoffins}%

\begin{document}%

\NewCoffin \BodyGrid%
\SetVerticalCoffin \BodyGrid {176mm} {\color{green!10!white}\rule{176mm}{236mm}}%

\SetVerticalPole \BodyGrid {PoleColA} {0mm}%
\SetVerticalPole \BodyGrid {PoleColB} {30mm}%
\SetVerticalPole \BodyGrid {PoleColC} {60mm}%
\SetVerticalPole \BodyGrid {PoleColD} {90mm}%
\SetVerticalPole \BodyGrid {PoleColE} {120mm}%
\SetVerticalPole \BodyGrid {PoleColF} {150mm}%

\SetHorizontalPole \BodyGrid {PoleRowA} {236mm}%
\SetHorizontalPole \BodyGrid {PoleRowB} {206mm}%
\SetHorizontalPole \BodyGrid {PoleRowC} {176mm}%
\SetHorizontalPole \BodyGrid {PoleRowD} {146mm}%
\SetHorizontalPole \BodyGrid {PoleRowE} {116mm}%
\SetHorizontalPole \BodyGrid {PoleRowF} {86mm}%
\SetHorizontalPole \BodyGrid {PoleRowG} {56mm}%
\SetHorizontalPole \BodyGrid {PoleRowH} {26mm}%

\NewCoffin \CoffinFC%
\SetVerticalCoffin \CoffinFC {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [PoleColF,PoleRowC] \CoffinFC [l,t]%

% \ShowCoffinStructure \BodyGrid %

\NewCoffin \CoffinCG%
\SetVerticalCoffin \CoffinCG {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [\BodyGrid-PoleColC,\BodyGrid-PoleRowG] \CoffinCG [l,t] %

% \ShowCoffinStructure \BodyGrid %

\TypesetCoffin \BodyGrid%

\end{document}%
3
  • Thanks Phelype! This is the solution.
    – Jensolig
    Mar 10 '20 at 15:09
  • I tried \BodyGrid-PoleColC ... but I did it for the first AND second coffin. Now I realize that at the first time they don't exist yet.
    – Jensolig
    Mar 10 '20 at 15:12
  • 1
    @Jensolig Yeah, when you first define a coffin only the one- or two-letter standard names exist. \ShowCoffinStructure helps a lot when debugging these. Also, some time ago there was a discussion here about the pole-renaming thing, suggesting that only standard pole names should be renamed. If you, as a user, have an idea about that, feel free to comment there. Mar 10 '20 at 15:19

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.