summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvfloat/latex/hvfloat-2.inc
blob: 9c27dc88b45c62e7965d96a91d048c290bc470fc (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
%%
%% Herbert Voss <hvoss@tug.org>
%% Copyright (C) 2023
%%
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN archives
%% in directory macros/latex/base/lppl.txt.
%%
%% ||1in+evenside --- |1in+oddside ---||
%

\def\do@hvFloat@doublePAGE#1{%  image on left and right page with caption on the right ----------------------------------
  % #1-> 0/1 caption under/right
%  \global\setlength\hv@tempWidthA{\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection}%
%  \global\setlength\hv@leftPageObjectWidth{\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection}%
  \expandafter\global\expandafter\savebox\expandafter\hvObjectBox\expandafter{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
  \expandafter\global\expandafter\savebox\expandafter\hv@boxLeftPage\expandafter{\clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}}%
  \expandafter\global\expandafter\savebox\expandafter\hv@boxRightPage\expandafter{\clipbox*{\hv@leftPageObjectWidth{} -\depth{} \width{} \height}{\usebox\hvObjectBox}}%
  %\checkoddpage
  \ifoddpage
    \hvfloat@typeout{do@hvFloat@doublePAGE: oddpage}%
    \if@twocolumn
      \if@firstcolumn
        \hvfloat@typeout{do@hvFloat@doublePAGE: ifoddpage->twocolumn->firstcolumn}%
        \afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}%
      \else
        \hvfloat@typeout{do@hvFloat@doublePAGE: ifoddpage->twocolumn->secondcolumn}%
        \do@hvFloat@doublePAGECaptionRight{#1}%
      \fi
    \else
      \afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}%
    \fi  
  \else
    \hvfloat@typeout{do@hvFloat@doublePAGE: evenpage}%
    %---------
    \hv@atPageBeginfalse
    \stepcounter{hvfloat@ref}%
    \zsavepos{\thehvfloat@ref}%
    \@tempy=\dimexpr-\zposy{\thehvfloat@ref} sp+\paperheight-1in-\topmargin-\headheight-\headsep\relax
    \@tempx=\dimexpr-\zposx{\thehvfloat@ref} sp+\evensidemargin+1in\relax
    %\typeout{>>>>\the\@tempx >>>>>\the\@tempy >>>>\f@size}%
    \ifdim\@tempy > \z@ 
      %\typeout{>>>>Case 0, Leere Box oder Text auf der Seite \thehvfloat@ref}%
      \ifdim\@tempx < \z@ 
         %\typeout{>>>>Case 0-1, Text oben auf der Seite  \thehvfloat@ref}%
      \else
        %\typeout{>>>>Case 0-2, Absolut oben links auf der Seite  \thehvfloat@ref}%
        \hv@atPageBegintrue
      \fi
    \else
      \ifdim\@tempx > \z@ 
        %\typeout{>>>>Case 1,  Oben auf der Seite  \thehvfloat@ref, aber nicht am Anfang der Zeile}%
      \else
        %\typeout{>>>>Case 2,  Absolut oben links auf der Seite  \thehvfloat@ref }%
        \hv@atPageBegintrue
      \fi
    \fi
  %---------
    \ifhv@atPageBegin
      \do@hvFloat@doublePAGECaptionRight{#1}%
    \else
      \if@twocolumn
        \if@firstcolumn
          \afterpage{\afterpage{\afterpage{afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}}}}%
        \else
          \afterpage{\afterpage{\afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}}}%
        \fi
      \else
        \afterpage{\afterpage{\do@hvFloat@doublePAGECaptionRight{#1}}}%   onecolumn/left page
      \fi
    \fi %end \hv@atPageBegintrue
  \fi
  \endgroup% startet at main macro
}
%
\def\do@hvFloat@doublePAGECaptionRight#1{%  image on left and right page with caption on the right ----------------------------------
  % #1-> 0/1 caption under/right
    \hvfloat@typeout{do@hvFloat@doublePAGECaptionRight->start}%
      \hfuzz=\maxdimen
      \expandafter\hvFloatSet\expandafter{\hv@save@setting}%
      \ifx\hv@caption@format\@empty\else\expandafter\captionsetup\expandafter{\hv@caption@format}\fi
      \ifx\hv@subcaption@format\@empty\else
        \expandafter
           \captionsetup\expandafter[\expandafter s\expandafter u\expandafter b\expandafter]\expandafter
                             {\hv@subcaption@format}%
      \fi
      \ifhv@useOBox
        \global\let\hvObjectBox\hvOBox
      \else      
        \global\savebox\hvObjectBox{\hv@floatObject}%
      \fi
      \noindent
      \global\hv@tempWidthA=\the\dimexpr1in+\oddsidemargin-\hvSet@bindCorrection%
      \global\hv@leftPageObjectWidth=\the\dimexpr\paperwidth-1in-\evensidemargin-\hvSet@bindCorrection%
      \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
      \ifx\hv@label\@empty\else\label{\hv@label}\fi            
      \null\newpage\if@twocolumn\null\newpage\fi
      \expandafter\global\expandafter\savebox\expandafter\hvObjectBox\expandafter{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
      \noindent
      \hspace*{\dimexpr-\hv@tempWidthA}%
      \clipbox*{\the\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}%
      \ifx\hv@label\@empty\else\label{\hv@label-2}\fi            
      \begingroup
          \ifnum#1>0
            \medskip
            \ifdim\dp\hvObjectBox > \z@
              \rotatebox[origin=c]{90}{\parbox{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
                \ifx\relax\hv@shortCap\relax
                  \captionof{\hv@floatType}{\hv@longCap}%
                \else
                  \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
                \fi
              \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi            
              }}%
            \else
              \rotatebox{90}{\parbox{\the\dimexpr\ht\hvObjectBox+\dp\hvObjectBox}{%
                \ifx\relax\hv@shortCap\relax
                  \captionof{\hv@floatType}{\hv@longCap}%
                \else
                  \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
                \fi
              \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi            
              }}%
            \fi
        \else% caption not rotated
          \par\noindent
          \parbox{\textwidth}{%
      \expandafter\hvFloatSet\expandafter{\hv@save@setting,capFormat={font={tiny},labelsep=newline}}%
              \ifx\relax\hv@shortCap\relax
                \captionof{\hv@floatType}{\hv@longCap}%
              \else
                \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
              \fi
              \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi
            }%
        \fi
        \endgroup
        \newpage\if@twocolumn\null\newpage\fi
}
%