texlive[76055] Master/texmf-dist: leporello (14aug25)
commits+karl at tug.org
commits+karl at tug.org
Thu Aug 14 22:02:26 CEST 2025
Revision: 76055
https://tug.org/svn/texlive?view=revision&revision=76055
Author: karl
Date: 2025-08-14 22:02:25 +0200 (Thu, 14 Aug 2025)
Log Message:
-----------
leporello (14aug25)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/leporello/README.md
trunk/Master/texmf-dist/doc/latex/leporello/doc/layout.tex
trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.pdf
trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.tex
trunk/Master/texmf-dist/tex/latex/leporello/leporello.cls
Modified: trunk/Master/texmf-dist/doc/latex/leporello/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leporello/README.md 2025-08-14 20:02:16 UTC (rev 76054)
+++ trunk/Master/texmf-dist/doc/latex/leporello/README.md 2025-08-14 20:02:25 UTC (rev 76055)
@@ -1,8 +1,8 @@
-
+
# The `leporello` class
-A simple LaTeX document class to create folding flyers with the following key features:
+A simple LaTeX document class to create folded leaflets with the following key features:
- The document layout consists of a specific number of pages that can have varying widths and are placed next to each other. Each page contains one frame to contain typeset material.
- Material is typeset in boxes and boxes are positioned in columns which in turn are placed into the frames on the pages of the document.
Modified: trunk/Master/texmf-dist/doc/latex/leporello/doc/layout.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leporello/doc/layout.tex 2025-08-14 20:02:16 UTC (rev 76054)
+++ trunk/Master/texmf-dist/doc/latex/leporello/doc/layout.tex 2025-08-14 20:02:25 UTC (rev 76055)
@@ -16,6 +16,8 @@
show ids
]{leporello}
+\errorcontextlines100
+
\leporellosetstyle{align bottom}{
align parent={l,b},
align self={l,b}
@@ -23,7 +25,7 @@
\begin{leporellocolumn}{example-a}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
height=50mm,
bleed={l,t}
]
@@ -33,7 +35,7 @@
\begin{leporellocolumn}{example-b}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
offset={0mm,50mm},
stretch height,
bleed={b}
@@ -44,7 +46,7 @@
\begin{leporellocolumn}{example-c}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
align bottom,
bleed={r,b}
]
Modified: trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.tex 2025-08-14 20:02:16 UTC (rev 76054)
+++ trunk/Master/texmf-dist/doc/latex/leporello/leporello-doc.tex 2025-08-14 20:02:25 UTC (rev 76055)
@@ -11,8 +11,8 @@
% This work has the LPPL maintenance status `maintained'.
%
\documentclass[a4paper]{article}
-\def\leporellofileversion{0.7.0}
-\def\leporellofiledate{8 August 2025}
+\def\leporellofileversion{0.8.0}
+\def\leporellofiledate{12 August 2025}
\usepackage[T1]{fontenc}
\usepackage{Alegreya}
@@ -258,11 +258,12 @@
\makedoctitle
[The leporello package]
{The \titlemacro{leporello} class}
- {A simple LaTeX document class to create folding flyers using columns and boxes}
+ {A simple LaTeX document class to create folded leaflets using columns and boxes}
{Jasper Habicht}[E-mail: \href{mailto:mail at jasperhabicht.de}{mail at jasperhabicht.de}.]
{Version \leporellofileversion, released on \leporellofiledate}
\changes{v0.7.0}{2025/08/08}{First public beta release.}
+\changes{v0.8.0}{2025/08/12}{Added box attachment mechanism and option to place arbitrary code to box background.}
\begin{document}
\printdoctitle
@@ -270,7 +271,7 @@
\section{Introduction}
-The \macro{leporello} class is a simple LaTeX document class to create folding flyers with the following key features:
+The \macro{leporello} class is a simple LaTeX document class to create folded leaflets with the following key features:
\begin{itemize}
\item The document layout consists of a specific number of pages that can have varying widths and are placed next to each other. Each page contains one frame to contain typeset material.
@@ -279,6 +280,8 @@
\item Boxes can have padding (including bleed) and a background and are positioned inside a column.
\end{itemize}
+A folded leaflet is sometimes called leporello in reference to the servant of Don Giovanni (known from the opera by Mozart) who, at one point, unfolds a lengthy zig-zag folded list of his master's love affairs.
+
\section{Loading the document class}
Use \macro{\documentclass{leporello}} to load the document class. The document class loads the \macro{geometry}, the \macro{graphicx} and the \macro{l3draw} package.
@@ -349,9 +352,19 @@
\end{macrodef}
Expects a dimension for the width of the bleed that is added to boxes with background and other material reaching to the edges of the document layout. If \macro{bleed} is not specified, the class assumes the default value of \macro{3mm}.
+\begin{macrodef}
+|\leporellobleed|
+\end{macrodef}
+Retrieves the width of the bleed in pt.
+
+\begin{macrodef}
+|\leporelloboxwidth|
+\end{macrodef}
+Retrieves the width of the current box including padding, but without bleed, in pt.
+
\section{Defining columns}
-Columns are grouped material to be typeset onto a specific page of the folding flyer. A column can contain anything that can be placed in a TeX box in general, but the typical use of a column is to only serve as a frame to which boxes are attached. While the package provides a flow mechanism across boxes, no such mechanism is provided for columns. Thus, if a column contains more than fits into it, the relevant parts just spill over the frame edges.
+Columns are grouped material to be typeset onto a specific page of the folded leaflet. A column can contain anything that can be placed in a TeX box in general, but the typical use of a column is to only serve as a frame to which boxes are attached. While the package provides a flow mechanism across boxes, no such mechanism is provided for columns. Thus, if a column contains more than fits into it, the relevant parts just spill over the frame edges.
\begin{macrodef}
\null\begin{|leporellocolumn|}{<string>}
@@ -370,9 +383,14 @@
Boxes can be positioned inside of columns. They can contain anything that can be placed in a TeX box in general. A box is defined by the \macro{leporellobox} environment which takes one optional argument to set box-specific options. These are the following:
\begin{macrodef}
+|parent|={<integer>}
+\end{macrodef}
+Expects the ID of the box to which the current box is aligned. If not specified, the default value \macro{0} is assumed, denoting the current column box.
+
+\begin{macrodef}
|align parent|={<tuple of poles>}
\end{macrodef}
-Expects a comma-separated list of two items (a tuple) which denotes the horizontal and vertical pole of which the intersection defines the coordinate of the current column that serves as anchor to align the current box. If not specified, the default value \macro{l, t} is assumed, denoting the top left corner. Available poles are:
+Expects a comma-separated list of two items (a tuple) which denotes the horizontal and vertical pole of which the intersection defines the coordinate of the parent box (per default this is the current column box) that serves as anchor to align the current box. If not specified, the default value \macro{l, t} is assumed, denoting the top left corner. Available poles are:
\begin{longtable}{
@{}
@@ -396,7 +414,7 @@
\begin{macrodef}
|align self|={<tuple of poles>}
\end{macrodef}
-Expects a comma-separated list of two items (a tuple) which denotes the horizontal and vertical pole of which the intersection defines the coordinate of the current box that serves as anchor to align the current box to the current column. If not specified, the default value \macro{l, t} is assumed, denoting the top left corner. Available poles are the same as for \macro{align parent}.
+Expects a comma-separated list of two items (a tuple) which denotes the horizontal and vertical pole of which the intersection defines the coordinate of the current box that serves as anchor to align the current box to parent box (per default this is the current column box). If not specified, the default value \macro{l, t} is assumed, denoting the top left corner. Available poles are the same as for \macro{align parent}.
\begin{macrodef}
|offset|={<tuple of dimensions>}
@@ -438,12 +456,17 @@
Expects a token list that is placed before the actual contents of the box. Should not contain typeset material. This key should be used if boxes are manually split using the \macro{\leporelloboxbreak} command.
\begin{macrodef}
-|background|={<color name>}
-|background|={none}
+|background color|={<color name>}
+|background color|={none}
\end{macrodef}
Expects a color name as defined via \macro{l3color} or \macro{none} which will not fill the background. If not specified, the default value of \macro{none} is assumed.
\begin{macrodef}
+|background code|={<code>}
+\end{macrodef}
+Expects typeset material that will be placed into the background of the box aligned at the upper left corner of the box. THe typeset material is clipped to the size of the box.
+
+\begin{macrodef}
|bleed|={<list of values>}
\end{macrodef}
Expects a comma-separated list consisting of up to four items with the values \macro{l} and \macro{r}, \macro{t} and \macro{b} that describe the edges (left, right, top and bottom) where bleed should be added to the box. Note that bleed is never added to the inner edges where the columns meet.
@@ -473,7 +496,7 @@
\begin{macrodef}
|reverse layout|
\end{macrodef}
-The command takes one optional argument that can take the option \macro{reverse layout}. If set, the widths of the columns are reversed, but the placement of the columns is still from left to right. This option does not take a value. The option should be used to typeset the verso of a folding flyer that naturally has the widths of the columns reversed.
+The command takes one optional argument that can take the option \macro{reverse layout}. If set, the widths of the columns are reversed, but the placement of the columns is still from left to right. This option does not take a value. The option should be used to typeset the verso of a folded leaflet that naturally has the widths of the columns reversed.
Currently, boxes can only be attached to columns. A future version of the document class may allow the attachment of boxes to each other. If a box should be positioned below another box with natural height defined by its contents, the \macro{store height} key can be used to store the height of the upper box into a custom macro which can then be used to calculate the offset from the top.
@@ -486,10 +509,56 @@
\end{macrodef}
The flow mechanism works across multiple boxes. But due to the way the typesetting mechanism of TeX works, it needs some manual adjustment if the typeset material flows across boxes of different width. In this case, the command \macro{\leporelloboxbreak} should be inserted at the point where the break should take place.
+\subsection{Hooks}
+
+The package offers two pairs of hooks that are positioned at the start and end of columns and boxes allowing for inserting code. The package uses the hook \macro{leporello/box/before} to insert code for the flow mechanism.
+
+Apart from that, the package uses the hook \macro{begindocument/before} to insert layout-related settings among other things via the \macro{geometry} package as well as the hook \macro{shipout/foreground} to insert code to draw cropmarks.
+
+\begin{longtable}{
+ @{}
+ p{13em}
+ p{\dimexpr\linewidth-2\tabcolsep-13em}
+ @{}
+}
+ \toprule
+ \textbf{Hook} & \textbf{Position} \\
+ \midrule
+ \macro{leporello/column/before} & before the code block stored via the \macro{leporellocolumn} environment is typeset to the column box, preceded by a line of code that sets \macro{\l_leporello_current_column_str} to the name of the current column \\
+ \macro{leporello/column/after} & after the code block stored via the \macro{leporellocolumn} environment is typeset to the column box \\
+ \macro{leporello/box/before} & before the code block stored via the \macro{leporellobox} environment is typeset to the relevant box which is preceded by a line of code that sets \macro{\l_leporello_current_box_int} to the ID of the current column and inserts the code defined via the \macro{pre} key \\
+ \macro{leporello/box/after} & after the code block stored via the \macro{leporellobox} environment is typeset to the relevant box \\
+ \bottomrule
+\end{longtable}
+
\section{Other settings}
+\subsection{Hooks}
+
+The package offers two pairs of hooks that are positioned at the start and end of columns and boxes allowing for inserting code. The package uses the hook \macro{leporello/box/before} to insert code for the flow mechanism.
+
+Apart from that, the package uses the hook \macro{begindocument/before} to insert layout-related settings among other things via the \macro{geometry} package as well as the hook \macro{shipout/foreground} to insert code to draw cropmarks.
+
+\begin{longtable}{
+ @{}
+ p{13em}
+ p{\dimexpr\linewidth-2\tabcolsep-13em}
+ @{}
+}
+ \toprule
+ \textbf{Hook} & \textbf{Position} \\
+ \midrule
+ \macro{leporello/column/before} & before the code block stored via the \macro{leporellocolumn} environment is typeset to the column box, preceded by a line of code that sets \macro{\l_leporello_current_column_str} to the name of the current column \\
+ \macro{leporello/column/after} & after the code block stored via the \macro{leporellocolumn} environment is typeset to the column box \\
+ \macro{leporello/box/before} & before the code block stored via the \macro{leporellobox} environment is typeset to the relevant box which is preceded by a line of code that sets \macro{\l_leporello_current_box_int} to the ID of the current column and inserts the code defined via the \macro{pre} key \\
+ \macro{leporello/box/after} & after the code block stored via the \macro{leporellobox} environment is typeset to the relevant box \\
+ \bottomrule
+\end{longtable}
+
\subsection{Inserting images}
+One way to insert images is via the \macro{\includegraphics} command provided by the \macro{graphicx} package. Using the \macro{background code} key, images can be added to the background of a box.
+
\begin{macrodef}
|\leporelloimage|[<options>]{<file name>}
\end{macrodef}
@@ -578,7 +647,7 @@
\begin{leporellocolumn}{example-a}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
height=50mm,
bleed={l,t}
]
@@ -588,7 +657,7 @@
\begin{leporellocolumn}{example-b}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
offset={0mm,50mm},
stretch height,
bleed={b}
@@ -599,7 +668,7 @@
\begin{leporellocolumn}{example-c}
\begin{leporellobox}[
- background=black!10,
+ background color=black!10,
align bottom,
bleed={r,b}
]
@@ -628,4 +697,4 @@
\end{document}
-%% End of file `leporello-doc.tex`.
+%% End of file `leporello-doc.tex`.
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/leporello/leporello.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/leporello/leporello.cls 2025-08-14 20:02:16 UTC (rev 76054)
+++ trunk/Master/texmf-dist/tex/latex/leporello/leporello.cls 2025-08-14 20:02:25 UTC (rev 76055)
@@ -11,17 +11,18 @@
% This work has the LPPL maintenance status `maintained'.
%
\ProvidesExplClass{leporello}
- {2025/08/08} {0.7.0} {Document class for typesetting folding flyers}
+ {2025/08/12} {0.8.0} {Document class for typesetting folded leaflets}
\cs_generate_variant:Nn \clist_item:Nn { NV }
\cs_generate_variant:Nn \color_select:n { e }
-\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { Neeceeee }
+\cs_generate_variant:Nn \coffin_attach:NnnNnnnn { ceeceeee }
+\cs_generate_variant:Nn \msg_error:nnnn { nneV }
\cs_generate_variant:Nn \prop_gput:Nnn { cnV , cne }
\cs_generate_variant:Nn \tl_const:Nn { co }
-\cs_generate_variant:Nn \msg_error:nnnn { nneV }
+\cs_generate_variant:Nn \vbox_set_top:Nn { Ne }
\prg_generate_conditional_variant:Nnn \clist_if_in:nn { en } { T , F , TF }
-\prg_generate_conditional_variant:Nnn \str_if_eq:nn { en } { TF }
+\prg_generate_conditional_variant:Nnn \str_if_eq:nn { en } { F }
\bool_new:N \l_leporello_show_frames_bool
\bool_new:N \l_leporello_show_id_bool
@@ -37,7 +38,7 @@
\dim_new:N \l__leporello_paper_height_dim
\keys_define:nn { leporello / global } {
- columns .code:n = {
+ columns .code:n = {
\clist_set:Nn \l_leporello_columns_clist {#1}
\int_set:Nn \l_leporello_column_count_int {
\clist_count:N \l_leporello_columns_clist
@@ -47,22 +48,22 @@
\dim_add:Nn \l__leporello_layout_width_dim {##1}
}
} ,
- columns .initial:n = { 97mm , 100mm , 100mm } ,
- layout ~ height .dim_set:N = \l_leporello_layout_height_dim ,
- layout ~ height .initial:n = { 210mm } ,
- show ~ frames .bool_set:N = \l_leporello_show_frames_bool ,
- show ~ frames .default:n = { true } ,
- show ~ frames .initial:n = { false } ,
- show ~ ids .bool_set:N = \l_leporello_show_id_bool ,
- show ~ ids .default:n = { true } ,
- show ~ ids .initial:n = { false } ,
- prepress .bool_set:N = \l_leporello_prepress_bool ,
- prepress .default:n = { true } ,
- prepress .initial:n = { false } ,
- bleed .dim_set:N = \l_leporello_bleed_dim ,
- bleed .initial:n = { 3mm } ,
- info ~ area .dim_set:N = \l_leporello_info_area_dim ,
- info ~ area .initial:n = { 10mm } ,
+ columns .initial:n = { 97mm , 100mm , 100mm } ,
+ layout ~ height .dim_set:N = \l_leporello_layout_height_dim ,
+ layout ~ height .initial:n = { 210mm } ,
+ show ~ frames .bool_set:N = \l_leporello_show_frames_bool ,
+ show ~ frames .default:n = { true } ,
+ show ~ frames .initial:n = { false } ,
+ show ~ ids .bool_set:N = \l_leporello_show_id_bool ,
+ show ~ ids .default:n = { true } ,
+ show ~ ids .initial:n = { false } ,
+ prepress .bool_set:N = \l_leporello_prepress_bool ,
+ prepress .default:n = { true } ,
+ prepress .initial:n = { false } ,
+ bleed .dim_set:N = \l_leporello_bleed_dim ,
+ bleed .initial:n = { 3mm } ,
+ info ~ area .dim_set:N = \l_leporello_info_area_dim ,
+ info ~ area .initial:n = { 10mm } ,
two ~ columns .meta:n = {
columns = { 99mm , 99mm }
@@ -110,10 +111,10 @@
\str_new:N \l_leporello_current_column_str
\dim_new:N \l_leporello_current_column_offset_dim
\coffin_new:N \l_leporello_current_column_coffin
-\coffin_new:N \l_leporello_current_column_phantom_coffin
\int_new:N \g_leporello_box_int
\int_new:N \l_leporello_current_box_int
+\clist_new:N \g_leporello_parent_boxes_clist
\tl_new:N \l__leporello_box_align_parent_clist
\tl_new:N \l__leporello_box_align_self_clist
@@ -129,7 +130,9 @@
\dim_new:N \l__leporello_box_padding_top_dim
\dim_new:N \l__leporello_box_padding_bottom_dim
\tl_new:N \l__leporello_box_pre_tl
-\tl_new:N \l__leporello_box_background_tl
+\tl_new:N \l__leporello_box_background_color_tl
+\tl_new:N \l__leporello_box_background_code_tl
+\box_new:N \l__leporello_box_background_box
\clist_new:N \l__leporello_box_bleed_clist
\dim_new:N \l__leporello_typeset_box_width_dim
@@ -139,39 +142,47 @@
\dim_new:N \l__leporello_typeset_box_bleed_x_dim
\dim_new:N \l__leporello_typeset_box_bleed_y_dim
\int_new:N \l__leporello_typeset_coffin_attach_align_int
-\coffin_new:N \l__leporello_typeset_temp_coffin
+\box_new:N \l__leporello_typeset_column_box
+\coffin_new:N \l__leporello_typeset_mark_coffin
\coffin_new:N \l__leporello_typeset_mark_temp_coffin
\keys_define:nn { leporello / box } {
- align ~ parent .clist_set:N = \l__leporello_box_align_parent_clist ,
- align ~ parent .initial:n = { l , t } ,
- align ~ self .clist_set:N = \l__leporello_box_align_self_clist ,
- align ~ self .initial:n = { l , t } ,
- offset .clist_set:N = \l__leporello_box_offset_clist ,
- offset .initial:n = { 0mm , 0mm } ,
- width .code:n = {
+ parent .code:n = {
+ \clist_if_exist:cF { g_leporello_box_ #1 _children_clist } {
+ \clist_new:c { g_leporello_box_ #1 _children_clist }
+ }
+ \clist_gput_right:cV { g_leporello_box_ #1 _children_clist } \g_leporello_box_int
+ \clist_gput_right:NV \g_leporello_parent_boxes_clist \g_leporello_box_int
+ } ,
+ align ~ parent .clist_set:N = \l__leporello_box_align_parent_clist ,
+ align ~ parent .initial:n = { l , t } ,
+ align ~ self .clist_set:N = \l__leporello_box_align_self_clist ,
+ align ~ self .initial:n = { l , t } ,
+ offset .clist_set:N = \l__leporello_box_offset_clist ,
+ offset .initial:n = { 0mm , 0mm } ,
+ width .code:n = {
\bool_set_true:N \l__leporello_box_width_bool
\dim_set:Nn \l__leporello_box_width_dim {#1}
} ,
- height .code:n = {
+ height .code:n = {
\bool_set_true:N \l__leporello_box_height_bool
\dim_set:Nn \l__leporello_box_height_dim {#1}
} ,
- stretch ~ height .bool_set:N = \l__leporello_box_stretch_height_bool ,
- stretch ~ height .default:n = { true } ,
- stretch ~ height .initial:n = { false } ,
- padding / left .dim_set:N = \l__leporello_box_padding_left_dim ,
- padding / right .dim_set:N = \l__leporello_box_padding_right_dim ,
- padding / top .dim_set:N = \l__leporello_box_padding_top_dim ,
- padding / bottom .dim_set:N = \l__leporello_box_padding_bottom_dim ,
- padding .code:n = { \keys_set:nn { leporello / box / padding } {#1} } ,
- padding .initial:n = {
+ stretch ~ height .bool_set:N = \l__leporello_box_stretch_height_bool ,
+ stretch ~ height .default:n = { true } ,
+ stretch ~ height .initial:n = { false } ,
+ padding / left .dim_set:N = \l__leporello_box_padding_left_dim ,
+ padding / right .dim_set:N = \l__leporello_box_padding_right_dim ,
+ padding / top .dim_set:N = \l__leporello_box_padding_top_dim ,
+ padding / bottom .dim_set:N = \l__leporello_box_padding_bottom_dim ,
+ padding .code:n = { \keys_set:nn { leporello / box / padding } {#1} } ,
+ padding .initial:n = {
left = 7.5mm ,
right = 7.5mm ,
top = 7.5mm ,
bottom = 7.5mm
} ,
- no ~ padding .meta:n = {
+ no ~ padding .meta:n = {
padding = {
left = 0mm ,
right = 0mm ,
@@ -179,12 +190,13 @@
bottom = 0mm
}
} ,
- pre .tl_set:N = \l__leporello_box_pre_tl ,
- background .tl_set:N = \l__leporello_box_background_tl ,
- background .initial:n = { none } ,
- bleed .clist_set:N = \l__leporello_box_bleed_clist ,
- store ~ width .tl_set:N = \l__leporello_box_store_width_tl ,
- store ~ height .tl_set:N = \l__leporello_box_store_height_tl
+ pre .tl_set:N = \l__leporello_box_pre_tl ,
+ background ~ color .tl_set:N = \l__leporello_box_background_color_tl ,
+ background ~ color .initial:n = { none } ,
+ background ~ code .tl_set:N = \l__leporello_box_background_code_tl ,
+ bleed .clist_set:N = \l__leporello_box_bleed_clist ,
+ store ~ width .tl_set:N = \l__leporello_box_store_width_tl ,
+ store ~ height .tl_set:N = \l__leporello_box_store_height_tl
}
\bool_new:N \l_leporello_reverse_layout_bool
@@ -215,35 +227,37 @@
\box_new:N \l__leporello_image_original_box
\keys_define:nn { leporello / image } {
- width .code:n = {
+ width .code:n = {
\bool_set_true:N \l_leporello_image_width_bool
\dim_set:Nn \l_leporello_image_width_dim {#1}
} ,
- height .code:n = {
+ height .code:n = {
\bool_set_true:N \l_leporello_image_height_bool
\dim_set:Nn \l_leporello_image_height_dim {#1}
} ,
- clip ~ width .code:n = {
+ clip ~ width .code:n = {
\bool_set_true:N \l_leporello_image_clip_width_bool
\dim_set:Nn \l_leporello_image_clip_width_dim {#1}
} ,
- clip ~ height .code:n = {
+ clip ~ height .code:n = {
\bool_set_true:N \l_leporello_image_clip_height_bool
\dim_set:Nn \l_leporello_image_clip_height_dim {#1}
} ,
- offset .code:n = {
+ offset .code:n = {
\dim_set:Nn \l_leporello_image_offset_x_dim { \clist_item:nn {#1} { 1 } }
\dim_set:Nn \l_leporello_image_offset_y_dim { - \clist_item:nn {#1} { 2 } }
} ,
- offset .initial:n = { 0mm , 0mm } ,
- scale .fp_set:N = \l_leporello_image_scale_fp ,
- scale .initial:n = { 1 } ,
- ignore ~ padding .clist_set:N = \l_leporello_image_ignore_padding_clist ,
- fill ~ bleed .bool_set:N = \l_leporello_image_fill_bleed_bool ,
- fill ~ bleed .default:n = { true } ,
- fill ~ bleed .initial:n = { false }
+ offset .initial:n = { 0mm , 0mm } ,
+ scale .fp_set:N = \l_leporello_image_scale_fp ,
+ scale .initial:n = { 1 } ,
+ ignore ~ padding .clist_set:N = \l_leporello_image_ignore_padding_clist ,
+ fill ~ bleed .bool_set:N = \l_leporello_image_fill_bleed_bool ,
+ fill ~ bleed .default:n = { true } ,
+ fill ~ bleed .initial:n = { false }
}
+% ===
+
\hook_new_pair:nn { leporello / column / before } { leporello / column / after }
\hook_new_pair:nn { leporello / box / before } { leporello / box / after }
@@ -255,6 +269,12 @@
\RequirePackage { graphicx }
\RequirePackage { l3draw }
+\cs_set_eq:NN \leporello_pagestyle_set:n \pagestyle
+\cs_set_eq:NN \leporello_geometry_set:n \geometry
+\cs_new_protected:Npn \leoprello_graphics_use:nn #1#2 {
+ \includegraphics [ #1 ] {#2}
+}
+
\cs_new_protected:Npn \leporello_draw_absolute:nn #1#2 {
\draw_begin:
\bool_set_false:N \l_draw_bb_update_bool
@@ -327,8 +347,8 @@
\draw_end:
}
-\AddToHook { begindocument / before } {
- \pagestyle { empty }
+\hook_gput_code:nnn { begindocument / before } { . } {
+ \leporello_pagestyle_set:n { empty }
\dim_set:Nn \l__leporello_paper_height_dim {
\l_leporello_layout_height_dim + 2 \l_leporello_info_area_dim
}
@@ -336,7 +356,7 @@
\l__leporello_layout_width_dim + 2 \l_leporello_info_area_dim
}
\bool_if:NTF \l_leporello_prepress_bool {
- \geometry {
+ \leporello_geometry_set:n {
layoutwidth = \l__leporello_layout_width_dim ,
layoutheight = \l_leporello_layout_height_dim ,
layouthoffset = \l_leporello_info_area_dim ,
@@ -345,7 +365,7 @@
paperheight = \l__leporello_paper_height_dim ,
margin = 0pt
}
- \AddToHook { shipout / foreground } {
+ \hook_gput_code:nnn { shipout / foreground } { . } {
\__leporello_cropmarks:
\dim_set:Nn \l_leporello_current_column_offset_dim {
\l_leporello_info_area_dim
@@ -359,7 +379,7 @@
}
}
} {
- \geometry {
+ \leporello_geometry_set:n {
paperwidth = \l__leporello_layout_width_dim ,
paperheight = \l_leporello_layout_height_dim ,
margin = 0pt
@@ -379,6 +399,14 @@
}
}
+\NewDocumentCommand { \leporelloboxwidth } { } {
+ \dim_use:N \l__leporello_typeset_box_width_dim
+}
+
+\NewDocumentCommand { \leporellobleed } { } {
+ \dim_use:N \l_leporello_bleed_dim
+}
+
\NewDocumentCommand { \leporellocolordefine } { m m m } {
\color_set:nnn {#1} {#2} {#3}
}
@@ -396,7 +424,7 @@
}
\hbox_set:Nn \l__leporello_image_original_box {
- \includegraphics {#2}
+ \leoprello_graphics_use:nn { } {#2}
}
\bool_if:NF \l_leporello_image_clip_width_bool {
@@ -439,6 +467,11 @@
g_leporello_box_ \int_use:N \l_leporello_current_box_int _prop
} { padding ~ left }
}
+ \skip_add:Nn \tex_hfuzz:D {
+ \prop_item:cn {
+ g_leporello_box_ \int_use:N \l_leporello_current_box_int _prop
+ } { padding ~ left }
+ }
}
\clist_if_in:NnT \l_leporello_image_ignore_padding_clist { r } {
\dim_add:Nn \l_leporello_image_outer_offset_right_dim {
@@ -451,6 +484,11 @@
g_leporello_box_ \int_use:N \l_leporello_current_box_int _prop
} { padding ~ right }
}
+ \skip_add:Nn \tex_hfuzz:D {
+ \prop_item:cn {
+ g_leporello_box_ \int_use:N \l_leporello_current_box_int _prop
+ } { padding ~ right }
+ }
}
\clist_if_in:NnT \l_leporello_image_ignore_padding_clist { t } {
\dim_add:Nn \l_leporello_image_outer_offset_top_dim {
@@ -536,7 +574,7 @@
\skip_vertical:n { - \l_leporello_image_outer_offset_top_dim }
\skip_horizontal:n { - \l_leporello_image_outer_offset_left_dim }
- \includegraphics [
+ \leoprello_graphics_use:nn {
scale = \fp_to_decimal:N \l_leporello_image_scale_fp ,
clip ,
viewport =
@@ -568,7 +606,7 @@
) / \l_leporello_image_scale_fp
}
}
- ] {#2}
+ } {#2}
\skip_horizontal:n { - \l_leporello_image_outer_offset_right_dim }
\skip_vertical:n { - \l_leporello_image_outer_offset_bottom_dim }
\group_end:
@@ -581,7 +619,6 @@
}
\tl_gset:cn { g_leporello_column_ #1 _tl } {
\clist_gclear:c { g_leporello_column_ #1 _boxes_clist }
- \str_set:Nn \l_leporello_current_column_str {#1}
#2
}
} { }
@@ -651,8 +688,11 @@
{ pre }
{ \l__leporello_box_pre_tl }
\prop_gput:cnV { g_leporello_box_ \int_use:N \g_leporello_box_int _prop }
- { background }
- \l__leporello_box_background_tl
+ { background ~ color }
+ \l__leporello_box_background_color_tl
+ \prop_gput:cno { g_leporello_box_ \int_use:N \g_leporello_box_int _prop }
+ { background ~ code }
+ { \l__leporello_box_background_code_tl }
\prop_gput:cne { g_leporello_box_ \int_use:N \g_leporello_box_int _prop }
{ bleed }
{ \clist_use:Nn \l__leporello_box_bleed_clist { , } }
@@ -679,135 +719,344 @@
} { }
\cs_new_protected:Npn \__leporello_box_construct:nnn #1#2#3 {
- \prop_if_in:cnTF { g_leporello_box_ #3 _prop } { width } {
- \dim_set:Nn \l__leporello_typeset_box_width_dim {
- \prop_item:cn { g_leporello_box_ #3 _prop } { width }
+ \coffin_if_exist:cF { g_leporello_box_ #1 _ #2 _ #3 _outer_coffin } {
+ \prop_if_in:cnTF { g_leporello_box_ #3 _prop } { width } {
+ \dim_set:Nn \l__leporello_typeset_box_width_dim {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { width }
+ }
+ } {
+ \dim_set:Nn \l__leporello_typeset_box_width_dim {
+ \clist_item:Nn \l_leporello_columns_clist {#2}
+ }
}
- } {
- \dim_set:Nn \l__leporello_typeset_box_width_dim {
- \clist_item:Nn \l_leporello_columns_clist {#2}
+
+ \coffin_new:c {
+ g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
}
- }
+ \vcoffin_gset:cnn {
+ g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
+ } {
+ \l__leporello_typeset_box_width_dim -
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ left } -
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ right }
+ } {
+ \draw_suspend_begin:
+ \int_set:Nn \l_leporello_current_box_int {#3}
+ \hook_use:n { leporello / box / before }
+ \tl_use:c { g_leporello_box_ #3 _tl }
+ \hook_use:n { leporello / box / after }
+ \draw_suspend_end:
+ }
- \coffin_new:c {
- g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
- }
- \vcoffin_gset:cnn {
- g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
- } {
- \l__leporello_typeset_box_width_dim -
- \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ left } -
- \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ right }
- } {
- \draw_suspend_begin:
- \int_set:Nn \l_leporello_current_box_int {#3}
- \hook_use:n { leporello / box / before }
- \tl_use:c { g_leporello_box_ #3 _tl }
- \hook_use:n { leporello / box / after }
- \draw_suspend_end:
- }
+ \prop_if_in:cnTF { g_leporello_box_ #3 _prop } { height } {
+ \dim_set:Nn \l__leporello_typeset_box_height_dim {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { height }
+ }
+ } {
+ \dim_set:Nn \l__leporello_typeset_box_height_dim {
+ \coffin_ht:c {
+ g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
+ } +
+ \coffin_dp:c {
+ g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
+ } +
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ top } +
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ bottom }
+ }
+ }
- \prop_if_in:cnTF { g_leporello_box_ #3 _prop } { height } {
- \dim_set:Nn \l__leporello_typeset_box_height_dim {
- \prop_item:cn { g_leporello_box_ #3 _prop } { height }
+ \bool_if:nT { \prop_item:cn { g_leporello_box_ #3 _prop } { stretch ~ height } } {
+ \dim_set:Nn \l__leporello_typeset_box_height_dim {
+ \fp_to_dim:n {
+ \l_leporello_layout_height_dim -
+ (
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { offset }
+ } { 2 }
+ )
+ }
+ }
}
- } {
- \dim_set:Nn \l__leporello_typeset_box_height_dim {
- \coffin_ht:c {
- g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
- } +
- \coffin_dp:c {
- g_leporello_box_ #1 _ #2 _ #3 _inner_coffin
- } +
- \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ top } +
- \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ bottom }
+
+ \dim_zero:N \l__leporello_typeset_box_bleed_x_dim
+ \dim_zero:N \l__leporello_typeset_box_bleed_y_dim
+
+ \int_compare:nNnT {#2} = { 1 } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ } { l } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_x_dim { \l_leporello_bleed_dim }
+ }
}
- }
+ \int_compare:nNnT {#2} = { \l_leporello_column_count_int } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ } { r } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_x_dim { \l_leporello_bleed_dim }
+ }
+ }
+ \skip_set:Nn \tex_hfuzz:D { \l__leporello_typeset_box_bleed_x_dim }
- \bool_if:nT { \prop_item:cn { g_leporello_box_ #3 _prop } { stretch ~ height } } {
- \dim_set:Nn \l__leporello_typeset_box_height_dim {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ } { t } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_y_dim { \l_leporello_bleed_dim }
+ }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ } { b } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_y_dim { \l_leporello_bleed_dim }
+ }
+ \skip_set:Nn \tex_vfuzz:D { \l__leporello_typeset_box_bleed_y_dim }
+
+ \coffin_new:c {
+ g_leporello_box_ #1 _ #2 _ #3 _outer_coffin
+ }
+ \vcoffin_gset:cnn {
+ g_leporello_box_ #1 _ #2 _ #3 _outer_coffin
+ } { \l__leporello_typeset_box_width_dim } {
+ \draw_suspend_begin:
+ \draw_begin:
+ \draw_path_rectangle:nn { 0mm , 0mm } {
+ \l__leporello_typeset_box_width_dim +
+ \l__leporello_typeset_box_bleed_x_dim ,
+ \l__leporello_typeset_box_height_dim +
+ \l__leporello_typeset_box_bleed_y_dim
+ }
+ \str_if_eq:enF {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { background ~ color }
+ } { none } {
+ \group_begin:
+ \color_select:e {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { background ~ color }
+ }
+ \draw_path_use:n { fill }
+ \group_end:
+ }
+ \draw_path_use_clear:n { clip }
+ \prop_if_in:cnT { g_leporello_box_ #3 _prop } { background ~ code } {
+ \vbox_set_top:Ne \l__leporello_box_background_box {
+ \prop_item:cn { g_leporello_box_ #3 _prop } { background ~ code }
+ }
+ \draw_box_use:Nn \l__leporello_box_background_box {
+ 0mm ,
+ \l__leporello_typeset_box_height_dim +
+ \l__leporello_typeset_box_bleed_y_dim -
+ \box_ht:N \l__leporello_box_background_box
+ }
+ }
+ \draw_end:
+ \draw_suspend_end:
+ }
+
+ \tl_if_exist:cT { c_leporello_box_ #3 _store_width_tl } {
+ \exp_args:NNo \exp_args:No
+ \dim_set_eq:NN { \use:c { c_leporello_box_ #3 _store_width_tl } }
+ \l__leporello_typeset_box_width_dim
+ }
+ \tl_if_exist:cT { c_leporello_box_ #3 _store_height_tl } {
+ \exp_args:NNo \exp_args:No
+ \dim_set_eq:NN { \use:c { c_leporello_box_ #3 _store_height_tl } }
+ \l__leporello_typeset_box_height_dim
+ }
+
+ \bool_if:NT \l_leporello_show_id_bool {
+ \hcoffin_set:Nn \l__leporello_typeset_mark_coffin {
+ \__leporello_id_mark:n { #3 }
+ }
+ \coffin_attach:cnnNnnnn {
+ g_leporello_box_
+ \int_use:N \l_leporello_current_page_int _
+ \int_use:N \l_leporello_current_column_int _
+ #3 _inner_coffin
+ } { hc } { vc }
+ \l__leporello_typeset_mark_coffin
+ { hc } { vc } { 0pt } { 0pt }
+ }
+
+ \__leporello_box_set_bleed:n {#3}
+
+ \coffin_attach:cnncnnnn {
+ g_leporello_box_
+ \int_use:N \l_leporello_current_page_int _
+ \int_use:N \l_leporello_current_column_int _
+ #3 _outer_coffin
+ } { l } { t } {
+ g_leporello_box_
+ \int_use:N \l_leporello_current_page_int _
+ \int_use:N \l_leporello_current_column_int _
+ #3 _inner_coffin
+ } { l } { t } {
\fp_to_dim:n {
- \l_leporello_layout_height_dim -
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ left } +
+ \l__leporello_typeset_box_bleed_left_dim
+ }
+ } {
+ \fp_to_dim:n {
(
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ #3 _prop } { offset }
- } { 2 }
- )
+ \prop_item:cn { g_leporello_box_ #3 _prop } { padding ~ top } +
+ \l__leporello_typeset_box_bleed_top_dim
+ ) * -1
}
}
}
+}
+\cs_generate_variant:Nn \__leporello_box_construct:nnn { VVn }
- \dim_zero:N \l__leporello_typeset_box_bleed_x_dim
- \dim_zero:N \l__leporello_typeset_box_bleed_y_dim
+\cs_new:Npn \__leporello_box_set_bleed:n #1 {
+ \dim_zero:N \l__leporello_typeset_box_bleed_left_dim
+ \dim_zero:N \l__leporello_typeset_box_bleed_top_dim
- \int_compare:nNnT {#2} = { 1 } {
+ \int_compare:nNnT {
+ \l_leporello_current_column_int
+ } = { 1 } {
\clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
} { l } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_x_dim { \l_leporello_bleed_dim }
+ \dim_add:Nn \l__leporello_typeset_box_bleed_left_dim { \l_leporello_bleed_dim }
}
}
- \int_compare:nNnT {#2} = { \l_leporello_column_count_int } {
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
- } { r } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_x_dim { \l_leporello_bleed_dim }
- }
- }
- \skip_set:Nn \tex_hfuzz:D { \l__leporello_typeset_box_bleed_x_dim }
-
\clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
} { t } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_y_dim { \l_leporello_bleed_dim }
+ \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim { \l_leporello_bleed_dim }
}
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ #3 _prop } { bleed }
+}
+
+\cs_new_protected:Npn \__leporello_boxes_attach:nn #1#2 {
+ \clist_if_in:enTF {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ self }
} { b } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_y_dim { \l_leporello_bleed_dim }
+ \int_set:Nn \l__leporello_typeset_coffin_attach_align_int { 1 }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { bleed }
+ } { b } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim {
+ \l_leporello_bleed_dim
+ }
+ }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { bleed }
+ } { t } {
+ \dim_sub:Nn \l__leporello_typeset_box_bleed_top_dim {
+ \l_leporello_bleed_dim
+ }
+ }
+ } {
+ \int_set:Nn \l__leporello_typeset_coffin_attach_align_int { -1 }
}
- \skip_set:Nn \tex_vfuzz:D { \l__leporello_typeset_box_bleed_y_dim }
- \coffin_new:c {
- g_leporello_box_ #1 _ #2 _ #3 _outer_coffin
- }
- \vcoffin_gset:cnn {
- g_leporello_box_ #1 _ #2 _ #3 _outer_coffin
- } { \l__leporello_typeset_box_width_dim } {
- \draw_suspend_begin:
- \draw_begin:
- \draw_path_rectangle:nn { 0mm , 0mm } {
- \l__leporello_typeset_box_width_dim +
- \l__leporello_typeset_box_bleed_x_dim ,
- \l__leporello_typeset_box_height_dim +
- \l__leporello_typeset_box_bleed_y_dim
+ \prop_if_exist:cT { g_leporello_box_ #1 _prop } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { l } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
+ } { l } {
+ \dim_sub:Nn \l__leporello_typeset_box_bleed_left_dim {
+ \l_leporello_bleed_dim
+ }
}
- \str_if_eq:enTF {
- \prop_item:cn { g_leporello_box_ #3 _prop } { background }
- } { none } {
- \draw_path_use_clear:n { clip }
- } {
- \color_select:e {
- \prop_item:cn { g_leporello_box_ #3 _prop } { background }
+ }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { r } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
+ } { r } {
+ \dim_sub:Nn \l__leporello_typeset_box_bleed_left_dim {
+ \l_leporello_bleed_dim
}
- \draw_path_use_clear:n { fill }
}
- \draw_end:
- \draw_suspend_end:
+ }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { t } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
+ } { t } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim {
+ \l_leporello_bleed_dim
+ }
+ }
+ }
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { b } {
+ \clist_if_in:enT {
+ \prop_item:cn { g_leporello_box_ #1 _prop } { bleed }
+ } { b } {
+ \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim {
+ \l_leporello_bleed_dim
+ }
+ }
+ }
}
- \tl_if_exist:cT { c_leporello_box_ #3 _store_width_tl } {
- \exp_args:NNo \exp_args:No
- \dim_set_eq:NN { \use:c { c_leporello_box_ #3 _store_width_tl } }
- \l__leporello_typeset_box_width_dim
+ \coffin_attach:ceeceeee {
+ \int_compare:nNnTF {#1} = { 0 } {
+ l_leporello_current_column_coffin
+ } {
+ g_leporello_box_
+ \int_use:N \l_leporello_current_page_int _
+ \int_use:N \l_leporello_current_column_int _
+ #1 _outer_coffin
+ }
+ } {
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { 1 }
+ } {
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ parent }
+ } { 2 }
+ } {
+ g_leporello_box_
+ \int_use:N \l_leporello_current_page_int _
+ \int_use:N \l_leporello_current_column_int _
+ #2 _outer_coffin
+ } {
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ self }
+ } { 1 }
+ } {
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { align ~ self }
+ } { 2 }
+ } {
+ \fp_to_dim:n {
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { offset }
+ } { 1 } -
+ \l__leporello_typeset_box_bleed_left_dim
+ }
+ } {
+ \fp_to_dim:n {
+ (
+ \clist_item:en {
+ \prop_item:cn { g_leporello_box_ #2 _prop } { offset }
+ } { 2 } -
+ \l__leporello_typeset_box_bleed_top_dim
+ ) * \l__leporello_typeset_coffin_attach_align_int
+ }
}
- \tl_if_exist:cT { c_leporello_box_ #3 _store_height_tl } {
- \exp_args:NNo \exp_args:No
- \dim_set_eq:NN { \use:c { c_leporello_box_ #3 _store_height_tl } }
- \l__leporello_typeset_box_height_dim
+}
+
+\cs_new_protected:Npn \__leporello_box_attach_children:n #1 {
+ \clist_if_exist:cT { g_leporello_box_ #1 _children_clist } {
+ \clist_map_inline:cn { g_leporello_box_ #1 _children_clist } {
+ \__leporello_box_construct:VVn
+ \l_leporello_current_page_int
+ \l_leporello_current_column_int
+ {##1}
+ \__leporello_box_attach_children:n {##1}
+ }
+ \clist_map_inline:cn { g_leporello_box_ #1 _children_clist } {
+ \__leporello_box_set_bleed:n {##1}
+ \__leporello_boxes_attach:nn {#1} {##1}
+ }
}
}
-\cs_generate_variant:Nn \__leporello_box_construct:nnn { VVn }
\NewDocumentCommand { \leporellotypesetcolumns } { O{} m } {
\int_incr:N \l_leporello_current_page_int
@@ -840,27 +1089,25 @@
\l_leporello_current_column_int
} {
\draw_suspend_begin:
- \str_set:Nn \l_leporello_current_column_str {##1}
- \hook_use:n { leporello / column / before }
- \tl_use:c { g_leporello_column_ ##1 _tl }
- \hook_use:n { leporello / column / after }
+ \draw_begin:
+ \draw_path_rectangle:nn { 0mm , 0mm } {
+ \clist_item:NV \l_leporello_columns_clist
+ \l_leporello_current_column_int ,
+ \l_leporello_layout_height_dim
+ }
+ \draw_path_use_clear:n { clip }
+ \vbox_set_top:Nn \l__leporello_typeset_column_box {
+ \draw_suspend_begin:
+ \str_set:Nn \l_leporello_current_column_str {##1}
+ \hook_use:n { leporello / column / before }
+ \tl_use:c { g_leporello_column_ ##1 _tl }
+ \hook_use:n { leporello / column / after }
+ \draw_suspend_end:
+ }
+ \draw_box_use:N \l__leporello_typeset_column_box
+ \draw_end:
\draw_suspend_end:
}
- \vcoffin_set:Nnn \l_leporello_current_column_phantom_coffin {
- \clist_item:NV \l_leporello_columns_clist
- \l_leporello_current_column_int
- } {
- \draw_suspend_begin:
- \draw_begin:
- \draw_path_rectangle:nn { 0mm , 0mm } {
- \clist_item:NV \l_leporello_columns_clist
- \l_leporello_current_column_int ,
- \l_leporello_layout_height_dim
- }
- \draw_path_use_clear:n { clip }
- \draw_end:
- \draw_suspend_end:
- }
\clist_map_inline:cn { g_leporello_column_ ##1 _boxes_clist } {
\__leporello_box_construct:VVn
@@ -867,127 +1114,16 @@
\l_leporello_current_page_int
\l_leporello_current_column_int
{####1}
-
- \dim_zero:N \l__leporello_typeset_box_bleed_left_dim
- \dim_zero:N \l__leporello_typeset_box_bleed_top_dim
-
- \int_compare:nNnT {
- \l_leporello_current_column_int
- } = { 1 } {
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { bleed }
- } { l } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_left_dim { \l_leporello_bleed_dim }
- }
+ \iow_log:n {####1}
+ \__leporello_box_attach_children:n {####1}
+ }
+ \clist_map_inline:cn { g_leporello_column_ ##1 _boxes_clist } {
+ \clist_if_in:NnF \g_leporello_parent_boxes_clist {####1} {
+ \__leporello_box_set_bleed:n {####1}
+ \__leporello_boxes_attach:nn { 0 } {####1}
}
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { bleed }
- } { t } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim { \l_leporello_bleed_dim }
- }
-
- \bool_if:NT \l_leporello_show_id_bool {
- \hcoffin_set:Nn \l__leporello_typeset_temp_coffin {
- \__leporello_id_mark:n { ####1 }
- }
- \coffin_attach:cnnNnnnn {
- g_leporello_box_
- \int_use:N \l_leporello_current_page_int _
- \int_use:N \l_leporello_current_column_int _
- ####1 _inner_coffin
- } { hc } { vc }
- \l__leporello_typeset_temp_coffin
- { hc } { vc } { 0pt } { 0pt }
- }
-
- \coffin_attach:cnncnnnn {
- g_leporello_box_
- \int_use:N \l_leporello_current_page_int _
- \int_use:N \l_leporello_current_column_int _
- ####1 _outer_coffin
- } { l } { t } {
- g_leporello_box_
- \int_use:N \l_leporello_current_page_int _
- \int_use:N \l_leporello_current_column_int _
- ####1 _inner_coffin
- } { l } { t } {
- \fp_to_dim:n {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { padding ~ left } +
- \l__leporello_typeset_box_bleed_left_dim
- }
- } {
- \fp_to_dim:n {
- (
- \prop_item:cn { g_leporello_box_ ####1 _prop } { padding ~ top } +
- \l__leporello_typeset_box_bleed_top_dim
- ) * -1
- }
- }
-
- \clist_if_in:enTF {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { align ~ self }
- } { b } {
- \int_set:Nn \l__leporello_typeset_coffin_attach_align_int { 1 }
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { bleed }
- } { b } {
- \dim_add:Nn \l__leporello_typeset_box_bleed_top_dim {
- \l_leporello_bleed_dim
- }
- }
- \clist_if_in:enT {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { bleed }
- } { t } {
- \dim_sub:Nn \l__leporello_typeset_box_bleed_top_dim {
- \l_leporello_bleed_dim
- }
- }
- } {
- \int_set:Nn \l__leporello_typeset_coffin_attach_align_int { -1 }
- }
-
- \coffin_attach:Neeceeee \l_leporello_current_column_phantom_coffin {
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { align ~ parent }
- } { 1 }
- } {
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { align ~ parent }
- } { 2 }
- } {
- g_leporello_box_
- \int_use:N \l_leporello_current_page_int _
- \int_use:N \l_leporello_current_column_int _
- ####1 _outer_coffin
- } {
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { align ~ self }
- } { 1 }
- } {
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { align ~ self }
- } { 2 }
- } {
- \fp_to_dim:n {
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { offset }
- } { 1 } -
- \l__leporello_typeset_box_bleed_left_dim
- }
- } {
- \fp_to_dim:n {
- (
- \clist_item:en {
- \prop_item:cn { g_leporello_box_ ####1 _prop } { offset }
- } { 2 } -
- \l__leporello_typeset_box_bleed_top_dim
- ) * \l__leporello_typeset_coffin_attach_align_int
- }
- }
}
- \draw_coffin_use:Nnnn \l_leporello_current_column_phantom_coffin
- { l } { t } { \l_leporello_current_column_offset_dim , 0mm }
\draw_coffin_use:Nnnn \l_leporello_current_column_coffin
{ l } { t } { \l_leporello_current_column_offset_dim , 0mm }
@@ -1016,7 +1152,7 @@
}
}
\group_end:
-} { }
+}
% === Flow mechanism
@@ -1027,13 +1163,13 @@
\dim_new:N \l_leporello_box_flow_width_second_dim
\keys_define:nn { leporello / box } {
- flow ~ into .code:n = {
+ flow ~ into .code:n = {
\prop_gput:cne { g_leporello_box_ \int_use:N \g_leporello_box_int _prop }
{ flow ~ into } {#1}
}
}
-\AddToHook { leporello / box / before } {
+\hook_gput_code:nnn { leporello / box / before } { . } {
\prop_if_in:cnT { g_leporello_box_ \int_use:N \l_leporello_current_box_int _prop }
{ flow ~ into } {
\int_set:Nn \l_leporello_box_flow_into_int {
@@ -1114,7 +1250,9 @@
}
}
-\NewDocumentCommand { \leporelloboxbreak } { } { }
+\NewDocumentCommand { \leporelloboxbreak } { } {
+ \tex_relax:D
+}
\NewDocumentCommand { \leporellojustified } { } {
\skip_zero:N \tex_rightskip:D
@@ -1121,4 +1259,4 @@
\skip_zero:N \tex_leftskip:D
}
-% EOF
\ No newline at end of file
+% EOF
More information about the tex-live-commits
mailing list.