after Phelype has solved my problem concerning the poles of my grid I tried to make the next step. The grid should be available on every page and should not interact with the "normal" text in the body.

Package everypage works fine, but in the first attempt I was unable to position my grid with tikz. As far as I understood the documentation the main coffin poles [H,l] should have been in the same position as (current page.north west), but it was [hc,vc] instead. Probably I didn't read careful enough ... and had to calculate offsets as a workaround. Any better approach would be welcome.

On the second page I still find the coffins content of page 1 (of course), but how clearing it? I could not find a way except setting the coffin and its poles again (defined a command for that). I tried to put the init-command at the end of the everypage-hook, but this doesn't work, probably because shipout is not finished. On the other hand I also didn't get the afterpage-hook work. So again, any better approaches would be welcome. Thanks, Jens.


\NewCoffin \BodyGrid%
\NewCoffin \CoffinA%
\NewCoffin \CoffinB%



\SetVerticalCoffin \BodyGrid {176mm} {\color{green!20!white}\rule{\textwidth}{\textheight}}% just to make it visible
\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}%

\begin{tikzpicture}[remember picture, overlay]%
\node [xshift=\shiftxodd,yshift=\shifty]  at (current page.north west) {\TypesetCoffin \BodyGrid};%
\begin{tikzpicture}[remember picture, overlay]%
\node [xshift=\shiftxeven,yshift=\shifty]  at (current page.north west) {\TypesetCoffin \BodyGrid};%



\SetVerticalCoffin \CoffinA {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [PoleColF,PoleRowC] \CoffinA [l,t]%
\SetVerticalCoffin \CoffinB {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [\BodyGrid-PoleColC,\BodyGrid-PoleRowG] \CoffinB [l,t] %


\SetVerticalCoffin \CoffinA {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [PoleColF,PoleRowH] \CoffinA [l,t]%
\SetVerticalCoffin \CoffinB {26mm} {\rule{26mm}{26mm}}%
\JoinCoffins \BodyGrid [\BodyGrid-PoleColA,\BodyGrid-PoleRowC] \CoffinB [l,t] %



This solution answers the question of resetting the created grid, to be reused on another page with new data.

The proposed solution uses memoir class because I am familiar with geometric setting of the page, but this is of no consequence for the solution. There is no need to check for odd or even pages as the grid is a zero dimension text object, typeset at the current insertion point: the first line (after issuing \newpage) at left text border, and [twoside]memoir takes care of the odd and even margins. Here the spine margin is half the edge margin (a recommended choice for a book) to show how it works.

A grid of red lines is included to verify that the figures landed at the proper intersections of rows and columns.

I found that including the join of Zerox --a zero dimension coffin-- in the initialization code makes a notation like [\GridXY-PoleColA, \GridXY-PoleRowF] usable for all the joins in the document, including the first, and it doesn't seem to cause any harm.

The limitation, which I do not do if there is solution with this scheme, is that the restart must be invoked every new page, no "raw" grid memory. Once used it is lost. So it must be inserted manually in the corresponding place. It will be placed at the current insertion point, wherever it is, as the last image shows.

% !TeX TS-program = lualatex




%% set page parameters for memoir
\setstocksize{9in}{6in} % 6 x 9 in
\settypeblocksize{*}{1.0\lxvchars}{1.6}  % 1.6 aspect ratio of text area, line = 65 chars
\setlrmargins{*}{*}{2} % edge = spine x2 
\setheaderspaces{*}{30pt}{*} % Sets the spacing above and below the header
% ends setting of the page

\usepackage{kantlipsum}% dummy text
\usepackage{pifont}% big numbers

\newcommand{\hairlinexvii}[1][green]{% to test text and grid alignment
\leavevmode\kern-0.1pt %
\smash{\color{#1}\vrule height 50pt depth 450pt width 0.1pt}%

%%********************** symbols for fun


\SetHorizontalCoffin\Pxi{\formatPxi\ding{182}} %#1
\SetHorizontalCoffin\Pxix{\formatPxiii\ding{190}} %#9

%%********************** GRID



    \SetVerticalPole \GridXY {PoleColA} {0mm}%
    \SetVerticalPole \GridXY {PoleColB} {25mm}%
    \SetVerticalPole \GridXY {PoleColC} {50mm}%
    \SetVerticalPole \GridXY {PoleColD} {75mm}%
    \SetVerticalPole \GridXY {PoleColE} {100mm}%
    \SetVerticalPole \GridXY {PoleColF} {125mm}%
    \SetHorizontalPole \GridXY {PoleRowA} {-175mm}%
    \SetHorizontalPole \GridXY {PoleRowB} {-150mm}%
    \SetHorizontalPole \GridXY {PoleRowC} {-125mm}%
    \SetHorizontalPole \GridXY {PoleRowD} {-100mm}%
    \SetHorizontalPole \GridXY {PoleRowE} {-75mm}%
    \SetHorizontalPole \GridXY {PoleRowF} {-50mm}%
    \SetHorizontalPole \GridXY {PoleRowG} {-25mm}%
    \SetHorizontalPole \GridXY {PoleRowH} {0mm}%
    \JoinCoffins*\GridXY [PoleColA, PoleRowA] \Zerox [l,t] % zero dimension coffin
%   \JoinCoffins*\GridXY [\GridXY-PoleColC,\GridXY-PoleRowC] \Pxix [hc,vc]  % print #9  for testing grid       
\LineGrid % for testing X Y alignmen

\newcommand{\LineGrid}{% for testing X Y alignment
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColB, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColC, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColD, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColE, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColF, \GridXY-PoleRowH] \Vrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowA] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowB] \Hrule [l,t]% 
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowC] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowD] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowE] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowF] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowG] \Hrule [l,t]%
    \JoinCoffins*\GridXY [\GridXY-PoleColA, \GridXY-PoleRowH] \Hrule [l,t]%


\SetGrid  %init & Set Grid  
\JoinCoffins*\GridXY [ \GridXY-PoleColA, \GridXY-PoleRowH] \Pxi [hc,vc]%
\JoinCoffins*\GridXY [\GridXY-PoleColA,\GridXY-PoleRowF] \Pxii[hc,vc] %
\noindent\TypesetCoffin\GridXY %print 1 &2

{\sffamily \color{blue} 3. \kant[3]}


\JoinCoffins*\GridXY [\GridXY-PoleColC,\GridXY-PoleRowE] \Pxiii [hc,vc]%        
\JoinCoffins*\GridXY [\GridXY-PoleColD,\GridXY-PoleRowE] \Pxii [hc,vc] %        
\JoinCoffins*\GridXY [\GridXY-PoleColC,\GridXY-PoleRowB] \Pxiv [hc,vc] %        
\noindent\TypesetCoffin\GridXY  %print 2, 3 & 4

{\sffamily \color{blue} 1. \kant[1]}

%\noindent\TypesetCoffin\GridXY% prints nothing, only empty grid lines! >> OK!  
\JoinCoffins*\GridXY [\GridXY-PoleColA,\GridXY-PoleRowF] \Pxvii [hc,vc]%        
\JoinCoffins*\GridXY [\GridXY-PoleColD,\GridXY-PoleRowE] \Pxvi[hc,vc] %     
\JoinCoffins*\GridXY [\GridXY-PoleColE,\GridXY-PoleRowB] \Pxv [hc,vc] % 
\noindent\TypesetCoffin\GridXY% prints 7,6,& 5

{\sffamily \color{blue} 4-6. \kant[2-6]}
\JoinCoffins*\GridXY [\GridXY-PoleColB,\GridXY-PoleRowF] \Pxvii [hc,vc]%        
\JoinCoffins*\GridXY [\GridXY-PoleColB,\GridXY-PoleRowE] \Pxviii[hc,vc] %     
\noindent\TypesetCoffin\GridXY% prints 7,6,& 




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.