summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvfloat/latex/hvfloat-0.inc
blob: a39a994c76c657021868e0ff256545f787d19fa6 (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
%% 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 ---||       Image is 2\paperwidth wide, height is variable or user set
%
\def\do@hvFloat@doubleFullPage#1{%  image on left and right page with caption before/below/right/after
  % #1-> not used, caption always below lefr or below right
  \setcounter{topnumber}{1}%
  \setcounter{dbltopnumber}{1}%
  \expandafter\hvFloatSet\expandafter{\hv@save@setting}%    
%  \ifx\hvSet@capPos\hv@Right\else\ifx\hvSet@capPos\hv@Left\else
%    \let\hvSet@capPos\hv@Right
%  \fi\fi
  \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
  \let\c@hv@tempCNTfigA\c@figure
  \let\c@hv@tempCNTtabA\c@table
%  \checkoddpage
  \ifoddpage
    \if@twocolumn
      \if@firstcolumn
        \afterpage{afterpage{\do@hvFloat@doubleFullPage@ObjectAndCaption}}%  2nd Col and newpage
      \else
        \do@hvFloat@doubleFullPage@ObjectAndCaption% odd, 2nd col -> no newpage
      \fi
    \else % onecol
      \afterpage{\do@hvFloat@doubleFullPage@ObjectAndCaption}% oddpage->newpage
    \fi % end \if@twocolumn
  \else% evenpage 
    \if@twocolumn
      \if@firstcolumn
        \afterpage{\afterpage{\afterpage{\do@hvFloat@doubleFullPage@ObjectAndCaption}}}%  ->2nd Col left page and newpage
      \else
        \afterpage{\afterpage{\do@hvFloat@doubleFullPage@ObjectAndCaption}}% ->newpage ( 2columns)
      \fi
    \else % onecol
      \afterpage{\afterpage{\do@hvFloat@doubleFullPage@ObjectAndCaption}}% evenpage->newpage->newpage
    \fi % end \if@twocolumn
  \fi% main ifoddpage
  \endgroup% started at main macro \hvFloat
}

\def\do@hvFloat@doubleFullPage@ObjectAndCaption{%
  \begin{\hv@floatType*}[t]
    \hv@set@noverticalSpace
    \hfuzz=\maxdimen
    \expandafter\hvFloatSet\expandafter{\hv@save@setting}% 
    \hv@leftPageObjectWidth=\dimexpr\paperwidth-\hvSet@bindCorrection%
    \savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
    \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep}%-\baselineskip-\parskip+1.5\lineskip}%  no interlineskip
    \hspace*{\the\dimexpr-\evensidemargin-\parindent-1in}%
    \clipbox*{0 -\depth{} \hv@leftPageObjectWidth{} \height}{\usebox\hvObjectBox}%
    \ifx\hv@label\@empty
    \else
      \ifx\hv@floatType\hv@figure
        \global\refstepcounter{hv@tempCNTfigA}%
      \else
        \global\refstepcounter{hv@tempCNTtabA}%   before caption
      \fi
      \label{\hv@label}%
    \fi        
    \ifx\hvSet@capPos\hv@Left %  left side a caption
      \ifhv@onlyText
        \hv@longCap
      \else
        \ifx\hv@shortCap\@empty
          \captionof{\hv@floatType}{\hv@longCap}%
        \else
          \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
        \fi
      \fi
      \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi            
    \else
      \ifhv@global@sameHeight
        \par\noindent\phantom{\parbox{\textwidth}{\caption*{\hv@longCap}}}%
%      \vspace{-2pt}%
      \fi
    \fi
    \hv@reset@noverticalSpace
  \end{\hv@floatType*}%
  %  start right half of the image ----------------- RIGHT
  \begin{\hv@floatType*}[t]
    \hv@set@noverticalSpace
    \hfuzz=\maxdimen
%    \let\c@hv@tempCNTfigA\c@figure
%    \let\c@hv@tempCNTtabA\c@table
    \expandafter\hvFloatSet\expandafter{\hv@save@setting}% 
    \hv@leftPageObjectWidth=\dimexpr\paperwidth-\hvSet@bindCorrection
    \savebox{\hvObjectBox}{\ifhv@useOBox\usebox{\hvOBox}\else\hv@floatObject\fi}%
    \vspace*{\the\dimexpr-1in-\voffset-\topmargin-\headheight-\headsep}%-\baselineskip-\parskip+1.5\lineskip}%  no interlineskip
    \hspace*{\the\dimexpr-1in-\oddsidemargin+\hvSet@bindCorrection}%
    \clipbox*{\the\hv@leftPageObjectWidth{} -\depth{} \width{} \height{}}{\usebox\hvObjectBox}%
    \ifx\hv@label\@empty
    \else
      \ifx\hv@floatType\hv@figure
        \global\refstepcounter{hv@tempCNTfigA}%
      \else
        \global\refstepcounter{hv@tempCNTtabA}%   before caption
      \fi
      \label{\hv@label}%
    \fi        
    \ifx\hvSet@capPos\hv@Left %  left side a caption
      \ifhv@global@sameHeight
        \par\noindent\phantom{\parbox{\textwidth}{\caption*{\hv@longCap}}}%
%      \vspace{-2pt}%
      \fi
    \else
      \ifhv@onlyText
        \hv@longCap
      \else
        \ifx\hv@shortCap\@empty
          \captionof{\hv@floatType}{\hv@longCap}%
        \else
          \captionof{\hv@floatType}[\hv@shortCap]{\hv@longCap}%
        \fi
      \fi
      \ifx\hv@label\@empty\else\label{\hv@label-cap}\fi            
    \fi
    \hv@reset@noverticalSpace
  \end{\hv@floatType*}%
}