diff options
author | Karl Berry <karl@freefriends.org> | 2022-11-01 19:51:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-11-01 19:51:57 +0000 |
commit | 2c5c31bc18fa243494f2794216d5d5d07a46dc60 (patch) | |
tree | 5d42ec0a865f4f8772e1d46c387ddc77bbfe858d /Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty | |
parent | e05e175799230c3e1ed103bdb81196705716e8fc (diff) |
canoniclayout (1nov22)
git-svn-id: svn://tug.org/texlive/trunk@64889 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty | 206 |
1 files changed, 158 insertions, 48 deletions
diff --git a/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty b/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty index a88d26ac08d..e811e2967b3 100644 --- a/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty +++ b/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty @@ -7,26 +7,30 @@ %% canoniclayout.dtx (with options: `package') %% ______________________________________________________ %% The canoniclayout package for LaTeX -%% Copyright (C) 2010-2020 Claudio Beccari +%% Copyright (C) 2010 Claudio Beccari %% All rights reserved %% %% License information appended %% \NeedsTeXFormat{LaTeX2e}[2009/01/01] \ProvidesPackage{canoniclayout}% - [2020-04-09 v.0.5 Canonic layout circumscribed to a circle] + [2022/11/01 v.1.0 Text block height equal to paper width] +\IfFormatAtLeastTF{2022/06/01}{}{% +\PackageWarning{canoniclayout}{% +The format file is not suited\MessageBreak +for working with this package.\MessageBreak +This package is being skipped and \MessageBreak +its functionalities are not available +\expandafter\endinput} +\fi} -\IfFileExists{xfp.sty}{\RequirePackage{xfp}}{% -\PackageError{canoniclayout}{\MessageBreak% -The xfp package is not available\MessageBreak -and this package cannot work without\MessageBreak}{ -Reading of this package is skipped\MessageBreak -Expect a different layout form the canonical one\Messagebreak -Update your TeX system installation!\expandafter\endinput}} \@ifclassloaded{memoir}{% -\edef\CLshape{\fpeval{\paperwidth / \paperheight}} -\edef\CLinvshape{\fpeval{1/\CLshape}} +\AtBeginDocument{% +\dimen@=\dimexpr \p@ * \paperwidth / \paperheight\relax +\edef\CLshape{\strip@pt\dimen@} +\dimen@=\dimexpr \p@ * \p@ / \dimen@\relax +\edef\CLinvshape{\strip@pt\dimen@} \textheight=\paperwidth \settypeblocksize{\textheight}{*}{\CLshape} \setlrmargins{*}{*}{\CLinvshape} @@ -34,54 +38,160 @@ Update your TeX system installation!\expandafter\endinput}} \setmarginnotes{7pt}{\dimexpr \foremargin-3\marginparsep}{\onelineskip} \checkandfixthelayout -}{% -\newlength\innermargin -\newlength\outermargin -\newlength\uppermargin -\edef\CLpageratio{\fpeval{\paperwidth/\paperheight}} % x -\edef\CLlargeratio{\fpeval{(1-\CLpageratio)/(1+\CLpageratio)}} % y -\edef\CLsmallratio{\fpeval{\CLpageratio*\CLlargeratio}} % z -\textheight\paperwidth -\textwidth=\CLpageratio\textheight -\innermargin=\CLsmallratio\paperwidth -\outermargin=\CLlargeratio\paperwidth -\uppermargin=\CLsmallratio\paperheight -\marginparwidth=\fpeval{0.8\outermargin-\marginparsep}pt -\evensidemargin=\fpeval{\outermargin -(1in)}pt -\oddsidemargin=\fpeval{\innermargin-(1in)}pt -\topmargin=\fpeval{\uppermargin-(1in)-\headheight-\headsep}pt -\normalfont\textheight=% -\fpeval{round((\textheight - \topskip)/\baselineskip, 0) * \baselineskip + \topskip}pt% -\normalbaselineskip\baselineskip -}% end of test on the class being used +}}% memoir class end code; start code for standard classes +{\RequirePackage{etoolbox,pict2e}% +\AtEndPreamble{% +\unless\ifcsname color\endcsname \RequirePackage{xcolor}\fi +\newlength\CLinner \newlength\CLouter % new length registers +\newlength\CLtop \newlength\CLbottom % other new registers +\edef\CLx{\fpeval{\paperwidth/\paperheight}}% equation 1 +\edef\CLxx{\fpeval{(1-\CLx)/(1+\CLx)}}% for equations 2, 3, 4, 5, 9 +\CLinner=\fpeval{\paperwidth*\CLx*\CLxx}\p@% equation 2 +\CLouter=\fpeval{\paperwidth*\CLxx}\p@% equation 3 +\CLtop=\fpeval{\paperheight*\CLx*\CLxx}\p@% equation 4 +\CLbottom=\fpeval{\paperheight*\CLxx}\p@% equation 5 +\textwidth=\fpeval{\CLx*\paperwidth}\p@% equation 6 +\textheight=\paperwidth% equation 7 +\edef\CLcirclecenterX{\fpeval{\paperwidth/2}}% equation 8 +\edef\CLcirclecenterY{\fpeval{\CLxx*\paperheight+\paperwidth/2}}% eq. 9 +\let\CLcircleradius\CLcirclecenterX% equation 10 +\edef\CLcirclediameter{\strip@pt\paperwidth}% +\let\CLpageW\CLcirclediameter + +\normalsize +\headheight=\baselineskip +\headsep=\baselineskip +\footskip=2\baselineskip +\marginparsep=0.1\CLouter\relax +\marginparwidth=0.8\CLouter\relax +\topmargin=\dimexpr\CLtop-\headsep-\headheight-1in\relax +\oddsidemargin=\dimexpr\CLinner-1in \relax +\evensidemargin=\dimexpr\CLouter-1in \relax + +\edef\CLdiagX{\strip@pt\paperwidth}% diagonal horizontal component +\edef\CLdiagY{\strip@pt\paperheight}% diagonal vertical component +\let\@CLdrawing\relax% initially drawings are turned off +\edef\CLlly{-\expandafter\strip@pt% both pages corner ordinate + \dimexpr\paperheight-\CLtop+\headsep}% +\edef\CLllLx{-\strip@pt\CLouter}% lower left left-page corner abscissa +\edef\CLllRx{-\strip@pt\CLinner}% lower left right-page corner abscissa + +\newcommand*\CLstartdrawings{\let\@CLdrawing\CLdrawing} +\newcommand*\CLstopdrawings{\let\@CLdrawing\relax} + +\newcommand*\CLdrawing{% + \begin{picture}(0,0)\color{red}% + \unitlength=\p@ + \if@twoside + \ifodd\value{page}% + \put(\CLllRx,\CLlly){% right page: displaces the origin to the + \put(\CLcirclecenterX,\CLcirclecenterY){\circle{\CLcirclediameter}} + \put(\CLpageW,0){\line(-\CLdiagX,\CLdiagY){\CLpageW}} + } + \else + \put(\CLllLx,\CLlly){% left page: displaces the origin to the + \put(\CLcirclecenterX,\CLcirclecenterY){\circle{\CLcirclediameter}} + \put(0,0){\line(\CLdiagX,\CLdiagY){\CLpageW}} + } + \fi + \else + \put(\CLllRx,\CLlly){% one side: displaces the origin to the + \put(\CLcirclecenterX,\CLcirclecenterY){\circle{\CLcirclediameter}} + \put(\CLcirclecenterX,\CLcirclecenterY){% + \put(0,0){\line(\CLdiagX,\CLdiagY){\CLcircleradius}} + \put(0,0){\line(-\CLdiagX,-\CLdiagY){\CLcircleradius}} + } + } + \fi + \end{picture} +} +\def\ps@empty{% + \let\@mkboth\@gobbletwo + \def\@oddhead{\makebox[\textwidth][l]{{\@CLdrawing}}}\let\@oddfoot\@empty + \def\@evenheadhead{\makebox[\textwidth][l]{{\@CLdrawing}}} + \let\@evenfoot\@empty} +\def\ps@plain{\let\@mkboth\@gobbletwo + \def\@oddhead{\makebox[\textwidth][l]{{\@CLdrawing}}} + \def\@oddfoot{\reset@font\hfil\thepage\hfil} + \def\@evenheadhead{\makebox[\textwidth][l]{{\@CLdrawing}}} + \let\@evenfoot\@oddfoot} +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\@CLdrawing\thepage\hfil{\slshape\leftmark}}% + \def\@oddhead{\@CLdrawing{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markboth {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \@chapapp\ \thechapter. \ % + \fi + \fi + ##1}}{}}% + \def\sectionmark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\z@ + \thesection. \ % + \fi + ##1}}}} +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{\@CLdrawing{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \@chapapp\ \thechapter. \ % + \fi + \fi + ##1}}}} +\fi +\def\ps@myheadings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\@CLdrawing\thepage\hfil{\slshape\leftmark}}% + \def\@oddhead{\@CLdrawing{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\@gobbletwo + \let\chaptermark\@gobble + \let\sectionmark\@gobble + } + +}}% \newlength\abc@width -\settowidth\abc@width{abcdefghijklmnopqrstuvwxyz}% -\edef\CLcharcount{\fpeval{round(\textwidth * 26 / \abc@width,0)}} \newcommand*\currentfontletters{% +\settowidth\abc@width{abcdefghijklmnopqrstuvwxyz}\dimen0=26\p@ +\dimen0=\dimexpr \textwidth * \dimen0 / \abc@width \relax +\count254=\numexpr \dimen0 / \p@ \relax \par The number of characters in one text line with the current font is - \CLcharcount.\par} + \the\count254.\par} + \newcommand*\charactersperpage{% -\edef\CLlinesperpage{\fpeval{round(\textheight / \baselineskip,0)}} -\edef\CLcharsperpage{% - \fpeval{\CLcharcount * \CLlinesperpage}} -\begin{quote} The average number of characters in one text line - with the current font is \CLcharcount; - this text block contains \CLlinesperpage\ lines; +\settowidth\abc@width{abcdefghijklmnopqrstuvwxyz}\dimen0=26\p@ +\dimen0=\dimexpr \textwidth * \dimen0 / \abc@width \relax +\count254=\numexpr \dimen0 / \p@ \relax +\count252=\numexpr \textheight / \baselineskip \relax +\count250=\numexpr \count252 * \count254\relax +\quote The number of characters in one text line with the current + font is \the\count254;\\ + this text block contains \the\count252\ lines;\\ a rough estimate of the number of characters per page is - \CLcharsperpage.\par - This information may be useful to evaluate the total number - of pages in a document. -\end{quote}} - + \the\count250.\par + This might be used to estimate the total number of pages of + a document. +\endquote} +%% Copyright 2010 Claudio Beccari +%% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of %% this license is at: http://www.latex-project.org/lppl.txt %% -%% This work consists of this file canoniclayout.dtx, a README.txt file -%% and the derived files canoniclayout.sty and canoniclayout.pdf. +%% This work is "author-maintained" %% -%% This work is "maintained" +%% This work consists of this file canoniclayout.dtx, a README file +%% and the derived files canoniclayout.sty and canoniclayout.pdf. %% %% %% End of file `canoniclayout.sty'. |