summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/toptesi
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-07-03 20:44:48 +0000
committerKarl Berry <karl@freefriends.org>2016-07-03 20:44:48 +0000
commitf0c23554405bd929a290a9a0532aeecaaf94a255 (patch)
tree4a9730b12ca293aff5d45d29dacd8c857014c3c9 /Master/texmf-dist/source/latex/toptesi
parent94626ee0ec44f738d36151189f2e0ef4327d91b7 (diff)
toptesi (3jul16)
git-svn-id: svn://tug.org/texlive/trunk@41608 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/toptesi')
-rw-r--r--Master/texmf-dist/source/latex/toptesi/toptesi.dtx364
1 files changed, 196 insertions, 168 deletions
diff --git a/Master/texmf-dist/source/latex/toptesi/toptesi.dtx b/Master/texmf-dist/source/latex/toptesi/toptesi.dtx
index 8da3fa99462..60655e0fac6 100644
--- a/Master/texmf-dist/source/latex/toptesi/toptesi.dtx
+++ b/Master/texmf-dist/source/latex/toptesi/toptesi.dtx
@@ -61,11 +61,11 @@ lines of the file for how-to information.
\askforoverwritefalse
\generate{\file{toptesi.cls}{\from{toptesi.dtx}{class}}
- \file{toptesi.sty}{\from{toptesi.dtx}{topsty}}
- \file{topcoman.sty}{\from{toptesi.dtx}{topcmn}}
- \file{topfront.sty}{\from{toptesi.dtx}{topfrn}}
- \file{toptesi.cfg}{\from{toptesi.dtx}{topcfg}}
- }
+ \file{toptesi.sty}{\from{toptesi.dtx}{topsty}}
+ \file{topcoman.sty}{\from{toptesi.dtx}{topcmn}}
+ \file{topfront.sty}{\from{toptesi.dtx}{topfrn}}
+ \file{toptesi.cfg}{\from{toptesi.dtx}{topcfg}}
+ }
\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
@@ -107,7 +107,7 @@ lines of the file for how-to information.
%<topcmn>\ProvidesPackage{topcoman}[%
%<topfrn>\ProvidesPackage{topfront}[%
%<*driver,class,topsty,topcmn,topfrn>
-2015/12/18 v.5.91
+2016/06/29 v.5.92
%<class>Class for typesetting university theses]
%<topsty>Extension for toptesi.cls]
%<topcmn>Additional commands for the TOPtesi bundle]
@@ -126,6 +126,7 @@ lines of the file for how-to information.
\usepackage{metalogo,multicol}
\def\prog#1{\textsf{#1}}
\def\pack#1{\textsf{\slshape#1}}
+\def\env#1{\textit{#1}}\let\amb\env
\begin{document}\errorcontextlines=9
\maketitle
\begin{multicols}{2}
@@ -137,7 +138,7 @@ lines of the file for how-to information.
%</driver>
% \fi
%
-% \CheckSum{2763}
+% \CheckSum{2779}
%
% \begin{abstract}
% This file describes the TOPtesi bundle; it is a set of files designed to
@@ -653,6 +654,16 @@ lines of the file for how-to information.
% math Greek letters, so there is the facility to typeset an upright ``pi''
% (the number) to be distinguished from an slanted ''pi'' (the angle).
% %
+% \Item[goodpagebreak] inserts a conditional page break in after the line
+% where this command appears; it is not equivalent to the |\raggedbottom|
+% declaration that does not vertically justify any page, but tests the
+% amount of space remaining on the page, and if less than a given number of
+% lines are available inserts a page break; the result is a ragged bottom
+% single page, that sometimes is better than loose spacing between paragraphs,
+% or within items of a list, or before or after displayed material. It is
+% handy also to use before starting a new section, because at least four
+% lines are required by \LaTeX\ in order to avoid orphan lines.
+%
% \Item[listing] requires for its argument the name of a file and typesets
% it in verbatim mode; this command is very useful for typesetting the
% listings of the programs that were written for the thesis; for best results
@@ -667,14 +678,13 @@ lines of the file for how-to information.
% that might be used as an independent extension package with any document class.
%
% \section{PDF/A archivable format}
-% This section in general does not apply if the thesis is typeset by means
-% of \XeLaTeX, because the typesetting engine in this case cannot directly
-% produce a PDF formatted output file. Nevertheless even a PDF produced with
-% \XeLaTeX\ can be made PDF/A compliant; even better, \LuaLaTeX, whose source
-% file is practically the same as that of \XeLaTeX, may directly produce a PDF/A
-% compliant output file if the user uses a little patch described further on.
-% The patch is integrated into TOPtesi, and the user might be interested only
-% if s/he used a different class to typeset some of the included files.
+% This section in general applies also if the thesis is typeset by means
+% of \XeLaTeX, but in this case special attention should be given to the
+% details of the procedure as described in the documentation of the
+% \pack{pdfx} package. Even better, \LuaLaTeX, whose source file is
+% practically the same as that of \XeLaTeX, may produce in a simpler way
+% a PDF/A compliant output file if the users follow attentively the
+% instructions contained in the documentation of the \pack{pdfx} package.
%
% More details are given in the Italian documentation contained in files
% \texttt{toptesi\discretionary{-}{}{-}it-pdftex}.
@@ -694,9 +704,9 @@ lines of the file for how-to information.
% software is available.
%
% The requirements for the `a' sub-format imply not only those imposed on
-% the `b' one, but also that all characters are conforming to UNICODE and
-% that the logical structure of the document be accessible from outside
-% (Tagged PDF). The requirements for the `b' sub-format are that the
+% the `b' one, but also that the logical structure of the document be
+% accessible from outside (Tagged PDF).
+% The requirements for the `b' sub-format are that the
% document must be reproducible without modifications exactly as it was at
% the moment of archiving. Both sub-formats must contain \emph{metadata}
% that are searchable even without decompressing the normally compressed
@@ -706,8 +716,8 @@ lines of the file for how-to information.
% information, such as the keywords that ease up library searches.
%
% Since version 1.40, the program \texttt{pdflatex} is capable of producing
-% PDF/A-1b compliant files, provided that some attention is put into the
-% manipulation of the source file of the thesis. With the distribution of
+% PDF/A-1b compliant files, provided that some attention is put into
+% editing of the source file of the thesis. With the distribution of
% the 2008 version of the \TeX\ system, the executable \texttt{pdflatex} has
% version number 1.40.9 (or higher) and is capable of producing PDF/A-1b files.
%
@@ -728,27 +738,25 @@ lines of the file for how-to information.
% produce a PDF/A final document, but you have to transform it by means of
% |ghostscript|; read the |ghostscript| (version 9.16 or later) documentation
% file |ps2pdf.html| in order to find out how to produce the correct
-% PS-to-PDF/A transformation. A procedure similar to this one is available when
-% the thesis is typeset by means of \XeLaTeX, and produces valid results
-% provided some caution is exercised when using fonts. The documentation in
-% Italian describes several methods to transform a non compliant PDF/A file
-% into a compliant one, and how to correct the ``imperfections'' that forbid
-% any valid transformation.
-%
-% \item As said before, \prog{lualatex} is not fully compatible with package
-% \pack{pdfx}, because in spite of having a typesetting engine that has
-% a strong resemblance with \prog{pdftex} it does not contain all its
-% primitives; in particular it misses the \cs{pdfmdfivesum} primitive. In
-% order to supply a patch it is necessary to load the package \pack{pdftexcmds}
-% that defines some macros that emulate the missing \prog{pdftex} primitives
-% by means of macros. This patch is already integrated into TOPtesi, so when
-% the user typesets his/her thesis with \prog{LuaLaTeX}, non ``undefined
-% control sequence'' errors show up, and their functionality is preserved by
-% means of the above patch.
+% PS-to-PDF/A transformation. The documentation in
+% Italian describes several more or less effective methods to transform
+% a non compliant PDF/A file into a compliant one, and how to correct the
+% ``imperfections'' that forbid any valid transformation.
+%
+% \item As said before, \prog{lualatex} used to be partially compatible
+% with package \pack{pdfx}, because in spite of having a typesetting
+% engine that has a strong resemblance with \prog{pdftex} it did not
+% contain all its primitives; therefore it was necessary to load other
+% packages e create some little patches. Since 2016 the TeXLive
+% distribution contains a new version of \pack{pdfx} and now PDF documents
+% produced with \prog{lualatex} may be fully compatible with the standard
+% PDF/A. With some special care, even \prog{xelatex} can now produce PDF/A
+% compliant output files.
%
% \item Your up-to-date complete \TeX\ distribution should contain the package
% \textsf{pdfx}; if it does not, upgrade your \TeX\ system complete
-% distribution.
+% distribution. Be sure that the version number of the \pack{pdfx} package
+% has version number 1.5.8 or higher.
%
% \item If your thesis main file, the one you run your \texttt{pdflatex} on,
% is named, say, \texttt{JohnSmithMasterThesis.tex}, prepare in the same
@@ -762,61 +770,42 @@ lines of the file for how-to information.
% \Author{John Smith}
% \end{verbatim}
% The keyword list requires a specific format that can be examined
-% in the package documentation.
+% in the package documentation. The best way to be sure that this file
+% accompanies the thesis main file, is to put its contents in a
+% \env{filecontents*} environment before the |\documentclass| declaration.
+% The details are in the documentation of the \pack{pdfx} package.
%
% \item Some mathematical symbol commands obtained from the standard \LaTeX\
% set-up and the standard mathematical fonts require some patching that is
% already included in this \texttt{TOPtesi} bundle; but it is not excluded
% that with other fonts similar patches might be requested. The UNICODE
-% math fonts used by \XeLaTeX\ do not require any patch, but unfortunately
-% its PDF byproduct is not PDF/A compliant (it must be converted by means
-% of \prog{ghostscript}). With \LuaLaTeX\ there are no problems with fonts.
+% math fonts used by \XeLaTeX\ and \LuaLaTeX\ do not require any patch.
%
-% \item Use only PNG and JPEG images with RGB color profiles.
+% \item Use only PNG and JPEG images with RGB color profiles. If a PNG image
+% file contains some transparencies, the document PDF cannot be validated
+% as PDF/A compliant.
%
% \item If you include PDF images that contain some text, be sure that the
% fonts for this text are completely embedded in the included file. Should
-% the PDF file come% from an external drawing program be sure to configure
+% the PDF file come from an external drawing program be sure to configure
% that program so that it embeds all the fonts used in the image. If you
% don't succeed, open the PDF file with the free program \texttt{inkscape}
% and save it back in PDF format; the missing fonts will be replaced with
% their traced outlines and this will not disturb the PDF/A conformity. Pay
% attention, because Inkscape might save your file with some specifications
-% for transparency; Transparency specification destroy the PDF/A compliance.
+% for transparency; transparency specification destroy the PDF/A compliance.
%
% \item Verify your final PDF file with a suitable program and do not give
% up doing the necessary corrections or modifications while the verification
-% program keeps saying that this or that is not conforming to the PDF/A
+% program keeps saying that this or that is not compliant with the PDF/A
% specification. A suitable program is the Preflight module of Adobe Acrobat
% Pro~XI, but this, although the most authoritative, is a commercial program;
% probably your university has special facilities for this task.
%
-% \item If you use \prog{xelatex} and you want to convert it by means of
-% |ghostscript|for typesetting your thesis, you have to accompany your
-% master file with another one that contains the metadata and other necessary
-% information. Be sure to call this auxiliary file has the masterfile name
-% glued with |-def.ps|; so if your masterfile is named
-% \texttt{JohnSmithMasterThesis.tex}, name this auxiliary file as
-% \texttt{JohnSmithMasterThesis-def.ps} and fill in the necessary metadata
-% and other technical information into this file in the lines marked with
-% |% Customize|. Then run the \prog{ghostscript} program with the proper
-% name (different for Windows or UNIX-like platforms) with the proper input
-% parameters and options as the |PS2PD.hhtml| file explains. There are
-% strong chances that if you follow the general recommendations shown here
-% and in the document |toptesi-it-xetex.pdf| file, the output file will be
-% PDF/A compliant.
-%
-% \item If you really have to typeset your document with \prog{xelatex} because
-% you have to use Opentype fonts or you have to manage languages in a
-% different way from what you can do with |babel|, then prefer using
-% \prog{lualatex}, even if you have to force the compilation; formally
-% \LuaLaTeX\ and package \pack{pdfx} are incompatible (by the end of 2015),
-% but if at the first error you force the continuation of the compilation
-% you may end up with a compliant PDF/A file.
%\end{enumerate}
%
% Warning: if you are using Adobe Reader X (or later), this program will open
-% a PDF file beginning with an information header stating that the file
+% a PDF file beginning with an information header stating that the file
% PDF/A claims to be compliant; maybe it's true, but do not trust this
% information too much, at least don't believe that this information is a
% ``certification'' of the PDF/A compliance. I have seen files with this
@@ -828,8 +817,8 @@ lines of the file for how-to information.
% in the free nature of the \prog{pdflatex}, \prog{xelatex}, and \prog{lualatex}
% programs, that, on the opposite, according to my experience have a very high
% rate of success in producing PDF/A compliant documents. If you stick to the
-% default \TeX\ system Type~1 256-glyph fonts, or to the UNICODE encoded otf
-% or ttf fonts and use this patched version of \texttt{TOPtesi} you should be able
+% default \TeX\ system Type~1, 256-glyph fonts, or to the UNICODE encoded otf
+% or ttf fonts and use this version of \texttt{TOPtesi} you should be able
% to avoid most problems.
%
% \StopEventually{} ^^A Bibliography?
@@ -964,12 +953,7 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
% inserting the university logo(s); if the user forgets that this package has
% already been loaded nothing dramatic happens, because the |\usepackage|
% and |\RequirePackage| macros perform the necessary tests in order to avoid
-% reloading the same packages again and again. In order to produce PDF/A
-% compliant files the necessary patches are very simple, but must be done
-% directly into a personal copy of the \pack{pdfx} package; see the Italian
-% documentation about this point. This notice is done here because this would
-% have been a convenient point to introduce the initial single patch I
-% found; but this patch by itself is not sufficient.
+% reloading the same packages again and again.
%
% \begin{macrocode}
\RequirePackage{graphicx}
@@ -985,9 +969,6 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\newlength\interno
\textheight 0.7\paperheight
\setlength{\textheight}{\dimexpr\textheight*\baselineskip/\baselineskip+\topskip}
-%\divide\textheight by \baselineskip
-%\multiply\textheight by \baselineskip
-%\advance\textheight by \topskip
% \end{macrocode}
% The inner margin is parametrised to the paper width, but a small correction
% is made if the extra size of 14pt is chosen. Also |\footskip| is parametrised
@@ -1002,7 +983,7 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\footskip=2\baselineskip
\fi
% \end{macrocode}
-% The convenience of holding the spine margin widthin a dimensional register
+% The convenience of holding the spine margin within a dimensional register
% becomes really useful now in order to define the other text-body
% grid-dimensions.
% Without binding correction the inner and outer margin are chosen equal, but
@@ -1110,11 +1091,12 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\endgroup
\fi}
% \end{macrocode}
-% The various tables of contents or figures or tables require some boolean variables to
-% be defined; in facts, although the ISO regulations require that every technical report
-% contains the list of figures and/or tables, in Italy theses rarely contain these lists;
-% after all: is a thesis a technical report? We require also some other boolean variables
-% to handle the difference between front matter and main matter; this differences are
+% The various tables of contents or figures or tables require some boolean
+% variables to be defined; in facts, although the ISO regulations require
+% that every technical report contains the list of figures and/or tables,
+% in Italy theses rarely contain these lists; but is a thesis a technical
+% report? We require also some other boolean variables to handle the
+% difference between front matter and main matter; this differences are
% already defined in the \texttt{book} document class, but not in the \texttt{report}
% one.
% \begin{macrocode}
@@ -1134,19 +1116,23 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
}
\AtBeginDocument{\frontmatter}
% \end{macrocode}
-% The main matter is automatically established with the first |\chapter| command issued
-% by the user; this means that every command that starts a section at the ``chapter''
-% level within the front matter must be executed without an explicit call to |\chapter|.
+% The main matter is automatically established with the first |\chapter|
+% command issued by the user; this means that every command that starts
+% a section at the ``chapter'' level within the front matter must be executed
+% without an explicit call to |\chapter|.
%
-% By default we set to false the boolean variables that control the typesetting of the
-% list of figures and the list of tables.
+% By default we set to false the boolean variables that control the typesetting
+% of the list of figures and the list of tables.
% \begin{macrocode}
\figurespagefalse
\tablespagefalse
% \end{macrocode}
%
% Before going further on, we redefine the |\cleardoublepage| command so that
-% it uses by default the plain page style, but it can be set to any other style.
+% it uses by default the plain page style for the blank page to be possibly
+% inserted if chapters should start on an odd page: but with the
+% |\blankpagestyle| command it can be set to any other style, for example
+% the |empty| page style.
% \begin{macrocode}
\let\ps@blank\ps@plain
\newcommand*\blankpagestyle[1]{%
@@ -1156,30 +1142,27 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\clearpage\null\thispagestyle{#1}\clearpage\fi\fi\fi}
% \end{macrocode}
%
-% We have to define the front matter sectioning names |\sommario| and |\ringraziamenti|
-% so as to remain in the front matter.
+% We have to define the front matter sectioning names |\sommario| and
+% |\ringraziamenti| so as to remain in the front matter.
% \begin{macrocode}
\def\sommario{%
\iffrontmatter\else\frontmattertrue\fi
- \chapter*{\summaryname}%
- \addcontentsline{toc}{chapter}{\summaryname}%
- }
+ \chapter*{\summaryname}}
%
\def\ringraziamenti{%
\iffrontmatter\else\frontmattertrue\fi
- \chapter*{\acknowledgename}%
- }
+ \chapter*{\acknowledgename}}
% \end{macrocode}
-% The strings |\summaryname| and |\acknowledgename| are not defined in any
-% language option to \texttt{babel}. Default definitions are given below, but the user
-% must define new names for localising the package in a language different from
-% Italian and English.
+% The strings |\summaryname| and |\acknowledgename| are not defined for every
+% language option to \texttt{babel}. Default definitions are given below, and
+% the user must define new names for localising the package in a language
+% different from Italian and English.
%
% We have to modify the |\chapter| and |\part| commands so that as the user
% first issues one of these commands the typesetting style is switched to that
% of the main matter. Actually it is not necessary to redefine the whole
-% commands, but just those of the unstarred versions. In facts the starred
-% chapter commands to typeset the Summary and the Acknowledgements chapters,
+% commands, but just those of the unstarred versions. In facts
+% |\chapter| commands to typeset the Summary and the Acknowledgements chapters,
% as defined above, are regularly typeset in the style of the front matter,
% opening on any page (even or odd) and numbered with small caps roman numerals.
% \begin{macrocode}
@@ -1222,9 +1205,10 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\@endpart}
% \end{macrocode}
% At the same time we have to make sure that |\tableofcontents|,
-% |\listoftables| and |\listoffigures| do not exit from the front matter style.
-% We assume these commands are issued while in front matter, the default at the begin
-% document step, so we have to avoid to use starred or un-starred |\chapter| commands.
+% |\listoftables| and |\listoffigures| do not exit from the front matter
+% style. We assume these commands are issued while in front matter, the
+% default at the begin document step, so we have to avoid to use starred
+% or un-starred |\chapter| commands.
% \begin{macrocode}
\renewcommand\tableofcontents{%
\chapter*{\contentsname}%
@@ -1250,9 +1234,9 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\if@restonecol\twocolumn\fi
}
% \end{macrocode}
-% We need to define |\indici| that typesets the table of contents and, optionally,
-% the lists of tables and/or figures while assuring that the front matter style is used for
-% typesetting.
+% We need to define |\indici| that typesets the table of contents and,
+% optionally, the lists of tables and/or figures while assuring that
+% the front matter style is used for typesetting.
% \begin{macrocode}
\def\indici{%
\iffrontmatter\else\frontmattertrue\fi
@@ -1274,15 +1258,15 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\ifbool{@twoside}{\clearpage\thispagestyle{empty}\null\clearpage}{}}
% \end{macrocode}
%
-% Command |\onecolumn| is not actually necessary; it simply overrides the possible
-% misused option \texttt{twocolumn} in the opening document class statement;
-% no thesis should be typeset in two columns.
+% Command |\onecolumn| is not actually necessary; it simply overrides the
+% possible misused option \texttt{twocolumn} in the opening document class
+% statement; no thesis should be typeset in two columns.
% \begin{macrocode}
\onecolumn
% \end{macrocode}
%
-% Here come some declarations for vertical justification and for avoiding an hyphenated
-% word at the bottom of a page
+% Here come some declarations for vertical justification and for avoiding
+% an hyphenated word at the bottom of a page
% \begin{macrocode}
\if@twoside
\flushbottom
@@ -1300,39 +1284,42 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
% requires the baseline skip to be proportioned to the font size, generally
% it is some 10--20\% larger than the font size. In some reasonable instances
% a larger or a smaller baseline skip might be required; the \LaTeX\ kernel
-% allows to use the |\linespread| command;
-% in the previous versions of this bundle a command |\interlinea| and an environment
-% \texttt{interlinea} were defined so as to allow setting the line spread factor.
-% The experience has shown that some students tend to use this command so as to typeset
-% a poor and thin thesis on more pages. Well, every instrument can be judiciously or
+% allows to use the |\linespread| command; in the previous versions of this
+% bundle a command |\interlinea| and an environment \texttt{interlinea} were
+% defined so as to allow setting the line spread factor. The experience has
+% shown that some students tend to use this command so as to typeset a poor
+% and thin thesis on more pages. Well, every instrument can be judiciously or
% maliciously used; this is one of those double sided instruments.
% \begin{macrocode}
\def\interlinea#1{\linespread{#1}\selectfont}
\def\endinterlinea{\par}
% \end{macrocode}
-% But whatever might be the current line spread factor within figures and tables we reset
-% this factor to the unit value; floating bodies do not belong to this or that section
-% of text where a different spread factor might be reasonable.
+% But whatever might be the current line spread factor within figures and
+% tables we reset this factor to the unit value; floating bodies do not
+% belong to this or that section of text where a different spread factor
+% might be reasonable.
% \begin{macrocode}
-\def\@floatboxreset {%
+\def\@floatboxreset{%
\reset@font
\linespread{1}%
\normalsize
\@setminipage
}
% \end{macrocode}
-% Since we are at it we define the floating bodies placing parameters; not only the
-% values ``here'', ``top of the page'' and ``bottom of the page'', that we set as
-% the default ones leaving to the user to explicitly specify the ``page of floats'',
-% but also the numerical and geometrical parameters that control the float placements.
-% These geometrical parameters are critical and everybody has his/her own ideas of
-% what are the best values for them. According to my experience these parameters work
-% quite well but I would not suggest them for every kind of typewritten document.
-% In particular the zero value for the text fraction appears strange, but students
-% have the tendency to create large figures (more than large tables) and these tend
-% to clog the figures queue. A 100\% space for the top of page figures and a
-% requirement of 0\% text allows large floats to exit the queue provided they do not
-% exceed the text height.
+% Since we are at it we define the floating bodies placing parameters; not
+% only the values ``here'', ``top of the page'' and ``bottom of the page'',
+% that we set as the default ones leaving to the user to explicitly specify
+% the ``page of floats'', but also the numerical and geometrical parameters
+% that control the float placements.
+% These geometrical parameters are critical and everybody has his/her own
+% ideas of what are the best values for them. According to my experience
+% these parameters work quite well but I would not suggest them for every
+% kind of typewritten document.
+% In particular the zero value for the text fraction appears strange, but
+% students have the tendency to create large figures (more than large
+% tables) and these tend to clog the figures queue. A 100\% space for the
+% top of page figures and a requirement of 0\% text allows large floats
+% to exit the queue provided they do not exceed the text height.
% \begin{macrocode}
\def\fps@figure{htb} \def\fps@table{htb}
%
@@ -1346,22 +1333,29 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\setcounter{dbltopnumber}{2}
\def\dbltopfraction{1}
\def\dblfloatpagefraction{0}
+
% \end{macrocode}
-% One command that the default definition does not satisfy me very much is the
-% |\caption| command; actually it is the internal |\@makecaption| macro that performs
-% the job. The point is that I prefer a narrower justified caption rather than a
-% caption where the last line is just a short word or the right segment of an
-% hyphenated word. If one sets the |\finalhyphendemerits| parameter to an incredibly
-% high value, one might succeed in avoiding hyphenation in the last word of a caption;
-% but this might lead to a very loose typesetting of the caption paragraph, especially
-% if the horizontal box that contains it hardly exceeds the caption width.
-% I initially set the caption width (a new length) to the overall text width diminished
-% by 3em; then if the caption text, inclusive of the caption type string and number,
-% is shorter than the text width it is typeset as centred text; if it exceeds the
-% text width it is set as a justified paragraph whose line width equals the established
-% caption width; but in any case the last line of the paragraph is measured and if it
-% is shorter than one third of the caption width, this width is shortened a little bit
-% and the paragraph is set again with this shortened caption width; in order to be sure
+% One command that the default definition does not satisfy me very much is
+% the |\caption| command; Of course it is possible to configure the caption
+% styles by means of the \pack{caption} package and its handy set of option
+% styles specified by means of the \textit{key$=$value} syntax; but if this
+% package is not used, then it is convenient to redefine the internal
+% |\@makecaption| macro that performs the job as explained hereafter.
+% The issue is that I prefer a narrower justified caption rather than a
+% caption where the last line is just a short word or the right segment
+% of an hyphenated last word. If one sets the |\finalhyphendemerits|
+% parameter to an incredibly high value, one might succeed in avoiding
+% hyphenation in the last word of a caption, but this might lead to a very
+% loose typesetting of the caption paragraph, especially if the horizontal
+% box that contains it hardly exceeds the caption width. I initially set
+% the caption width (a new length) to the overall text width diminished
+% by 3em; then if the caption text, inclusive of the caption type string
+% and number, is shorter than the text width it is typeset as centred text;
+% if it exceeds the text width it is set as a justified paragraph whose
+% line width equals the established caption width; but in any case the last
+% line of the paragraph is measured and if it is shorter than one third
+% of the caption width, this width is shortened a little bit and the
+% paragraph is set again with this shortened caption width; in order to be sure
% that one iteration is sufficient, the caption width shrinking must be computed
% according to the number of lines the paragraph occupies.
%
@@ -1380,7 +1374,7 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
% of this line in our arithmetics.
%
% If the length of the stripped last line is longer that one third of the
-% caption width, then the vertical box is recomposed by restacking the
+% caption width, then the vertical box is recomposed by re\-stacking the
% individual lines, but if this last line is shorter than one third of the
% caption width, this width is recomputed in this way: let $N-1$ be the number
% of lines obtained with the integer division, i.e.\ one line less than those
@@ -1389,16 +1383,29 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
% the total length of the caption of width $x$ is $Nx+x_2$ and this should be
% distributed over $N+1$ lines; if we obtained the new caption width $y$ by
% dividing the total length by $N+1$ we should be able to typeset the whole
-% caption with all the lines of equal length. This does not actually take place
-% because the new lines do not necessarily contain the same amount of inter word
-% space, some words might have been hyphenated in a different way, and so on.
+% caption with all the lines of equal length. This does not actually take
+% place because the new lines do not necessarily contain the same amount of
+% inter word space, some words might have been hyphenated in a different
+% way, and so on.
% Moreover we do not want a caption that barely exceeds the length of
-% |\captionwidth| to be retyped into a two line caption width that is about one half
-% of the width of the other captions. Therefore we allow for some white space in
-% the last line by computing the new caption width with the following formula
+% |\captionwidth| to be retyped into a two line caption width that is about
+% one half of the width of the other captions.
+% Therefore we allow for some white space in the last line by computing the
+% new caption width with the following formula
% \[ y=\frac{(N+0.5)x + x_2}{N+1} \]
-% \begin{macrocode}
+% By the way, if the package \pack{caption} has been loaded in the preamble,
+% the specific definition of this bundle is not defined at all; it is
+% necessary to delay this definition at |\AtBeginDocument| so we are sure
+% that that the package has been or has not been loaded. Of course
+% if the \pack{caption} package has not been loaded the |\captionsetup| macro
+% is not defined and its use (for example, as a left over of some experiments
+% with the \pack{caption} package) would produce an error for this reason we
+% define it as a gobbling macro so as to neutralise its presence.
+% \begin{macrocode}
+\AtBeginDocument{\@ifpackageloaded{caption}{}{%
+\providecommand\captionsetup{}\renewcommand\captionsetup[2][]{}%
\newdimen\captionwidth
+\belowcaptionskip=\abovecaptionskip
\long\def\@makecaption#1#2{%
\begingroup
\small \parskip\z@ \parindent\z@
@@ -1430,16 +1437,37 @@ Read documentation toptesi-it-*.pdf, because package pdfx has changed}}
\fi
\fi
\makebox[\hsize]{\box0}%
+ \vskip \belowcaptionskip
\endgroup
-}
+}}}
+
% \end{macrocode}
-%
-% The option \texttt{chapterbib} requires a redefinition of the \texttt{thebibliogrpahy}
-% environment in case a separate reference list is required for every chapter.
+% We define the |\goodpagepbreak| command; we have to distinguish if the
+% command is issued in vertical mode or in horizontal mode; In the former
+% instance we assume it has been issued between two paragraphs and a
+% potential page break is required before the second paragraph; while in
+% the latter case we assume that a |\vadjust| element should be inserted
+% so that a page break takes place after the current line has been typeset.
+% the command accepts an optional argument that represents the maximum
+% number of lines that should be present on the page in order to issue
+% a |\newpage| command; in other words if the number of lines available
+% on the page are less or equal to the optional number, then a |\newpage|
+% command is issued, otherwise noting is done; The test |\ifhmode| is used
+% in order to avoid any action if in math mode.
+% \begin{macrocode}
+\newcommand\goodpagebreak[1][4]{\ifvmode
+\unless\ifdim\dimexpr\pagegoal-\pagetotal>#1\baselineskip\newpage\fi
+\else\ifhmode\vadjust{\newpage}\fi\fi}
+% \end{macrocode}
+%
+% The option \texttt{chapterbib} requires a redefinition of the
+% \texttt{thebibliogrpahy} environment in case a separate reference list
+% is required for every chapter.
% The point is that for this task the reference key must contain also the
-% chapter number; the rest is simply a redefinition of the environment that behaves
-% differently according to the chosen option. In any case the bibliography goes to the
-% table of contents as an unnumbered chapter or section.
+% chapter number; the rest is simply a redefinition of the environment that
+% behaves differently according to the chosen option. In any case the
+% bibliography goes to the table of contents as an unnumbered chapter or
+% section.
% \begin{macrocode}
\def\redef@bibitem{\def\@bibitem##1{\item\if@filesw
\immediate\write\@auxout
@@ -1991,7 +2019,7 @@ Skipping any redefinition\MessageBreak}%
\def\@oddfoot{\vbox to 0.05\paperheight{\vss
\hbox to\hsize{\hfil{\Large{\@submitdate}}\hfil}}}%
\let\@evenfoot\@oddfoot
- \def\@oddhead{
+ \def\@oddhead{%
\vbox to\headheight{\vss\iftopTPTlogos
\hbox to\textwidth{%
\headstrut\hfil