summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/canoniclayout
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/canoniclayout')
-rw-r--r--Master/texmf-dist/source/latex/canoniclayout/canoniclayout.dtx730
1 files changed, 408 insertions, 322 deletions
diff --git a/Master/texmf-dist/source/latex/canoniclayout/canoniclayout.dtx b/Master/texmf-dist/source/latex/canoniclayout/canoniclayout.dtx
index 0855bd860ec..21acee83376 100644
--- a/Master/texmf-dist/source/latex/canoniclayout/canoniclayout.dtx
+++ b/Master/texmf-dist/source/latex/canoniclayout/canoniclayout.dtx
@@ -6,28 +6,28 @@
\preamble
______________________________________________________
The canoniclayout package for LaTeX
- Copyright (C) 2010-2011 Claudio Beccari
+ Copyright (C) 2010-2020 Claudio Beccari
All rights reserved
License information appended
\endpreamble
-\postamble
-Copyright 2011 Claudio Beccari
+\postamble
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"
+
\endpostamble
\askforoverwritefalse
%
\generate{\file{canoniclayout.sty}{\from{canoniclayout.dtx}{package}}}
+\generate{\file{README.txt}{\from{canoniclayout.dtx}{txt}}}
%
\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
@@ -41,21 +41,22 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}[2009/01/01]
%<package>\ProvidesPackage{canoniclayout}%
-%<*package>
- [2011/11/05 v.0.3 Canonic layout circumscribed to a circle]
-%</package>
+%<txt>\ProvidesFile{README.txt}
+%<*package,txt>
+ [2020-04-09 v.0.5 Canonic layout circumscribed to a circle]
+%</package,txt>
%<*driver>
\documentclass[a4paper]{ltxdoc}
\paperwidth=210mm\paperheight=297mm
\pdfpagewidth=\paperwidth \pdfpageheight=\paperheight
-\usepackage[latin1]{inputenc}
+\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{textcomp}
\usepackage{multicol}
\usepackage{amsmath,array,booktabs}
-\usepackage{pict2e}[2009/06/01]%
-\usepackage{color}
+\usepackage{pict2e}[2019/06/01]%
+\usepackage{color,xfp}
\usepackage{canoniclayout}
\hfuzz 10pt
@@ -63,21 +64,28 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
\newcommand*\pack[1]{\textsf{#1}}
\newcommand*\prog[1]{\textsl{#1}}
\newcommand*\file[1]{\texttt{#1}}
-\definecolor{grigio}{gray}{.75}
+\definecolor{grigio}{gray}{.85}
\makeatletter
-\def\cblayoutdestro{\dimen256=\dimexpr\headheight+\topmargin+1in-\paperheight\relax
-\dimen258=\dimexpr\oddsidemargin+1in\relax
-\dimen262=1mm\relax
-\dimen260=\dimexpr \paperwidth*\p@/\dimen262\relax
-\dimen264=\dimexpr \paperheight-\topmargin-\headheight-1in-\headsep-\textheight\relax
-\begin{picture}(0,0)(\strip@pt\dimen258,-\strip@pt\dimen256)
+%\newdimen\CLinnermargin % 258
+%\newdimen\CLmm % 262
+%\newdimen\CLpagewidth % 260
+%\newdimen\Clowermargin % 264
+%\newdimen\CLvoffset % 256
+\edef\CLinnermargin{\fpeval{\oddsidemargin+1in}}
+\edef\CLmm{\fpeval{1mm}}
+\edef\CLpagewidth{\fpeval{\paperwidth}}
+\edef\CLlowermargin{\fpeval{\paperheight-\topmargin-\headheight-(1in)-\headsep-\textheight}}
+\edef\CLvoffset{\fpeval{\headheight+\topmargin+1in-\paperheight}}
+\edef\CLpageheight{\fpeval{\paperheight}}
+\def\cblayoutdestro{%
+\begin{picture}(0,0)(\CLinnermargin,-\CLvoffset)
\put(0,0){\unitlength=\p@
-\put(0,0){\framebox(\strip@pt\paperwidth,\strip@pt\paperheight){}}
+\put(0,0){\framebox(\CLpagewidth,\CLpageheight){}}
\color{red}
-\put(\strip@pt\dimen258,\strip@pt\dimen264){\makebox(0,0)[bl]{\color{grigio}\rule{\textwidth}{\textheight}}}
- \Line(0,\strip@pt\paperheight)(\strip@pt\paperwidth,0)
- \put(\strip@pt\dimexpr\paperwidth/2\relax,\strip@pt\dimexpr\dimen264+\textheight/2\relax){\circle{\strip@pt\paperwidth}}
+\put(\CLinnermargin,\CLlowermargin){\makebox(0,0)[bl]{\color{grigio}\rule{\textwidth}{\textheight}}}
+ \Line(0,\CLpageheight)(\CLpagewidth,0)
+ \put(\fpeval{\CLpagewidth/2},\fpeval{\CLlowermargin+(\textheight)/2}){\circle{\CLpagewidth}}
}
\end{picture}}
\def\ps@title{\ps@plain
@@ -86,52 +94,73 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
\allowdisplaybreaks
\begin{document}
\GetFileInfo{canoniclayout.dtx}
-\title{Package \pack{canoniclayout}\thanks{Version number \fileversion; last
- revision \filedate.}}
-\author{Claudio Beccari\thanks{e-mail: \texttt{claudio dot beccari at gmail dot com}}}
+\title{Package \pack{canoniclayout}}
+\author{Claudio Beccari}
+\date{\centering Version number \fileversion; last revision \filedate.\\
+ e-mail: \texttt{claudio dot beccari at gmail dot com}\par}
\maketitle\thispagestyle{title}
\DocInput{canoniclayout.dtx}
\end{document}
%</driver>
% \fi
%
-% \CheckSum{211}
-% \begin{abstract}
-% This package is a small extension that allows to determine the page
-% parameters for a canonical layout where the text block is placed onto the page in such a
-% way as: $(a)$ its diagonal coincides with the page relevant diagonal, and $(b)$ the
-% circle inscribed within the text block is also tangent to the page sides. The text
-% block width to height ratio is kept equal to the page ratio, as well as the inner to
-% outer and the upper to lower margin ratios.
-%
-% The canonical layout determined by this package is laid down on this very page; of
-% course the actual text block fits the text block grid, because this
-% documentation is typeset by means of the \texttt{ltxdoc} document class, that by
-% itself would use other layout parameters, but that is has been arrayed so as to invoke
-% this very package. This allows you to immediately evaluate this traditional layout and
-% see if it fits to your needs.
-% \end{abstract}
+% \CheckSum{128}
+%\begin{abstract}
+%\noindent
+% This package is a small extension that allows to determine the page
+% parameters for a canonical layout where the text block is placed onto
+% the page in such a way as: $(a)$ its diagonal coincides with the page
+% relevant diagonal, and $(b)$ the circle inscribed within the text block
+% is tangent to the page sides. The text block width to height ratio is
+% kept equal to the page ratio, as well as the inner to outer and the
+% upper to lower margin ratios.
+%
+% The canonical layout determined by this package is laid down on this
+% very page; of course the actual text block fits the text block grid,
+% because this documentation is typeset by means of the \texttt{ltxdoc}
+% document class, that by itself would use other layout parameters, but
+% that is has been arranged so as to invoke this very package. This
+% allows you to immediately evaluate this traditional layout and see if
+% it fits your requirements.
+%\end{abstract}
%
% \begin{multicols}{2}
% \tableofcontents
% \end{multicols}
%
% \section{Introduction}
-% As any user of the \class{memoir} class knows well, this class allows to customize the
-% page layout virtually without any limitation; such limitations are connected mainly with
-% the user inconsistent data that miss to specify necessary information or give unnecessary
-% and contrasting information. Also other classes and/or packages allow the customized
-% design of the page layout; some other classes, such as the standard ones, do not have any
-% facility for customizing the page geometry, unless the user invokes suitable packages,
-% such as \pack{geometry} or \pack{tyeparea}, just to male a couple of well known examples.
+% As any user of the \class{memoir} class knows well, this class allows
+% to customise the page layout virtually without any limitation; such
+% limitations are connected mainly with the user inconsistent data that
+% miss to specify necessary information or give unnecessary or conflicting
+% information. Also other classes and/or packages allow the customised
+% design of the page layout; some other classes, such as the standard
+% ones, do not have any facility to customise the page geometry, unless
+% the user invokes suitable packages, such as \pack{geometry} or
+% \pack{tyeparea}, just to male a couple of well known examples.
%
-% Many packages exist in order to specify a named layout; this package \pack{canoniclayout}
-% is another one that computes the page parameters to determine the horizontal and vertical
-% dimensions of the margins and the text block. All other details shall be specified by the
-% user, for example the dimensions of the stock paper, the trimming widths, and therefore
-% the position of the page onto the stock paper, and so on.
-% This package deals only with the trimmed page, not with the page and stock paper
-% relationship.
+% Many packages exist in order to specify a named layout; this package
+% \pack{canoniclayout} is another one that computes the page parameters
+% to determine the horizontal and vertical dimensions of the margins
+% and the text block. All other details shall be specified by the user,
+% for example the dimensions of the stock paper, the trimming widths,
+% and therefore the position of the page onto the stock paper; and so on.
+% This package deals only with the trimmed page, not with the page and
+% stock paper relationship.
+%
+% \paragraph{Warning} This package works well only with a modern
+% installation of the \TeX\ system; in particular it uses the
+% facilities of the \pack{xfp} package, that is an interface between
+% the end user and the lower level language known as \LaTeX\,3 (L3 for
+% short). This implies a \LaTeX kernel implementation dated at least
+% 2029-01-01, and a complete installation of the \TeX\ system. In
+% particular the availability of the \pack{xfp} package is checked,
+% and if the typesetting program cannot fetch it, is issues a message
+% and interrupts loading this package. It is a clear message that your
+% installation is obsolete; you might have your good reasons for not
+% using a modern release of the \TeX\ system, but either you upgrade
+% your installation or you cannot use this package.
+
%
% \begin{figure}
% \makebox[\textwidth]{\makebox[1.1\textwidth][r]{%
@@ -161,130 +190,160 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
% \unitlength0.001591\textwidth
% \let\ul=\unitlength
% \begin{picture}(220,330)(0,-20)
-% \put(0,0){\framebox(220,280){}}
-% \put(20.742,33.6){\makebox(0,0)[bl]{\color{grigio}\rule{172.86\ul}{220\ul}}}
-% \put(110,-35){\makebox(0,0)[b]{Letter paper canonical layout}}
-% \color{red}
-% \put(110,143.6){\circle{220}}
+% \put(0,0){\framebox(220,280){}}
+% \put(20.742,33.6){\makebox(0,0)[bl]{\color{grigio}\rule{172.86\ul}{220\ul}}}
+% \put(110,-35){\makebox(0,0)[b]{Letter paper canonical layout}}
+% \color{red}
+% \put(110,143.6){\circle{220}}
% \multiput(0,280)(2.37837837838,-3.02702702703){93}{\line(220,-280){1}}
% \end{picture}
% }}%
-% \caption{A right page with the relevant diagonal, the text block and the canonical circle.
-% In this figure the important information is the page proportions, not the scale; matter of
-% fact the letter paper is 17.6 mm shorter than the A4 paper, but the drawings to the same
-% height emphasize the relative proportions of the various page parts.}
+% \caption{A right page with the relevant diagonal, the text block and the
+% canonical circle.
+% In this figure it is important to notice the page proportions, not the
+% scale; matter of fact the letter paper height is 17.6\,mm shorter than
+% the A4 paper, but the drawings to the same height emphasise the relative
+% proportions of the various page parts.}
% \label{fig:canoniclayout}
% \end{figure}
%
-% Figure~\ref{fig:canoniclayout} depicts the situation described above; the gray rectangle
-% represents the type block; the dotted page diagonal, as it can be seen, passes through
-% the diagonal vertices of the type block; at the same time the circle is tangent to both
-% the type block and the page contour.
-%
-% It must also be noticed, in the sketch on the left, that the page rectangle is a golden
-% one; therefore also the type block is a golden rectangle; the inner to the outer margin
-% ratio is the golden section value so as this same ratio exists between the upper and the
-% lower margin. This canonical layout implies that the type block height is equal to the
-% page width.
-%
-% Therefore this canonical layout is not suited when the page width is too small compared
-% to the page height: with the golden section\footnote{Here we denote $\phi=1,618\dots$
-% with the name of \emph{golden number}, and its reciprocal $\varphi=0,618\dots$ with the
-% name of \emph{golden section}.} this ratio is 0.618, with the ISO paper shape, in the
-% sketch on the center, this ratio is 0,707, and so on.
-%
-% But it is equally unsuitable with squarish pages, such as the sketch on the right where
-% the page proportions conform with the USA letter paper size: the type block leaves little
-% space for the margins, as it is evident from the properties of the canonical circle, which
-% is tangent to the page lateral sides and to the type block horizontal sides; to the limit
-% in a square page the type block is so large that there is no room for the margins.
+% Figure~\ref{fig:canoniclayout} depicts the situation described above;
+% the grey rectangle represents the type block; the dotted page diagonal,
+% as it can be seen, passes through the diagonal vertices of the type
+% block; at the same time the circle is tangent to both the type block
+% and the page contour.
+%
+% It must also be noticed, in the sketch on the left, that the page
+% rectangle is a golden one; therefore also the type block is a golden
+% rectangle; the inner to the outer margin ratio is the golden section
+% value so as this same ratio exists between the upper and the lower
+% margin. This canonical layout implies that the type block height is
+% equal to the page width.
+%
+% Therefore this canonical layout is not suited when the page width
+% is too small compared to the page height: with the golden
+% section\footnote{Here we denote $\phi=1,618\dots$
+% with the name of \emph{golden number}, and its reciprocal
+% $\varphi=0,618\dots$ with the name of \emph{golden section}.} this
+% ratio is 0.618, with the ISO paper shape, in the sketch on the center,
+% this ratio is 0,707, and so on.
+%
+% But it is equally unsuitable with squarish pages, such as the sketch
+% on the right where the page proportions conform with the USA letter
+% paper size: the type block leaves little space for the margins, as
+% it is evident from the properties of the canonical circle, which
+% is tangent to the page lateral sides and to the type block horizontal
+% sides; to the limit in a square page the type block is so large that
+% there is no room for the margins.
%
% \section{The mathematics of the canonical layout}
-% If one plays a little with the drawing of figure~\ref{fig:canoniclayout} and applies what
-% has been described in the Introduction, may easily derive the following formulas:
+% If one plays a little with the drawing of figure~\ref{fig:canoniclayout}
+% and applies what has been described in the Introduction, may easily
+% derive the following formulas:
%\begin{align}
-%&\text{Page shape ratio:}& x&=b/h \label{equ:1} \\
-%&\text{Inner margin:}& I&=bx(1-x)/(1+x) \\
-%&\text{External margin:}& E&=b(1-x)/(1+x) \\
-%&\text{Top margin:}& T&=hx(1-x)/(1+x) \\
-%&\text{Bottom margin:}& B&=h(1-x)/(1+x) \\
-%&\text{Text width:}& W&=xb \\
-%&\text{Text height:}& H&=b \\
-%&\text{Circle center abscissa:}&C_x&=0.5b \\
-%&\text{Circle center ordinate:}&C_y&=h(1-x)/(1+x)+b/2 \\
-%&\text{Circle radius:}& R&=0.5b \label{equ:10}
+%&\text{Page shape ratio:} & x&=b/h \label{equ:1} \\
+%&\text{Inner margin:} & I&=bx(1-x)/(1+x) \\
+%&\text{External margin:} & E&=b(1-x)/(1+x) \\
+%&\text{Top margin:} & T&=hx(1-x)/(1+x) \\
+%&\text{Bottom margin:} & B&=h(1-x)/(1+x) \\
+%&\text{Text width:} & W&=xb \\
+%&\text{Text height:} & H&=b \\
+%&\text{Circle center abscissa:} & C_x&=0.5b \\
+%&\text{Circle center ordinate:} & C_y&=h(1-x)/(1+x)+b/2 \\
+%&\text{Circle radius:} & R&=0.5b \label{equ:10}
%\end{align}
-% whose results are summarized in table~\ref{tab:canoniclayout} for three common values of
-% the shape factor and for the letter paper shape ratio.
-%
-%\begin{table}[!b]\centering\let~\enspace
-%\hrule
-%\caption{Canonical layout ratios referred to the the base (or width, $b$) of the trimmed
-% page and its height ($h$).}\label{tab:canoniclayout}
+% whose results are summarised in table~\ref{tab:canoniclayout} for
+% three common values of the shape factor and for the letter paper
+% shape ratio.
+%
+%\begin{table}[!b]\centering^^A\let~\enspace
+%^^A\hrule
+%\caption{Canonical layout ratios referred to the base
+% (or width, $b$) and the height ($h$) of the trimmed page.}
+%\label{tab:canoniclayout}
%\bigskip
%\begin{tabular}{l@{\qquad}*4{>{$}c<{$}}}
%\toprule
-% &\multicolumn4c{Canon} \\
-%\multicolumn1c{Quantity} & \phi:1 & 3:2 & \sqrt2:1 & 11:8.5\\
+% &\multicolumn4c{Canon} \\
+%\multicolumn1c{Shape ratio} & \phi:1 & 3:2 & \sqrt2:1 & 11:8.5\\
%\midrule
-% Page shape ratio &0,618~ &0,666~ &0,707~ &0,773~ \\
-% Inner margin &0,146b &0,133b &0,121b &0,099b \\
-% External margin &0,236b &0,200b &0,172b &0,128b \\
-% Upper margin &0,146h &0,133h &0,121h &0,099h \\
-% Lower margin &0,236h &0,200h &0,172h &0,128h \\
-% Text width & 0,618b &0,666b &0,707b &0,773b \\
-% Text height & b & b & b &b \\
-% Circle center abscissa & b/2 & b/2 & b/2 &b/2 \\
-% Circle center ordinate & 0,545h &0,533h &0,526h &0,515h \\
-% Circle radius & b/2 & b/2 & b/2 &b/2 \\
+% Page shape ratio &0,618~ &0,666~ &0,707~ &0,773~ \\
+% Inner margin &0,146b &0,133b &0,121b &0,099b \\
+% External margin &0,236b &0,200b &0,172b &0,128b \\
+% Upper margin &0,146h &0,133h &0,121h &0,099h \\
+% Lower margin &0,236h &0,200h &0,172h &0,128h \\
+% Text block width & 0,618b &0,666b &0,707b &0,773b \\
+% Text block height & b & b & b &b \\
+% Circle center abscissa & b/2 & b/2 & b/2 &b/2 \\
+% Circle center ordinate & 0,545h &0,533h &0,526h &0,515h \\
+% Circle radius & b/2 & b/2 & b/2 &b/2 \\
%\bottomrule
%\end{tabular}
%\end{table}
%
-% Actually the formulas~\ref{equ:1}--\ref{equ:10}, and their numerical evaluations reported
-% in table~\ref{tab:canoniclayout}, are just for general information. The actual
-% computations are performed by this package, either by means of the \class{memoir} built-in
-% facilities or by explicit computations that exploit the $\varepsilon$-\TeX\ extensions.
-% But it can be easily seen that as the trimmed page becomes more squarish, the
-% page size ratio tends to one, ad the margins become smaller and smaller. Therefore it
-% seems that this layout is most suited for intermediate page ratios, such as the ISO one
-% or the common European book size of 170\,mm $\times$ 240\,mm with a ratio of 0,708.
+% Actually the formulas~\ref{equ:1}–\ref{equ:10}, and their numerical
+% evaluations reported in table~\ref{tab:canoniclayout}, are just for
+% general information. The actual computations are performed by this
+% package, either by means of the \class{memoir} built-in facilities
+% or by explicit computations that exploit the \pack{xfp} functions.
+% But it can be easily seen that as the trimmed page becomes more
+% squarish, the page size ratio tends to one, ad the margins become
+% smaller and smaller. Therefore it seems that this layout is better
+% suited for intermediate page ratios, such as the ISO one or the
+% common European book size of 170\,mm $\times$ 240\,mm with a ratio
+% of 0,708.
%
% \section{Usage}
% This package is invoked as usual with:
%\begin{verbatim}
% \usepackahe{canoniclayout}
%\end{verbatim}
-% No options are necessary; but it is necessary to invoke the package only after the page
-% dimensions are known, be they specified by an option passed to the class, such as, for
-% example, \texttt{a4paper}, or by means of a \texttt{page}$size$ specification, for example
+% No options are necessary; but it is necessary to invoke the package
+% only after the actual page dimensions are known, be they specified
+% by an option passed to the class, such as, for example, \texttt{a4paper},
+% or by means of a \texttt{page}\meta{size} specification, for example
% \texttt{pagebv} for calling the ISO B5 size.
%
-% At any convenient moment after calling this package, the trimming margins with respect to
-% the stock paper may be computed and the layout rechecked and fixed for consistency.
+% At any convenient moment after calling this package, the trimming
+% margins with respect to the stock paper may be computed and the
+% layout rechecked and fixed for consistency.
%
% \section{Font normal size}
-% At the same time if this page layout is chosen, the font normal size should be selected on
-% the actual text block width; it is possible that the golden ratio type block, on a golden
-% rectangle paper obtained by trimming an ISO A4 stock paper, might be suitable with a 10pt
-% normal font size (exactly 66 characters per line with 10pt Latin Modern fonts), while a
-% full ISO A4 paper yields a type block that might be more suited for a 12pt normal font
-% size (86 characters with 10pt Latin Modern fonts). The computations might be left to the
-% \class{memoir} class commands, but it's better the user is aware of this particular point.
-% For his/her sake this package provides the command |\currentfontletters| (to be used
-% only after |\begin{document}|, because specific font packages might be loaded after the
-% page layout has been computed; in any case the command is ``text producing'', therefore
-% it can't be used while in the preamble!) that types out a sentence such as ``The number
-% of characters in one text line with the current font is $nn$'', where the $nn$ is the
-% actual number printed out. If such number is much larger than the ideal Bringhurst range
-% of $66\pm5$, it's wiser to chose a larger normal font size.
-% In any case the alternative command |\charactersperpage| types out the same information,
-% the number of lines and the estimated number of characters per page. These commands are
-% supposed to be useful while setting up the complete preliminary parameters for the page
+% At the same time if this page layout is chosen, the font normal size
+% should be selected on the actual text block width; it is possible
+% that the golden ratio type block, on a golden rectangle paper obtained
+% by trimming an ISO A4 stock paper, might be suitable with a 10\,pt
+% normal font size (exactly 66 characters per line with 10pt Latin
+% Modern fonts), while a full ISO A4 paper yields a type block that
+% might be more suited for a 12pt normal font size (86 characters with
+% 10pt Latin Modern fonts is too much). The computations might be left
+% to the \class{memoir} class commands, but it's better the user
+% is aware of this particular point.
+% For his/her sake this package provides the command |\currentfontletters|
+% (to be used only after |\begin{document}|, because specific font
+% packages might be loaded after the page layout has been computed; in
+% any case the command is “text producing”, therefore it can't be used
+% while in the preamble!) that types out a sentence such as “The number
+% of characters in one text line with the current font is $nn$”, where
+% the $nn$ is the actual number printed out. If such number is much
+% larger than the ideal Bringhurst range of $66\pm6$, it's wiser to
+% chose a larger normal font size.
+% In any case the alternative command |\charactersperpage| types out
+% the same information, the number of lines and the estimated number
+% of characters per page. These commands are supposed to be useful
+% while setting up the complete preliminary parameters for the page
% layout.
%
-% Just to have a comparison, table~\ref{tab:sizes} displays the number of characters in one
-% line of text for several fonts and for page sizes A4, A5, and B5.
+% Just to have a comparison, table~\ref{tab:sizes} displays the number
+% of characters in one text line for several fonts and for page sizes
+% A4, A5, and B5. As you see, although that Bringhurst range comes form
+% socio-psychological studies and therefore has a large standard deviation,
+% It appears that for the larger papers only those fonts with wider
+% lowercase letters are suitable for this canonical layout; with smaller
+% paper sizes, quite understandably, more font collections are suited.
+% This very document, typeset with this canonical layout on A4 paper
+% with a Latin Modern 10\,pt font size, has long text lines that stress
+% the readers eyes.
%
%\begin{table}
%\caption{Text line lengths measured in average number
@@ -295,120 +354,119 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
% \let\b\bfseries \let\i\itshape\tabcolsep=5pt
% \makebox[\textwidth]{\small\begin{tabular}{l*9c}
% \toprule
-% Font collection & \multicolumn3c{A4 paper size}
-% & \multicolumn3c{A5 paper size}
-% &\multicolumn3c{B5 paper size}\\
-% & 10\,pt & 11\,pt & 12\,pt & 10\,pt & 11\,pt & 12\,pt & 10\,pt & 11\,pt & 12\,pt \\
+% Font collection & \multicolumn3c{A4 paper size}
+% & \multicolumn3c{A5 paper size}
+% &\multicolumn3c{B5 paper size}\\
+% &10\,pt &11\,pt &12\,pt &10\,pt &11\,pt &12\,pt &10\,pt &11\,pt &12\,pt\\
% \midrule
-% Times eXtended & \i92 & \i84 & \i77 & \b64 & 59 & \i54 & \i77 & \b70 & \b64 \\
-% Latin Modern & \i86 & \i79 & 73 & 60 & \i55 & \i51 & 72 & \b66 & \b61 \\
-% Kepler Project & \i83 & 76 & \b69 & 58 & \i53 & \i48 & \b69 & \b63 & 58 \\
-% Palatino eXtended& \i82 & 75 & \b69 & 58 & \i53 & \i48 & \b69 & \b63 & 57 \\
+% Times eXtended
+% & \i92 & \i84 & \i77 & \b64 & 59 & \i54 & \i77 & \b70 & \b64\\
+% Latin Modern
+% & \i86 & \i79 & 73 & \b60 & \i55 & \i51 & \b72 & \b66 & \b61\\
+% Kepler Project
+% & \i83 & 76 & \b69 & 58 & \i53 & \i48 & \b69 & \b63 & 58\\
+% Palatino eXtended
+% & \i82 & 75 & \b69 & 58 & \i53 & \i48 & \b69 & \b63 & 57\\
% \bottomrule
% \end{tabular}}
%\end{table}
%
-% It can be seen that the bold measures satisfy the Bringhurst rule with a number of
-% characters in the range $66\pm5$; the measures typeset in medium series type are out of
-% the optimal Bringhurst range, but may be considered acceptable; the measures typeset in
-% italics are completely out of the interval $66\pm10$ and should not be considered
-% acceptable. This means that the large A4 paper size may be best used with intrinsically
-% large fonts such as the Palatino eXtended (package \pack{pxfonts}) and the Kepler Project
-% (package \pack{kpfonts}). With the smaller A5 paper size with 10\,pt size fonts the best
-% ones are the Times eXtended (package \pack{txfonts}), but substantially all the examined
-% fonts are acceptable, while with 12\,pt fonts none are acceptable.
-%
-% With an intermediate sized paper, such as a B5 ISO size, all the considered fonts are
-% acceptable inside or just outside the optimal Bringhurst interval.
-%
-% Many books are trimmed to a size close the B5 paper size, therefore the page layout
-% produced with this package is most useful with medium and smaller sizes (at least with
-% ISO sizes).
+% It can be seen that the bold measures satisfy the Bringhurst rule
+% with a number of characters in the range $66\pm6$; the measures
+% typeset in medium series type are out of the optimal Bringhurst
+% range, but may be considered acceptable; the measures typeset in
+% italics are completely out of the interval $66\pm10$ and should
+% not be considered acceptable. This means that the large A4 paper
+% size may be best used with intrinsically large fonts such as the
+% Palatino eXtended (package \pack{newpxtext}) and the Kepler Project
+% (package \pack{kpfonts}). With the smaller A5 paper size with 10\,pt
+% size fonts the best ones are the Times eXtended (package
+% \pack{newtxtext}), and the Latin Modern ones (package \pack{lmodern})
+% but substantially all the examined fonts are acceptable, while with
+% 12\,pt fonts none are acceptable.
+%
+% With an intermediate sized paper, such as a B5 ISO size, all the
+% considered fonts are acceptable inside or just outside the optimal Bringhurst interval.
+%
+% Many books are trimmed to a size close the B5 paper size, therefore
+% the page layout produced with this package is most useful with medium
+% and smaller sizes (at least with ISO sizes).
% \section{Conclusion}
-% I don't think this package should set also the header and footer distances, for example,
-% or should set any specification for the page ``decorations'', such as underlined headers,
-% or overlined footers, or the size, font family, series and shape of the header and footer
-% contents. These specifications are of course important, but have nothing to do with the
-% relationship between the paper size, the page size and the type block size.
-%
-% As a final remark it's worth noting that a single pass of \prog{pdflatex} on this
-% \file{canoniclayout.dtx} file produces at the same time both the \file{canoniclayout.sty}
-% package file and the documentation \file{canoniclayout.pdf} file. After running
-% \prog{pdflatex} move \file{canoniclayout.sty} to a \file{tex/latex/canoniclayout/} folder
-% and \file{canoniclayout.pdf} to a \file{doc/latex\discretionary{}{/}{/}canoniclayout/} one;
-% if such folders don't exist, create them on your personal \TeX\ tree. After moving these
-% files remember to refresh the file name data base.
+% I don't think this package should set also the header and footer
+% distances, for example, or should set any specification for the page
+% “decorations”, such as underlined headers, or over lined footers,
+% or the size, font family, series and shape of the header and footer
+% contents. These specifications are of course important, but have
+% nothing to do with the relationship between the paper size, the
+% page size and the type block size.
+%
+% As a final remark it's worth noting that a single pass of
+% \prog{pdflatex} on this \file{canoniclayout.dtx} file produces at the
+% same time both the \file{canoniclayout.sty} package file and the
+% documentation \file{canoniclayout.pdf} file, besides a \file{README.txt}
+% required for uploading to the \textsc{ctan} archives. After running
+% \prog{pdflatex} move \file{canoniclayout.sty} to a
+% \file{tex/latex/canoniclayout/} folder and \file{canoniclayout.pdf}
+% to a \file{doc/latex\discretionary{}{/}{/}canoniclayout/} one;
+% if such folders don't exist, create them on your personal \TeX\
+% tree. After moving these files and if you have a Mik\TeX\ installation,
+% remember to refresh the file name data base.
%
%
% \StopEventually{}
%
% \section{Documented code}
-% The package preliminaries are already in place. We are going to make some computations in
-% order to determine the page shape factor $x$; to this end we exploit the dimensional
-% computing capabilities of $\varepsilon$-\TeX, that are already embedded in the most recent
-% implementations of the program \prog{pdftex}; in fact it must be remarked that these
-% facilities are being embedded into the \prog{pdftex} typesetting engine since the \TeX~Live
-% distribution of the year 2005. If these facilities are not available, either
-% because the \TeX\ distribution is a little too old, or because the real \prog{tex}
-% typesetting engine, not \prog{pdftex}, is being used, then, this entire package contents is
-% skipped and nothing is done, except issuing a suitable warning.
-% \begin{macrocode}
+% The package preliminaries are already in place. We are going to make
+% some computations in order to determine the page shape factor $x$;
+% to this end we exploit the dimensional computing capabilities package
+% \pack{xft}, that are already available in the most recent \LaTeX\
+% kernel files; in facts, the \LaTeX\,3 (L3) language computing
+% facilities have been available for several years, but the simple
+% and efficient user interface package \pack{xfp} has been available
+% since the 2018 autumn. If these facilities are not available, either
+% because the \TeX\ distribution is a little too old, or because the
+% real \prog{tex} typesetting engine, not \prog{pdftex}, is being used,
+% then, this entire package contents is skipped and nothing is done,
+% except issuing a suitable warning.
+%\iffalse
%<*package>
-\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
+%\fi
+% \begin{macrocode}
+\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}}
% \end{macrocode}
%
-% In order to have this layout work with the \class{memoir} class or with any other
-% class we have to test the fact they they package has been loaded within the preamble
-% of a \class{memoir} styled document; according to the result of this test we can exploit
-% the \class{memoir} facilities for determining the page geometry, or we have to carry out
-% the complete computations ourselves.
+% In order to have this layout work with the \class{memoir} class or
+% with any other class we have to test the fact that this package
+% has been loaded within the preamble of a \class{memoir} styled document;
+% according to the result of this test we can exploit
+% the \class{memoir} facilities for determining the page geometry,
+% or we have to carry out the complete computations ourselves.
% \begin{macrocode}
-\@ifclassloaded{memoir}{% }% balancing brace
+\@ifclassloaded{memoir}{%
% \end{macrocode}
-% Working with the \class{memoir} facilities, we can determine the page shape factor
-% and we save it into the control sequence |\CLshape|. The trick of multiplying by |p@|,
-% a length of 1\,pt, is a simple trick for reducing the shape ratio to a length whose
-% numerical value is exactly the ratio we are interested in. By stripping the `pt' part
-% from this dimension value we remain with the real number we want to keep in memory.
-% Of course we need also the reciprocal value, therefore we have to perform this
-% calculation a second time with different factors.
-% This ``strange'' way of computing real ratios derives from the ability of the
-% $\varepsilon$-\TeX\ engine to scale lengths with a higher computational precision than
-% ``normal'' \TeX\ can do with the standard dimension and integer operations. In facts
-% all the computational operations are performed in the CPU registers and the intermediate
-% first result of the multiplication is kept into a double length register, so that no bits
-% are rounded or truncated; the division operation is performed with a double length
-% numerator and a single length denominator, so that, again, almost no information is lost
-% at the inevitable end of the division algorithm with a non vanishing remainder.
+% Working with the \class{memoir} facilities, we can determine the page
+% shape factor and we save it into the control sequence |\CLshape|.
% \begin{macrocode}
-\dimen@=\dimexpr \p@ * \paperwidth / \paperheight\relax
-\edef\CLshape{\strip@pt\dimen@}
-\dimen@=\dimexpr \p@ * \p@ / \dimen@\relax
-\edef\CLinvshape{\strip@pt\dimen@}
+\edef\CLshape{\fpeval{\paperwidth / \paperheight}}
+\edef\CLinvshape{\fpeval{1/\CLshape}}
% \end{macrocode}
-% We then assign the text height, thanks to the fact that the canonical layout has the
-% block height just as long as the page width, due to the circle property mentioned in the
-% Introduction; in any case the formulas~\ref{equ:1}--\ref{equ:10} and
-% table~\ref{tab:canoniclayout} confirm this property for any shape.
+% We then assign the text height, thanks to the fact that the canonical
+% layout has the block height just as long as the page width, due to the
+% circle property mentioned in the Introduction; in any case the
+% formulas~\ref{equ:1}--\ref{equ:10} and table~\ref{tab:canoniclayout} confirm this property for any shape.
% \begin{macrocode}
\textheight=\paperwidth
% \end{macrocode}
%
-% This done, we can use the internal \class{memoir} commands to determine the other layout
-% dimensions.
+% This done, we can use the internal \class{memoir} commands to determine
+% the other layout dimensions.
% \begin{macrocode}
\settypeblocksize{\textheight}{*}{\CLshape}
\setlrmargins{*}{*}{\CLinvshape}
@@ -417,129 +475,157 @@ and the derived files canoniclayout.sty and canoniclayout.pdf.
% \end{macrocode}
%
-% We now use the |\checkandfixthelayout| so that it adjusts the type block dimensions
-% to an integer number of lines in the normal font and eventually prints the page
-% parameters to the% \file{.log} file.
+% We now use the |\checkandfixthelayout| so that it adjusts the type
+% block dimensions to an integer number of lines in the normal font and
+% eventually prints the page parameters to the \file{.log} file.
% \begin{macrocode}
\checkandfixthelayout
% \end{macrocode}
%
-% At this point we are finished with the computations if the \class{memoir} class is the active one, nut we need to perform the complete calculations in case we are not working with the \class{memoir} class.
+% At this point we are finished with the computations if the
+% \class{memoir} class is the active one, but we need to perform
+% the complete calculations in case we are not working with the
+% \class{memoir} class.
% \begin{macrocode}
}{%
% \end{macrocode}
-% We start by defining the lengths registers that hold the real inner, outer and upper
-% margins, without the one inch shift and without taking into consideration the headings
-% and their spacings, that must be specified before calling this package.
+% We start by defining the lengths registers that hold the real inner,
+% outer and upper margins, without the one inch shift and without taking
+% into consideration the headings and their spacings, that must be
+% specified before calling this package.
% \begin{macrocode}
\newlength\innermargin
\newlength\outermargin
\newlength\uppermargin
% \end{macrocode}
-% Then we define scratch length registers in order to maintain intermediate values.
+% Then we use some macros where to store some constant values;
+% we compute them using the rimmed page width and height;
% \begin{macrocode}
-\dimendef\CLpageratio=1256% x=b/h
-\dimendef\CLsmallratio=1258% z=x*y
-\dimendef\CLlargeratio=1260% y=(1-x)/(1+x)
-% \end{macrocode}
-% Now we determine the actual values based on the page width and height; we work on dimensions, and we extract the decimal fractional value by stripping off the `pt' part of their measure; we keep the decimal fractionl values into service macros:
-% \begin{macrocode}
-\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}
+\edef\CLpageratio{\fpeval{\paperwidth/\paperheight}} % x
+\edef\CLlargeratio{\fpeval{(1-\CLpageratio)/(1+\CLpageratio)}} % y
+\edef\CLsmallratio{\fpeval{\CLpageratio*\CLlargeratio}} % z
% \end{macrocode}
% We compute the type block dimensions:
% \begin{macrocode}
-\textheight\paperwidth% altezza griglia
-\textwidth=\CL@pageratio\textheight
+\textheight\paperwidth
+\textwidth=\CLpageratio\textheight
% \end{macrocode}
% We then compute the real margins between the page sides and the type block:
% \begin{macrocode}
-\innermargin=\CL@smallratio\paperwidth
-\outermargin=\CL@largeratio\paperwidth
-\uppermargin=\CL@smallratio\paperheight
+\innermargin=\CLsmallratio\paperwidth
+\outermargin=\CLlargeratio\paperwidth
+\uppermargin=\CLsmallratio\paperheight
% \end{macrocode}
-% But the typesetting engine does not use the net margins, due to the historical
-% one inch shift of the original \TeX\ implementation and, for the upper margin,
-% due to the fact that by default this layout implies the headings and the footers
-% outside the type block. Since we have the real outer margin dimension, we compute
+% But the typesetting engine does not use the net margins, due to the
+% historical one inch shift of the original \TeX\ implementation and,
+% for the upper margin, due to the fact that by default this layout
+% implies the headings and the footers outside the type block. Since
+% we have the real outer margin dimension, we compute
% the actual default marginal note measure:
% \begin{macrocode}
-\marginparwidth=\dimexpr0.8\outermargin-\marginparsep\relax
-\evensidemargin=\dimexpr\outermargin -1in\relax
-\oddsidemargin=\dimexpr\innermargin-1in\relax
-\topmargin=\dimexpr\uppermargin-1in-\headheight-\headsep\relax
+\marginparwidth=\fpeval{0.8\outermargin-\marginparsep}pt
+\evensidemargin=\fpeval{\outermargin -(1in)}pt
+\oddsidemargin=\fpeval{\innermargin-(1in)}pt
+\topmargin=\fpeval{\uppermargin-(1in)-\headheight-\headsep}pt
% \end{macrocode}
-% When using different classes from the \class{memoir} one, we adjust the type block
-% dimensions so that the type block contains an integer number of lines; we use the
-% normal size |\baslineskip| value and compute the number of lines contained in the
-% initial type block minus the first line stander height equal to |\topskip|; notice
-% that the integer value expression computed for counter 256 is a rounded value, not
-% a truncated value, therefore the actual type block height might get enlarged or
-% reduced a very little bit that will not be noticed with naked eye when one examines
-% a typeset page; eventually we recompute the |\textheight| taking into account the
-% height of the first line.
+% When using different classes from the \class{memoir} one, we adjust
+% the type block dimensions so that the type block contains an integer
+% number of lines; we use the normal size |\baselineskip| value and
+% compute the number of lines contained in the initial type block minus
+% the first line standard height equal to |\topskip|; notice that the
+% integer value expression is a rounded value,
+% not a truncated one, therefore the actual type block height might get
+% enlarged or reduced by a very little bit that will not be noticed with
+% naked eye when one examines a typeset page; eventually we recompute the
+% |\textheight| taking into account the height of the first line.
% \begin{macrocode}
-\normalfont
-\count256=\numexpr(\textheight-\topskip)/\baselineskip\relax
-\textheight=\count256\baselineskip\relax
-\textheight=\dimexpr\textheight+\topskip\relax
+\normalfont\textheight=%
+\fpeval{round((\textheight - \topskip)/\baselineskip, 0) * \baselineskip + \topskip}pt%
\normalbaselineskip\baselineskip
% \end{macrocode}
-% and we eventually close the second action depending on the use of the \class{memoir}
-% class:
+% and we eventually close the second action depending on the use of the
+% \class{memoir} class:
% \begin{macrocode}
-}
+}% end of test on the class being used
% \end{macrocode}
%
-% Just for testing the number of characters in a line, the following macros are provided.
-% A couple of scratch dimension registers will be used |dimen@| and |\abcwidth|; |\abcwidth|
-% will hold the current lowercase alphabet length, and |\dimen@| will hold several values
-% in succession. The scratch counter |\count254| will receive the final result to be
-% printed out. $\varepsilon$-\TeX\ arithmetics will be used throughout.
-%
-% Another service macro for the user's sake is |\charactersperpage|; this macro
-% typesets the average number of characters per line, the numbers of lines per
-% page, and eventually their product, a good estimate of the number of characters
-% per page.
-%
-% Many text editors have facilities for counting a ``compuscript'' number o words
-% and characters; with this further information the user may easily estimate the
-% number of pages of his/her document; of course s/he must allow a certain allowance
-% for the front and back matter pages, so that s/he can evaluate the total amount
-% of signatures of the whole typeset document; of course, by typesetting it with
-% \prog{(pdf)latex} s/he knows exactly the number of pages of the final document, but the
-% typographer wants to know a good estimate before the source \TeX\ files are finished.
+% Just for testing the number of characters in a line, the following
+% macros are provided. A couple of variables will be used |\CLaux|
+% and |\CLabcwidth|; |\CLabcwidth| will hold the current lowercase
+% alphabet length, while |\CLaux| will hold several values in succession.
+% The scratch variable |\CLcharcount| will receive the final result to be
+% printed out.
+%
+% Another service macro for the user's sake is |\charactersperpage|; this
+% macro typesets the average number of characters per line, the numbers of
+% lines per page, and eventually their product, a good estimate of the
+% number of characters per page.
+%
+% Many text editors have facilities for counting a “compuscript”
+% number of words and characters; with this further information the
+% user may easily estimate the number of pages of his/her document;
+% of course s/he must allow a certain allowance for the front and back
+% matter pages, so that s/he can evaluate the total amount of signatures
+% of the whole typeset document; of course, by typesetting it with
+% \prog{(pdf)latex} s/he knows exactly the number of pages of the final
+% document, but the typography shop generally wants to know a good
+% estimate before the source \TeX\ files are finished.
% \begin{macrocode}
\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}}
+% \end{macrocode}
+% Using these macros, we can type out the information relative to this
+% specific documentation.
+% \charactersperpage
+%\iffalse
%</package>
+%<*txt>
+%\fi
+%
+% \begin{macrocode}
+Canoniclayout is a small extension package that allows to design
+a canonic layout based on the great circle inscribed within the
+page and tangent to the horizontal sides of the type block rectangle.
+The margins reflect the trimmed page shape ratio, therefore the
+type block principal diagonal coincides with the corresponding
+page diagonal; this layout is especially good for ISO page shapes
+but it can be used with many other traditional book page shapes.
+
+This new version is completely new, in the sense that its code
+calculations are performed by means of the 2018 xfp package
+facilities. For this reason it cannot be used with any TeX
+distribution preceding the year 2018 and updated by the end of
+that year; should this happen this very package aborts its own
+input while advising the user by means of an Error Message.
+
+This work is released under the Latex Project Public Licence
+v.1.3c. The LPPL is distributed with any TeX system distribution
+and can be found also in any CTAN archive.
+
+Claudio Beccari 2020
+claudio dot beccari at gmail dot com
% \end{macrocode}
+%\iffalse
+%</txt>
+%\fi
% \Finale
% \endinput
%