summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/pagelayout/tex/pagelayout.cls
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/pagelayout/tex/pagelayout.cls')
-rw-r--r--macros/latex/contrib/pagelayout/tex/pagelayout.cls372
1 files changed, 332 insertions, 40 deletions
diff --git a/macros/latex/contrib/pagelayout/tex/pagelayout.cls b/macros/latex/contrib/pagelayout/tex/pagelayout.cls
index fbc4a507ff..8e7d3616ae 100644
--- a/macros/latex/contrib/pagelayout/tex/pagelayout.cls
+++ b/macros/latex/contrib/pagelayout/tex/pagelayout.cls
@@ -1,5 +1,5 @@
%%
-%% Copyright (c) 2022-2023 by Friedemann Bartels
+%% Copyright (c) 2022-2024 by Friedemann Bartels
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
@@ -13,8 +13,8 @@
%%
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
-\ProvidesClass{pagelayout}[2023/12/21 Layout graphic rich documents]
-\def\pagelayoutversion{1.0.5}
+\ProvidesClass{pagelayout}[2024/01/17 Layout graphic rich documents]
+\def\pagelayoutversion{1.1.0}
% packages
\RequirePackage{pgfopts}
@@ -85,7 +85,7 @@
\newdimen\pal@topsafetymargin\newdimen\pal@bottomsafetymargin\newdimen\pal@innersafetymargin\newdimen\pal@outersafetymargin
\newdimen\pal@topmargin\newdimen\pal@topmargintmp\newdimen\pal@innermargin\newdimen\pal@bottommargin\newdimen\pal@outermargin
\newdimen\pal@gutter
-\newdimen\pal@x\newdimen\pal@y\newdimen\pal@xx\newdimen\pal@yy\newdimen\width\newdimen\height\newdimen\x\newdimen\y
+\newdimen\pal@x\newdimen\pal@y\newdimen\pal@xx\newdimen\pal@yy\newdimen\pal@yytmp\newdimen\width\newdimen\height\newdimen\x\newdimen\y
\newdimen\pal@gridoffsethorizontal\newdimen\pal@gridoffsetvertical\newdimen\pal@gridoffsethorizontaln\newdimen\pal@gridoffsetverticaln
\newdimen\pal@graphpaperx\newdimen\pal@graphpapery\newdimen\pal@graphpaperoffset\newdimen\pal@graphpapersnap
@@ -868,13 +868,18 @@
% graphic
\newif\ifpal@isvisible
\newif\ifpal@calculatecrop
+\newif\ifpal@trimnext
+\newif\ifpal@hflip
+\newif\ifpal@vflip
+\newif\ifpal@graphicoptionhflip
+\newif\ifpal@graphicoptionvflip
\newdimen\pal@originalgraphicwidth\newdimen\pal@originalgraphicheight
\newdimen\pal@cropx\newdimen\pal@cropy
\newdimen\pal@cropleft\newdimen\pal@cropright
\newdimen\pal@cropbottom\newdimen\pal@croptop
\newdimen\pal@cropstart\newdimen\pal@cropend
\newdimen\pal@snapleft\newdimen\pal@snapright
-\newdimen\pal@snapbottom\newdimen\pal@snaptop
+\newdimen\pal@snapbottom\newdimen\pal@snaptop\newdimen\pal@dimentmp
\newdimen\pal@viewportwidth\newdimen\pal@viewportheight
\newdimen\pal@frameborderwidth
\newdimen\pal@frameborderradius
@@ -1000,6 +1005,9 @@
/graphic,
file/.store in=\pal@graphicoptionfile,
scale/.store in=\pal@graphicoptionscale,
+ orientation/.store in=\pal@graphicoptionorientation,
+ hflip/.is if=pal@graphicoptionhflip,
+ vflip/.is if=pal@graphicoptionvflip,
vpos/.store in=\pal@graphicoptionvpos,
hpos/.store in=\pal@graphicoptionhpos,
unsharp/.store in=\pal@graphicoptionunsharp,
@@ -1259,16 +1267,31 @@
\def\newgraphic#1#2{
\expandafter\newcommand\csname pal@graphic@#1\endcsname[2][0]{%
\ifnum##1=0
- \pgfkeys{pagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2,##2}
+ \pgfkeys{pagegraphic,file={#1},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2,##2}
\else
\ifnum##1=1
- \pgfkeys{backcoverpagegraphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2}
+ \pgfkeys{backcoverpagegraphic,file={#1},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2}
\else
- \pgfkeys{graphic,file={#1},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2,##2}
+ \pgfkeys{graphic,file={#1},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#2,##2}
\fi
\fi
}%
}
+\def\togglesnapv{
+ \pal@dimentmp=\pal@snaptop
+ \pal@snaptop=\pal@snapbottom
+ \pal@snapbottom=\pal@dimentmp
+}
+\def\togglesnaph{
+ \pal@dimentmp=\pal@snapleft
+ \pal@snapleft=\pal@snapright
+ \pal@snapright=\pal@dimentmp
+}
+\def\togglepos{
+ \xdef\pal@tmp{\pal@graphicoptionhpos}
+ \xdef\pal@graphicoptionhpos{\pal@graphicoptionvpos}
+ \xdef\pal@graphicoptionvpos{\pal@tmp}
+}
\newcommand\pal@putgraphic[6][]{
\pal@x=\posx{1}{#2}{1}{#3}
\pal@yy=\posy{1}{#2}
@@ -1298,13 +1321,156 @@
\pal@snapbleedbottom=\pal@null
\begingroup
- \xdef\pal@filename{#6-\pal@density-\pal@graphicoptionscale-\pal@graphicoptionhpos-\pal@graphicoptionvpos-\the\numexpr\pal@snaptop\relax-\the\numexpr\pal@snapright\relax-\the\numexpr\pal@snapbottom\relax-\the\numexpr\pal@snapleft\relax-\the\numexpr\width\relax-\the\numexpr\height\relax-\pal@downsamplethreshold-\pal@graphicoptionunsharp-\pal@quality}
+ \pal@hflipfalse
+ \pal@vflipfalse
+
+ \ifnum\pal@graphicoptionorientation=1
+ \def\pal@angle{0}
+ \ifpal@graphicoptionhflip
+ \pal@hfliptrue
+ \togglesnaph
+ \fi
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \togglesnapv
+ \fi
+ \pgfmathqparse{1pt-\pal@graphicoptionvpos pt}
+ \edef\pal@graphicoptionvpos{\pgfmathresult}
+ \else
+ \ifnum\pal@graphicoptionorientation=2
+ \def\pal@angle{0}
+ \ifpal@graphicoptionhflip
+ \else
+ \pal@hfliptrue
+ \togglesnaph
+ \fi
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \togglesnapv
+ \fi
+ \pgfmathqparse{1pt-\pal@graphicoptionvpos pt}
+ \edef\pal@graphicoptionvpos{\pgfmathresult}
+ \pgfmathqparse{1pt-\pal@graphicoptionhpos pt}
+ \edef\pal@graphicoptionhpos{\pgfmathresult}
+ \else
+ \ifnum\pal@graphicoptionorientation=3
+ \def\pal@angle{180}
+ \ifpal@graphicoptionhflip
+ \pal@hfliptrue
+ \else
+ \togglesnaph
+ \fi
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \else
+ \togglesnapv
+ \fi
+ \pgfmathqparse{1pt-\pal@graphicoptionhpos pt}
+ \edef\pal@graphicoptionhpos{\pgfmathresult}
+ \else
+ \ifnum\pal@graphicoptionorientation=4
+ \def\pal@angle{180}
+ \ifpal@graphicoptionhflip
+ \togglesnaph
+ \else
+ \pal@hfliptrue
+ \fi
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \else
+ \togglesnapv
+ \fi
+ \else
+ \ifnum\pal@graphicoptionorientation=5
+ \def\pal@angle{270}
+ \ifpal@graphicoptionhflip
+ \pal@hfliptrue
+ \else
+ \togglesnaph
+ \fi
+ \ifpal@graphicoptionvflip
+ \togglesnapv
+ \else
+ \pal@vfliptrue
+ \fi
+ \togglepos
+ \pgfmathqparse{1pt-\pal@graphicoptionvpos pt}
+ \edef\pal@graphicoptionvpos{\pgfmathresult}
+ \pgfmathqparse{1pt-\pal@graphicoptionhpos pt}
+ \edef\pal@graphicoptionhpos{\pgfmathresult}
+ \else
+ \ifnum\pal@graphicoptionorientation=6
+ \def\pal@angle{270}
+ \ifpal@graphicoptionhflip
+ \pal@hfliptrue
+ \else
+ \togglesnaph
+ \fi
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \else
+ \togglesnapv
+ \fi
+ \togglepos
+ \pgfmathqparse{1pt-\pal@graphicoptionhpos pt}
+ \edef\pal@graphicoptionhpos{\pgfmathresult}
+ \else
+ \def\pal@angle{90}
+ \ifpal@graphicoptionhflip
+ \pal@hfliptrue
+ \togglesnaph
+ \fi
+ \ifnum\pal@graphicoptionorientation=7
+ \ifpal@graphicoptionvflip
+ \else
+ \pal@vfliptrue
+ \togglesnapv
+ \fi
+ \togglepos
+ \else
+ \ifpal@graphicoptionvflip
+ \pal@vfliptrue
+ \togglesnapv
+ \fi
+ \togglepos
+ \pgfmathqparse{1pt-\pal@graphicoptionvpos pt}
+ \edef\pal@graphicoptionvpos{\pgfmathresult}
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+
+ \ifnum\pal@graphicoptionorientation<5
+ \xdef\pal@filename{#6-\pal@density-\pal@graphicoptionscale-\pal@graphicoptionhpos-\pal@graphicoptionvpos-\the\numexpr\pal@snaptop\relax-\the\numexpr\pal@snapright\relax-\the\numexpr\pal@snapbottom\relax-\the\numexpr\pal@snapleft\relax-\the\numexpr\width\relax-\the\numexpr\height\relax-\pal@downsamplethreshold-\pal@graphicoptionunsharp-\pal@quality}
+ \else
+ \xdef\pal@filename{#6-\pal@density-\pal@graphicoptionscale-\pal@graphicoptionhpos-\pal@graphicoptionvpos-\the\numexpr\pal@snapleft\relax-\the\numexpr\pal@snaptop\relax-\the\numexpr\pal@snapright\relax-\the\numexpr\pal@snapbottom\relax-\the\numexpr\height\relax-\the\numexpr\width\relax-\pal@downsamplethreshold-\pal@graphicoptionunsharp-\pal@quality}
+ \fi
+
\ifpal@optimize
\IfFileExists{./cache/\pal@filename/g.jpg}{
- \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g.jpg}}
+ \ifnum\pal@graphicoptionorientation<3
+ \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g.jpg}}
+ \else
+ \ifnum\pal@graphicoptionorientation<5
+ \def\pal@nextincludegraphic{\includegraphics[width=\width,angle=\pal@angle]{cache/\pal@filename/g.jpg}}
+ \else
+ \def\pal@nextincludegraphic{\includegraphics[height=\width,angle=\pal@angle]{cache/\pal@filename/g.jpg}}
+ \fi
+ \fi
}{
\IfFileExists{./cache/\pal@filename/g.png}{
- \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g.png}}
+ \ifnum\pal@graphicoptionorientation<3
+ \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g.png}}
+ \else
+ \ifnum\pal@graphicoptionorientation<5
+ \def\pal@nextincludegraphic{\includegraphics[width=\width,angle=\pal@angle]{cache/\pal@filename/g.png}}
+ \else
+ \def\pal@nextincludegraphic{\includegraphics[height=\width,angle=\pal@angle]{cache/\pal@filename/g.png}}
+ \fi
+ \fi
}{
\pal@calculatecroptrue
}
@@ -1332,10 +1498,13 @@
\pal@disablegraphicsfilecheck
\ifpal@calculatecrop
% graphic crop
- \settowidth{\pal@originalgraphicwidth}{\includegraphics{\pal@currfilebase\pal@currfileext}}
- \settoheight{\pal@originalgraphicheight}{\includegraphics{\pal@currfilebase\pal@currfileext}}
- \pgfmathqparse{1pt-\pal@graphicoptionvpos pt}
- \edef\pal@graphicoptionvpos{\pgfmathresult}
+ \ifnum\pal@graphicoptionorientation<5
+ \settowidth{\pal@originalgraphicwidth}{\includegraphics{\pal@currfilebase\pal@currfileext}}
+ \settoheight{\pal@originalgraphicheight}{\includegraphics{\pal@currfilebase\pal@currfileext}}
+ \else
+ \settoheight{\pal@originalgraphicwidth}{\includegraphics{\pal@currfilebase\pal@currfileext}}
+ \settowidth{\pal@originalgraphicheight}{\includegraphics{\pal@currfilebase\pal@currfileext}}
+ \fi
\pgfmathqparse{\pal@originalgraphicwidth/\pal@originalgraphicheight}
\edef\pal@graphicratio{\pgfmathresult}
\pgfmathqparse{\width/\height}
@@ -1408,6 +1577,7 @@
\pal@snapoptimizedgraphic
\fi
+ \pal@trimnextfalse
\ifdefined\pal@nextincludegraphic
\else
\ifpal@optimize
@@ -1418,19 +1588,39 @@
\isoptimizable{\pal@currfileext}{\pal@optimizegraphic{\pal@currfilebase}{\pal@currfileext}}
\ifdefined\pal@optimizedext
\IfFileExists{./cache/\pal@filename/g\pal@optimizedext}{
- \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g\pal@optimizedext}}
+ \ifnum\pal@graphicoptionorientation<3
+ \def\pal@nextincludegraphic{\includegraphics[width=\width]{cache/\pal@filename/g\pal@optimizedext}}
+ \else
+ \ifnum\pal@graphicoptionorientation<5
+ \def\pal@nextincludegraphic{\includegraphics[width=\width,angle=\pal@angle]{cache/\pal@filename/g\pal@optimizedext}}
+ \else
+ \def\pal@nextincludegraphic{\includegraphics[height=\width,angle=\pal@angle]{cache/\pal@filename/g\pal@optimizedext}}
+ \fi
+ \fi
}{
\ifx\pal@processresult\pal@ok
\ClassError{pagelayout}{Unexpected error. File not optimized}{File `cache/#6/g\pal@optimizedext' not found.\MessageBreak Try to delete the `cache' directory.\MessageBreak\MessageBreak\@ehc}
\fi
- \def\pal@nextincludegraphic{\includegraphics[trim={\pal@cropleft} {\pal@cropbottom} {\pal@cropright} {\pal@croptop},\pal@clip,width=\width]{\pal@currfilebase\pal@currfileext}}
+ \pal@trimnexttrue
}
\else
- \def\pal@nextincludegraphic{\includegraphics[trim={\pal@cropleft} {\pal@cropbottom} {\pal@cropright} {\pal@croptop},\pal@clip,width=\width]{\pal@currfilebase\pal@currfileext}}
+ \pal@trimnexttrue
\fi
\fi
\else
+ \pal@trimnexttrue
+ \fi
+ \fi
+
+ \ifpal@trimnext
+ \ifnum\pal@graphicoptionorientation<3
\def\pal@nextincludegraphic{\includegraphics[trim={\pal@cropleft} {\pal@cropbottom} {\pal@cropright} {\pal@croptop},\pal@clip,width=\width]{\pal@currfilebase\pal@currfileext}}
+ \else
+ \ifnum\pal@graphicoptionorientation<5
+ \def\pal@nextincludegraphic{\includegraphics[trim={\pal@cropleft} {\pal@cropbottom} {\pal@cropright} {\pal@croptop},\pal@clip,width=\width,angle=\pal@angle]{\pal@currfilebase\pal@currfileext}}
+ \else
+ \def\pal@nextincludegraphic{\includegraphics[trim={\pal@cropbottom} {\pal@cropright} {\pal@croptop} {\pal@cropleft},\pal@clip,height=\width,angle=\pal@angle]{\pal@currfilebase\pal@currfileext}}
+ \fi
\fi
\fi
@@ -1475,7 +1665,11 @@
\ifdim\pal@defaultborderradius>0pt
\pal@ismaskrequiredtrue
\else
- \pal@ismaskrequiredfalse
+ \ifnum\pal@graphicoptionorientation=1
+ \pal@ismaskrequiredfalse
+ \else
+ \pal@ismaskrequiredtrue
+ \fi
\fi
\fi
\else
@@ -1498,9 +1692,27 @@
\fi
\draw[draw opacity=0,rounded corners=\pal@defaultborderradius,path picture={
- \node at (0.5\width,0.5\height){
- \pal@nextincludegraphic
- };
+ \ifpal@hflip
+ \ifpal@vflip
+ \node[xscale=-1,yscale=-1] at (0.5\width,0.5\height){
+ \pal@nextincludegraphic
+ };
+ \else
+ \node[xscale=-1] at (0.5\width,0.5\height){
+ \pal@nextincludegraphic
+ };
+ \fi
+ \else
+ \ifpal@vflip
+ \node[yscale=-1] at (0.5\width,0.5\height){
+ \pal@nextincludegraphic
+ };
+ \else
+ \node at (0.5\width,0.5\height){
+ \pal@nextincludegraphic
+ };
+ \fi
+ \fi
}] (0,0) rectangle ++(\width,\height);%
\end{tikzpicture}%
\else%
@@ -1574,12 +1786,19 @@
}
% pagegraphic
+\newif\ifpal@pagegraphicoptionhflip
+\newif\ifpal@pagegraphicoptionvflip
+\newif\ifpal@backcoveroptionpagegraphichflip
+\newif\ifpal@backcoveroptionpagegraphicvflip
\def\pal@pagegraphic{}
\pgfkeys{
/pagegraphic/.is family,
/pagegraphic,
file/.store in=\pal@pagegraphic,
scale/.store in=\pal@pagegraphicoptionscale,
+ orientation/.store in=\pal@pagegraphicoptionorientation,
+ hflip/.is if=pal@pagegraphicoptionhflip,
+ vflip/.is if=pal@pagegraphicoptionvflip,
vpos/.store in=\pal@pagegraphicoptionvpos,
hpos/.store in=\pal@pagegraphicoptionhpos,
unsharp/.store in=\pal@pagegraphicoptionunsharp,
@@ -1589,6 +1808,9 @@
/backcoverpagegraphic,
file/.store in=\pal@backcoveroptionpagegraphicfile,
scale/.store in=\pal@backcoveroptionpagegraphicscale,
+ orientation/.store in=\pal@backcoveroptionpagegraphicorientation,
+ hflip/.is if=pal@backcoveroptionpagegraphichflip,
+ vflip/.is if=pal@backcoveroptionpagegraphicvflip,
vpos/.store in=\pal@backcoveroptionpagegraphicvpos,
hpos/.store in=\pal@backcoveroptionpagegraphichpos,
unsharp/.store in=\pal@backcoveroptionpagegraphicunsharp,
@@ -1601,7 +1823,7 @@
\innermargin=\pal@null
\outermargin=\pal@null
\setgrid{{{1}}}
- \pgfkeys{graphic,scale=\pal@pagegraphicoptionscale,hpos=\pal@pagegraphicoptionhpos,vpos=\pal@pagegraphicoptionvpos,unsharp=\pal@pagegraphicoptionunsharp,border width=0pt,border radius=0pt,shadow size=0,shadow xshift=0pt,shadow yshift=0pt}
+ \pgfkeys{graphic,scale=\pal@pagegraphicoptionscale,orientation=\pal@pagegraphicoptionorientation,hflip=\ifpal@pagegraphicoptionhflip true\else false\fi,vflip=\ifpal@pagegraphicoptionvflip true\else false\fi,hpos=\pal@pagegraphicoptionhpos,vpos=\pal@pagegraphicoptionvpos,unsharp=\pal@pagegraphicoptionunsharp,border width=0pt,border radius=0pt,shadow size=0,shadow xshift=0pt,shadow yshift=0pt}
\pal@putgraphic{0}{0}{1}{1}{\pal@pagegraphic}
\endgroup
}
@@ -1609,7 +1831,7 @@
\ifcsname pal@graphic@#2\endcsname%
\csname pal@graphic@#2\endcsname{#1}
\else%
- \pgfkeys{pagegraphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#1}
+ \pgfkeys{pagegraphic,file={#2},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#1}
\fi
}
\def\nopagegraphic{\setpagegraphic{}}
@@ -1660,6 +1882,7 @@
colframe/.store in=\pal@defaultbordercolor,
opacityframe/.store in=\pal@defaultborderopacity,
breakable/.is if=pal@text@option@breakable,
+ % baselinesnap/.store in=\pal@text@option@baselinesnap,
.unknown/.code=,
library/.unknown/.code=,
}
@@ -1697,6 +1920,7 @@
height/.code={\originaltcbset{height=#1}\def\pal@text@option@height{#1}},
parbox/.is if=pal@text@option@parbox,
breakable/.is if=pal@text@option@breakable,
+ baselinesnap/.store in=\pal@text@option@baselinesnap,
border radius/.code={\originaltcbset{arc=#1}\ifdim\pal@null=\dimexpr#1\relax\originaltcbset{outer arc=#1}\else\originaltcbset{auto outer arc}\fi\def\pal@defaultborderradius{#1}},
arc/.forward to=/text/border radius,
border width/.forward to=/text/boxrule,
@@ -1711,6 +1935,7 @@
.unknown/.code={\originaltcbset{\pgfkeyscurrentname=#1}}
}
\newdimen\pal@tcbheight
+\newcount\pal@breakabletextindex
\newcommand\pal@puttext[5]{
\ifpal@isbatchmode
\else
@@ -1779,6 +2004,14 @@
\fi
\ifpal@text@option@breakable
+ \global\expandafter\edef\csname pal@breakabletext@name@\the\pal@breakabletextindex\endcsname{\pal@text@option@name}
+ \global\expandafter\edef\csname pal@breakabletext@breakat@\pal@text@option@name\endcsname{\the\height}
+ \global\expandafter\edef\csname pal@breakabletext@startat@\pal@text@option@name\endcsname{\the\pal@yy}
+ \ifdefined\pal@text@option@baselinesnap
+ \global\expandafter\edef\csname pal@breakabletext@baselinesnap@\pal@text@option@name\endcsname{\pal@text@option@baselinesnap}
+ \fi
+ % \errmessage{\the\pal@yy, \the\pal@y, \the\height, \the\pageheight}
+ \global\advance\pal@breakabletextindex by 1
\expandafter\xdef\csname pal@textarray@\pal@text@option@name @offsetx\endcsname{\pal@text@option@leftrule}
\expandafter\xdef\csname pal@textarray@\pal@text@option@name @offsety\endcsname{\pal@text@option@bottomrule}
\else
@@ -1797,7 +2030,8 @@
standard jigsaw,
width=\width,
enforce breakable,
- break at=\height,
+ break at=\ifcsname pal@breakable@\pal@text@option@name\endcsname\csname pal@breakable@\pal@text@option@name\endcsname\else\height\fi,
+ % break at=\height/\height/\height/\height/\height/\height/46.633pt/\height,
height fixed for=all,
reset box array=\pal@text@option@name,
store to box array=\pal@text@option@name,
@@ -1872,6 +2106,7 @@
\fi
\fi
}
+
\newcommand\pal@putusetext[5][default]{
\ifpal@isbatchmode
\else
@@ -1879,6 +2114,24 @@
\pal@xx=\posx{-1}{#4}{-1}{#5}
\pal@y=\posy{-1}{#4}
\pal@yy=\posy{1}{#2}
+ \ifdim\csname pal@breakabletext@startat@#1\endcsname=\the\pal@yy
+ \else
+ \ifcsname pal@breakabletext@baselinesnap@#1\endcsname
+ \pal@yytmp=\dimexpr\csname pal@breakabletext@startat@#1\endcsname\relax
+ \ifdim\pal@yytmp>\pal@yy
+ \loop
+ \pal@yytmp=\dimexpr\pal@yytmp-\csname pal@breakabletext@baselinesnap@#1\endcsname\relax
+ \ifdim\pal@yytmp>\pal@yy\repeat
+ \else
+ \ifdim\dimexpr\pal@yytmp+\csname pal@breakabletext@baselinesnap@#1\endcsname\relax<\pal@yy
+ \loop
+ \pal@yytmp=\dimexpr\pal@yytmp+\csname pal@breakabletext@baselinesnap@#1\endcsname\relax
+ \ifdim\dimexpr\pal@yytmp+\csname pal@breakabletext@baselinesnap@#1\endcsname\relax<\pal@yy\repeat
+ \fi
+ \fi
+ \pal@yy=\pal@yytmp
+ \fi
+ \fi
\width=\dimexpr(\pal@xx - \pal@x)\relax
\height=\dimexpr(\pal@yy - \pal@y)\relax
\pal@textboxwidth=\dimexpr(\pal@xx - \pal@x)\relax
@@ -1887,6 +2140,7 @@
\pal@checkvisibility
\ifpal@isvisible
\ifcsname pal@textarray@#1@index\endcsname
+ \global\expandafter\edef\csname pal@breakabletext@breakat@#1\endcsname{\csname pal@breakabletext@breakat@#1\endcsname/\the\height}
\global\expandafter\advance\csname pal@textarray@#1@index\endcsname by 1%
\pal@y=\dimexpr\pal@yy-\pal@textboxheight\relax
@@ -2078,13 +2332,14 @@
}
\def\pal@drawshadow{
\pal@ifshadow{
- \xdef\pal@shadowid{shadow-\pal@defaultshadowsize-\pal@defaultshadowcolor-\pal@defaultshadowopacity-\the\numexpr\pal@frameshadowwidth\relax-\the\numexpr\pal@frameshadowheight\relax-\the\numexpr\pal@frameshadowradius\relax-\the\numexpr\pal@frameshadowborder\relax}
+ \convertcolorspec{named}{\pal@defaultshadowcolor}{RGB}\pal@colortmp
+ \xdef\pal@shadowid{shadow-\pal@defaultshadowsize-\pal@colortmp-\pal@defaultshadowopacity-\the\numexpr\pal@frameshadowwidth\relax-\the\numexpr\pal@frameshadowheight\relax-\the\numexpr\pal@frameshadowradius\relax-\the\numexpr\pal@frameshadowborder\relax}
\IfFileExists{./cache/\pal@shadowid/s.pdf}{
\put(\pal@dimentonumber{\dimexpr\pal@x-5cm-\pal@frameshadowoffsetx+\pal@defaultshadowxshift\relax},\pal@dimentonumber{\dimexpr\pal@y-5cm-\pal@frameshadowoffsety-\pal@defaultshadowyshift\relax}){%
\includegraphics[width=\pal@frameshadowwidth]{cache/\pal@shadowid/s.pdf}
}
}{
- \pal@makeshadow{\pal@shadowid}
+ \pal@makeshadow{\pal@shadowid}{\pal@colortmp}
\IfFileExists{./cache/\pal@shadowid/s.pdf}{
\put(\pal@dimentonumber{\dimexpr\pal@x-5cm-\pal@frameshadowoffsetx+\pal@defaultshadowxshift\relax},\pal@dimentonumber{\dimexpr\pal@y-5cm-\pal@frameshadowoffsety-\pal@defaultshadowyshift\relax}){%
\includegraphics[width=\pal@frameshadowwidth]{cache/\pal@shadowid/s.pdf}
@@ -2550,11 +2805,11 @@
\ifx\pal@pagecolor\pal@emptystring
\else
\begingroup
- \margin=\pal@null
- \topmargin=\pal@null
- \bottommargin=\pal@null
- \innermargin=\pal@null
- \outermargin=\pal@null
+ \margin=-1pt
+ \topmargin=-1pt
+ \bottommargin=-1pt
+ \innermargin=\ifpal@fanfold\pal@null\else-1pt\fi
+ \outermargin=-1pt
\setgrid{{{1}}}
\ifx\pal@pagecolormodel\pal@emptystring
\else
@@ -2596,6 +2851,7 @@
\global\let\pal@defaultshadowxshift\pal@defaultshadowxshift
\global\let\pal@defaultshadowyshift\pal@defaultshadowyshift
\global\let\pal@pagegraphicoptionscale\pal@pagegraphicoptionscale
+ \global\let\pal@pagegraphicoptionorientation\pal@pagegraphicoptionorientation
\global\let\pal@pagegraphicoptionvpos\pal@pagegraphicoptionvpos
\global\let\pal@pagegraphicoptionhpos\pal@pagegraphicoptionhpos
\global\let\pal@pagegraphicoptionunsharp\pal@pagegraphicoptionunsharp
@@ -2782,6 +3038,17 @@
\else
\def\pal@pagegraphic{\pal@backcoveroptionpagegraphicfile}
\def\pal@pagegraphicoptionscale{\pal@backcoveroptionpagegraphicscale}
+ \def\pal@pagegraphicoptionorientation{\pal@backcoveroptionpagegraphicorientation}
+ \ifpal@backcoveroptionpagegraphichflip
+ \pal@pagegraphicoptionhfliptrue
+ \else
+ \pal@pagegraphicoptionhflipfalse
+ \fi
+ \ifpal@backcoveroptionpagegraphicvflip
+ \pal@pagegraphicoptionvfliptrue
+ \else
+ \pal@pagegraphicoptionvflipfalse
+ \fi
\def\pal@pagegraphicoptionvpos{\pal@backcoveroptionpagegraphicvpos}
\def\pal@pagegraphicoptionhpos{\pal@backcoveroptionpagegraphichpos}
\def\pal@pagegraphicoptionunsharp{\pal@backcoveroptionpagegraphicunsharp}
@@ -2970,6 +3237,9 @@
\ifdefined\pal@pagegraphicoptionscale
\let\pal@backcoveroptionpagegraphicscale\pal@pagegraphicoptionscale
\fi
+ \ifdefined\pal@pagegraphicoptionorientation
+ \let\pal@backcoveroptionpagegraphicorientation\pal@pagegraphicoptionorientation
+ \fi
\ifdefined\pal@pagegraphicoptionhpos
\let\pal@backcoveroptionpagegraphichpos\pal@pagegraphicoptionhpos
\fi
@@ -3299,7 +3569,7 @@
\ifnum\pal@contentcounter=\pal@placeholdercounter
\def\pal@currentplaceholdertype{graphic}
\def\pal@currentplaceholderoptions{}
- \pgfkeys{graphic,file={#2},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#1}
+ \pgfkeys{graphic,file={#2},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,#1}
\ifcsname pal@graphic@#2\endcsname%
\csname pal@graphic@#2\endcsname[2]{#1}%
\fi
@@ -3402,7 +3672,7 @@
\csname pal@graphic@##2\endcsname[2]{##1}
\else
\ifpal@template\else
- \pgfkeys{graphic,file={##2},scale=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,##1}
+ \pgfkeys{graphic,file={##2},scale=1,orientation=1,vpos=0.5,hpos=0.5,unsharp=\pal@unsharp,##1}
\fi
\fi
\fi
@@ -3546,6 +3816,12 @@
\fi
}
\AtEndDocument{
+ \ifnum\pal@breakabletextindex>0
+ \loop
+ \advance\pal@breakabletextindex by -1
+ \immediate\write\@auxout{\gdef\string\pal@breakable@\csname pal@breakabletext@name@\the\pal@breakabletextindex\endcsname{\csname pal@breakabletext@breakat@\csname pal@breakabletext@name@\the\pal@breakabletextindex\endcsname\endcsname}}
+ \ifnum\pal@breakabletextindex>0\repeat
+ \fi
\ifpal@beginleft
\ifpal@leftpage
\pal@hasoddnumberofpagestrue
@@ -3646,9 +3922,17 @@
\pal@errmsg@magicknotinstalled{Ppi not calculated}
\else
\ifdim\pal@originalgraphicwidth<\pal@originalgraphicheight
- \pgfmathqparse{(\pal@originalgraphicwidth - \pal@cropleft - \pal@cropright) / \pal@originalgraphicwidth * \pal@graphicsize pt / \the\width * 72.27pt}
+ \ifnum\pal@graphicoptionorientation<5
+ \pgfmathqparse{(\pal@originalgraphicwidth - \pal@cropleft - \pal@cropright) / \pal@originalgraphicwidth * \pal@graphicsize pt / \the\width * 72.27pt}
+ \else
+ \pgfmathqparse{(\pal@originalgraphicheight - \pal@croptop - \pal@cropbottom) / \pal@originalgraphicheight * \pal@graphicsize pt / \the\height * 72.27pt}
+ \fi
\else
- \pgfmathqparse{(\pal@originalgraphicheight - \pal@croptop - \pal@cropbottom) / \pal@originalgraphicheight * \pal@graphicsize pt / \the\height * 72.27pt}
+ \ifnum\pal@graphicoptionorientation<5
+ \pgfmathqparse{(\pal@originalgraphicheight - \pal@croptop - \pal@cropbottom) / \pal@originalgraphicheight * \pal@graphicsize pt / \the\height * 72.27pt}
+ \else
+ \pgfmathqparse{(\pal@originalgraphicwidth - \pal@cropleft - \pal@cropright) / \pal@originalgraphicwidth * \pal@graphicsize pt / \the\width * 72.27pt}
+ \fi
\fi
\pgfmathint{\pgfmathresult}
@@ -3659,7 +3943,11 @@
\immediate\closein\pal@scriptresult
}
\newcommand\pal@optimizegraphic[2]{
- \immediate\openin\pal@scriptresult={|pagelayoutapi optimize\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@density\%\the\numexpr\width\%\the\numexpr\height\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \ifnum\pal@graphicoptionorientation<5
+ \immediate\openin\pal@scriptresult={|pagelayoutapi optimize\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@density\%\the\numexpr\width\%\the\numexpr\height\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \else
+ \immediate\openin\pal@scriptresult={|pagelayoutapi optimize\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@density\%\the\numexpr\height\%\the\numexpr\width\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \fi
\ifeof\pal@scriptresult
\pal@errmsg@shellaccessforbidden{File not optimized}
\else
@@ -3676,8 +3964,8 @@
\fi
\immediate\closein\pal@scriptresult
}
-\newcommand\pal@makeshadow[1]{
- \immediate\openin\pal@scriptresult={|pagelayoutapi makeshadow\%#1\%\pal@defaultshadowsize\%\pal@defaultshadowopacity\%\pal@defaultshadowcolor\%\the\pal@frameshadowwidth\%\the\pal@frameshadowheight\%\the\pal@frameshadowframewidth\%\the\pal@frameshadowframeheight\%\the\pal@frameshadowborder\%\the\pal@frameshadowradius}
+\newcommand\pal@makeshadow[2]{
+ \immediate\openin\pal@scriptresult={|pagelayoutapi makeshadow\%#1\%\pal@defaultshadowsize\%\pal@defaultshadowopacity\%#2\%\the\pal@frameshadowwidth\%\the\pal@frameshadowheight\%\the\pal@frameshadowframewidth\%\the\pal@frameshadowframeheight\%\the\pal@frameshadowborder\%\the\pal@frameshadowradius}
\ifeof\pal@scriptresult
\edef\pal@processresult{\pal@err@shellaccessforbidden}
\pal@errmsg@shellaccessforbidden{Shadow not created}
@@ -3724,7 +4012,11 @@
\immediate\closein\pal@scriptresult
}
\newcommand\pal@addtobatchlist[2]{
- \global\edef\pal@batchlist{\pal@batchlist\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@density\%\the\numexpr\width\%\the\numexpr\height\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \ifnum\pal@graphicoptionorientation<5
+ \global\edef\pal@batchlist{\pal@batchlist\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@density\%\the\numexpr\width\%\the\numexpr\height\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \else
+ \global\edef\pal@batchlist{\pal@batchlist\% "#1#2" \% "\pal@filename" \%\pal@optimizedext\%\the\numexpr\pal@originalgraphicheight\%\the\numexpr\pal@originalgraphicwidth\%\the\numexpr\pal@cropbottom\%\the\numexpr\pal@croptop\%\the\numexpr\pal@cropleft\%\the\numexpr\pal@cropright\%\the\numexpr\pal@density\%\the\numexpr\height\%\the\numexpr\width\%\pal@downsamplethreshold\%\pal@graphicoptionunsharp\%\pal@quality}
+ \fi
}
\newcommand\pal@batchoptimize{
\immediate\openin\pal@scriptresult={|pagelayoutapi batchoptimize\pal@batchlist}