%%
%% This is file `canoniclayout.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% canoniclayout.dtx  (with options: `package')
%%   ______________________________________________________
%%   The canoniclayout package for LaTeX
%%   Copyright (C) 2010-2020 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]


\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}}
\textheight=\paperwidth
\settypeblocksize{\textheight}{*}{\CLshape}
\setlrmargins{*}{*}{\CLinvshape}
\setulmargins{*}{*}{\CLinvshape}
\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
\newlength\abc@width
\settowidth\abc@width{abcdefghijklmnopqrstuvwxyz}%
\edef\CLcharcount{\fpeval{round(\textwidth * 26 / \abc@width,0)}}
\newcommand*\currentfontletters{%
\par The number of characters in one text line with the current font is
    \CLcharcount.\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;
    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}}


%% 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 "maintained"
%% 
%%
%% End of file `canoniclayout.sty'.
