summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/l3kernel/l3box.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-11-25 00:14:23 +0000
committerKarl Berry <karl@freefriends.org>2011-11-25 00:14:23 +0000
commit4796116f06de1574987757c8945f6678d21f0a40 (patch)
treeb6d95196b38ef31d6021471ecbf7c4d48fcaa730 /Master/texmf-dist/tex/latex/l3kernel/l3box.sty
parent27ecf3bfa131e03a530396ff6c0016cf6dffacd0 (diff)
l3kernel 2966 (19nov11)
git-svn-id: svn://tug.org/texlive/trunk@24657 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/l3kernel/l3box.sty')
-rw-r--r--Master/texmf-dist/tex/latex/l3kernel/l3box.sty142
1 files changed, 99 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty
index 1e25d4ea93d..817e1982e4f 100644
--- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty
+++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty
@@ -46,7 +46,7 @@
%%
%% -----------------------------------------------------------------------
\RequirePackage{l3names}
-\GetIdInfo$Id: l3box.dtx 2896 2011-10-09 20:36:50Z joseph $
+\GetIdInfo$Id: l3box.dtx 2960 2011-11-15 08:50:21Z joseph $
{L3 Experimental boxes}
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
@@ -57,19 +57,19 @@
\newbox #1
}
\cs_generate_variant:Nn \box_new:N { c }
-\cs_new_protected_nopar:Npn \box_clear:N #1
+\cs_new_protected:Npn \box_clear:N #1
{ \box_set_eq:NN #1 \c_empty_box }
-\cs_new_protected_nopar:Npn \box_gclear:N #1
+\cs_new_protected:Npn \box_gclear:N #1
{ \box_gset_eq:NN #1 \c_empty_box }
\cs_generate_variant:Nn \box_clear:N { c }
\cs_generate_variant:Nn \box_gclear:N { c }
-\cs_new_protected_nopar:Npn \box_clear_new:N #1
+\cs_new_protected:Npn \box_clear_new:N #1
{
\cs_if_exist:NTF #1
{ \box_set_eq:NN #1 \c_empty_box }
{ \box_new:N #1 }
}
-\cs_new_protected_nopar:Npn \box_gclear_new:N #1
+\cs_new_protected:Npn \box_gclear_new:N #1
{
\cs_if_exist:NTF #1
{ \box_gset_eq:NN #1 \c_empty_box }
@@ -77,15 +77,15 @@
}
\cs_generate_variant:Nn \box_clear_new:N { c }
\cs_generate_variant:Nn \box_gclear_new:N { c }
-\cs_new_protected_nopar:Npn \box_set_eq:NN #1#2
+\cs_new_protected:Npn \box_set_eq:NN #1#2
{ \tex_setbox:D #1 \tex_copy:D #2 }
-\cs_new_protected_nopar:Npn \box_gset_eq:NN
+\cs_new_protected:Npn \box_gset_eq:NN
{ \tex_global:D \box_set_eq:NN }
\cs_generate_variant:Nn \box_set_eq:NN { cN , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq:NN { cN , Nc , cc }
-\cs_new_protected_nopar:Npn \box_set_eq_clear:NN #1#2
+\cs_new_protected:Npn \box_set_eq_clear:NN #1#2
{ \tex_setbox:D #1 \tex_box:D #2 }
-\cs_new_protected_nopar:Npn \box_gset_eq_clear:NN
+\cs_new_protected:Npn \box_gset_eq_clear:NN
{ \tex_global:D \box_set_eq_clear:NN }
\cs_generate_variant:Nn \box_set_eq_clear:NN { cN , Nc , cc }
\cs_generate_variant:Nn \box_gset_eq_clear:NN { cN , Nc , cc }
@@ -95,11 +95,11 @@
\cs_generate_variant:Nn \box_ht:N { c }
\cs_generate_variant:Nn \box_dp:N { c }
\cs_generate_variant:Nn \box_wd:N { c }
-\cs_new_protected_nopar:Npn \box_set_dp:Nn #1#2
+\cs_new_protected:Npn \box_set_dp:Nn #1#2
{ \box_dp:N #1 \dim_eval:w #2 \dim_eval_end: }
-\cs_new_protected_nopar:Npn \box_set_ht:Nn #1#2
+\cs_new_protected:Npn \box_set_ht:Nn #1#2
{ \box_ht:N #1 \dim_eval:w #2 \dim_eval_end: }
-\cs_new_protected_nopar:Npn \box_set_wd:Nn #1#2
+\cs_new_protected:Npn \box_set_wd:Nn #1#2
{ \box_wd:N #1 \dim_eval:w #2 \dim_eval_end: }
\cs_generate_variant:Nn \box_set_ht:Nn { c }
\cs_generate_variant:Nn \box_set_dp:Nn { c }
@@ -137,10 +137,9 @@
\cs_generate_variant:Nn \box_if_empty:NT { c }
\cs_generate_variant:Nn \box_if_empty:NF { c }
\cs_generate_variant:Nn \box_if_empty:NTF { c }
-\cs_new_eq:NN \l_last_box \tex_lastbox:D
-\cs_new_protected_nopar:Npn \box_set_to_last:N #1
- { \tex_setbox:D #1 \l_last_box }
-\cs_new_protected_nopar:Npn \box_gset_to_last:N
+\cs_new_protected:Npn \box_set_to_last:N #1
+ { \tex_setbox:D #1 \tex_lastbox:D }
+\cs_new_protected:Npn \box_gset_to_last:N
{ \tex_global:D \box_set_to_last:N }
\cs_generate_variant:Nn \box_set_to_last:N { c }
\cs_generate_variant:Nn \box_gset_to_last:N { c }
@@ -149,20 +148,20 @@
\box_new:N \l_tmpb_box
\cs_new_eq:NN \box_show:N \tex_showbox:D
\cs_generate_variant:Nn \box_show:N { c }
-\cs_new_protected_nopar:Npn \hbox:n { \tex_hbox:D \scan_stop: }
+\cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: }
\cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} }
-\cs_new_protected_nopar:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn }
+\cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn }
\cs_generate_variant:Nn \hbox_set:Nn { c }
\cs_generate_variant:Nn \hbox_gset:Nn { c }
\cs_new_protected:Npn \hbox_set_to_wd:Nnn #1#2#3
{ \tex_setbox:D #1 \tex_hbox:D to \dim_eval:w #2 \dim_eval_end: {#3} }
-\cs_new_protected_nopar:Npn \hbox_gset_to_wd:Nnn
+\cs_new_protected:Npn \hbox_gset_to_wd:Nnn
{ \tex_global:D \hbox_set_to_wd:Nnn }
\cs_generate_variant:Nn \hbox_set_to_wd:Nnn { c }
\cs_generate_variant:Nn \hbox_gset_to_wd:Nnn { c }
-\cs_new_protected_nopar:Npn \hbox_set:Nw #1
+\cs_new_protected:Npn \hbox_set:Nw #1
{ \tex_setbox:D #1 \tex_hbox:D \c_group_begin_token }
-\cs_new_protected_nopar:Npn \hbox_gset:Nw
+\cs_new_protected:Npn \hbox_gset:Nw
{ \tex_global:D \hbox_set:Nw }
\cs_generate_variant:Nn \hbox_set:Nw { c }
\cs_generate_variant:Nn \hbox_gset:Nw { c }
@@ -185,30 +184,30 @@
\cs_new_eq:NN \hbox_unpack_clear:N \tex_unhbox:D
\cs_generate_variant:Nn \hbox_unpack:N { c }
\cs_generate_variant:Nn \hbox_unpack_clear:N { c }
-\cs_new_protected_nopar:Npn \vbox:n { \tex_vbox:D \scan_stop: }
-\cs_new_protected_nopar:Npn \vbox_top:n { \tex_vtop:D \scan_stop: }
+\cs_new_protected:Npn \vbox:n { \tex_vbox:D \scan_stop: }
+\cs_new_protected:Npn \vbox_top:n { \tex_vtop:D \scan_stop: }
\cs_new_protected:Npn \vbox_to_ht:nn #1#2
{ \tex_vbox:D to \dim_eval:w #1 \dim_eval_end: {#2} }
\cs_new_protected:Npn \vbox_to_zero:n #1 { \tex_vbox:D to \c_zero_dim {#1} }
\cs_new_protected:Npn \vbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_vbox:D {#2} }
-\cs_new_protected_nopar:Npn \vbox_gset:Nn { \tex_global:D \vbox_set:Nn }
+\cs_new_protected:Npn \vbox_gset:Nn { \tex_global:D \vbox_set:Nn }
\cs_generate_variant:Nn \vbox_set:Nn { c }
\cs_generate_variant:Nn \vbox_gset:Nn { c }
\cs_new_protected:Npn \vbox_set_top:Nn #1#2
{ \tex_setbox:D #1 \tex_vtop:D {#2} }
-\cs_new_protected_nopar:Npn \vbox_gset_top:Nn
+\cs_new_protected:Npn \vbox_gset_top:Nn
{ \tex_global:D \vbox_set_top:Nn }
\cs_generate_variant:Nn \vbox_set_top:Nn { c }
\cs_generate_variant:Nn \vbox_gset_top:Nn { c }
\cs_new_protected:Npn \vbox_set_to_ht:Nnn #1#2#3
{ \tex_setbox:D #1 \tex_vbox:D to \dim_eval:w #2 \dim_eval_end: {#3} }
-\cs_new_protected_nopar:Npn \vbox_gset_to_ht:Nnn
+\cs_new_protected:Npn \vbox_gset_to_ht:Nnn
{ \tex_global:D \vbox_set_to_ht:Nnn }
\cs_generate_variant:Nn \vbox_set_to_ht:Nnn { c }
\cs_generate_variant:Nn \vbox_gset_to_ht:Nnn { c }
-\cs_new_nopar:Npn \vbox_set:Nw #1
+\cs_new:Npn \vbox_set:Nw #1
{ \tex_setbox:D #1 \tex_vbox:D \c_group_begin_token }
-\cs_new_protected_nopar:Npn \vbox_gset:Nw
+\cs_new_protected:Npn \vbox_gset:Nw
{ \tex_global:D \vbox_set:Nw }
\cs_generate_variant:Nn \vbox_set:Nw { c }
\cs_generate_variant:Nn \vbox_gset:Nw { c }
@@ -224,7 +223,7 @@
\cs_new_eq:NN \vbox_unpack_clear:N \tex_unvbox:D
\cs_generate_variant:Nn \vbox_unpack:N { c }
\cs_generate_variant:Nn \vbox_unpack_clear:N { c }
-\cs_new_protected_nopar:Npn \vbox_set_split_to_ht:NNn #1#2#3
+\cs_new_protected:Npn \vbox_set_split_to_ht:NNn #1#2#3
{ \tex_setbox:D #1 \tex_vsplit:D #2 to \dim_eval:w #3 \dim_eval_end: }
\fp_new:N \l_box_angle_fp
\fp_new:N \l_box_cos_fp
@@ -243,7 +242,7 @@
\fp_new:N \l_box_y_fp
\fp_new:N \l_box_x_new_fp
\fp_new:N \l_box_y_new_fp
-\cs_new_protected_nopar:Npn \box_rotate:Nn #1#2
+\cs_new_protected:Npn \box_rotate:Nn #1#2
{
\hbox_set:Nn #1
{
@@ -260,7 +259,7 @@
\group_end:
}
}
-\cs_new_protected_nopar:Npn \box_rotate_aux:N #1
+\cs_new_protected:Npn \box_rotate_aux:N #1
{
\dim_set:Nn \l_box_top_dim { \box_ht:N #1 }
\dim_set:Nn \l_box_bottom_dim { -\box_dp:N #1 }
@@ -294,7 +293,7 @@
{ \l_box_right_new_dim - \l_box_left_new_dim }
\box_use:N \l_box_tmp_box
}
-\cs_new_protected_nopar:Npn \box_rotate_set_sin_cos:
+\cs_new_protected:Npn \box_rotate_set_sin_cos:
{
\fp_set_eq:NN \l_box_tmp_fp \l_box_angle_fp
\fp_div:Nn \l_box_tmp_fp { 180 }
@@ -302,7 +301,7 @@
\fp_sin:Nn \l_box_sin_fp { \l_box_tmp_fp }
\fp_cos:Nn \l_box_cos_fp { \l_box_tmp_fp }
}
-\cs_new_protected_nopar:Npn \box_rotate_x:nnN #1#2#3
+\cs_new_protected:Npn \box_rotate_x:nnN #1#2#3
{
\fp_set_from_dim:Nn \l_box_x_fp {#1}
\fp_set_from_dim:Nn \l_box_y_fp {#2}
@@ -313,7 +312,7 @@
\fp_sub:Nn \l_box_x_new_fp { \l_box_tmp_fp }
\dim_set:Nn #3 { \fp_to_dim:N \l_box_x_new_fp }
}
-\cs_new_protected_nopar:Npn \box_rotate_y:nnN #1#2#3
+\cs_new_protected:Npn \box_rotate_y:nnN #1#2#3
{
\fp_set_from_dim:Nn \l_box_x_fp {#1}
\fp_set_from_dim:Nn \l_box_y_fp {#2}
@@ -324,7 +323,7 @@
\fp_add:Nn \l_box_y_new_fp { \l_box_tmp_fp }
\dim_set:Nn #3 { \fp_to_dim:N \l_box_y_new_fp }
}
-\cs_new_protected_nopar:Npn \box_rotate_quadrant_one:
+\cs_new_protected:Npn \box_rotate_quadrant_one:
{
\box_rotate_y:nnN \l_box_right_dim \l_box_top_dim
\l_box_top_new_dim
@@ -335,7 +334,7 @@
\box_rotate_x:nnN \l_box_right_dim \l_box_bottom_dim
\l_box_right_new_dim
}
-\cs_new_protected_nopar:Npn \box_rotate_quadrant_two:
+\cs_new_protected:Npn \box_rotate_quadrant_two:
{
\box_rotate_y:nnN \l_box_right_dim \l_box_bottom_dim
\l_box_top_new_dim
@@ -346,7 +345,7 @@
\box_rotate_x:nnN \l_box_left_dim \l_box_bottom_dim
\l_box_right_new_dim
}
-\cs_new_protected_nopar:Npn \box_rotate_quadrant_three:
+\cs_new_protected:Npn \box_rotate_quadrant_three:
{
\box_rotate_y:nnN \l_box_left_dim \l_box_bottom_dim
\l_box_top_new_dim
@@ -357,7 +356,7 @@
\box_rotate_x:nnN \l_box_left_dim \l_box_top_dim
\l_box_right_new_dim
}
-\cs_new_protected_nopar:Npn \box_rotate_quadrant_four:
+\cs_new_protected:Npn \box_rotate_quadrant_four:
{
\box_rotate_y:nnN \l_box_left_dim \l_box_top_dim
\l_box_top_new_dim
@@ -417,7 +416,7 @@
}
\box_resize_common:N #1
}
-\cs_new_protected_nopar:Npn \box_resize_to_ht_plus_dp:Nn #1#2
+\cs_new_protected:Npn \box_resize_to_ht_plus_dp:Nn #1#2
{
\hbox_set:Nn #1
{
@@ -438,7 +437,7 @@
}
}
\cs_generate_variant:Nn \box_resize_to_ht_plus_dp:Nn { c }
-\cs_new_protected_nopar:Npn \box_resize_to_wd:Nn #1#2
+\cs_new_protected:Npn \box_resize_to_wd:Nn #1#2
{
\hbox_set:Nn #1
{
@@ -458,7 +457,7 @@
}
}
\cs_generate_variant:Nn \box_resize_to_wd:Nn { c }
-\cs_new_protected_nopar:Npn \box_scale:Nnn #1#2#3
+\cs_new_protected:Npn \box_scale:Nnn #1#2#3
{
\hbox_set:Nn #1
{
@@ -480,7 +479,7 @@
}
}
\cs_generate_variant:Nn \box_scale:Nnn { c }
-\cs_new_protected_nopar:Npn \box_scale_aux:Nnn #1#2#3
+\cs_new_protected:Npn \box_scale_aux:Nnn #1#2#3
{
\fp_compare:NNNTF \l_box_scale_y_fp > \c_zero_fp
{
@@ -496,7 +495,7 @@
{ \l_box_right_new_dim -#2 \l_box_right_dim }
\box_resize_common:N #1
}
-\cs_new_protected_nopar:Npn \box_resize_common:N #1
+\cs_new_protected:Npn \box_resize_common:N #1
{
\hbox_set:Nn \l_box_tmp_box
{
@@ -520,6 +519,63 @@
\box_use:N \l_box_tmp_box
}
}
+\cs_new_protected:Npn \box_clip:N #1
+ { \hbox_set:Nn #1 { \driver_box_use_clip:N #1 } }
+\cs_generate_variant:Nn \box_clip:N { c }
+\cs_new_protected:Npn \box_trim:Nnnnn #1#2#3#4#5
+ {
+ \box_set_wd:Nn #1 { \box_wd:N #1 - \dim_eval:n {#4} - \dim_eval:n {#2} }
+ \hbox_set:Nn #1
+ {
+ \skip_horizontal:n { - \dim_eval:n {#2} }
+ \box_use:N #1
+ }
+ \dim_compare:nNnTF { \box_dp:N #1 } > {#3}
+ { \box_set_dp:Nn #1 { \box_dp:N #1 - \dim_eval:n {#3} } }
+ {
+ \hbox_set:Nn #1
+ {
+ \box_move_down:nn { \dim_eval:n {#3} - \box_dp:N #1 }
+ { \box_use:N #1 }
+ }
+ \box_set_dp:Nn #1 \c_zero_dim
+ }
+ \dim_compare:nNnTF { \box_ht:N #1 } > {#5}
+ { \box_set_ht:Nn #1 { \box_ht:N #1 - \dim_eval:n {#5} } }
+ {
+ \hbox_set:Nn #1
+ {
+ \box_move_up:nn { \dim_eval:n {#5} - \box_ht:N #1 }
+ { \box_use:N #1 }
+ }
+ \box_set_ht:Nn #1 \c_zero_dim
+ }
+ }
+\cs_generate_variant:Nn \box_trim:Nnnnn { c }
+\cs_new_protected:Npn \box_viewport:Nnnnn #1#2#3#4#5
+ {
+ \box_set_wd:Nn #1 { \dim_eval:n {#4} - \dim_eval:n {#2} }
+ \hbox_set:Nn #1
+ {
+ \skip_horizontal:n { - \dim_eval:n {#2} }
+ \box_use:N #1
+ }
+ \dim_compare:nNnTF {#3} > \c_zero_dim
+ {
+ \hbox_set:Nn #1 { \box_move_down:nn {#3} { \box_use:N #1 } }
+ \box_set_dp:Nn #1 \c_zero_dim
+ }
+ { \box_set_dp:Nn #1 { - \dim_eval:n {#3} } }
+ \dim_compare:nNnTF {#5} > \c_zero_dim
+ { \box_set_ht:Nn #1 {#5} }
+ {
+ \hbox_set:Nn #1
+ { \box_move_up:nn { -\dim_eval:n {#5} } { \box_use:N #1 } }
+ \box_set_ht:Nn #1 \c_zero_dim
+ }
+ }
+\cs_generate_variant:Nn \box_viewport:Nnnnn { c }
+\cs_new_eq:NN \l_last_box \tex_lastbox:D
%%
%%
%% End of file `l3box.sty'.