summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xpackages/xhead/xtextblock.sty
blob: 3f1907a5b5d22abc238c894d61a7bcd3d949cbee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% tmp file during development

\DeclareObjectType {textblock-1} {1}
\DeclareObjectType {textblock-2} {2}
\DeclareObjectType {textblock-3} {3}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareTemplateInterface {textblock-1} {std} {1}
  {
    font          : tokenlist =                         ,
    parshape      : instance {parshape} = plain         ,
    justification : instance {justification} = default  ,
  }


\tl_new:N \l_tblock_font_tl

\cs_new:Npn \tblock_parshape: {}
\cs_new:Npn \tblock_justification: {}


\DeclareTemplateCode {textblock-1} {std} {1}
  {
    font           = \l_tblock_font_tl          ,
    parshape       = \tblock_parshape:          ,
    justification  = \tblock_justification:     ,
  }
  {
   \AssignTemplateKeys
   \group_begin:
      \l_tblock_font_tl
      \tblock_parshape:
      \tblock_justification:
      #1
      \@@par
   \group_end:
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\dim_new:N \l_tblock_h_dim 
\tl_new:N \l_tblock_font_ii_tl

\DeclareTemplateInterface {textblock-2} {hangfrom} {2}
  {
    font-1        : tokenlist =                         ,
    font-2        : tokenlist =                         ,
    h-sep         : length    = 1em                     ,              
    parshape      : instance {parshape} = plain         ,
    justification : instance {justification} = default  ,
  }


\DeclareTemplateCode {textblock-2} {hangfrom} {2}
  {

    font-1         = \l_tblock_font_tl           ,
    font-2         = \l_tblock_font_ii_tl        ,
    h-sep          = \l_tblock_h_dim             ,
    parshape       = \tblock_parshape:           ,
    justification  = \tblock_justification:      ,
  }
  {
   \AssignTemplateKeys
   \group_begin:
      \l_tblock_font_tl
 
      \hbox_set:Nn \l_tmpa_box 
         { \tl_if_empty:oF {#1} {#1 \hskip \l_tblock_h_dim } }
 
      \UseInstance{measure}{fullwidth} 
                  { \box_wd:N \l_tmpa_box  }

      \l_tblock_font_ii_tl
      \tblock_parshape:
      \tblock_justification:

      \leavevmode 
      \box_set_to_last:N \l_tmpb_box
      \hskip -\leftskip
      \hbox_overlap_left:n{ \box_use:N \l_tmpa_box }
      \hskip  \leftskip
      \box_use:N \l_tmpb_box
      #2
      \@@par
   \group_end:
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%555


\DeclareTemplateInterface {textblock-3} {std} {3}
  {
  }