summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/foliono
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/foliono')
-rw-r--r--macros/latex/contrib/foliono/MANIFEST-Foliono.txt30
-rw-r--r--macros/latex/contrib/foliono/README24
-rw-r--r--macros/latex/contrib/foliono/foliono.pdfbin0 -> 181952 bytes
-rw-r--r--macros/latex/contrib/foliono/foliono.sty526
-rw-r--r--macros/latex/contrib/foliono/foliono.tex923
-rw-r--r--macros/latex/contrib/foliono/lppl.txt416
-rw-r--r--macros/latex/contrib/foliono/pics/only-folio.pngbin0 -> 29936 bytes
-rw-r--r--macros/latex/contrib/foliono/pics/only-quire.pngbin0 -> 31016 bytes
-rw-r--r--macros/latex/contrib/foliono/pics/skip-first.pngbin0 -> 33524 bytes
-rw-r--r--macros/latex/contrib/foliono/pics/standard.pngbin0 -> 33597 bytes
10 files changed, 1919 insertions, 0 deletions
diff --git a/macros/latex/contrib/foliono/MANIFEST-Foliono.txt b/macros/latex/contrib/foliono/MANIFEST-Foliono.txt
new file mode 100644
index 0000000000..a955a2a757
--- /dev/null
+++ b/macros/latex/contrib/foliono/MANIFEST-Foliono.txt
@@ -0,0 +1,30 @@
+Package: foliono
+Author: Tommi Syrjänen
+Version: 1.000
+Date: 25 III 2021
+
+Copyright (c) 2021 Tommi Syrjänen
+
+This work is released under the Latex Project Public License (LPPL)
+version 1.3c. See file lppl.txt for details.
+
+This work has the LPPL maintenance status "maintained".
+The Current Maintainer of this work is Tommi Syrjänen.
+This work consists of the files listed in this file.
+
+1. The latex style file:
+- foliono.sty - the latex style file
+
+2. Documentation files:
+- foliono.pdf - the users' manual
+- README - a short summary of the package
+
+3. Documentation source files:
+- foliono.tex - LaTeX source for the manual
+- pics/standard.png - image file for documentation
+- pics/skip-first.png - image file for documentation
+- pics/only-folio.png - image file for documentation
+- pics/only-quire.png - image file for documentation
+
+4. License:
+- lppl.txt - the Latex Project Public License
diff --git a/macros/latex/contrib/foliono/README b/macros/latex/contrib/foliono/README
new file mode 100644
index 0000000000..d716b80345
--- /dev/null
+++ b/macros/latex/contrib/foliono/README
@@ -0,0 +1,24 @@
+Foliono is a package that replaces page numbering with medieval and
+early modern folio numbering.
+
+Folio numbering was used before modern page numbering convention came
+to use. In its basic form only every other page has a number and it
+has two parts: the quire number and the folio number inside the quire.
+A quire or a gathering is a collection of sheets that are bound into
+the book as one unit. For example, if a book has four-sheet quires,
+then each quire will have 16 modern pages and the folio 'B 1'
+corresponds to the modern page 17 and 'B 2' to page 19.
+
+The foliono package has direct support for several different folio
+numbering conventions that were used in books before the 19th century.
+The package works best in conjunction with fancyhdr and fontspec, but
+it can be used without them.
+
+
+This package is distributed under the Latex Project Public License
+(LPPL).
+
+--
+Tommi Syrjänen
+<tssyrjan@iki.fi>
+
diff --git a/macros/latex/contrib/foliono/foliono.pdf b/macros/latex/contrib/foliono/foliono.pdf
new file mode 100644
index 0000000000..104b0f0ff5
--- /dev/null
+++ b/macros/latex/contrib/foliono/foliono.pdf
Binary files differ
diff --git a/macros/latex/contrib/foliono/foliono.sty b/macros/latex/contrib/foliono/foliono.sty
new file mode 100644
index 0000000000..6d1ed632c2
--- /dev/null
+++ b/macros/latex/contrib/foliono/foliono.sty
@@ -0,0 +1,526 @@
+%% foliono.sty
+%% Copyright 2021 Tommi Syrjänen
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Tommi Syrjänen
+%
+% See file MANIFEST-Foliono.txt to a list of files that make up this
+% work.
+\ProvidesPackage{foliono}[2021/03/25 Folio numbering]
+
+%% We need 'calc' to compute the size of a half quire
+\RequirePackage{calc}
+
+\makeatletter
+
+%% First the definitions for conditionals
+
+%% A conditional to check if the quire number should be capitalized,
+%% defaults to true
+\newif\ifFoliono@capitalizeQuireNumber
+\Foliono@capitalizeQuireNumbertrue
+
+%% A conditional to check if all folios in a quire have folio numbers
+%% or if the first page has only quire number. Defaults to true
+\newif\ifFolioNo@skipFirstFolioNumber
+\FolioNo@skipFirstFolioNumberfalse
+
+
+%% A conditional to check if we want to skip the latter half of folio
+%% numbers of a quire
+\newif\ifFolioNo@useSheetNumbering
+\FolioNo@useSheetNumberingfalse
+
+%% A condition to check if we want to print only first half + 1 folio
+%% numbers in a quire Defaults to false
+\newif\ifFolioNo@onlyFirstHalf
+\FolioNo@onlyFirstHalffalse
+
+
+%% A conditional for showing only the quire number and not folio
+%% within the quire. Defaults to false
+\newif\ifFolioNo@showOnlyQuireNumber
+\FolioNo@showOnlyQuireNumberfalse
+
+%% A condition to check whether we want label references to include
+%% 'r' and 'v' to denote the 'recto' and 'verso' sides of the folio.
+%% This defaults to false. You probably shouldn't use this without the
+%% following conditional
+\newif\ifFolioNo@ShowSideInLabels
+\FolioNo@ShowSideInLabelsfalse
+
+%% A condition to check whether we use arabic or roman numbers for
+%% folio counter
+\newif\ifFolioNo@UseArabicNumbers
+\FolioNo@UseArabicNumbersfalse
+
+%% A condition to check if we want to leave quire numbers off
+%% altogheter. Defaults to false
+\newif\ifFolioNo@noQuires
+\FolioNo@noQuiresfalse
+
+%% A condition to check if we want to use all letters for quire
+%% numbers instead of skipping over 'i' and 'u'. Default 'true'
+\newif\ifFolioNo@skipQuires
+\FolioNo@skipQuirestrue
+
+
+
+%% Option: show only the quire number and that only in the first page
+%% of the quire
+\DeclareOption{OnlyQuire}{\FolioNo@showOnlyQuireNumbertrue}
+
+%% Option: show only the folio number and leave the quire number out
+\DeclareOption{NoQuires}{\FolioNo@noQuirestrue}
+
+%% Option: use all letters as quire numbers
+\DeclareOption{AllQuires}{\FolioNo@skipQuiresfalse}
+
+%% Show only the quire number on the first folio of the quire and both
+%% quire and folio counters on other folios.
+\DeclareOption{SkipFirst}{\FolioNo@skipFirstFolioNumbertrue}
+
+%% Leave out the folio number completely from the end half of the
+%% quire
+\DeclareOption{SkipEnd}{\FolioNo@onlyFirstHalftrue}
+
+%% Show only folio numbers of the first half of a quire
+\DeclareOption{SheetNumbers}{\FolioNo@useSheetNumberingtrue}
+
+%% Format the quire number in lower case instead of upper case
+\DeclareOption{LowerCase}{\Foliono@capitalizeQuireNumberfalse}
+
+%% Show folio sides 'r' and 'v'in labels.
+\DeclareOption{ShowSides}{\FolioNo@ShowSideInLabelstrue}
+
+%% Format folio counter as arabic numbers instead of roman.
+\DeclareOption{ArabicNumbers}{\FolioNo@UseArabicNumberstrue}
+\ProcessOptions*{}
+
+%%% User-visible commands
+
+%% The command to place the folio number at place, this should be
+%% placed in header or footer. Note that this also handles increasing
+%% the folio number so this should be run exactly once per page (the
+%% command inserts the number only on odd pages)
+\newcommand{\folionumber}{\foliono@formatFolioNumber}
+
+%% This writes a new label to the .aux file with the current folio number
+\newcommand{\folionolabel}[1]{%
+ \protected@write\@auxout{}{\string \newlabel {#1}{{\foliono@createFolioLabel{}}{}}}}%
+
+%% This writes a new label to the .aux file complete with stylized
+%% formatting. NOTE! It is very easy to get strange errors with
+%% macros that are read back from .aux file
+\newcommand{\folionolabelwithstyles}[1]{%
+ \protected@write\@auxout{}{\string \newlabel {#1}{{\currentfoliowithstyles}{}}}}%
+
+
+%% This writes its argument to the index file with the folio number as
+%% the page
+\newcommand{\folionoindex}[1]{%
+ \protected@write\@indexfile{}{%
+ \string\indexentry{#1}{\foliono@createFolioLabel{}}}
+}
+
+%% This writes its argument to the index file with completely
+%% formatted and styled folionumber as the page. NOTE! It is very easy
+%% to get strange errors with macros that are read back from index file
+\newcommand{\folionoindexwithstyles}[1]{%
+ \protected@write\@indexfile{}{%
+ \string\indexentry{#1}{\currentfoliowithstyles}}}
+
+%% This sets the font that is used to set the folio number. This
+%% should be a name of a font that is then accessed with fontspec.
+\newcommand{\folionofont}[1]{%
+ \gdef\foliono@font{#1}}
+
+
+%% This sets the font size for the folio number. Note that this is
+%% used only if the font is also set
+\newcommand{\folionofontsize}[1]{%
+ \setcounter{foliono@fontSize}{#1}}
+
+%% This sets the font color. Note that this is used only if the font
+%% is also set.
+\newcommand{\folionofontcolor}[1]{%
+ \gdef\foliono@fontColor{#1}}
+
+
+%% The folio number style defaults to empty if folionumber font is not selected,
+%% otherwise use the defined font and style. This is user-visible so
+%% that it can be redefined easier.
+\newcommand{\folionostyle}[1]{%
+ \ifx\foliono@font\empty%
+ #1%
+ \else%
+ % Otherwise set the font number and size
+ \begingroup%
+ \fontsize{\value{foliono@fontSize}}{\value{foliono@fontSize}}\fontspec[Color=\foliono@fontColor]{\foliono@font}#1%
+ \endgroup%
+ \fi%
+}
+
+%% The quire number style also defaults to empty if folionumber font
+%% is not selected and otherwise uses the defined font. This and
+%% folionostyle are separate so that they can be set separately if
+%% desired.
+\newcommand{\quirenostyle}[1]{%
+ \ifx\foliono@font\empty%
+ #1%
+ \else%
+ % Otherwise set the font number and size
+ \begingroup%
+ \fontsize{\value{foliono@fontSize}}{\value{foliono@fontSize}}\fontspec[Color=\foliono@fontColor]{\foliono@font}#1%
+ \endgroup%
+ \fi%
+}
+
+
+
+%% Set how many folios there are in a quire. Each folio is two modern
+%% pages. Each quire should have an even number of folios or printing
+%% the quires will be challenging.
+\newcommand{\folionoquirefolios}[1]{%
+ \setcounter{foliono@foliosPerQuire}{#1}%
+ \setcounter{foliono@foliosPerHalfQuire}{#1/2}%
+ \setcounter{foliono@foliosPerHalfQuirePlusOne}{#1/2+1}%
+}
+
+%% Returns the current folio number as a string without styling. This
+%% returns the actual quire and folio numbers even if they are not
+%% printed on the page. The only exception is that the quire number is
+%% left out if 'NoQuires' option is set.
+\newcommand{\currentfolio}{%
+ \ifFolioNo@noQuires%
+ \foliono@getUnformattedFolioCounter%
+ \else%
+ \foliono@getUnformattedQuireCounter{} % space intentional
+ \foliono@getUnformattedFolioCounter%
+ \fi%
+}
+
+
+%% Returns the current folio number as string without styling as with
+%% '\currentfolio' but this adds the folio side suffix to it
+\newcommand{\currentfoliowithsides}{%
+ \currentfolio%
+ \ifFolioNo@UseArabicNumbers\relax\else{\hbox{ }}\fi%
+ \foliono@folioSide%
+}
+
+
+%% Returns the current folio number formatted like it would be printed
+%% on the page (if it has it).
+\newcommand{\currentfoliowithstyles}{%
+ \foliono@alwaysCreateFormattedFolioLabel%
+}
+
+
+%% Manually set the folio number. The firts argument is the quire
+%% number and the second argument is the folio number
+\newcommand{\setfoliono}[2]{
+ \setcounter{foliono@quireCounter}{#1}%
+ \setcounter{foliono@folioCounter}{#2}%
+ \foliono@setFolioSide%
+}
+
+%% Manually move to the next folio number
+\newcommand{\stepfolio}{%
+ \foliono@stepFolio%
+ \foliono@setFolioSide%
+}
+
+%% Add a prefix before the quire number when typeset on the page (not
+%% included in labels)
+\newcommand{\quirenoprefix}[1]{%
+ \gdef\foliono@quirePrefix{#1}
+}
+
+%% Add a suffix after the quire number when typeset on page (not
+%% included in labels)
+\newcommand{\quirenosuffix}[1]{%
+ \gdef\foliono@quireSuffix{#1}
+}
+
+
+%% Add a prefix before the folio number when typeset on page (not
+%% included in labels)
+\newcommand{\folionoprefix}[1]{%
+ \gdef\foliono@folioPrefix{#1}
+}
+
+%% Add a suffix after the folio number when typeset on page (not
+%% included in labels)
+\newcommand{\folionosuffix}[1]{%
+ \gdef\foliono@folioSuffix{#1}
+}
+
+%% The separator that is put between the quire and folio numbers. This
+%% defaults to a single space. (Not included in labels)
+\newcommand{\folionoseparator}[1]{%
+ \gdef\foliono@separator{#1}
+}
+
+
+%% Internal workings that should not concern the end user start here
+
+%% the counter for folios per quire, half quire, and half quire plus one
+\newcounter{foliono@foliosPerQuire}
+\newcounter{foliono@foliosPerHalfQuire}
+\newcounter{foliono@foliosPerHalfQuirePlusOne}
+
+%% Default value: 8 folios
+\setcounter{foliono@foliosPerQuire}{8}
+\setcounter{foliono@foliosPerHalfQuire}{4}
+\setcounter{foliono@foliosPerHalfQuirePlusOne}{5}
+
+%% The font size, default value 10
+\newcounter{foliono@fontSize}
+\setcounter{foliono@fontSize}{10}
+
+
+%% The quirrent quire number
+\newcounter{foliono@quireCounter}
+\setcounter{foliono@quireCounter}{1}
+
+%% The current folio number inside the current quire.
+\newcounter{foliono@folioCounter}
+\setcounter{foliono@folioCounter}{1}
+
+% The default color is black
+\newcommand{\foliono@fontColor}{000000}
+
+
+
+
+%% This creates the label that is written to .aux file when folioLabel
+%% is used.
+\newcommand{\foliono@createFolioLabel}{%
+ \ifFolioNo@ShowSideInLabels%
+ \currentfoliowithsides%
+ \else%
+ \currentfolio%
+ \fi%
+}
+
+
+%% The font name defaults to empty
+\gdef\foliono@font{}
+
+\newcount\halfpages
+%% This command creates the next folio number.
+\newcommand{\foliono@stepFolio}{%
+ % Increase the folio counter
+ \stepcounter{foliono@folioCounter}%
+ % If we pass the last page of the quire, move to the next quire. We
+ % don't do the reset if quires are not used
+ \ifFolioNo@noQuires\else%
+ \ifnum\value{foliono@folioCounter}>\value{foliono@foliosPerQuire}%
+ \setcounter{foliono@folioCounter}{1}%
+ \stepcounter{foliono@quireCounter}%
+ % Skip 'i' and 'u' quire numbers because 'i' and 'j' are two forms
+ % of the same letter and similarly 'u' and 'v'.
+ \ifFolioNo@skipQuires%
+ \ifnum\value{foliono@quireCounter}=9\stepcounter{foliono@quireCounter}\fi%
+ \ifnum\value{foliono@quireCounter}=21\stepcounter{foliono@quireCounter}\fi%
+ \fi\fi\fi%
+}
+
+
+
+
+
+%% Create the folio label formatted for adding to the page
+\newcommand{\foliono@createFormattedFolioLabel}{%
+ \quirenostyle{%
+ \foliono@getQuireCounter%
+ }%
+ \folionostyle{\foliono@separator}%
+ \folionostyle{%
+ \foliono@getFolioCounter%
+ }%
+}
+
+
+%% Create complete formatted folio label even if we are on page that
+%% will not get a printed folio number
+\newcommand{\foliono@alwaysCreateFormattedFolioLabel}{%
+ %% However, skip the quire counter if it is not in use
+ \ifFolioNo@noQuires\else%
+ \quirenostyle{%
+ \foliono@getFormattedQuireCounter%
+ }%
+ \quirenostyle{\foliono@separator}%
+ \fi%
+ \folionostyle{%
+ \foliono@getFormattedFolioCounter%
+ }%
+}
+
+%% This function returns which side of the folio we are currently
+%% processing. This starts as 'r' for recto and
+%% '\foliono@formatFolioNumber' will toggle it between 'r' and 'v'.
+\gdef\foliono@folioSide{r}
+
+%% The default settings for the prefix, suffix and separator commands
+\gdef\foliono@quirePrefix{}
+\gdef\foliono@quireSuffix{}
+\gdef\foliono@folioPrefix{}
+\gdef\foliono@folioSuffix{}
+\gdef\foliono@separator{\hbox{ }}
+
+
+%% The main function for folio numbering. This should be called at
+%% least for each even odd page but it should be called also for even
+%% pages if folio side labeling is turned on. This should not be
+%% called multiple times per page as this also increases the counters.
+\newcommand{\foliono@formatFolioNumber}{%
+ % Folio number is placed only on odd pages
+ \ifodd\thepage%
+ % First format the folio label and then step to next folio with
+ % counter
+ \foliono@createFormattedFolioLabel%
+ \foliono@stepFolio%
+ \fi%
+ % Set also folio side
+ \foliono@setFolioSide%
+}
+
+%% Set the folio side to either 'r' or 'v' based on whether we are on
+%% an odd or even page
+\newcommand{\foliono@setFolioSide}{%
+ \ifodd\thepage%
+ \gdef\foliono@folioSide{r}%
+ \else%
+ \gdef\foliono@folioSide{v}%
+ \fi%
+}
+
+
+%% Function that formats the folio counter when are printing it. It is
+%% formatted either as roman or arabic numbers
+\newcommand{\foliono@getFormattedFolioCounter}{%
+ \begingroup%
+ \foliono@folioPrefix%
+ \ifFolioNo@UseArabicNumbers%
+ \arabic{foliono@folioCounter}%
+ \else%
+ \roman{foliono@folioCounter}%
+ \fi%
+ \foliono@folioSuffix%
+ \endgroup%
+}
+
+%% Function that returns the folio counter without prefix or suffix
+\newcommand{\foliono@getUnformattedFolioCounter}{%
+ \ifFolioNo@UseArabicNumbers%
+ \arabic{foliono@folioCounter}%
+ \else%
+ \roman{foliono@folioCounter}%
+ \fi%
+}
+
+
+
+%% Function that formats the quire counter when are printing it. It is
+%% formatted either as upper or lower case
+\newcommand{\foliono@getFormattedQuireCounter}{%
+ \begingroup%
+ \foliono@quirePrefix%
+ \ifFoliono@capitalizeQuireNumber%
+ \Alph{foliono@quireCounter}%
+ \else%
+ \alph{foliono@quireCounter}%
+ \fi%
+ \foliono@quireSuffix%
+ \endgroup%
+}
+
+
+%% Function that returns the quire counter without prefix or suffix
+\newcommand{\foliono@getUnformattedQuireCounter}{%
+ \ifFoliono@capitalizeQuireNumber%
+ \Alph{foliono@quireCounter}%
+ \else%
+ \alph{foliono@quireCounter}%
+ \fi%
+}
+
+
+\newif\ifFoliono@showThisFolioCounter
+\Foliono@showThisFolioCountertrue
+%% Function that determines wheter we want to print the folio counter
+%% in this case and then calls '\foliono@getFormattedFolioCounter' to
+%% get the representation of the counter.
+\newcommand{\foliono@getFolioCounter}{%
+ \relax%
+ % If the first is skipped and we are looking at it, skip
+ \ifFolioNo@skipFirstFolioNumber%
+ \ifnum\value{foliono@folioCounter}=1%
+ \relax\Foliono@showThisFolioCounterfalse%
+ \fi%
+ \fi%
+ % With sheet numbering skip the latter half of the quire
+ \ifFolioNo@useSheetNumbering%
+ \ifnum\value{foliono@folioCounter}>\value{foliono@foliosPerHalfQuire}%
+ \relax\Foliono@showThisFolioCounterfalse%
+ \fi%
+ \fi%
+ %% Check if we should skip the last folio number completely
+ \ifFolioNo@onlyFirstHalf%
+ \ifnum\value{foliono@folioCounter}>\value{foliono@foliosPerHalfQuirePlusOne}%
+ \relax\Foliono@showThisFolioCounterfalse%
+ \fi\fi%
+ % If only quire number is shown, remove the folio number
+ \ifFolioNo@showOnlyQuireNumber%
+ \Foliono@showThisFolioCounterfalse%
+ \fi%
+ % Show the counter if not skipped
+ \ifFoliono@showThisFolioCounter%
+ \foliono@getFormattedFolioCounter%
+ \fi%
+}
+
+%% Function that returns the quire counter string without styling.
+%% This first checks if we want to show it at all, and then returns it
+%% either as a lower or upper case capital
+\newif\ifFoliono@showThisQuireCounter
+\Foliono@showThisQuireCountertrue
+\newcommand{\foliono@getQuireCounter}{%
+ \relax%
+ % If quire numbers are not used, skip
+ \ifFolioNo@noQuires%
+ \Foliono@showThisQuireCounterfalse%
+ \fi%
+ %% When only quire numbers are shown, show it only on the first page
+ %% of quire.
+ \ifFolioNo@showOnlyQuireNumber%
+ \ifnum\value{foliono@folioCounter}>1%
+ \relax\Foliono@showThisQuireCounterfalse%
+ \fi\fi%
+ %% Check if we show half+1 and
+ \ifFolioNo@onlyFirstHalf%
+ \ifnum\value{foliono@folioCounter}>\value{foliono@foliosPerHalfQuirePlusOne}%
+ \relax\Foliono@showThisQuireCounterfalse%
+ \fi\fi%
+ %% If sheet numbering is in use, hide the number from
+ %% the second half of the quire
+ \ifFolioNo@useSheetNumbering%
+ \ifnum\value{foliono@folioCounter}>\value{foliono@foliosPerHalfQuire}%
+ \relax\Foliono@showThisQuireCounterfalse%%
+ \fi\fi%
+ \ifFoliono@showThisQuireCounter%
+ \relax\foliono@getFormattedQuireCounter%
+ \fi%
+}
+
+\makeatother \ No newline at end of file
diff --git a/macros/latex/contrib/foliono/foliono.tex b/macros/latex/contrib/foliono/foliono.tex
new file mode 100644
index 0000000000..627406f7bb
--- /dev/null
+++ b/macros/latex/contrib/foliono/foliono.tex
@@ -0,0 +1,923 @@
+%% missaali.tex
+%% Copyright 2021 Tommi Syrjänen
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Tommi Syrjänen
+%
+% See file MANIFEST-Foliono.txt to a list of files that make up this
+% work.
+\documentclass[a4paper, 12pt]{article}
+%% Author: Tommi Syrjänen (tssyrjan@iki.fi)
+%%
+%% This software is distributed under the LPPL license
+
+%% This is the documentation file for the foliono LaTeX package.
+\usepackage{fontspec}
+\usepackage{graphicx}
+
+\newcommand{\feature}[1]{\texttt{#1}}
+\newcommand{\command}[1]{\texttt{\textbackslash{}#1}}
+\newcommand{\commandone}[2]{\texttt{\textbackslash{}#1\{#2\}}}
+\newcommand{\commandtwo}[3]{\texttt{\textbackslash{}#1\{#2\}\{#3\}}}
+\newcommand{\argument}[1]{\texttt{#1}}
+
+\makeatletter
+
+\newcommand{\foliodemo}[2]{%
+ \setfoliono{#1}{#2}%
+ \currentfoliowithstyles%
+}
+
+\makeatother
+
+
+
+\title{The \texttt{foliono} package \\
+ Folio numbering for old books}
+
+\author{Tommi Syrjänen\\ \texttt{tssyrjan@iki.fi}}
+\date{Version 1.0, 25 March, 2021}
+
+\usepackage{foliono}
+
+
+% Define the folionumber font. This font is available in the package
+% 'missaali'
+\folionofont{Missaali}
+\folionofontsize{14}
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+ The \texttt{foliono} package implements medieval and early modern
+ folio numbering with a few customizable options. In folio numbering
+ only every other page gets a number and the number has two parts
+ that identify both the quire and the folio inside of the quire. The
+ package works best in conjunction with the \texttt{fancyhdr} package
+ but it can be used also without it.
+\end{abstract}
+
+\section{Introduction}
+
+Before modern page numbering was introduced, the pages of a book were
+numbered using \emph{folio numbering}. In this context \emph{folio}
+means a single leaf of a page, an odd page and the even page that is
+on the other side of.
+
+A medieval book was composed of \emph{quires}. A quire is a collection
+of sheets of paper or parchment that are folded together to form
+pages. As the name suggests, most quires had four sheets that were
+folded to form eight folios and 16 pages, but there were also three,
+five, and even six sheet quires. With printed books the modern term
+\emph{gathering} is usually used in place of \emph{quire}, but I have
+used \emph{quire} throughout because it is shorter.
+
+A medieval scribe would write the text on quires and then a bookbinder
+would sew the completed quires together and attach the book covers.
+Most texts needed more than one quire. Scribes started to number the
+quires to help bookbinders to keep the quires in order. They were
+usually marked by writing letters in alphabetical order at the bottom
+or top right corner of the first page of the quire.
+
+\begin{figure}
+ \centering
+\begin{verbatim}
+\usepackage{foliono}
+\usepackage{fancyhdr}
+\pagestyle{fancy}
+\cfoot{}
+\renewcommand{\headrulewidth}{0pt}
+\fancyfoot[R]{\folionumber}
+\end{verbatim}
+ \caption{Quick-start minimal code skeleton with \feature{fancyhdr}.}
+ \label{fig:quick_start}
+\end{figure}
+
+
+Later scribes started to add numbers for the individual folios of a
+quire. This was usually done for books that needed a table of contents
+or an index. Folio numbering became more prevalent with the advent of
+printing as including them helped the bookbinder to ensure that the
+sheets were folded right and put in the correct order.
+
+For printed books the quires are formed using two basic principles.
+The largest book format is called \emph{folio} and there the sheet is
+folded once so that the result has two folios and four pages. These
+sheets are collected in quires the same ways as manuscript sheets
+were. In late medieval and early modern times the number of sheets put
+in a quire varied also for printed books. I have seen examples ranging
+from three sheets (6 folios) to six sheets (12 folios), with five
+sheets (10 folios) being very common.
+
+In smaller format books one printed sheet usually makes up a quire by
+itself. In \emph{quarto} size the sheet is folded twice, so a quire
+will have only four folios, in \emph{octavo} it is folded three times
+so there are eight folios per quire, and in \emph{duodecimo} sheets
+are folded four times to produce 12 folios.
+
+\begin{table}[b]
+ \centering
+ \begin{tabular}{lcc}
+ Format & Folios per quire & Pages per quire \\
+ \hline
+ Folio (2:o) & 6-12 & 12-24 \\
+ Quarto (4:o) & 4 & 8 \\
+ Octavo (8:o) & 8 & 16 \\
+ Duodecimo (12:o) & 12 & 24 \\
+ \end{tabular}
+ \caption{Common old printed book formats}
+ \label{fig:formats}
+\end{table}
+
+A medieval or early modern folio number generally consists of two
+parts, the quire number (A, B) and the folio number within quire in
+Roman numerals (i, ii). There are some examples where the folios are
+numbered sequentially from the start with no respect to the quire
+structure. In many of these cases the folio numbers were added after
+the book had already been bound.
+
+In modern reference convention the
+two pages of a folio are called \emph{recto} (r) and \emph{verso} (v).
+The recto is the first page of the folio that is shown on the right
+hand side of the spread and the verso is the second page on the left
+hand side.
+
+Bookprinters often did not include the folio number for each folio of
+the quire. For example, with the \emph{folio} and \emph{octavo}
+formats it was common that only the folios of the first half of a
+quire had numbers. Similarly, with \emph{quarto} the last folio number
+of a quire was often left out.
+
+The \feature{foliono} package supports several different folio
+numbering conventions and it also provides very rudimentary support
+for creating tables of content and indices for folio-numbered
+documents. However, a lot of manual work is necessary for creating
+them.
+
+\begin{figure}
+ \centering
+ \begin{tabular}{cc}
+ \includegraphics[width=5cm]{pics/standard.png} &
+ \includegraphics[width=5cm]{pics/skip-first.png} \\
+ (a) Default & (b) \feature{SkipFirst} \\
+ \includegraphics[width=5cm]{pics/only-quire.png} &
+ \includegraphics[width=5cm]{pics/only-folio} \\
+ (c) \feature{OnlyQuire} & (d) \feature{NoQuires} \\
+ \end{tabular}
+ \caption{Mode of operation samples}
+ \label{fig:modes}
+\end{figure}
+
+In the examples I will be using the font \emph{Missaali} to typeset
+the folio numbers as they would appear on the page. \emph{Missaali} is
+a free opentype font that comes with the package \feature{missaali}
+that is based on late 15th century book Northern German book textura.
+
+\section{Modes of operation}
+
+The \feature{foliono} package can operate in several different modes
+that are controlled using the package options. A folio number consists
+of two parts, the quire number and the folio number, and the different
+modes show them using different principles. Figure \ref{fig:modes}
+shows four of the basic modes in schematics.
+
+\begin{description}
+\item [Default] \mbox{} \\
+ The default behavior of \emph{foliono} is that each folio is
+ numbered with both the quire number and the folio number inside a
+ quire. Thus, the folio numbers advance like:
+ \begin{center}
+ A 1, A 2, \textellipsis, A 8, B 1, B 2, \textellipsis, B 8, C 1, \textellipsis
+ \end{center}
+
+\item [Skip first folio number (\feature{SkipFirst})] \mbox{} \\
+ The first folio number skipping mode is otherwise the same as the
+ default mode, but the first folio of a quire contains only the quire
+ number and not the folio counter. The numbers advance like:
+ \begin{center}
+ A, A 2, A 3, \textellipsis, A 8, B, B 2, \textellipsis, C , C 2 \textellipsis
+ \end{center}
+
+
+
+\item [Only quire numbers (\feature{OnlyQuire})] \mbox{}\\
+ In the only quire numbers mode the folio numbers are not included
+ at all and only the first pages of a quire have the mark:
+ \begin{center}
+ A, \{\}, \{\}, \{\}, \{\}, \{\}, \{\}, \{\}, B, \{\}, \textellipsis
+ \end{center}
+
+\item [No quires (\feature{NoQuires})]\mbox{} \\
+ In this mode the folios are numbered sequentially from the start of
+ the book paying no regards to the quire structure. Here the numbers
+ are simply:
+ \begin{center}
+ 1, 2, 3, 4, 5, \textellipsis
+ \end{center}
+
+\item [Sheet numbering (\feature{SheetNumbering})] \mbox{}\\
+ In sheet numbering mode there is only one folio number per a two
+ page sheet. In practice, this means that the first half folios of a
+ quire are numbered using the default style and the latter half are
+ left unnumbered:
+ \begin{center}
+ A 1, A 2, A 3, A 4, \{\}, \{\}, \{\}, \{\}, B 1, B 2, \textellipsis
+ \end{center}
+ This mode can be combined with skipping the first folio number.
+
+
+\item [Skip end half (\feature{SkipEnd})] \mbox{} \\
+ In this mode the folio numbers are printed to the first half + 1
+ folios of a quire and the rest are left empty. In practice the
+ effect is otherwise same as with sheet numbering except that one
+ more folio has a number.
+
+ For quarto format the numbers go:
+ \begin{center}
+ A 1, A 2, A 3, \{\}, B 1, B 2, \textellipsis
+ \end{center}
+ For octavo format the numbers are:
+ \begin{center}
+ A 1, A 2, \textellipsis, A 5, \{\}, \{\}, \{\}, B 1, B 2, \textellipsis
+ \end{center}
+ For duodecimo they go:
+ \begin{center}
+ A 1, A 2, \textellipsis, A 7, \{\}, \{\}, \{\}, \{\}, \{\}, B 1, B 2, \textellipsis
+ \end{center}
+ This mode can be combined with skipping the first folio number.
+
+\end{description}
+
+\section{General usage}
+
+The basic command in the package is \command{folionumber}. This should
+be put either in the header or footer of the page and it should be run
+exactly once on each page since it keeps track of the folio number
+counters and also whether we are on recto or verso side of the folio.
+Manipulating headers and footers is simplest with the
+\feature{fancyhdr} package. For the basic functionality you can add
+the following to the preamble of the document:
+
+\begin{verbatim}
+\usepackage{fancyhdr}
+\usepackage{foliono}
+\cfoot{}
+\renewcommand{\headrulewidth}{0pt}
+\fancyfoot[R]{\folionumber}
+\pagestyle{fancy}
+\end{verbatim}
+
+Here the \command{cfoot} removes the modern page number,
+\command{fancyfoot} adds the folio number to the right footer,
+overriding the \command{headrulewidth} removes the horizontal line
+from top that \feature{fancyhdr} wants to add there, and
+\command{pagestyle} enables the fancy header style.
+
+You need to decide how big your quires are. The package defaults to
+eight folio quires, meaning that when printed there are four sheets in
+the quire. Historically that was the most common quire size for
+manuscripts, but other sizes were also used. You can set the quire
+size with the \command{folionoquirefolios} command. For example:
+\begin{verbatim}
+\folionoquirefolios{10}
+\end{verbatim}
+sets the quires to have 10 folios and 20 pages each. It is possible to
+change the value in the middle of the document to get quires of
+different sizes.
+
+In case you need to set the folio number manually, there are two ways
+to do it:
+
+\begin{enumerate}
+\item \command{stepfolio}: this moves the counters to the next folio.
+\item \commandtwo{setfoliono}{quireNo}{folioNo}: sets the quire
+ counter to \argument{quireNo} and the folio counter to
+ \argument{folioNo}.
+\end{enumerate}
+
+There are three commands that you can use to access the current folio
+number from text. All of these commands set the folio number even if
+\command{folionumber} does not print it on the page.
+\begin{enumerate}
+\item \command{currentfolio} this sets the current folio number as
+ unformatted string.
+
+\item \command{currentfoliowithsides} this sets the current folio
+ number as unformatted string that is followed by the side reference
+ \feature{r} or \feature{v}.
+
+\item \command{currentfoliowithstyles} this sets the current folio
+ number formatted and styled the exact same way as it is
+
+\end{enumerate}
+
+Here is an example for their use:
+
+\begin{center}
+\begin{tabular}{lc}
+ \begin{minipage}{0.5\linewidth}
+\begin{verbatim}
+\setfoliono{2}{4}
+1: \currentfolio \\
+2: \currentfoliowithsides \\
+3: \currentfoliowithstyles \\
+\end{verbatim}
+ \end{minipage}
+&
+ \begin{minipage}{0.4\linewidth}
+ \setfoliono{3}{4}\strut\mbox{}\\
+ \strut\mbox{}\\
+ 1: \currentfolio \\
+ 2: \currentfoliowithsides \\
+ 3: \currentfoliowithstyles \\
+ \end{minipage}
+ \end{tabular}
+\end{center}
+
+\subsection{Font selection and properties}
+
+By default the folio numbers are set using the default document font
+and size. There are commands that allow you to select the font when
+using the \feature{fontspec} package. If you are using some other
+environment, you can redefine the \command{folionostyle} command that
+adds style to the folio numbers.
+
+The font selection commands are:
+\begin{enumerate}
+\item \commandone{folionofont}{FontName}: set the \feature{fontspec}
+ font that is used to set the folio number. You need to set this for
+ the other two font setting commands having effect.
+
+\item \commandone{folionofontsize}{size}: set the size of the folio
+ number. The font must have been set eariler.
+
+\item \commandone{folionofontcolor}{color}: set the color for the
+ folio number. The font must have been set eariler.
+
+\end{enumerate}
+
+\begin{center}
+ \begin{tabular}{lc}
+ \begin{minipage}{0.6\linewidth}
+\begin{verbatim}
+Before: \currentfoliowithstyles \\
+\folionofont{Missaali}
+\folionofontsize{18}
+\folionofontcolor{c55e47}
+After: \currentfoliowithstyles
+\end{verbatim}
+ \end{minipage}
+ &
+ \begin{minipage}{0.3\linewidth}
+ \begingroup
+ Before: \currentfoliowithstyles \\
+ \folionofont{Missaali}
+ \folionofontsize{18}
+ \folionofontcolor{c55e47}
+ After: \currentfoliowithstyles
+ \folionofontsize{14}
+ \folionofontcolor{000000}
+ \endgroup
+ \end{minipage}
+ \end{tabular}
+\end{center}
+
+\subsection{Controlling the formatting}
+
+By default the folio number is typeset with a space between the quire
+and folio numbers. There are commands to add content or commands
+before and after the both commands as well as to override the default
+separator.
+
+\begin{enumerate}
+\item \commandone{quirenoprefix}{text}: the \emph{text} is added
+ before the quire number.
+\item \commandone{quirenosuffix}{text}: the \emph{text} is added
+ after the quire number.
+\item \commandone{folionoprefix}{text}: the \emph{text} is added
+ before the folio number.
+\item \commandone{folionosuffix}{text}: the \emph{text} is added
+ after the folio number.
+\item \commandone{folionoseparator}{text}: the \emph{text} is added
+ between the quire and folio numbers.
+\end{enumerate}
+
+\begin{figure}
+ \centering
+\begin{verbatim}
+\quirenostyle{%
+ \quirenoprefix%
+ QUIRE COUNTER%
+ \quirenosuffix%
+ \folionoseparator}%
+\folionostyle{%
+ \folionoprefix%
+ FOLIO COUNTER%
+ \folionosuffix%
+}
+\end{verbatim}
+ \caption{A pseudocode explanation on how the quire number is
+ formatted. The separator is formatted using the quire number
+ style.}
+ \label{fig:foliono}
+\end{figure}
+For example, you can add periods before, after, and in the middle of
+the folio number with:
+\begin{center}
+ \begin{tabular}{lc}
+ \begin{minipage}{0.6\linewidth}
+\begin{verbatim}
+\quirenoprefix{.}
+\folionoseparator{.}
+\folionosuffix{.}
+\currentfoliowithstyles
+\end{verbatim}
+ \end{minipage}
+ &
+ \begin{minipage}{0.3\linewidth}
+ \quirenoprefix{.}
+ \folionoseparator{.}
+ \folionosuffix{.}
+ \currentfoliowithstyles
+ \quirenoprefix{}
+ \folionosuffix{}
+ \folionoseparator{\hbox{ }}
+ \end{minipage}
+ \end{tabular}
+\end{center}
+
+You can also add formatting commands to the prefixes. For example, you
+can achieve two-colored folio numbers with:
+\begin{verbatim}
+\quirenoprefix{\addfontfeature{Color=455f9b}}
+\folionoprefix{\addfontfeature{Color=c55e47}}
+\currentfoliowithstyles
+\end{verbatim}
+This produces the result:
+\begin{center}
+ \begin{minipage}{0.3\linewidth}
+ \quirenoprefix{\addfontfeature{Color=455f9b}}
+ \folionoprefix{\addfontfeature{Color=c55e47}}
+ \currentfoliowithstyles
+ \quirenoprefix{}
+ \folionoprefix{}
+ \end{minipage}
+\end{center}
+
+\subsection{Labels and indices}
+
+There are two commands for creating labels that have folio numbers for
+the reference and two commands for creating index entries. The basic
+forms of the commands typeset the folio numbers without formatting or
+prefixes and suffixes, and the two others typeset the numbers as they
+appear on page. All of these commands produce the folio number string
+even if it is not printed on the current page. Note that commands that
+are read in from auxiliary and index files break easily and often
+cause weird error messages.
+
+If you want to create a medieval-styled table of contents, the best
+way to proceed is probably to use the indexing commands, copy the
+index file as a base for a new LaTeX document, and then manipulate
+them by hand to get the desired outcome. You can then combine the
+original document and the index using the \feature{pdfpages} package.
+There are two main reasons to do it this way: as far as I know there
+are no existing index formats that would produce results that are even
+remotely close to medieval tables of contents or indices, and the main
+text should start on the folio A 1 of the document. If the table of
+contents is at the beginning, it should be on a separate unnumbered
+sheet.
+
+\begin{enumerate}
+\item \commandone{folionolabel}{label}: defines a label whose
+ reference string is unformatted version of the current folio number.
+
+\item \commandone{folionolabelwithstyles}{label}: defines a label
+ whose reference string is the formatted version of the current folio
+ number.
+
+\item \commandone{folionoindex}{text}: adds \feature{text} as an index
+ entry in the index file.\footnote{Remember to use
+ \command{makeindex} command in the preamble if you use index
+ commands.}
+
+\item \commandone{folionoindexwithstyles}{text}: adds \feature{text}
+ as an index entry in the index file with complete styling.
+
+\end{enumerate}
+
+
+
+
+
+
+
+
+\section{Package options}
+
+The \feature{foliono} package defines the following options:
+
+\begin{description}
+\item [\feature{AllQuires}] \mbox{} \\
+ Before the 17th century the letters \emph{i} and \emph{j} were not
+ yet separated and they were considered to be two variant forms of
+ the same letter that could be used almost interchangeably.
+ Similarly, \emph{u} and \emph{v} were still the same. Because of
+ this \feature{foliono} does not use \emph{i} and \emph{u} as quire
+ numbers by default. The package option \feature{AllQuires} takes the
+ two missing letters in use as quire numbers.
+
+\item [\feature{ArabicNumbers}] \mbox{} \\
+ This option changes the folio numbers into Arabic numerals instead
+ of the Roman numberals. This is most useful together with the
+ \feature{NoQuires} option. However, some later printed books used
+ Arabic numerals in folio numbers.
+
+ \item [\feature{LowerCase}] \mbox{} \\
+ This changes the quire numbers to be in lower case instead of the
+ default upper case letters.
+
+ \item [\feature{NoQuires}] \mbox{} \\
+ This turns on the no quires mode where folio numbers are numbered
+ sequentially from one upwards with no regard to quire structure.
+
+ \item [\feature{OnlyQuire}] \mbox{} \\
+ This turns on the only quires mode where folio numbers are left out
+ and the quires have a quire number on their first page.
+
+ \item [\feature{SheetNumbers}] \mbox{} \\
+ This turns on sheet numbering mode where there is only one folio
+ number on a two-folio sheet of paper. In practice the first half
+ of folios on a quire will have a number and the rest are empty.
+ This does not work together with \feature{NoQuires}.
+
+ \item [\feature{ShowSides}] \mbox{} \\
+ If enabled, it will add the indicator \emph{r} or \emph{v} to
+ labels and index entries to show if they land on recto or verso
+ side of the folio. This is not added to the folio numbers printed
+ on pages, only on the references.
+
+ \item [\feature{SkipFirst}] \mbox{} \\
+ When enabled the first folio of a quire will have only the quire
+ number and not the folio number.
+
+
+ \item [\feature{SkipEnd}] \mbox{} \\
+ When enabled the folio numbers are printed on first half + 1
+ folios of a quire. The effect is otherwise the same as with
+ \feature{SheetNumbers} except that one more folio has the number.
+\end{description}
+
+\section{Command Reference}
+
+
+\begin{description}
+\item [\command{folionumber}] \mbox{} \\
+ Sets both the formatted and styled folio number to the page and it
+ also keeps track of the quire and folio counters as well as the
+ recto and verso sides on the document. It should be run exactly once
+ per page of output.
+
+\item [\commandone{folionoquirefolios}{folioNo}] \mbox{} \\
+ Sets the size of quires to \argument{folioNo} folios.
+ The value should be even. This can be run multiple times inside a
+ document to get quires of different sizes.
+
+\item [\commandone{folionofont}{fontId}] \mbox{} \\
+ Sets the font that is used to folio numbers to the
+ \feature{fontspec} font \argument{fontId}. If you are using some
+ other font system, you need to redefine \command{folionostyle} and
+ \command{quirenostyle} instead.
+
+\item [\commandone{folionofontsize}{points}] \mbox{} \\
+ Sets the size of the folio number font to \argument{points}. This
+ has an effect only if the font has been selected with
+ \command{folionofont}. Default size is 10 points.
+
+\item [\commandone{folionofontcolor}{color}] \mbox{} \\
+ Sets the folio number font color to \argument{color}. This has an
+ effect only if the font has been selected with
+ \command{folionofont}. Default color is black.
+
+\item [\commandone{quirenostyle}{commands}] \mbox{} \\
+ A styling command for non-\feature{fontspec} users. Redefine this
+ command to apply styling to the quire counter. This defaults to
+ using the font, size, and color set using the previous font
+ selection commands.
+
+\item [\commandone{folionostyle}{commands}] \mbox{} \\
+ A styling command for non-\feature{fontspec} users. Redefine this to
+ apply styling to the folio counter. This defaults to using the font,
+ size, and color set using the previous font selection commands.
+
+\item [\commandone{folionolabel}{label}] \mbox{} \\
+ Adds a \argument{label} that can be accessed with the \command{ref}
+ command. The label text will be an unformatted folio number string.
+ This creates a reference using the folio number of that particular
+ page even if the number is not printed on the page. This has the
+ most obvious effect when the \feature{SheetNumbers} option is turned
+ on.
+
+\item [\commandone{folionolabelwithstyles}{label}] \mbox{} \\
+ Adds a \argument{label} whose reference text contains all the styles
+ and formatting of the current folio number. Otherwise this works the
+ same as \command{folionolabel}. \emph{Note! It is very easy to get
+ weird TeX error messages if there is anything complex or fragile
+ in the commands read from .aux files}.
+
+\item [\commandone{folionoindex}{text}] \mbox{} \\
+ This adds \argument{text} as an index entry where the page number is
+ replaced with unformatted current folio number. Using this command
+ and some manual manipulation is the easiest way to create medieval
+ tables of context.
+
+\item [\commandone{folionoindexwithstyles}{text}] \mbox{} \\
+ This adds \argument{text} as an index entry where the page number is
+ replaced with styled current folio number.
+
+\item [\commandtwo{setfoliono}{quireNo}{folioNo}] \mbox{} \\
+ Sets the quire counter to \argument{quireNo} and the folio counter
+ to \argument{folioNo}.
+
+\item [\command{stepfolio}] \mbox{} \\
+ Moves the folio number to the next folio. This is most useful in
+ cases you want to remove the folio number from a single page as
+ setting the page style to \argument{empty} also prevents
+ \command{folionumber} from moving to the next number.
+
+\item [\commandone{quirenoprefix}{text}] \mbox{} \\
+ Sets a prefix of the quire number to be \argument{text}. The prefix
+ can contain formatting commands, but the more complex the commands
+ are, the more likely is that \command{folionolabelwithstyles} and
+ \command{folionoindexwithstyles} commands break.
+
+\item [\commandone{quirenosuffix}{text}] \mbox{} \\
+ Sets the quire number suffix to \argument{text}. The suffix may
+ contain both text and commands.
+
+\item [\commandone{folionoprefix}{text}] \mbox{} \\
+ Sets the folio counter prefix to \argument{text}.
+
+\item [\commandone{folionosuffix}{text}] \mbox{} \\
+ Sets the folio number suffix to \argument{text}.
+
+\item [\commandone{folionoseparator}{text}] \mbox{} \\
+ Sets the separator that is placed between quire and folio numbers to
+ \argument{text}. The separator is formatted according to the quire
+ number style.
+
+\item [\command{currentfolio}] \mbox{} \\
+ Gives the unformatted and non-styled version of the current folio
+ number. In particular, the prefixes, suffixes, and the separator are
+ left out of it.
+
+\item [\command{currentfoliowithsides}] \mbox{} \\
+ Gives the unformatted and non-styled version of the current folio
+ number with the side indicator (\emph{r} or \emph{v}) added to its
+ end.
+
+\item [\command{currentfoliowithstyles}] \mbox{} \\
+ Gives the current folio number formatted the same way as it is added
+ to the page by \command{folionumber}. This gives the real folio
+ number even if \command{folionumber} will skip it, for example, if
+ we are in the second half of a quire and \feature{SheetNumbers} is
+ turned on.
+
+
+\end{description}
+
+\section{Examples}
+
+\begin{description}
+
+\item [Codex Montpellier, c.1300] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & unknown \\
+ Format: & manuscript \\
+ Folio numbers: & continuously running folio numbers, roman numbers
+ surrounded by centered dots. \\
+ Sample: &
+ \begin{minipage}{7cm}
+ \makeatletter
+ \FolioNo@noQuirestrue
+ \folionoprefix{·}
+ \folionosuffix{·}
+ \folionoseparator{}
+ \foliono@createFormattedFolioLabel
+ \folionoprefix{}
+ \folionosuffix{}
+ \folionoseparator{\hbox{ }}
+ \makeatother
+ \end{minipage} \\
+ \end{tabular}
+
+ Code:
+
+ \begin{minipage}{5cm}
+ \verb!\usepackage[NoQuires]{foliono}!\\
+ \verb!\folionoprefix{·}! \\
+ \verb!\folionosuffix{·}! \\
+ \end{minipage}
+
+
+\item [Glogauer Liederbuch, c. 1480] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & unknown \\
+ Format: & manuscript \\
+ Folios: & 12 per quire \\
+ Folio numbers: & on top right of every folio, most quires have
+ lower case quire numbers but some use upper case \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \makeatletter
+ \Foliono@capitalizeQuireNumberfalse
+ \foliono@createFormattedFolioLabel
+ \makeatother
+ \end{minipage} \\
+ \end{tabular}
+
+ Code:
+
+ \begin{minipage}{5cm}
+ \verb!\usepackage[LowerCase]{foliono}!\\
+ \verb!\folionoquirefolios{12}!\\
+ \end{minipage}
+
+\item [Missale Aboense, 1488] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Bookprinter: & Barthomolew Ghotan \\
+ Format: & folio \\
+ Folios: & 12 per quire \\
+ Folio numbers: & on every folio, capital quire number, centered dots surround folio number \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \folionoprefix{·}
+ \folionosuffix{·}
+ \folionoseparator{}
+ \currentfoliowithstyles
+ \folionoprefix{}
+ \folionosuffix{·}
+ \folionoseparator{\hbox{ }}
+ \end{minipage} \\
+ \end{tabular}
+
+ Code:
+
+ \begin{minipage}{5cm}
+ \verb!\usepackage{foliono}!\\
+ \verb!\folionoquirefolios{12}!\\
+ \verb!\folionoprefix{·}! \\
+ \verb!\folionosuffix{·}! \\
+ \verb!\folionoseparator{}!
+ \end{minipage}
+
+
+\item [Revelationes Sancti Birgitte, 1492] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Bookprinter: & Barthomolew Ghotan \\
+ Format: & folio \\
+ Folios: & 10 per quire \\
+ Folio numbers: & on first half of a quire, lower case quire number, periods surround folio number \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \makeatletter
+ \Foliono@capitalizeQuireNumberfalse
+ \makeatother
+ \folionoprefix{.}
+ \folionosuffix{.}
+ \folionoseparator{}
+ \currentfoliowithstyles
+ \folionoprefix{}
+ \folionosuffix{}
+ \folionoseparator{\hbox{ }}
+ \end{minipage}
+ \end{tabular}
+
+Code:
+
+\begin{minipage}{5cm}
+ \verb!\usepackage[LowerCase,SheetNumbers]{foliono}!\\
+ \verb!\folionoquirefolios{10}!\\
+ \verb!\folionoprefix{.}! \\
+ \verb!\folionosuffix{.}! \\
+ \verb!\folionoseparator{}!
+\end{minipage}
+
+\item[Messu eli Herran Echtolinen, 1549] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & Mikael Agricola \\
+ Format: & quarto \\
+ Folios: & 8 per quire \\
+ Folio numbers: & first folio of a quire has only quire number,
+ quire numbers are capitalized. \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \currentfoliowithstyles
+ \end{minipage}
+ \end{tabular}
+
+Code:
+
+\begin{minipage}{5cm}
+ \verb!\usepackage[SkipFirst]{foliono}!\\
+ \verb!\folionoquirefolios{8}!\\
+\end{minipage}
+
+\item[Historiae animalum, 1551] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & Conrad Gessner \\
+ Format: & folio \\
+ Folios: & 6 or 8 per quire \\
+ Folio numbers: & quire numbers are set in Roman typeface, most are
+ upper case but preface uses lower case, folio
+ numbers with arabic numbers, only one folio number per sheet.
+ \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \makeatletter
+ \def\quirenostyle{}
+ \def\folionostyle{}
+ \FolioNo@useSheetNumberingtrue
+ \FolioNo@UseArabicNumberstrue
+ \setfoliono{3}{2}
+ \makeatother
+ \currentfoliowithstyles
+ \end{minipage}
+ \end{tabular}
+
+ Code:
+
+\begin{minipage}{5cm}
+ \verb!\usepackage[SheetNumbers,ArabicNumbers]{foliono}!\\
+ \verb!\folionoquirefolios{6}!\\
+\end{minipage}
+
+
+
+\item[Wanhain Suomen maan Pijspain Latinan kielised laulud, 1616] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & Hemminki Maskulainen \\
+ Format: & octavo \\
+ Folios: & 8 per quire \\
+ Folio numbers: & folio numbers on first five folios of a quire,
+ the first folio has just the quire number, quire number in upper
+ case. \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \makeatletter
+ \setfoliono{3}{4}
+ \FolioNo@skipFirstFolioNumbertrue
+ \FolioNo@onlyFirstHalftrue
+ \makeatother
+ \currentfoliowithstyles
+ \end{minipage}
+ \end{tabular}
+
+Code:
+
+\begin{minipage}{5cm}
+ \verb!\usepackage[SkipFirst,SkipEnd]{foliono}!\\
+ \verb!\folionoquirefolios{8}!\\
+\end{minipage}
+
+
+\item[Somen Kielinen Catechismus, 1628] \mbox{} \\
+ \begin{tabular}{lp{7cm}}
+ Author: & Martin Luther \\
+ Translator: & Knut Carelius \\
+ Format: & quarto \\
+ Folios: & 4 per quire \\
+ Folio numbers: & first folio of a quire has only quire number,
+ last folio of a quire is without number,
+ quire numbers are capitalized. \\
+ Sample: &
+ \begin{minipage}{6cm}
+ \currentfoliowithstyles
+ \end{minipage}
+ \end{tabular}
+
+Code:
+
+\begin{minipage}{5cm}
+ \verb!\usepackage[SkipFirst,SkipEnd]{foliono}!\\
+ \verb!\folionoquirefolios{4}!\\
+\end{minipage}
+
+
+\end{description}
+
+
+
+
+
+\end{document}
diff --git a/macros/latex/contrib/foliono/lppl.txt b/macros/latex/contrib/foliono/lppl.txt
new file mode 100644
index 0000000000..90e5e3ab79
--- /dev/null
+++ b/macros/latex/contrib/foliono/lppl.txt
@@ -0,0 +1,416 @@
+The LaTeX Project Public License
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+
+LPPL Version 1.3c 2006-05-20
+
+Copyright 1999 2002-2006 LaTeX3 Project
+ Everyone is allowed to distribute verbatim copies of this
+ license document, but modification of it is not allowed.
+
+
+PREAMBLE
+========
+
+The LaTeX Project Public License (LPPL) is the primary license under
+which the the LaTeX kernel and the base LaTeX packages are distributed.
+
+You may use this license for any work of which you hold the copyright
+and which you wish to distribute. This license may be particularly
+suitable if your work is TeX-related (such as a LaTeX package), but
+it is written in such a way that you can use it even if your work is
+unrelated to TeX.
+
+The section `WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE',
+below, gives instructions, examples, and recommendations for authors
+who are considering distributing their works under this license.
+
+This license gives conditions under which a work may be distributed
+and modified, as well as conditions under which modified versions of
+that work may be distributed.
+
+We, the LaTeX3 Project, believe that the conditions below give you
+the freedom to make and distribute modified versions of your work
+that conform with whatever technical specifications you wish while
+maintaining the availability, integrity, and reliability of
+that work. If you do not see how to achieve your goal while
+meeting these conditions, then read the document `cfgguide.tex'
+and `modguide.tex' in the base LaTeX distribution for suggestions.
+
+
+DEFINITIONS
+===========
+
+In this license document the following terms are used:
+
+ `Work'
+ Any work being distributed under this License.
+
+ `Derived Work'
+ Any work that under any applicable law is derived from the Work.
+
+ `Modification'
+ Any procedure that produces a Derived Work under any applicable
+ law -- for example, the production of a file containing an
+ original file associated with the Work or a significant portion of
+ such a file, either verbatim or with modifications and/or
+ translated into another language.
+
+ `Modify'
+ To apply any procedure that produces a Derived Work under any
+ applicable law.
+
+ `Distribution'
+ Making copies of the Work available from one person to another, in
+ whole or in part. Distribution includes (but is not limited to)
+ making any electronic components of the Work accessible by
+ file transfer protocols such as FTP or HTTP or by shared file
+ systems such as Sun's Network File System (NFS).
+
+ `Compiled Work'
+ A version of the Work that has been processed into a form where it
+ is directly usable on a computer system. This processing may
+ include using installation facilities provided by the Work,
+ transformations of the Work, copying of components of the Work, or
+ other activities. Note that modification of any installation
+ facilities provided by the Work constitutes modification of the Work.
+
+ `Current Maintainer'
+ A person or persons nominated as such within the Work. If there is
+ no such explicit nomination then it is the `Copyright Holder' under
+ any applicable law.
+
+ `Base Interpreter'
+ A program or process that is normally needed for running or
+ interpreting a part or the whole of the Work.
+
+ A Base Interpreter may depend on external components but these
+ are not considered part of the Base Interpreter provided that each
+ external component clearly identifies itself whenever it is used
+ interactively. Unless explicitly specified when applying the
+ license to the Work, the only applicable Base Interpreter is a
+ `LaTeX-Format' or in the case of files belonging to the
+ `LaTeX-format' a program implementing the `TeX language'.
+
+
+
+CONDITIONS ON DISTRIBUTION AND MODIFICATION
+===========================================
+
+1. Activities other than distribution and/or modification of the Work
+are not covered by this license; they are outside its scope. In
+particular, the act of running the Work is not restricted and no
+requirements are made concerning any offers of support for the Work.
+
+2. You may distribute a complete, unmodified copy of the Work as you
+received it. Distribution of only part of the Work is considered
+modification of the Work, and no right to distribute such a Derived
+Work may be assumed under the terms of this clause.
+
+3. You may distribute a Compiled Work that has been generated from a
+complete, unmodified copy of the Work as distributed under Clause 2
+above, as long as that Compiled Work is distributed in such a way that
+the recipients may install the Compiled Work on their system exactly
+as it would have been installed if they generated a Compiled Work
+directly from the Work.
+
+4. If you are the Current Maintainer of the Work, you may, without
+restriction, modify the Work, thus creating a Derived Work. You may
+also distribute the Derived Work without restriction, including
+Compiled Works generated from the Derived Work. Derived Works
+distributed in this manner by the Current Maintainer are considered to
+be updated versions of the Work.
+
+5. If you are not the Current Maintainer of the Work, you may modify
+your copy of the Work, thus creating a Derived Work based on the Work,
+and compile this Derived Work, thus creating a Compiled Work based on
+the Derived Work.
+
+6. If you are not the Current Maintainer of the Work, you may
+distribute a Derived Work provided the following conditions are met
+for every component of the Work unless that component clearly states
+in the copyright notice that it is exempt from that condition. Only
+the Current Maintainer is allowed to add such statements of exemption
+to a component of the Work.
+
+ a. If a component of this Derived Work can be a direct replacement
+ for a component of the Work when that component is used with the
+ Base Interpreter, then, wherever this component of the Work
+ identifies itself to the user when used interactively with that
+ Base Interpreter, the replacement component of this Derived Work
+ clearly and unambiguously identifies itself as a modified version
+ of this component to the user when used interactively with that
+ Base Interpreter.
+
+ b. Every component of the Derived Work contains prominent notices
+ detailing the nature of the changes to that component, or a
+ prominent reference to another file that is distributed as part
+ of the Derived Work and that contains a complete and accurate log
+ of the changes.
+
+ c. No information in the Derived Work implies that any persons,
+ including (but not limited to) the authors of the original version
+ of the Work, provide any support, including (but not limited to)
+ the reporting and handling of errors, to recipients of the
+ Derived Work unless those persons have stated explicitly that
+ they do provide such support for the Derived Work.
+
+ d. You distribute at least one of the following with the Derived Work:
+
+ 1. A complete, unmodified copy of the Work;
+ if your distribution of a modified component is made by
+ offering access to copy the modified component from a
+ designated place, then offering equivalent access to copy
+ the Work from the same or some similar place meets this
+ condition, even though third parties are not compelled to
+ copy the Work along with the modified component;
+
+ 2. Information that is sufficient to obtain a complete,
+ unmodified copy of the Work.
+
+7. If you are not the Current Maintainer of the Work, you may
+distribute a Compiled Work generated from a Derived Work, as long as
+the Derived Work is distributed to all recipients of the Compiled
+Work, and as long as the conditions of Clause 6, above, are met with
+regard to the Derived Work.
+
+8. The conditions above are not intended to prohibit, and hence do not
+apply to, the modification, by any method, of any component so that it
+becomes identical to an updated version of that component of the Work as
+it is distributed by the Current Maintainer under Clause 4, above.
+
+9. Distribution of the Work or any Derived Work in an alternative
+format, where the Work or that Derived Work (in whole or in part) is
+then produced by applying some process to that format, does not relax or
+nullify any sections of this license as they pertain to the results of
+applying that process.
+
+10. a. A Derived Work may be distributed under a different license
+ provided that license itself honors the conditions listed in
+ Clause 6 above, in regard to the Work, though it does not have
+ to honor the rest of the conditions in this license.
+
+ b. If a Derived Work is distributed under a different license, that
+ Derived Work must provide sufficient documentation as part of
+ itself to allow each recipient of that Derived Work to honor the
+ restrictions in Clause 6 above, concerning changes from the Work.
+
+11. This license places no restrictions on works that are unrelated to
+the Work, nor does this license place any restrictions on aggregating
+such works with the Work by any means.
+
+12. Nothing in this license is intended to, or may be used to, prevent
+complete compliance by all parties with all applicable laws.
+
+
+NO WARRANTY
+===========
+
+There is no warranty for the Work. Except when otherwise stated in
+writing, the Copyright Holder provides the Work `as is', without
+warranty of any kind, either expressed or implied, including, but not
+limited to, the implied warranties of merchantability and fitness for a
+particular purpose. The entire risk as to the quality and performance
+of the Work is with you. Should the Work prove defective, you assume
+the cost of all necessary servicing, repair, or correction.
+
+In no event unless required by applicable law or agreed to in writing
+will The Copyright Holder, or any author named in the components of the
+Work, or any other party who may distribute and/or modify the Work as
+permitted above, be liable to you for damages, including any general,
+special, incidental or consequential damages arising out of any use of
+the Work or out of inability to use the Work (including, but not limited
+to, loss of data, data being rendered inaccurate, or losses sustained by
+anyone as a result of any failure of the Work to operate with any other
+programs), even if the Copyright Holder or said author or said other
+party has been advised of the possibility of such damages.
+
+
+MAINTENANCE OF THE WORK
+=======================
+
+The Work has the status `author-maintained' if the Copyright Holder
+explicitly and prominently states near the primary copyright notice in
+the Work that the Work can only be maintained by the Copyright Holder
+or simply that it is `author-maintained'.
+
+The Work has the status `maintained' if there is a Current Maintainer
+who has indicated in the Work that they are willing to receive error
+reports for the Work (for example, by supplying a valid e-mail
+address). It is not required for the Current Maintainer to acknowledge
+or act upon these error reports.
+
+The Work changes from status `maintained' to `unmaintained' if there
+is no Current Maintainer, or the person stated to be Current
+Maintainer of the work cannot be reached through the indicated means
+of communication for a period of six months, and there are no other
+significant signs of active maintenance.
+
+You can become the Current Maintainer of the Work by agreement with
+any existing Current Maintainer to take over this role.
+
+If the Work is unmaintained, you can become the Current Maintainer of
+the Work through the following steps:
+
+ 1. Make a reasonable attempt to trace the Current Maintainer (and
+ the Copyright Holder, if the two differ) through the means of
+ an Internet or similar search.
+
+ 2. If this search is successful, then enquire whether the Work
+ is still maintained.
+
+ a. If it is being maintained, then ask the Current Maintainer
+ to update their communication data within one month.
+
+ b. If the search is unsuccessful or no action to resume active
+ maintenance is taken by the Current Maintainer, then announce
+ within the pertinent community your intention to take over
+ maintenance. (If the Work is a LaTeX work, this could be
+ done, for example, by posting to comp.text.tex.)
+
+ 3a. If the Current Maintainer is reachable and agrees to pass
+ maintenance of the Work to you, then this takes effect
+ immediately upon announcement.
+
+ b. If the Current Maintainer is not reachable and the Copyright
+ Holder agrees that maintenance of the Work be passed to you,
+ then this takes effect immediately upon announcement.
+
+ 4. If you make an `intention announcement' as described in 2b. above
+ and after three months your intention is challenged neither by
+ the Current Maintainer nor by the Copyright Holder nor by other
+ people, then you may arrange for the Work to be changed so as
+ to name you as the (new) Current Maintainer.
+
+ 5. If the previously unreachable Current Maintainer becomes
+ reachable once more within three months of a change completed
+ under the terms of 3b) or 4), then that Current Maintainer must
+ become or remain the Current Maintainer upon request provided
+ they then update their communication data within one month.
+
+A change in the Current Maintainer does not, of itself, alter the fact
+that the Work is distributed under the LPPL license.
+
+If you become the Current Maintainer of the Work, you should
+immediately provide, within the Work, a prominent and unambiguous
+statement of your status as Current Maintainer. You should also
+announce your new status to the same pertinent community as
+in 2b) above.
+
+
+WHETHER AND HOW TO DISTRIBUTE WORKS UNDER THIS LICENSE
+======================================================
+
+This section contains important instructions, examples, and
+recommendations for authors who are considering distributing their
+works under this license. These authors are addressed as `you' in
+this section.
+
+Choosing This License or Another License
+----------------------------------------
+
+If for any part of your work you want or need to use *distribution*
+conditions that differ significantly from those in this license, then
+do not refer to this license anywhere in your work but, instead,
+distribute your work under a different license. You may use the text
+of this license as a model for your own license, but your license
+should not refer to the LPPL or otherwise give the impression that
+your work is distributed under the LPPL.
+
+The document `modguide.tex' in the base LaTeX distribution explains
+the motivation behind the conditions of this license. It explains,
+for example, why distributing LaTeX under the GNU General Public
+License (GPL) was considered inappropriate. Even if your work is
+unrelated to LaTeX, the discussion in `modguide.tex' may still be
+relevant, and authors intending to distribute their works under any
+license are encouraged to read it.
+
+A Recommendation on Modification Without Distribution
+-----------------------------------------------------
+
+It is wise never to modify a component of the Work, even for your own
+personal use, without also meeting the above conditions for
+distributing the modified component. While you might intend that such
+modifications will never be distributed, often this will happen by
+accident -- you may forget that you have modified that component; or
+it may not occur to you when allowing others to access the modified
+version that you are thus distributing it and violating the conditions
+of this license in ways that could have legal implications and, worse,
+cause problems for the community. It is therefore usually in your
+best interest to keep your copy of the Work identical with the public
+one. Many works provide ways to control the behavior of that work
+without altering any of its licensed components.
+
+How to Use This License
+-----------------------
+
+To use this license, place in each of the components of your work both
+an explicit copyright notice including your name and the year the work
+was authored and/or last substantially modified. Include also a
+statement that the distribution and/or modification of that
+component is constrained by the conditions in this license.
+
+Here is an example of such a notice and statement:
+
+ %% pig.dtx
+ %% Copyright 2005 M. Y. Name
+ %
+ % This work may be distributed and/or modified under the
+ % conditions of the LaTeX Project Public License, either version 1.3
+ % of this license or (at your option) any later version.
+ % The latest version of this license is in
+ % http://www.latex-project.org/lppl.txt
+ % and version 1.3 or later is part of all distributions of LaTeX
+ % version 2005/12/01 or later.
+ %
+ % This work has the LPPL maintenance status `maintained'.
+ %
+ % The Current Maintainer of this work is M. Y. Name.
+ %
+ % This work consists of the files pig.dtx and pig.ins
+ % and the derived file pig.sty.
+
+Given such a notice and statement in a file, the conditions
+given in this license document would apply, with the `Work' referring
+to the three files `pig.dtx', `pig.ins', and `pig.sty' (the last being
+generated from `pig.dtx' using `pig.ins'), the `Base Interpreter'
+referring to any `LaTeX-Format', and both `Copyright Holder' and
+`Current Maintainer' referring to the person `M. Y. Name'.
+
+If you do not want the Maintenance section of LPPL to apply to your
+Work, change `maintained' above into `author-maintained'.
+However, we recommend that you use `maintained', as the Maintenance
+section was added in order to ensure that your Work remains useful to
+the community even when you can no longer maintain and support it
+yourself.
+
+Derived Works That Are Not Replacements
+---------------------------------------
+
+Several clauses of the LPPL specify means to provide reliability and
+stability for the user community. They therefore concern themselves
+with the case that a Derived Work is intended to be used as a
+(compatible or incompatible) replacement of the original Work. If
+this is not the case (e.g., if a few lines of code are reused for a
+completely different task), then clauses 6b and 6d shall not apply.
+
+
+Important Recommendations
+-------------------------
+
+ Defining What Constitutes the Work
+
+ The LPPL requires that distributions of the Work contain all the
+ files of the Work. It is therefore important that you provide a
+ way for the licensee to determine which files constitute the Work.
+ This could, for example, be achieved by explicitly listing all the
+ files of the Work near the copyright notice of each file or by
+ using a line such as:
+
+ % This work consists of all files listed in manifest.txt.
+
+ in that place. In the absence of an unequivocal list it might be
+ impossible for the licensee to determine what is considered by you
+ to comprise the Work and, in such a case, the licensee would be
+ entitled to make reasonable conjectures as to which files comprise
+ the Work.
+
diff --git a/macros/latex/contrib/foliono/pics/only-folio.png b/macros/latex/contrib/foliono/pics/only-folio.png
new file mode 100644
index 0000000000..1b85e4debd
--- /dev/null
+++ b/macros/latex/contrib/foliono/pics/only-folio.png
Binary files differ
diff --git a/macros/latex/contrib/foliono/pics/only-quire.png b/macros/latex/contrib/foliono/pics/only-quire.png
new file mode 100644
index 0000000000..10d07ffdfe
--- /dev/null
+++ b/macros/latex/contrib/foliono/pics/only-quire.png
Binary files differ
diff --git a/macros/latex/contrib/foliono/pics/skip-first.png b/macros/latex/contrib/foliono/pics/skip-first.png
new file mode 100644
index 0000000000..778bec094e
--- /dev/null
+++ b/macros/latex/contrib/foliono/pics/skip-first.png
Binary files differ
diff --git a/macros/latex/contrib/foliono/pics/standard.png b/macros/latex/contrib/foliono/pics/standard.png
new file mode 100644
index 0000000000..798655e013
--- /dev/null
+++ b/macros/latex/contrib/foliono/pics/standard.png
Binary files differ