diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/changelayout |
Initial commit
Diffstat (limited to 'macros/latex/contrib/changelayout')
-rw-r--r-- | macros/latex/contrib/changelayout/README | 18 | ||||
-rw-r--r-- | macros/latex/contrib/changelayout/changelayout-guide.pdf | bin | 0 -> 62531 bytes | |||
-rw-r--r-- | macros/latex/contrib/changelayout/changelayout-guide.tex | 180 | ||||
-rw-r--r-- | macros/latex/contrib/changelayout/changelayout.sty | 382 |
4 files changed, 580 insertions, 0 deletions
diff --git a/macros/latex/contrib/changelayout/README b/macros/latex/contrib/changelayout/README new file mode 100644 index 0000000000..54c9656af0 --- /dev/null +++ b/macros/latex/contrib/changelayout/README @@ -0,0 +1,18 @@ +This is the README file for 'changelayout' package. + +This package is an extension of Peter Wilson's 'changepage' package. +It can be used to change text and page layout parameters locally +(per page) or globally (for the whole document). The original +layout parameters can be recovered at any time during runtime. + +Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). + +This work may be distributed and/or modified for commercial +and non-commercial purposes. + +The LPPL maintenance status of this software is 'author-maintained'. + +This software is provided 'as it is', without warranty of any +kind, either expressed or implied, including, but not limited to, +the implied warranties of merchantability and fitness for a +particular purpose.
\ No newline at end of file diff --git a/macros/latex/contrib/changelayout/changelayout-guide.pdf b/macros/latex/contrib/changelayout/changelayout-guide.pdf Binary files differnew file mode 100644 index 0000000000..5a7ce96f22 --- /dev/null +++ b/macros/latex/contrib/changelayout/changelayout-guide.pdf diff --git a/macros/latex/contrib/changelayout/changelayout-guide.tex b/macros/latex/contrib/changelayout/changelayout-guide.tex new file mode 100644 index 0000000000..cdd590d757 --- /dev/null +++ b/macros/latex/contrib/changelayout/changelayout-guide.tex @@ -0,0 +1,180 @@ +\RequirePackage{xkvltxp}
+\documentclass{article}
+\usepackage{comment,xspace,lipsum}
+\usepackage[left=3cm,right=3cm]{geometry}
+\usepackage[logdefault,logfinal,strictcheck]{changelayout}
+\usepackage{hyperref}
+\hypersetup{colorlinks=true,linkcolor=red,pdfpagemode=UseThumbs,
+ implicit=true,breaklinks=true,citecolor=purple,pdfview=FitH,
+ pdfstartview=FitH}
+\xglobal\preparecolorset{rgb}{x}{0}{%
+ red1,1.00,0.31,0.31;red2,1.00,0.32,0.33;%
+ green1,0.00,0.50,0.00;green2,0.00,0.50,0.25;%
+ blue1,0.00,0.00,1.00;blue2,0.00,0.00,0.63;%
+ blue3,0.00,0.50,1.00;blue4,0.00,0.50,0.75;%
+ cyan1,0.50,0.84,1.00;magenta1,0.50,0.00,0.50;%
+ magenta2,0.50,0.00,1.00;magenta3,1.00,0.38,1.00;%
+ purple1,0.50,0.00,0.25;purple2,0.50,0.00,0.50;%
+ olive1,0.50,0.50,0.00;orange1,1.00,0.50,0.25;%
+ yellow1,1.00,1.00,0.00;yellow2,1.00,1.00,0.70%
+}
+\new\let\TC\textcolor
+\newrobustcmd*\stya[1]{\TC{xgreen10}{\texttt{#1}}\xspace}
+\newrobustcmd*\styb[1]{\TC{teal}{\texttt{#1}}\xspace}
+\newrobustcmd*\cmda[1]{\begingroup
+ \escapechar=92\endgroup\TC{xgreen10}{\texttt{\string#1}}\xspace}
+\newrobustcmd*\cmdb[1]{\begingroup
+ \escapechar=92\endgroup\TC{teal}{\texttt{\string#1}}\xspace}
+\long\csdef{temp1}{%
+ \begin{center}
+ \makebox[0pt]{\fboxrule2pt%
+ \fcolorbox{xred10}{xyellow20}{%
+ \parbox{\dimexpr\hsize-3cm}{%
+ This package is an extension of Peter Wilson's {\tt changepage} package.
+ \par\medskip
+ This package can be used with the \texttt{geometry} package,
+ but not with any \texttt{memoir} class. I used the \texttt{geometry}
+ package in the source file of this document.
+ \par\medskip
+ All page and text layout parameters can be changed for each
+ page using the macros illustrated in the source file of
+ this document. Please see the comments in the source file.
+ \par\medskip
+ This is a preliminary user guide; a more detailed manual
+ is in the works.}}}
+ \end{center}
+ \vspace*{2\baselineskip}
+}
+\long\csdef{temp2}{\section*{Use of \cmda{\adjusttextwidth}
+ \\--- with text extending into both margins}\par\lipsum[1-2]}
+\long\csdef{temp3}{\section*{Use of \cmda{\adjusttextwidth}
+ with \cmda{switchadjust}}\par\noindent\lipsum[1-2]}
+\long\csdef{temp4}{{\flushright\section*{Use of \cmda{\adjusttextwidth}
+ with \cmda{switchadjust}}}\par\noindent\lipsum[1-2]}
+
+\begin{document}
+
+\title{The {\tt changelayout} Package}
+\author{Ahmed Musa\\[.5ex]University of Central Lancashire\\
+ Preston, United Kingdom\\[1ex]\url{a.musa@rocketmail.com}
+}
+\maketitle
+
+\begin{comment}
+ Make text width smaller by 3cm (1.5cm into each margin):
+\end{comment}
+\adjusttextwidth{leftmargin=1.5cm,rightmargin=1.5cm,content=\csuse{temp1}}
+
+\section*{Default layout (as set with \styb{geometry} package)}
+\lipsum[1-2]
+
+\begin{comment}
+ Make text width wider by 2cm (1cm into each margin):
+\end{comment}
+\adjusttextwidth{leftmargin=-1cm,rightmargin=-1cm,textcolor=blue,
+content=\csuse{temp2}}
+
+\section*{Default layout}
+\lipsum[1-2]
+
+\newpage
+\lipsum[1-1]
+
+\begin{comment}
+ Make text width wider into right margin by 1.5cm on odd pages.
+ 'switchadjust' is a boolean for switching left and right margins on
+ odd and even pages. This is useful for twoside printing, where
+ the user may want the text extended only into outer margins:
+\end{comment}
+
+\adjusttextwidth{switchadjust=true,leftmargin=-0cm,rightmargin=-1.5cm,
+ textcolor=xmagenta20,content=\csuse{temp3}}
+
+\newpage
+\lipsum[1-1]
+
+\begin{comment}
+ Make text width wider into right margin by 1.5cm, but
+ 'switchadjust=true' means that it is actually the left margin
+ that is made wider on even pages. If the value of 'switchadjust'
+ is 'true', you can simply enter 'switchadjust' without value:
+\end{comment}
+
+\adjusttextwidth{switchadjust,leftmargin=-0cm,rightmargin=-1.5cm,
+ textcolor=red,content=\csuse{temp4}}
+
+\begin{comment}
+ 'strictcheck' is a boolean for enforcing strict page number check
+ (the idea is from the 'changepage' package). See the
+ \usepackage{changelayout} statement above.
+ Strict page checking is a safeguard against unlikely changes
+ to the kernel page counter by another macro or package. For a
+ large document, 'strictcheck' will generate a correspondingly
+ large number of labels. This is not expected to be a problem
+ with modern implementations of TeX/LaTeX; so I decided to
+ retain it.
+\end{comment}
+
+\newpage
+\begin{comment}
+ The layout of individual pages can be changed by using
+ \changepagelayout or \changetextlayout (they are synonymous).
+
+ Both \changetextlayout and \changepagelayout replace (in the
+ total sense) the prevailing text/page layout parameters by the
+ values submitted by the user through these macros. All the page
+ layout parameters (including \marginpar parameters) can be
+ changed/replaced by simply submitting (via these macros)
+ the new parameter values.
+\end{comment}
+\color{xpurple10}
+\changetextlayout{oddsidemargin=-1cm,evensidemargin=0cm,textheight=550pt,
+ textwidth=530pt}
+\section*{Use of \cmda{\changetextlayout}}
+\lipsum[1-4]
+\normalcolor
+
+\newpage
+\resetdefault%
+
+\begin{comment}
+ \resetdefault is a command for resetting page/text layout parameters
+ to the default values. The default parameters are saved at each run.
+ If the 'geometry' package is loaded, the default parameters will be
+ those determined by 'geometry'. \resetdefault is very handy for
+ recovering from page/text layout changes.
+
+ The original and final layout parameters are written into the log
+ file (and displayed on the screen) if the user issues the booleans
+ 'logdefault' and 'logfinal' (respectively) as options to the
+ package (preferably at \usepackage). These may be useful when deciding
+ on the changes or adjustments to be effected.
+\end{comment}
+
+\begin{comment}
+ In addition to \changepagelayout and \changetextlayout, there are
+ also \adjustpagelayout and \adjusttextlayout (again these
+ are synonymous).
+
+ Both \adjustpagelayout and \adjusttextlayout adjust (by adding to or
+ subtracting from) the prevailing text/page layout parameters the
+ values given by the user. All the text and page layout parameters
+ can be 'adjusted' by using these macros.
+\end{comment}
+
+\color{xorange10}
+\adjusttextlayout{oddsidemargin=1cm, evensidemargin=-0cm, textheight=-50pt,
+ textwidth=-50pt,topmargin=25pt}
+\section*{Use of \cmda{\adjusttextlayout}}
+\lipsum[1-4]
+\normalcolor
+
+\newpage
+\resetdefault%
+\section*{Default layout --- obtained by issuing \cmda{\resetdefault}}
+\textbf{\large The default is as set initially using the \styb{geometry} package.}
+\par\medskip
+\lipsum[1-4]
+
+
+\end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/changelayout/changelayout.sty b/macros/latex/contrib/changelayout/changelayout.sty new file mode 100644 index 0000000000..6d18afa673 --- /dev/null +++ b/macros/latex/contrib/changelayout/changelayout.sty @@ -0,0 +1,382 @@ +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +% This is file 'changelayout.sty', version 0.1. % +% % +% This package can be used to change page and text layout on the fly, % +% (ie, for specific pages, and, of course, for the entire document). % +% It is an extension of Peter Wilson's 'changepage' package. % +% % +% Copyright (c) 2009 Ahmed Musa (a.musa@rocketmail.com). % +% % +% This work may be distributed and/or modified for commercial and % +% non-commercial purposes. % +% % +% The LPPL maintenance status of this software is 'author-maintained'. % +% % +% This software is provided 'as it is', without warranty of any kind, % +% either expressed or implied, including, but not limited to, the % +% implied warranties of merchantability and fitness for a particular % +% purpose. % +%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% +\ProvidesPackage{changelayout}[2009/10/07 v0.1 Change page layout on the fly] +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{etextools} +\RequirePackage{xkeyval} +\RequirePackage{ltxnew} +\newrobustcmd\cpl@warn[1]{\PackageWarningNoLine{changelayout}{#1}} +\newrobustcmd\cpl@info[1]{\PackageInfo{changelayout}{#1\@gobble}} +\newrobustcmd\cpl@err[1]{\PackageError{changelayout}{#1}{\@ehc}} +\new\let\cpl@xp\expandafter +\@ifclassloaded{memoir}{% + \cpl@err{This package can't be used with\MessageBreak + memoir class. I've therefore exited} + \cpl@xp\endinput% +}{} +\@ifpackageloaded{xcolor}{% + \cpl@info{You've already loaded 'xcolor'\MessageBreak + package with options that possibly\MessageBreak + differ from my options.\MessageBreak + I've not reloaded 'xcolor'} +}{% + \RequirePackage[dvipsnames*,svgnames*,x11names*,table,hyperref]{xcolor} + \cpl@info{'xcolor' package loaded with\MessageBreak + options 'dvipsnames*', 'svgnames*',\MessageBreak + 'x11names*', 'table', 'hyperref'} +} +\AtEndPreamble{% + \@ifpackageloaded{changepage}{% + \cpl@err{This package is a replacement for\MessageBreak + 'changepage' package.\MessageBreak + It can't be used with 'changepage'} + \cpl@xp\endinput% + }{} +} +\newrobustcmd*\cpl@numdef[2]{% + \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak + to number}}{} + \ifundef{#1}{\new\count#1\relax #1=\z@\relax}{}% + #1=\numexpr#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}{\new\dimen#1\relax #1=\z@\relax}{}% + #1=\dimexpr#2\relax +} +\newrobustcmd*\cpl@csdimdef[1]{\cpl@xp\cpl@dimdef\csname#1\endcsname} +\newrobustcmd*\cpl@dimadd[2]{% + \ifstrempty{#2}{\cpl@err{Why do you want to add empty\MessageBreak + argument to dimension?}}{} + \ifundef{#1}{\cpl@err{You can't add to undefined dimension}}{} + #1=\dimexpr#1+#2\relax +} +\newrobustcmd*\cpl@csdimadd[1]{\cpl@xp\cpl@dimadd\csname#1\endcsname} +\newrobustcmd\cpl@changelayout{% + \@colht=\textheight% + \@colroom=\textheight% + \vsize=\textheight% + \columnwidth=\textwidth% + \if@twocolumn + \cpl@csdimdef{dimen@}{(\columnwidth-\columnsep)/2} + \columnwidth=\dimen@% + \@firstcolumntrue + \fi + \hsize=\columnwidth% + \linewidth=\hsize% +} +\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@getdefaults\relax +\AtEndPreamble{\cpl@getdefaults}% +\newcommand\cpl@print@defaultparams{% + ^^J*******************************************************^^J% + Original page layout dimensions and booleans^^J% + (changelayout package)^^J% + \string\paperwidth\space\space\the\cpl@orig@paperwidth^^J% + \string\paperheight\space\space\the\cpl@orig@paperheight^^J% + \string\textwidth\space\space\the\cpl@orig@textwidth^^J% + \string\textheight\space\space\the\cpl@orig@textheight^^J% + \string\oddsidemargin\space\space\the\cpl@orig@oddsidemargin^^J% + \string\evensidemargin\space\space\the\cpl@orig@evensidemargin^^J% + \string\topmargin\space\space\the\cpl@orig@topmargin^^J% + \string\headheight\space\space\the\cpl@orig@headheight^^J% + \string\headsep\space\space\the\cpl@orig@headsep^^J% + \string\footskip\space\space\the\cpl@orig@footskip^^J% + \string\marginparwidth\space\space\the\cpl@orig@marginparwidth^^J% + \string\marginparsep\space\space\the\cpl@orig@marginparsep^^J% + \string\columnsep\space\space\the\cpl@orig@columnsep^^J% + \string\columnseprule\space\space\the\cpl@orig@columnseprule^^J% + \string\skip\string\footins\space\space\the\cpl@orig@footins^^J% + \string\hoffset\space\space\the\cpl@orig@hoffset^^J% + \string\voffset\space\space\the\cpl@orig@voffset^^J% + \string\mag\space\space\the\cpl@orig@mag^^J% + \if@twocolumn\string\@twocolumntrue\space\fi% + \if@twoside\string\@twosidetrue\space\fi% + \if@mparswitch\string\@mparswitchtrue\space\fi% + \if@reversemargin\string\@reversemargintrue\space\fi^^J% + (1in=72.27pt, 1cm=28.45pt)^^J% + *******************************************************^^J% +}% +\@onlypreamble\cpl@print@defaultparams\relax +\newcommand\cpl@print@finalparams{% + ^^J+++++++++++++++++++++++++++++++++++++++++++++++++++++++^^J% + Final page layout dimensions and booleans^^J% + (changelayout package)^^J% + \string\paperwidth\space\space\the\paperwidth^^J% + \string\paperheight\space\space\the\paperheight^^J% + \string\textwidth\space\space\the\textwidth^^J% + \string\textheight\space\space\the\textheight^^J% + \string\oddsidemargin\space\space\the\oddsidemargin^^J% + \string\evensidemargin\space\space\the\evensidemargin^^J% + \string\topmargin\space\space\the\topmargin^^J% + \string\headheight\space\space\the\headheight^^J% + \string\headsep\space\space\the\headsep^^J% + \string\footskip\space\space\the\footskip^^J% + \string\marginparwidth\space\space\the\marginparwidth^^J% + \string\marginparsep\space\space\the\marginparsep^^J% + \string\columnsep\space\space\the\columnsep^^J% + \string\columnseprule\space\space\the\columnseprule^^J% + \string\skip\string\footins\space\space\the\footins^^J% + \string\hoffset\space\space\the\hoffset^^J% + \string\voffset\space\space\the\voffset^^J% + \string\mag\space\space\the\mag^^J% + \if@twocolumn\string\@twocolumntrue\space\fi% + \if@twoside\string\@twosidetrue\space\fi% + \if@mparswitch\string\@mparswitchtrue\space\fi% + \if@reversemargin\string\@reversemargintrue\space\fi^^J% + (1in=72.27pt, 1cm=28.45pt)^^J% + +++++++++++++++++++++++++++++++++++++++++++++++++++++++^^J% +}% +\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% +} +\define@boolkey+[KV]{changelay}[cpl@]{reset}[true]{% + \ifcpl@reset\cpl@backtodefaults\fi% + }{\cpl@err{Erroneous value for 'reset'}} +\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]{} +\define@cmdkey[KV]{changelay}[cpl@]{oddsidemargin}[\oddsidemargin]{} +\define@cmdkey[KV]{changelay}[cpl@]{topmargin}[\topmargin]{} +\define@cmdkey[KV]{changelay}[cpl@]{headheight}[\headheight]{} +\define@cmdkey[KV]{changelay}[cpl@]{headsep}[\headsep]{} +\define@cmdkey[KV]{changelay}[cpl@]{footskip}[\footskip]{} +\define@cmdkey[KV]{changelay}[cpl@]{footins}[\skip\footins]{} +\define@cmdkey[KV]{changelay}[cpl@]{topsep}[\topsep]{} +\define@cmdkey[KV]{changelay}[cpl@]{listparindent}[\parindent]{} +\define@cmdkey[KV]{changelay}[cpl@]{parindent}[\parindent]{} +\define@cmdkey[KV]{changelay}[cpl@]{parsep}[\parsep]{} +\define@cmdkey[KV]{changelay}[cpl@]{parskip}[\parskip]{} +\define@cmdkey[KV]{changelay}[cpl@]{leftmargin}[\leftmargin]{} +\define@cmdkey[KV]{changelay}[cpl@]{rightmargin}[\rightmargin]{} +\define@cmdkey[KV]{changelay}[cpl@]{columnwidth}[\columnwidth]{} +\define@cmdkey[KV]{changelay}[cpl@]{columnsep}[\columnsep]{} +\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]{} +\define@cmdkeys[KV@X]{changelay}[cpl@x@]{% + 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[KV]<changelay>[switchadjust,logdefault,logfinal, + strictcheck,oddpage]{content,textcolor, + 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 +} +\ProcessOptionsX*<changelay>\relax +\setkeys[KV@X]{changelay}{% + 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 +} +\cpl@csnumdef{cpl@cnt@a}{\z@} +\cpl@csnumdef{cpl@mem@c@page}{\z@} +\new\def\cpl@xlabel{_x_} +\new\gdef\thecpl@mem@c@page{\the\c@page} +\new\long\def\cpl@afterelsefi#1\else#2\fi{\fi#1} +\newrobustcmd\cpl@protected@write[3]{% + \begingroup + \let\thecpl@mem@c@page\relax + #2% + \let\protect\@unexpandable@protect + \csedef{@tempa}{\write#1{#3}}\@tempa% + \endgroup + \if@nobreak\ifvmode\nobreak\fi\fi +} +\ifcpl@strictcheck\if@filesw\cpl@afterelsefi + \new\def\cpl@mem@label#1{% + \@bsphack + \cpl@protected@write\@auxout{}% + {\cpl@new@mem@label{#1}{\thecpl@mem@c@page}}% + \@esphack + } +\else + \cpl@err{nofiles: I need to write to .aux file} +\fi\fi +\new\def\cpl@new@mem@label#1#2{\csgdef{m@#1}{#2}} +\new\def\cpl@mem@labelref#1{0\csuse{m@#1}} +\newrobustcmd\cpl@checkifoddpage{% + \cpl@oddpagefalse% + \ifbool{cpl@strictcheck}{% + \global\advance\cpl@cnt@a\@ne\relax + \cpl@mem@label{\cpl@xlabel\the\cpl@cnt@a}% + \cpl@mem@c@page=\cpl@mem@labelref{\cpl@xlabel\the\cpl@cnt@a}\relax + \ifodd\cpl@mem@c@page\cpl@oddpagetrue\fi + }{% + \ifodd\c@page\cpl@oddpagetrue\fi + }% +} +\ifbool{cpl@logdefault}{% + \AtBeginDocument{\immediate\write-1{\cpl@print@defaultparams}} +}{} +\ifbool{cpl@logfinal}{% + \AtEndDocument{\immediate\write-1{\cpl@print@finalparams}} +}{} +\newrobustcmd\changepagelayout[1]{% + \setkeys[KV]{changelay}{#1}% + \cpl@dimdef{\paperheight}{\cpl@paperheight}% + \cpl@dimdef{\paperwidth}{\cpl@paperwidth}% + \cpl@dimdef{\textheight}{\cpl@textheight}% + \cpl@dimdef{\textwidth}{\cpl@textwidth}% + \cpl@dimdef{\evensidemargin}{\cpl@evensidemargin}% + \cpl@dimdef{\oddsidemargin}{\cpl@oddsidemargin}% + \cpl@dimdef{\columnsep}{\cpl@columnsep}% + \cpl@dimdef{\columnseprule}{\cpl@columnseprule}% + \cpl@dimdef{\topmargin}{\cpl@topmargin}% + \cpl@dimdef{\headheight}{\cpl@headheight}% + \cpl@dimdef{\headsep}{\cpl@headsep}% + \cpl@dimdef{\footskip}{\cpl@footskip}% + \cpl@dimdef{\skip\footins}{\cpl@footins}% + \cpl@dimdef{\marginparwidth}{\cpl@marginparwidth}% + \cpl@dimdef{\marginparsep}{\cpl@marginparsep}% + \cpl@dimdef{\marginparpush}{\cpl@x@marginparpush}% + \cpl@changelayout% +} +\new\global\let\changetextlayout\changepagelayout +\newrobustcmd\adjustpagelayout[1]{% + \setkeys[KV@X]{changelay}{#1}% + \cpl@dimadd{\paperheight}{\cpl@x@paperheight}% + \cpl@dimadd{\paperwidth}{\cpl@x@paperwidth}% + \cpl@dimadd{\textheight}{\cpl@x@textheight}% + \cpl@dimadd{\textwidth}{\cpl@x@textwidth}% + \cpl@dimadd{\evensidemargin}{\cpl@x@evensidemargin}% + \cpl@dimadd{\oddsidemargin}{\cpl@x@oddsidemargin}% + \cpl@dimadd{\columnsep}{\cpl@x@columnsep}% + \cpl@dimadd{\columnseprule}{\cpl@x@columnseprule}% + \cpl@dimadd{\topmargin}{\cpl@x@topmargin}% + \cpl@dimadd{\headheight}{\cpl@x@headheight}% + \cpl@dimadd{\headsep}{\cpl@x@headsep}% + \cpl@dimadd{\footskip}{\cpl@x@footskip}% + \cpl@dimadd{\skip\footins}{\cpl@x@footins}% + \cpl@dimadd{\marginparwidth}{\cpl@x@marginparwidth}% + \cpl@dimadd{\marginparsep}{\cpl@x@marginparsep}% + \cpl@dimadd{\marginparpush}{\cpl@x@marginparpush}% + \cpl@changelayout% +} +\new\global\let\adjusttextlayout\adjustpagelayout +\new\def\cpl@listparams{% + \topsep=\z@% + \partopsep=\z@% + \listparindent=\parindent% + \parsep=\parskip% + \itemsep=\z@% +} +\newenvironment{cpl@adjustwidth}[2]{% + \begin{list}{}{% + \cpl@listparams% + \setlength\leftmargin{#1}% + \setlength\rightmargin{#2}% + }% + \item[]\ignorespaces}% +{\end{list}\@ignoretrue} +\newenvironment{cpl@adjustwidth*}[2]{% + \begin{list}{}{% + \cpl@listparams% + \cpl@checkifoddpage% + \ifbool{cpl@oddpage}{% + \setlength\leftmargin{#1}% + \setlength\rightmargin{#2}% + }{% + \setlength\leftmargin{#2}% + \setlength\rightmargin{#1}% + }% + }\item[]\ignorespaces}% +{\end{list}\@ignoretrue} +\newrobustcmd\adjusttextwidth[1]{% + \setkeys[KV]{changelay}{#1}% + \ifbool{cpl@switchadjust}{% + \begin{cpl@adjustwidth*}{\cpl@leftmargin}{\cpl@rightmargin}% + \textcolor{\cpl@textcolor}{\cpl@content}% + \end{cpl@adjustwidth*}\relax + }{% + \begin{cpl@adjustwidth}{\cpl@leftmargin}{\cpl@rightmargin}% + \textcolor{\cpl@textcolor}{\cpl@content}% + \end{cpl@adjustwidth}\relax + } +} +\newrobustcmd*\resetdefault{\setkeys[KV]{changelay}{reset=true}} + +\endinput
\ No newline at end of file |