summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-24 23:25:08 +0000
committerKarl Berry <karl@freefriends.org>2009-07-24 23:25:08 +0000
commit1cf7474fed91f7afc83683b2ed97842440f2c4c4 (patch)
treecb448d25235557b3db7f259ca67e8ded40c05c88 /Master/texmf-dist/tex
parentab7105b41fa4f7f5f2abae4dfce71dadbf78bbce (diff)
changelayout update (24jul09)
git-svn-id: svn://tug.org/texlive/trunk@14432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/changelayout/changelayout.sty227
1 files changed, 105 insertions, 122 deletions
diff --git a/Master/texmf-dist/tex/latex/changelayout/changelayout.sty b/Master/texmf-dist/tex/latex/changelayout/changelayout.sty
index a385e5df7f7..eaad7ce5e2a 100644
--- a/Master/texmf-dist/tex/latex/changelayout/changelayout.sty
+++ b/Master/texmf-dist/tex/latex/changelayout/changelayout.sty
@@ -24,10 +24,12 @@
\newrobustcmd\cpl@warn[1]{\PackageWarningNoLine{changelayout}{#1}}
\newrobustcmd\cpl@info[1]{\PackageInfo{changelayout}{#1\@gobble}}
\newrobustcmd\cpl@err[1]{\PackageError{changelayout}{#1}{\@ehc}}
+\let\cpl@xp\expandafter
+\def\cpl@glet#1#2{\@ifdefinable#1{\global\let#1#2}}
\@ifclassloaded{memoir}{%
\cpl@err{This package can't be used with\MessageBreak
memoir class. I've therefore exited}
- \expandafter\endinput%
+ \cpl@xp\endinput%
}{}
\@ifpackageloaded{xcolor}{%
\cpl@info{You've already loaded 'xcolor'\MessageBreak
@@ -45,65 +47,62 @@
\cpl@err{This package is a replacement for\MessageBreak
'changepage' package.\MessageBreak
It can't be used with 'changepage'}
- \expandafter\endinput%
+ \cpl@xp\endinput%
}{}
}
-\newrobustcmd*\csmdef[1]{\expandafter\csname#1\endcsname}
-\newrobustcmd*\cpl@numexpr[2]{%
- \ifstrempty{#2}{%
- \cpl@err{You can't assign empty argument\MessageBreak
- to number}}{}
- \ifcsundef{#1}{%
- \expandafter\newcount\csname#1\endcsname%
- \csmdef{#1}=\the\numexpr#2\relax
- }{\csmdef{#1}=\the\numexpr#2\relax}
+\newrobustcmd*\cpl@numdef[2]{%
+ \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak
+ to number}}{}
+ \ifundef{#1}{\newcount#1\relax #1=\z@\relax}{}%
+ #1=\numexpr#2\relax
}
-\newrobustcmd*\cpl@dimexpr[2]{%
- \ifstrempty{#2}{%
- \cpl@err{You can't assign empty argument\MessageBreak
- to dimension}}{}
- \ifcsundef{#1}{%
- \expandafter\newdimen\csname#1\endcsname%
- \csmdef{#1}=\the\dimexpr#2\relax
- }{\csmdef{#1}=\the\dimexpr#2\relax}
+\newrobustcmd*\cpl@csnumdef[1]{\cpl@xp\cpl@numdef\csname#1\endcsname}
+\newrobustcmd*\cpl@dimdef[2]{%
+ \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak
+ to dimension}}{}
+ \ifundef{#1}{\newdimen#1\relax #1=\z@\relax}{}%
+ #1=\dimexpr#2\relax
}
-\newrobustcmd\cpl@changetext{%
+\newrobustcmd*\cpl@csdimdef[1]{\cpl@xp\cpl@dimdef\csname#1\endcsname}
+\newrobustcmd\cpl@changelayout{%
\@colht=\textheight%
\@colroom=\textheight%
\vsize=\textheight%
\columnwidth=\textwidth%
\if@twocolumn
- \cpl@dimexpr{dimen@}{(\columnwidth-\columnsep)/2}
+ \cpl@csdimdef{dimen@}{(\columnwidth-\columnsep)/2}
\columnwidth=\dimen@%
\@firstcolumntrue
\fi
\hsize=\columnwidth%
\linewidth=\hsize%
}
-\protected@edef\cpl@setdefault{%
- \noexpand\cpl@dimexpr{cpl@orig@paperwidth}{\paperwidth}%
- \noexpand\cpl@dimexpr{cpl@orig@paperheight}{\paperheight}%
- \noexpand\cpl@dimexpr{cpl@orig@textheight}{\textheight}%
- \noexpand\cpl@dimexpr{cpl@orig@textwidth}{\textwidth}%
- \noexpand\cpl@dimexpr{cpl@orig@oddsidemargin}{\oddsidemargin}%
- \noexpand\cpl@dimexpr{cpl@orig@evensidemargin}{\evensidemargin}%
- \noexpand\cpl@dimexpr{cpl@orig@topmargin}{\topmargin}%
- \noexpand\cpl@dimexpr{cpl@orig@headsep}{\headsep}%
- \noexpand\cpl@dimexpr{cpl@orig@headheight}{\headheight}%
- \noexpand\cpl@dimexpr{cpl@orig@footskip}{\footskip}%
- \noexpand\cpl@dimexpr{cpl@orig@footins}{\skip\footins}%
- \noexpand\cpl@dimexpr{cpl@orig@marginparwidth}{\marginparwidth}%
- \noexpand\cpl@dimexpr{cpl@orig@marginparsep}{\marginparsep}%
- \noexpand\cpl@dimexpr{cpl@orig@marginparpush}{\marginparpush}%
- \noexpand\cpl@dimexpr{cpl@orig@columnsep}{\columnsep}%
- \noexpand\cpl@dimexpr{cpl@orig@columnseprule}{\columnseprule}%
- \noexpand\cpl@dimexpr{cpl@orig@linewidth}{\linewidth}%
- \noexpand\cpl@dimexpr{cpl@orig@hoffset}{\hoffset}%
- \noexpand\cpl@dimexpr{cpl@orig@voffset}{\voffset}%
- \noexpand\cpl@numexpr{cpl@orig@mag}{\mag}%
+\newrobustcmd\cpl@getdefaults{\begingroup
+ \protected@edef\@tempa{\endgroup
+ \noexpand\cpl@csdimdef{cpl@orig@paperwidth}{\paperwidth}%
+ \noexpand\cpl@csdimdef{cpl@orig@paperheight}{\paperheight}%
+ \noexpand\cpl@csdimdef{cpl@orig@textheight}{\textheight}%
+ \noexpand\cpl@csdimdef{cpl@orig@textwidth}{\textwidth}%
+ \noexpand\cpl@csdimdef{cpl@orig@oddsidemargin}{\oddsidemargin}%
+ \noexpand\cpl@csdimdef{cpl@orig@evensidemargin}{\evensidemargin}%
+ \noexpand\cpl@csdimdef{cpl@orig@topmargin}{\topmargin}%
+ \noexpand\cpl@csdimdef{cpl@orig@headsep}{\headsep}%
+ \noexpand\cpl@csdimdef{cpl@orig@headheight}{\headheight}%
+ \noexpand\cpl@csdimdef{cpl@orig@footskip}{\footskip}%
+ \noexpand\cpl@csdimdef{cpl@orig@footins}{\skip\footins}%
+ \noexpand\cpl@csdimdef{cpl@orig@marginparwidth}{\marginparwidth}%
+ \noexpand\cpl@csdimdef{cpl@orig@marginparsep}{\marginparsep}%
+ \noexpand\cpl@csdimdef{cpl@orig@marginparpush}{\marginparpush}%
+ \noexpand\cpl@csdimdef{cpl@orig@columnsep}{\columnsep}%
+ \noexpand\cpl@csdimdef{cpl@orig@columnseprule}{\columnseprule}%
+ \noexpand\cpl@csdimdef{cpl@orig@linewidth}{\linewidth}%
+ \noexpand\cpl@csdimdef{cpl@orig@hoffset}{\hoffset}%
+ \noexpand\cpl@csdimdef{cpl@orig@voffset}{\voffset}%
+ \noexpand\cpl@csnumdef{cpl@orig@mag}{\mag}%
+ }\@tempa%
}
-\@onlypreamble\cpl@setdefault%
-\cpl@setdefault%
+\@onlypreamble\cpl@getdefaults\relax
+\AtEndPreamble{\cpl@getdefaults}%
\long\def\cpl@print@defaultparams{%
^^J*******************************************************^^J%
Original page layout dimensions and booleans^^J%
@@ -133,7 +132,7 @@
(1in=72.27pt, 1cm=28.45pt)^^J%
*******************************************************^^J%
}%
-\@onlypreamble\cpl@print@defaultparams
+\@onlypreamble\cpl@print@defaultparams\relax
\long\def\cpl@print@finalparams{%
^^J+++++++++++++++++++++++++++++++++++++++++++++++++++++++^^J%
Final page layout dimensions and booleans^^J%
@@ -163,31 +162,35 @@
(1in=72.27pt, 1cm=28.45pt)^^J%
+++++++++++++++++++++++++++++++++++++++++++++++++++++++^^J%
}%
-\protected@edef\cpl@resetdefault{%
- \noexpand\setlength{\paperwidth}{\cpl@orig@paperwidth}%
- \noexpand\setlength{\paperheight}{\cpl@orig@paperheight}%
- \noexpand\setlength{\textheight}{\cpl@orig@textheight}%
- \noexpand\setlength{\textwidth}{\cpl@orig@textwidth}%
- \noexpand\setlength{\linewidth}{\cpl@orig@linewidth}%
- \noexpand\setlength{\oddsidemargin}{\cpl@orig@oddsidemargin}%
- \noexpand\setlength{\evensidemargin}{\cpl@orig@evensidemargin}%
- \noexpand\setlength{\topmargin}{\cpl@orig@topmargin}%
- \noexpand\setlength{\headsep}{\cpl@orig@headsep}%
- \noexpand\setlength{\headheight}{\cpl@orig@headheight}%
- \noexpand\setlength{\footskip}{\cpl@orig@footskip}%
- \noexpand\setlength{\skip\footins}{\cpl@orig@footins}%
- \noexpand\setlength{\marginparwidth}{\cpl@orig@marginparwidth}%
- \noexpand\setlength{\marginparsep}{\cpl@orig@marginparsep}%
- \noexpand\setlength{\marginparpush}{\cpl@orig@marginparpush}%
- \noexpand\setlength{\columnsep}{\cpl@orig@columnsep}%
- \noexpand\setlength{\columnseprule}{\cpl@orig@columnseprule}%
- \noexpand\setlength{\hoffset}{\cpl@orig@hoffset}%
- \noexpand\setlength{\voffset}{\cpl@orig@voffset}%
- \noexpand\mag=\cpl@orig@mag%
- \noexpand\cpl@changetext%
- \noexpand\cpl@info{Default layout parameters reset}
+\newrobustcmd\cpl@backtodefaults{\begingroup
+ \protected@edef\@tempa{\endgroup
+ \noexpand\setlength{\paperwidth}{\cpl@orig@paperwidth}%
+ \noexpand\setlength{\paperheight}{\cpl@orig@paperheight}%
+ \noexpand\setlength{\textheight}{\cpl@orig@textheight}%
+ \noexpand\setlength{\textwidth}{\cpl@orig@textwidth}%
+ \noexpand\setlength{\linewidth}{\cpl@orig@linewidth}%
+ \noexpand\setlength{\oddsidemargin}{\cpl@orig@oddsidemargin}%
+ \noexpand\setlength{\evensidemargin}{\cpl@orig@evensidemargin}%
+ \noexpand\setlength{\topmargin}{\cpl@orig@topmargin}%
+ \noexpand\setlength{\headsep}{\cpl@orig@headsep}%
+ \noexpand\setlength{\headheight}{\cpl@orig@headheight}%
+ \noexpand\setlength{\footskip}{\cpl@orig@footskip}%
+ \noexpand\setlength{\skip\footins}{\cpl@orig@footins}%
+ \noexpand\setlength{\marginparwidth}{\cpl@orig@marginparwidth}%
+ \noexpand\setlength{\marginparsep}{\cpl@orig@marginparsep}%
+ \noexpand\setlength{\marginparpush}{\cpl@orig@marginparpush}%
+ \noexpand\setlength{\columnsep}{\cpl@orig@columnsep}%
+ \noexpand\setlength{\columnseprule}{\cpl@orig@columnseprule}%
+ \noexpand\setlength{\hoffset}{\cpl@orig@hoffset}%
+ \noexpand\setlength{\voffset}{\cpl@orig@voffset}%
+ \noexpand\mag=\cpl@orig@mag%
+ \noexpand\cpl@changelayout%
+ \noexpand\cpl@info{Layout parameters reset to defaults}%
+ }\@tempa%
}
\def\cpl@content{No content}
+\def\cpl@paperheight{\paperheight}
+\def\cpl@paperwidth{\paperwidth}
\def\cpl@textheight{\textheight}
\def\cpl@textwidth{\textwidth}
\def\cpl@evensidemargin{\evensidemargin}
@@ -209,15 +212,18 @@
\def\cpl@columnseprule{\columnseprule}
\def\cpl@marginparwidth{\marginparwidth}
\def\cpl@marginparsep{\marginparsep}
+\def\cpl@marginparsep{\marginparpush}
\def\cpl@hoffset{\hoffset}
\def\cpl@voffset{\voffset}
\def\cpl@textcolor{black}
\define@boolkey+[KV]{changelay}[cpl@]{reset}[true]{%
- \cpl@resetdefault}{\cpl@warn{Erroneous value for 'reset' ignored}}
+ \cpl@backtodefaults}{\cpl@warn{Erroneous value for 'reset' ignored}}
\define@boolkeys[KV]{changelay}[cpl@]{switchadjust,logdefault,%
logfinal,strictcheck,oddpage}[true]{}
\define@cmdkey[KV]{changelay}[cpl@]{content}[]{}
\define@cmdkey[KV]{changelay}[cpl@]{textcolor}[black]{}
+\define@cmdkey[KV]{changelay}[cpl@]{paperheight}[\paperheight]{}
+\define@cmdkey[KV]{changelay}[cpl@]{paperwidth}[\paperwidth]{}
\define@cmdkey[KV]{changelay}[cpl@]{textheight}[\textheight]{}
\define@cmdkey[KV]{changelay}[cpl@]{textwidth}[\textwidth]{}
\define@cmdkey[KV]{changelay}[cpl@]{evensidemargin}[\evensidemargin]{}
@@ -239,25 +245,28 @@
\define@cmdkey[KV]{changelay}[cpl@]{columnseprule}[\columnseprule]{}
\define@cmdkey[KV]{changelay}[cpl@]{marginparwidth}[\marginparwidth]{}
\define@cmdkey[KV]{changelay}[cpl@]{marginparsep}[\marginparsep]{}
+\define@cmdkey[KV]{changelay}[cpl@]{marginparpush}[\marginparpush]{}
\define@cmdkey[KV]{changelay}[cpl@]{hoffset}[\hoffset]{}
\define@cmdkey[KV]{changelay}[cpl@]{voffset}[\voffset]{}
\def\do#1{\csdef{cpl@x@#1}{\z@}}
-\docsvlist{textheight,textwidth,evensidemargin,oddsidemargin,topmargin,%
- headheight,headsep,footskip,footins,topsep,listparindent,%
- parindent,parsep,parskip,leftmargin,rightmargin,columnwidth,%
- columnsep,columnseprule,marginparwidth,marginparsep,hoffset,voffset%
+\docsvlist{paperheight,paperwidth,textheight,textwidth,evensidemargin,%
+ oddsidemargin,topmargin,headheight,headsep,footskip,footins,topsep,%
+ listparindent,parindent,parsep,parskip,leftmargin,rightmargin,%
+ columnwidth,columnsep,columnseprule,marginparwidth,marginparsep,%
+ marginparpush,hoffset,voffset%
}
\define@cmdkeys[KV@X]{changelay}[cpl@x@]{%
- textheight,textwidth,evensidemargin,oddsidemargin,topmargin,%
- headheight,headsep,footskip,footins,topsep,listparindent,%
- parindent,parsep,parskip,leftmargin,rightmargin,columnwidth,%
- columnsep,columnseprule,marginparwidth,marginparsep,hoffset,voffset%
+ paperheight,paperwidth,textheight,textwidth,evensidemargin,%
+ oddsidemargin,topmargin,headheight,headsep,footskip,footins,%
+ topsep,listparindent,parindent,parsep,parskip,leftmargin,rightmargin,%
+ columnwidth,columnsep,columnseprule,marginparwidth,marginparsep,%
+ marginparpush,hoffset,voffset%
}[\z@]
\DeclareOptionX*{\cpl@warn{Unknown option '\CurrentOption' ignored}}
\ExecuteOptionsX<changelay>{}
\ProcessOptionsX*<changelay>\relax
-\cpl@numexpr{cpl@cnt@a}{\z@}
-\cpl@numexpr{cpl@mem@c@page}{\z@}
+\cpl@csnumdef{cpl@cnt@a}{\z@}
+\cpl@csnumdef{cpl@mem@c@page}{\z@}
\def\cpl@xlabel{_x_}
\gdef\thecpl@mem@c@page{\the\c@page}
\long\def\cpl@afterelsefi#1\else#2\fi{\fi#1}
@@ -294,36 +303,21 @@
\fi
}
\ifcpl@logdefault
- \cpl@protected@write{16}{}{\cpl@print@defaultparams}
+ \AtBeginDocument{\cpl@protected@write{16}{}{\cpl@print@defaultparams}}
+\fi
+\ifcpl@logfinal
+ \AtEndDocument{\immediate\write16{\cpl@print@finalparams}}
\fi
-\AtEndDocument{%
- \ifcpl@logfinal
- \immediate\write16{\cpl@print@finalparams}
- \fi
-}
-\newrobustcmd\changetextlayout[1]{%
- \setkeys[KV]{changelay}{#1}%
- \setlength\textheight{\cpl@textheight}%
- \setlength\textwidth{\cpl@textwidth}%
- \setlength\evensidemargin{\cpl@evensidemargin}%
- \setlength\oddsidemargin{\cpl@oddsidemargin}%
- \setlength\columnsep{\cpl@columnsep}%
- \setlength\columnseprule{\cpl@columnseprule}%
- \cpl@changetext%
- \setlength\marginparwidth{\cpl@marginparwidth}%
- \setlength\marginparsep{\cpl@marginparsep}%
- \setlength{\footskip}{\cpl@footskip}
- \setlength{\skip\footins}{\cpl@footins}
-}
\newrobustcmd\changepagelayout[1]{%
\setkeys[KV]{changelay}{#1}%
+ \setlength\paperheight{\cpl@paperheight}%
+ \setlength\paperwidth{\cpl@paperwidth}%
\setlength\textheight{\cpl@textheight}%
\setlength\textwidth{\cpl@textwidth}%
\setlength\evensidemargin{\cpl@evensidemargin}%
\setlength\oddsidemargin{\cpl@oddsidemargin}%
\setlength\columnsep{\cpl@columnsep}%
\setlength\columnseprule{\cpl@columnseprule}%
- \cpl@changetext%
\setlength\topmargin{\cpl@topmargin}%
\setlength\headheight{\cpl@headheight}%
\setlength\headsep{\cpl@headsep}%
@@ -331,32 +325,20 @@
\setlength{\skip\footins}{\cpl@footins}
\setlength\marginparwidth{\cpl@marginparwidth}%
\setlength\marginparsep{\cpl@marginparsep}%
+ \setlength\marginparpush{\cpl@x@marginparpush}%
+ \cpl@changelayout%
}
-\newrobustcmd\adjusttextlayout[1]{%
- \setkeys[KV@X]{changelay}{#1}%
- \addtolength\textheight{\cpl@x@textheight}%
- \addtolength\textwidth{\cpl@x@textwidth}%
- \addtolength\evensidemargin{\cpl@x@evensidemargin}%
- \addtolength\oddsidemargin{\cpl@x@oddsidemargin}%
- \addtolength\columnsep{\cpl@x@columnsep}%
- \setlength\columnseprule{\cpl@x@columnseprule}%
- \cpl@changetext%
- \addtolength\topmargin{\cpl@x@topmargin}%
- \addtolength\headsep{\cpl@x@headsep}%
- \addtolength\marginparwidth{\cpl@x@marginparwidth}%
- \addtolength\marginparsep{\cpl@x@marginparsep}%
- \addtolength\footskip{\cpl@x@footskip}%
- \addtolength{\skip\footins}{\cpl@x@footins}
-}
+\cpl@glet\changetextlayout\changepagelayout
\newrobustcmd\adjustpagelayout[1]{%
\setkeys[KV@X]{changelay}{#1}%
+ \addtolength\paperheight{\cpl@x@paperheight}%
+ \addtolength\paperwidth{\cpl@x@paperwidth}%
\addtolength\textheight{\cpl@x@textheight}%
\addtolength\textwidth{\cpl@x@textwidth}%
\addtolength\evensidemargin{\cpl@x@evensidemargin}%
\addtolength\oddsidemargin{\cpl@x@oddsidemargin}%
\addtolength\columnsep{\cpl@x@columnsep}%
\setlength\columnseprule{\cpl@x@columnseprule}%
- \cpl@x@changetext%
\addtolength\topmargin{\cpl@x@topmargin}%
\addtolength\headheight{\cpl@x@headheight}%
\addtolength\headsep{\cpl@x@headsep}%
@@ -364,7 +346,10 @@
\setlength{\skip\footins}{\cpl@x@footins}%
\addtolength\marginparwidth{\cpl@x@marginparwidth}%
\addtolength\marginparsep{\cpl@x@marginparsep}%
+ \addtolength\marginparpush{\cpl@x@marginparpush}%
+ \cpl@changelayout%
}
+\cpl@glet\adjusttextlayout\adjustpagelayout
\newenvironment{cpl@adjustwidth}[2]{%
\begin{list}{}{%
\topsep=\z@%
@@ -375,7 +360,7 @@
\setlength\leftmargin{#1}%
\setlength\rightmargin{#2}%
}%
- \item[]}%
+ \item[]\ignorespaces}%
{\end{list}\ignorespacesafterend}
\newenvironment{cpl@adjustwidth*}[2]{%
\begin{list}{}{%
@@ -392,7 +377,7 @@
\setlength\leftmargin{#2}%
\setlength\rightmargin{#1}%
\fi
- }\item[]}%
+ }\item[]\ignorespaces}%
{\end{list}\ignorespacesafterend}
\newrobustcmd\adjusttextwidth[1]{%
\setkeys[KV]{changelay}{#1}%
@@ -406,8 +391,6 @@
\end{cpl@adjustwidth}\relax
\fi
}
-\newrobustcmd\resetdefault{%
- \setkeys[KV]{changelay}{reset=true}%
-}
+\newrobustcmd*\resetdefault{\setkeys[KV]{changelay}{reset=true}}
\endinput \ No newline at end of file