summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/canoniclayout/canoniclayout.sty
blob: a88d26ac08d6035f56d86f77bacac4b0ee2b5bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
%%
%% 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'.