summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/rectopma/rectopma.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/rectopma/rectopma.dtx')
-rw-r--r--macros/latex/contrib/rectopma/rectopma.dtx219
1 files changed, 219 insertions, 0 deletions
diff --git a/macros/latex/contrib/rectopma/rectopma.dtx b/macros/latex/contrib/rectopma/rectopma.dtx
new file mode 100644
index 0000000000..aadfbe1da6
--- /dev/null
+++ b/macros/latex/contrib/rectopma/rectopma.dtx
@@ -0,0 +1,219 @@
+%\iffalse
+% file: rectopma.dtx
+% author: Battista Benciolini
+% contact: benciolinibattista at gmail dot com
+% date: 2024-04-04
+%\fi
+%\iffalse
+%<*ins>
+\begingroup
+\input docstrip.tex
+\keepsilent
+\preamble
+----------------------------------------------------------------
+This file is part of the distribution of rectopma [2024-04-04]
+The author of rectopma is Battista Benciolini
+<benciolinibattista at gmail dot com >
+----------------------------------------------------------------
+This program may be used, distributed and modified under
+the conditions of the LaTeX Project Public License.
+(see: http://www.latex-project.org/lppl.txt)
+----------------------------------------------------------------
+\endpreamble
+\askforoverwritefalse
+\generate{\file{rectopma.sty}{\from{rectopma.dtx}{package}}}
+\generate{\file{TestTitle.tex}{\from{rectopma.dtx}{example}}}
+\endgroup
+%</ins>
+%\fi
+%\iffalse
+%<*driver>
+\documentclass[a4paper,10pt]{ltxdoc}
+\title{The \texttt{rectopma} package:
+\\ recicle top matter, i.e.
+\\ reuse the title and author(s)}
+\author{Battista Benciolini
+\thanks{e-mail: benciolinibattista at gmail dot com}}
+\begin{document}
+\maketitle
+\DocInput{rectopma.dtx}
+\end{document}
+%</driver>
+%\fi
+%
+%\section{Introduction}
+% The package |rectopma| makes it possible to reuse the main
+% content of |\title| and |\author| in different parts of a
+% document. It is also possible to force linebreaks in the title with
+% a command that has no effect
+% when the title is re-printed.
+% The file |TestTitle.tex| is an example of the use
+% of the functions made available by the package.
+%
+%
+%\iffalse
+%<*example>
+%\fi
+%\section{Suggestions for the use and an example}
+%
+% I first present the suggestions for the use of |rectopma.sty|
+% and the example that will be available in |TestTitle.tex|
+% The example must obviously start loading the class (I use article)
+% and the package rectopma
+% \begin{macrocode}
+\documentclass{article}
+\usepackage{rectopma}
+% \end{macrocode}
+%
+% In the preamble I define the title and the authors.
+% The authors must be separated by |\and|. Title and authors
+% can have a note using |\thanks|, and the note will disappear when
+% the title and the author will be reused.
+% When a long title is present it is
+% \DescribeMacro{\intitlebreak}
+% \DescribeMacro{\intitlebreakvs}
+% perhaps useful to force linebreaks in some special position.
+% The new commands |\intitlebreak| and |\intitlebreakvs|
+% (vs= vertical skip) are used for this purpose, and their effect
+% will disappears when the title itself is re-used in the document.
+% \begin{macrocode}
+\title{Test of the package \texttt{rectopma}
+\intitlebreak and suggestions for its use
+\intitlebreakvs (I need a long title)%
+\thanks{Comments are welcome !}}
+\author{Battista Benciolini%
+\thanks{e-mail: benciolinibattista at gmail dot com}%
+\and No Second Author\thanks{No-Where Institute}}%
+% \end{macrocode}
+%
+%\par
+% The main part of the document starts as usual.
+% The command \DescribeMacro{\SaveTopMatter} |\SaveTopMatter|
+% must be used before |maketitle| to save the title and the author(s).
+%
+% \begin{macrocode}
+\begin{document}
+\SaveTopMatter
+\maketitle
+% \end{macrocode}
+%
+% The title and the authors can be reprinted with the commands
+% \DescribeMacro{\SavedTitle} \DescribeMacro{\SavedAuthor}
+%|\SavedTitle| and |\SavedAuthor|. When they are
+% reprinted the names of the various authors are simply separated
+% by commas and the content of |\thanks| is ignored.
+%
+% \begin{macrocode}
+The authors are listed here after: \SavedAuthor.
+This is obtained with \verb|\SavedAuthor|.
+It is also possible to reprint the title,
+by means of \verb|\SavedTitle|,
+and the result is: \SavedTitle.
+% \end{macrocode}
+%
+% And this is the end of the example.
+% \begin{macrocode}
+\end{document}
+% \end{macrocode}
+%
+%\iffalse
+%</example>
+%<*package>
+%\fi
+%\section{Code of the package}
+%
+% \begin{macrocode}
+\ProvidesPackage{rectopma}[2024/04/04]
+% \end{macrocode}%
+%
+% \begin{macro}{\declarecommand}
+% I need |\declarecommand| !
+% The definition is due to egreg in
+% a comment to question 128797 in |tex.stackexchange.com|.
+% \begin{macrocode}
+\newcommand\declarecommand[1]{\providecommand{#1}{}\renewcommand{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\intitlebreak}
+% The command |\intitlebreak| is used to force a line break in the title.
+% \begin{macrocode}
+\newcommand{\intitlebreak}{\\}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\intitlebreakvs}
+% The comman |\intitlebreakvs| (vs= vertical skip)
+% produces a line break and a vertical skip.
+% \begin{macrocode}
+\newcommand{\intitlebreakvs}{\\ \vskip 4mm }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@outsidetitle}
+% The commands |\intitlebreak|, |\intitlebreakvs|,
+% |\and| and |\thanks| need a redefinition for the
+% correct output of title and authors in a generic
+% position in the document.
+% The redefinition is operated by the command |\@outsidetitle|.
+% (I follow the old tradition of inserting a |@| in the
+% commands that are of internal use, not available to the user.)
+% \begin{macrocode}
+\newcommand{\@outsidetitle}{%
+\renewcommand{\intitlebreak}{\relax}%
+\renewcommand{\intitlebreakvs}{\relax}%
+\declarecommand{\thanks}[1]{\relax}%
+\declarecommand{\and}{\unskip,\ }}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SaveTopMatter}
+% The new command |\SaveTopMatter| saves the contents of |\@title|
+% and |\@author| in |\@SavedTitle| and |\@SavedAuthor| respectively,
+% so that they can be re-used anywhere in the document.
+% \begin{macrocode}
+\newcommand{\SaveTopMatter}{%
+\global\let\@SavedTitle\@title%
+\global\let\@SavedAuthor\@author}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SavedTitle}
+% The command |\SavedTitle|
+% actually prints the title.
+% \begin{macrocode}
+\newcommand{\SavedTitle}{\@outsidetitle\@SavedTitle}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\SavedAuthor}
+% The command |\SavedAuthor|
+% actually prints the authors.
+% \begin{macrocode}
+\newcommand{\SavedAuthor}{\@outsidetitle\@SavedAuthor}
+% \end{macrocode}
+% \end{macro}
+%
+% The package is now complete.
+%
+%\iffalse
+%</package>
+%\fi
+%\section{History}
+%\begin{description}
+%\item[2002] first release in CTAN,
+%\item[2024] second release in CTAN,
+% complete re-coding of |rectopma.sty|,
+% some changes in |TestTitle.sty|,
+% new documentation,
+% all stuff collected in |rectopma.dtx|.
+%\end{description}
+%\section{Recommendation}
+% I recommend all the users of |rectopma|, and all the
+% persons that by chance encounter it,
+% to send me any comment about it.
+% \vfill\centerline{\Large ***}\vfill
+%
+%\iffalse
+% END OF FILE rectopma.dtx
+%\fi