diff options
author | Dr. Clea F. Rees <cfrees@imapmail.org> | 2009-08-07 00:47:53 +0000 |
---|---|---|
committer | Dr. Clea F. Rees <cfrees@imapmail.org> | 2009-08-07 00:47:53 +0000 |
commit | 921eeb0b738259b75265be9a429795031c68dca5 (patch) | |
tree | 48fd7db71f77acad3fba6a099d4f6d6147cae7c1 | |
parent | ca8bee56f70fcad8271efe91a6a2381ce841c115 (diff) |
changelayout new version
git-svn-id: svn://tug.org/texlive/trunk@14562 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/changelayout/changelayout-guide.pdf | bin | 60302 -> 62187 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/changelayout/changelayout-guide.tex | 87 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/changelayout/changelayout.sty | 241 |
3 files changed, 177 insertions, 151 deletions
diff --git a/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.pdf b/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.pdf Binary files differindex abc2060bce1..ad6e57c37fe 100644 --- a/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.pdf +++ b/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.pdf diff --git a/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.tex b/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.tex index f4dd60fa11c..cc031fabdd6 100644 --- a/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.tex +++ b/Master/texmf-dist/doc/latex/changelayout/changelayout-guide.tex @@ -1,11 +1,12 @@ +\RequirePackage{xkvltxp} \documentclass{article} -\usepackage{lipsum,comment} +\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} -% Many colors for future use: + 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;% @@ -17,11 +18,18 @@ 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% } -\csdef{temp1}{% +\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)}{% + \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, @@ -37,11 +45,15 @@ \end{center} \vspace*{2\baselineskip} } -\csdef{temp2}{\section*{Adjusted layout}\par\lipsum[1-2]} -\csdef{temp3}{{\flushright\section*{Adjusted layout}}% - \par\noindent\lipsum[1-2]} +\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} @@ -53,7 +65,7 @@ \end{comment} \adjusttextwidth{leftmargin=1.5cm,rightmargin=1.5cm,content=\csuse{temp1}} -\section*{Default layout (as set with {\tt geometry} package)} +\section*{Default layout (as set with \styb{geometry} package)} \lipsum[1-2] \begin{comment} @@ -71,12 +83,12 @@ content=\csuse{temp2}} \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 + 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{temp2}} + textcolor=xmagenta20,content=\csuse{temp3}} \newpage \lipsum[1-1] @@ -89,36 +101,36 @@ content=\csuse{temp2}} \end{comment} \adjusttextwidth{switchadjust,leftmargin=-0cm,rightmargin=-1.5cm, - textcolor=red,content=\csuse{temp3}} + 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 + (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 -\color{xgreen10} \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 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=515pt} -\section*{Changed layout} + textwidth=530pt} +\section*{Use of \cmda{\changetextlayout}} \lipsum[1-4] \normalcolor @@ -140,10 +152,10 @@ content=\csuse{temp2}} \end{comment} \begin{comment} - In addition to \changepagelayout and \changetextlayout, there are - also \adjustpagelayout and \adjusttextlayout (again these + 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 @@ -153,15 +165,16 @@ content=\csuse{temp2}} \color{xorange10} \adjusttextlayout{oddsidemargin=1cm, evensidemargin=-0cm, textheight=-50pt, textwidth=-50pt,topmargin=25pt} -\section*{Changed layout} +\section*{Use of \cmda{\adjusttextlayout}} \lipsum[1-4] \normalcolor \newpage \resetdefault% -%\color{xolive10} -\section*{Default layout (as set with {\tt geometry} package)} +\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] -%\normalcolor + \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/changelayout/changelayout.sty b/Master/texmf-dist/tex/latex/changelayout/changelayout.sty index eaad7ce5e2a..5eaf199fbfa 100644 --- a/Master/texmf-dist/tex/latex/changelayout/changelayout.sty +++ b/Master/texmf-dist/tex/latex/changelayout/changelayout.sty @@ -19,13 +19,13 @@ %++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++% \ProvidesPackage{changelayout}[2009/06/25 v0.1 Change page layout on the fly] \NeedsTeXFormat{LaTeX2e} -\RequirePackage{etoolbox} +\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}} -\let\cpl@xp\expandafter -\def\cpl@glet#1#2{\@ifdefinable#1{\global\let#1#2}} +\new\let\cpl@xp\expandafter \@ifclassloaded{memoir}{% \cpl@err{This package can't be used with\MessageBreak memoir class. I've therefore exited} @@ -51,19 +51,26 @@ }{} } \newrobustcmd*\cpl@numdef[2]{% - \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak + \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak to number}}{} - \ifundef{#1}{\newcount#1\relax #1=\z@\relax}{}% + \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 + \ifstrempty{#2}{\cpl@err{You can't assign empty argument\MessageBreak to dimension}}{} - \ifundef{#1}{\newdimen#1\relax #1=\z@\relax}{}% + \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% @@ -103,7 +110,7 @@ } \@onlypreamble\cpl@getdefaults\relax \AtEndPreamble{\cpl@getdefaults}% -\long\def\cpl@print@defaultparams{% +\newcommand\cpl@print@defaultparams{% ^^J*******************************************************^^J% Original page layout dimensions and booleans^^J% (changelayout package)^^J% @@ -133,7 +140,7 @@ *******************************************************^^J% }% \@onlypreamble\cpl@print@defaultparams\relax -\long\def\cpl@print@finalparams{% +\newcommand\cpl@print@finalparams{% ^^J+++++++++++++++++++++++++++++++++++++++++++++++++++++++^^J% Final page layout dimensions and booleans^^J% (changelayout package)^^J% @@ -188,38 +195,38 @@ \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} -\def\cpl@oddsidemargin{\oddsidemargin} -\def\cpl@topmargin{\topmargin} -\def\cpl@headheight{\headheight} -\def\cpl@headsep{\headsep} -\def\cpl@footskip{\footskip} -\def\cpl@footins{\skip\footins} -\def\cpl@topsep{\topsep} -\def\cpl@listparindent{\listparindent} -\def\cpl@parindent{\parindent} -\def\cpl@parsep{\parsep} -\def\cpl@parskip{\parskip} -\def\cpl@leftmargin{\leftmargin} -\def\cpl@rightmargin{\rightmargin} -\def\cpl@columnwidth{\columnwidth} -\def\cpl@columnsep{\columnsep} -\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} +\new\def\cpl@content{No content} +\new\def\cpl@paperheight{\paperheight} +\new\def\cpl@paperwidth{\paperwidth} +\new\def\cpl@textheight{\textheight} +\new\def\cpl@textwidth{\textwidth} +\new\def\cpl@evensidemargin{\evensidemargin} +\new\def\cpl@oddsidemargin{\oddsidemargin} +\new\def\cpl@topmargin{\topmargin} +\new\def\cpl@headheight{\headheight} +\new\def\cpl@headsep{\headsep} +\new\def\cpl@footskip{\footskip} +\new\def\cpl@footins{\skip\footins} +\new\def\cpl@topsep{\topsep} +\new\def\cpl@listparindent{\listparindent} +\new\def\cpl@parindent{\parindent} +\new\def\cpl@parsep{\parsep} +\new\def\cpl@parskip{\parskip} +\new\def\cpl@leftmargin{\leftmargin} +\new\def\cpl@rightmargin{\rightmargin} +\new\def\cpl@columnwidth{\columnwidth} +\new\def\cpl@columnsep{\columnsep} +\new\def\cpl@columnseprule{\columnseprule} +\new\def\cpl@marginparwidth{\marginparwidth} +\new\def\cpl@marginparsep{\marginparsep} +\new\def\cpl@marginparpush{\marginparpush} +\new\def\cpl@hoffset{\hoffset} +\new\def\cpl@voffset{\voffset} +\new\def\cpl@textcolor{black} \define@boolkey+[KV]{changelay}[cpl@]{reset}[true]{% - \cpl@backtodefaults}{\cpl@warn{Erroneous value for 'reset' ignored}} + \cpl@backtodefaults}{\cpl@err{Erroneous value for 'reset'}} \define@boolkeys[KV]{changelay}[cpl@]{switchadjust,logdefault,% - logfinal,strictcheck,oddpage}[true]{} + logfinal,strictcheck,oddpage}[true] \define@cmdkey[KV]{changelay}[cpl@]{content}[]{} \define@cmdkey[KV]{changelay}[cpl@]{textcolor}[black]{} \define@cmdkey[KV]{changelay}[cpl@]{paperheight}[\paperheight]{} @@ -248,28 +255,35 @@ \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{paperheight,paperwidth,textheight,textwidth,evensidemargin,% +\DeclareCmdListParser\cpl@csvloop{,} +\new\def\cpl@cmddo#1{\csdef{cpl@x@#1}{\z@}} +\new\def\cpl@list@a{% + 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% } +\new\def\cpl@definecmds{\begingroup% + \edef\@tempa{\endgroup\cpl@csvloop[\cpl@cmddo]\cpl@list@a}% + \@tempa% +} +\cpl@definecmds\undef{\cpl@list@a}\undef{\cpl@definecmds}% \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% + 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@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} +\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 @@ -280,7 +294,7 @@ \if@nobreak\ifvmode\nobreak\fi\fi } \ifcpl@strictcheck\if@filesw\cpl@afterelsefi - \def\cpl@mem@label#1{% + \new\def\cpl@mem@label#1{% \@bsphack \cpl@protected@write\@auxout{}% {\cpl@new@mem@label{#1}{\thecpl@mem@c@page}}% @@ -289,107 +303,106 @@ \else \cpl@err{nofiles: I need to write in the .aux file} \fi\fi -\def\cpl@new@mem@label#1#2{\csgdef{m@#1}{#2}} -\def\cpl@mem@labelref#1{0\csuse{m@#1}} -\newrobustcmd\checkifoddpage{% +\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% - \ifcpl@strictcheck - \global\advance\cpl@cnt@a\@ne + \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 - \else + }{% \ifodd\c@page\cpl@oddpagetrue\fi - \fi + }% } -\ifcpl@logdefault - \AtBeginDocument{\cpl@protected@write{16}{}{\cpl@print@defaultparams}} -\fi -\ifcpl@logfinal - \AtEndDocument{\immediate\write16{\cpl@print@finalparams}} -\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}% - \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}% - \setlength\topmargin{\cpl@topmargin}% - \setlength\headheight{\cpl@headheight}% - \setlength\headsep{\cpl@headsep}% - \setlength\footskip{\cpl@footskip}% - \setlength{\skip\footins}{\cpl@footins} - \setlength\marginparwidth{\cpl@marginparwidth}% - \setlength\marginparsep{\cpl@marginparsep}% - \setlength\marginparpush{\cpl@x@marginparpush}% + \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% } -\cpl@glet\changetextlayout\changepagelayout +\new\global\let\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}% - \addtolength\topmargin{\cpl@x@topmargin}% - \addtolength\headheight{\cpl@x@headheight}% - \addtolength\headsep{\cpl@x@headsep}% - \addtolength\footskip{\cpl@x@footskip}% - \setlength{\skip\footins}{\cpl@x@footins}% - \addtolength\marginparwidth{\cpl@x@marginparwidth}% - \addtolength\marginparsep{\cpl@x@marginparsep}% - \addtolength\marginparpush{\cpl@x@marginparpush}% + \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% } -\cpl@glet\adjusttextlayout\adjustpagelayout +\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}{}{% - \topsep=\z@% - \partopsep=\z@% - \listparindent=\parindent% - \parsep=\parskip% - \itemsep=\z@% + \cpl@listparams% \setlength\leftmargin{#1}% \setlength\rightmargin{#2}% }% \item[]\ignorespaces}% -{\end{list}\ignorespacesafterend} +{\end{list}\@ignoretrue} \newenvironment{cpl@adjustwidth*}[2]{% \begin{list}{}{% - \topsep=\z@% - \partopsep=\z@% - \listparindent=\parindent% - \parsep=\parskip% - \itemsep=\z@% - \checkifoddpage% - \ifcpl@oddpage + \cpl@listparams% + \cpl@checkifoddpage% + \ifbool{cpl@oddpage}{% \setlength\leftmargin{#1}% \setlength\rightmargin{#2}% - \else + }{% \setlength\leftmargin{#2}% \setlength\rightmargin{#1}% - \fi + }% }\item[]\ignorespaces}% -{\end{list}\ignorespacesafterend} +{\end{list}\@ignoretrue} \newrobustcmd\adjusttextwidth[1]{% \setkeys[KV]{changelay}{#1}% - \ifcpl@switchadjust + \ifbool{cpl@switchadjust}{% \begin{cpl@adjustwidth*}{\cpl@leftmargin}{\cpl@rightmargin}% \textcolor{\cpl@textcolor}{\cpl@content}% \end{cpl@adjustwidth*}\relax - \else + }{% \begin{cpl@adjustwidth}{\cpl@leftmargin}{\cpl@rightmargin}% \textcolor{\cpl@textcolor}{\cpl@content}% \end{cpl@adjustwidth}\relax - \fi + } } \newrobustcmd*\resetdefault{\setkeys[KV]{changelay}{reset=true}} |