summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-04-11 22:21:31 +0000
committerKarl Berry <karl@freefriends.org>2020-04-11 22:21:31 +0000
commit2ce8fab99cc0add24a98b8765b5324aa0fa3f573 (patch)
treef199ca9052135cd022a1a8e8b26ccd58aed17cd0 /Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
parent9ba05f7c343e9c9ef750fc1cc4a49049e29de19c (diff)
canoniclayout (10apr20)
git-svn-id: svn://tug.org/texlive/trunk@54653 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.sty101
1 files changed, 40 insertions, 61 deletions
diff --git a/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty b/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
index 915dc3b0d5b..a88d26ac08d 100644
--- a/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
+++ b/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
@@ -7,33 +7,26 @@
%% canoniclayout.dtx (with options: `package')
%% ______________________________________________________
%% The canoniclayout package for LaTeX
-%% Copyright (C) 2010-2011 Claudio Beccari
+%% Copyright (C) 2010-2020 Claudio Beccari
%% All rights reserved
%%
%% License information appended
%%
\NeedsTeXFormat{LaTeX2e}[2009/01/01]
\ProvidesPackage{canoniclayout}%
- [2011/11/05 v.0.3 Canonic layout circumscribed to a circle]
+ [2020-04-09 v.0.5 Canonic layout circumscribed to a circle]
-\expandafter\ifx\csname eTeXversion\endcsname\relax
-\PackageWarning{canoniclayout}{%
-The typesetting engine is not suited\Messagebreak
-for working in extended mode.\Messagebreak}
-This package is being skipped}
-\expandafter\endinput
-\fi
-\ifnum\eTeXversion>\z@\else
-\PackageWarning{canoniclayout}{%
-The typesetting engine is not working in extended mode.\MessageBreak
-This package is being skipped}
-\expandaftter\endinput
-\fi
-\@ifclassloaded{memoir}{% }% balancing brace
-\dimen@=\dimexpr \p@ * \paperwidth / \paperheight\relax
-\edef\CLshape{\strip@pt\dimen@}
-\dimen@=\dimexpr \p@ * \p@ / \dimen@\relax
-\edef\CLinvshape{\strip@pt\dimen@}
+
+\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}
@@ -45,64 +38,50 @@ This package is being skipped}
\newlength\innermargin
\newlength\outermargin
\newlength\uppermargin
-\dimendef\CLpageratio=1256% x=b/h
-\dimendef\CLsmallratio=1258% z=x*y
-\dimendef\CLlargeratio=1260% y=(1-x)/(1+x)
-\CLpageratio=\dimexpr \p@*\paperwidth/\paperheight\relax % x
-\CLlargeratio=\dimexpr \p@*(\p@-\CLpageratio)/(\p@+\CLpageratio)\relax % y
-\CLsmallratio=\dimexpr \CLpageratio*\CLlargeratio/\p@\relax % z
-\edef\CL@pageratio{\strip@pt\CLpageratio}
-\edef\CL@smallratio{\strip@pt\CLsmallratio}
-\edef\CL@largeratio{\strip@pt\CLlargeratio}
-\textheight\paperwidth% altezza griglia
-\textwidth=\CL@pageratio\textheight
-\innermargin=\CL@smallratio\paperwidth
-\outermargin=\CL@largeratio\paperwidth
-\uppermargin=\CL@smallratio\paperheight
-\marginparwidth=\dimexpr0.8\outermargin-\marginparsep\relax
-\evensidemargin=\dimexpr\outermargin -1in\relax
-\oddsidemargin=\dimexpr\innermargin-1in\relax
-\topmargin=\dimexpr\uppermargin-1in-\headheight-\headsep\relax
-\normalfont
-\count256=\numexpr(\textheight-\topskip)/\baselineskip\relax
-\textheight=\count256\baselineskip\relax
-\textheight=\dimexpr\textheight+\topskip\relax
+\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{%
-\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
- \the\count254.\par}
-
+ \CLcharcount.\par}
\newcommand*\charactersperpage{%
-\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
+\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 \the\count254;
- this text block contains \the\count252\ lines;
+ with the current font is \CLcharcount;
+ this text block contains \CLlinesperpage\ lines;
a rough estimate of the number of characters per page is
- \the\count250.\par
+ \CLcharsperpage.\par
This information may be useful to evaluate the total number
of pages in a document.
\end{quote}}
-%% Copyright 2011 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 is "author-maintained"
-%%
-%% This work consists of this file canoniclayout.dtx, a README file
+%% 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'.