xcoffins - 用...固定棺材-在 ExplSyntax 中

xcoffins - 用...固定棺材-在 ExplSyntax 中

我继续使用 xcoffins 进行我的网格设置项目,并将代码转换为 latex3。

从较早前问题我了解到,当我第一次将两个棺材连接在一起时,杆子保持为<pole name>,后来保持为<coffin name>-<pole name>

将身体棺材连接到页面棺材(第一次连接)可以很好地工作

\coffin_attach:NnnNnnnn \l__jgrid_page_coffin { T } { l } \l__jgrid_body_coffin { T } { l } { \dim_use:N \l__jgrid_body_offsetx_dim } { \dim_use:N \l__jgrid_body_offsety_dim }

但我在连接下一个棺材时卡住了。\coffin_show_structure:N \l__jgrid_page_coffin有输出

>  \l__jgrid_page_coffin -T  =>  {0.0pt}{845.04684pt}{1000pt}{0pt}
>  \l__jgrid_body_coffin -l  =>  {54.06023pt}{116.29182pt}{0pt}{1000pt}

但以下代码不起作用:

\coffin_attach:NnnNnnnn \l__jgrid_page_coffin { \l__jgrid_page_coffin -T } { \l__jgrid_page_coffin -l } \l__jgrid_head_coffin { T } { l } { \dim_use:N \l__jgrid_head_offsetx_dim } { \dim_use:N \l__jgrid_head_offsety_dim }

我该如何“构建” <l__jgrid_page_coffin>-<T>?如果这是一个微不足道的问题,请记住这是我在 latex3 中的第一步。非常感谢,Jens。

答案1

第二个答案:

经过更多的测试之后,我(希望)能够更好地理解,定位如何根据所使用的功能而有所不同。

\coffin_attach:NnnNnnnn \l__jgrid_page_coffin { T } { l } \l__jgrid_foot_coffin { t } { l } { \dim_use:N \l__jgrid_body_offsetx_dim } { \dim_use:N \l__jgrid_body_offsety_dim - \textheight-\baselineskip }

\coffin_join:NnnNnnnn \l__jgrid_page_coffin {  \l__jgrid_page_coffin-T } {  \l__jgrid_page_coffin-l } \l__jgrid_foot_coffin { T } { l } { \dim_use:N \l__jgrid_body_offsetx_dim } { \dim_use:N \l__jgrid_body_offsety_dim - \textheight-\baselineskip}

在定位方面产生相同的结果。虽然\coffin_join第一个棺材的边界框被更新以包含两个棺材的边界框,\coffin_attach但第一个棺材保持不变。

第一个答案: 感谢 Ulrikes 的评论,我可能通过将代码简化为 MWE 找到了答案。在我看来,以前收到的解释“起初将杆子保存为(杆子名称),后来保存为(棺材名称-杆子名称)”仅对 xcoffins-DocumentFunctions 有效?!

有人可以证实这一点吗,或者它只是在这个简单的 MWE 中工作?

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

\setlength{\parindent}{0mm}%
\pagestyle{empty}%
\usepackage[width=164mm,height=236mm,left=19mm,top=19mm]{geometry}%
\usepackage{expl3,xparse,xcolor,xcoffins,xtemplate,layout,blindtext,tikz,everypage}%

%%%%%%%%%%%%%%%%
\ExplSyntaxOn
% page
\coffin_new:N \l__jgrid_page_coffin
\dim_new:N    \l__jgrid_page_width_dim
\dim_new:N    \l__jgrid_page_height_dim
\dim_new:N \l__jgrid_page_offsetx_dim
\dim_new:N \l__jgrid_page_offsety_dim
\tl_new:N \l__jgrid_page_main_content_tl
\dim_set:Nn \l__jgrid_page_width_dim { \paperwidth }
\dim_set:Nn \l__jgrid_page_height_dim { \paperheight }
% just to make coffin visible fpr MWE
\tl_set:Nn \l__jgrid_page_content_tl { \color{green!10!white}\rule{ \dim_use:N \l__jgrid_page_width_dim }{ \dim_use:N \l__jgrid_page_height_dim } }

% body
\coffin_new:N \l__jgrid_body_coffin
\dim_new:N    \l__jgrid_body_width_dim
\dim_new:N    \l__jgrid_body_height_dim
\dim_new:N \l__jgrid_body_offsetx_dim
\dim_new:N \l__jgrid_body_offsety_dim
\tl_new:N \l__jgrid_body_content_tl
\dim_set:Nn \l__jgrid_body_width_dim { \textwidth }
\dim_set:Nn \l__jgrid_body_height_dim { \textheight }
% just to make coffin visible for MWE
\tl_set:Nn \l__jgrid_body_content_tl { \color{red!10!white}\rule{ \dim_use:N \l__jgrid_body_width_dim }{ \dim_use:N \l__jgrid_body_height_dim } }

% foot
\coffin_new:N \l__jgrid_foot_coffin
\dim_new:N    \l__jgrid_foot_width_dim
\dim_new:N    \l__jgrid_foot_height_dim
\dim_new:N \l__jgrid_foot_offsetx_dim
\dim_new:N \l__jgrid_foot_offsety_dim
\tl_new:N \l__jgrid_foot_content_tl
\dim_set:Nn \l__jgrid_foot_width_dim { \textwidth }
\dim_set:Nn \l__jgrid_foot_height_dim { 30mm }
% just to make coffin visible for MWE
\tl_set:Nn \l__jgrid_foot_content_tl { \color{blue!10!white}\rule{ \dim_use:N \l__jgrid_foot_width_dim }{ \dim_use:N \l__jgrid_foot_height_dim } }


\DeclareDocumentCommand { \InitializePage } {  }
{ 
\vcoffin_set:Nnn \l__jgrid_page_coffin  { \dim_use:N \l__jgrid_page_width_dim } { \tl_use:N \l__jgrid_page_content_tl }
\vcoffin_set:Nnn \l__jgrid_body_coffin  { \dim_use:N \l__jgrid_body_width_dim } { \tl_use:N \l__jgrid_body_content_tl }
\vcoffin_set:Nnn \l__jgrid_foot_coffin  { \dim_use:N \l__jgrid_foot_width_dim } { \tl_use:N \l__jgrid_foot_content_tl }

\dim_set:Nn \l__jgrid_body_offsety_dim { -1in+\voffset+\headheight }
\int_if_odd:nTF { \thepage } { \dim_set:Nn \l__jgrid_body_offsetx_dim { 1in+\hoffset+\oddsidemargin} } { \dim_set:Nn \l__jgrid_body_offsetx_dim { 1in+\hoffset+\evensidemargin} }

\coffin_attach:NnnNnnnn \l__jgrid_page_coffin { T } { l } \l__jgrid_body_coffin { T } { l } { \dim_use:N \l__jgrid_body_offsetx_dim } { \dim_use:N \l__jgrid_body_offsety_dim }
\coffin_attach:NnnNnnnn \l__jgrid_page_coffin { T } { l } \l__jgrid_foot_coffin { T } { l } { \dim_use:N \l__jgrid_body_offsetx_dim } { \dim_use:N \l__jgrid_body_offsety_dim - \textheight-\baselineskip}
}

\DeclareDocumentCommand { \TypesetPage } {  }
{ 
\coffin_typeset:Nnnnn \l__jgrid_page_coffin { T } { l } { 0pt }{ 0pt }   
%\coffin_show_structure:N \l__jgrid_page_coffin
}

\ExplSyntaxOff
%%%%%%%%%%%%%%%%

\AddEverypageHook{%
\tikz[remember picture, overlay]{\node [xshift=0.5\paperwidth,yshift=-0.5\paperheight]  at (current page.north west) {\TypesetPage}}%
}%

\begin{document}%
\InitializePage\blindtext\clearpage
\InitializePage\blindtext
\end{document}%

相关内容