Debian Codegraph @

texmf-dist/source/latex/rectopma/rectopma.dtx

raw
1 %\iffalse
2 % file: rectopma.dtx
3 % author: Battista Benciolini
4 % contact: benciolinibattista at gmail dot com
5 % date: 2024-04-04
6 %\fi
7 %\iffalse
8 %<*ins>
9 \begingroup
10 \input docstrip.tex
11 \keepsilent
12 \preamble
13 ----------------------------------------------------------------
14 This file is part of the distribution of rectopma [2024-04-04]
15 The author of rectopma is Battista Benciolini
16 <benciolinibattista at gmail dot com >
17 ----------------------------------------------------------------
18 This program may be used, distributed and modified under
19 the conditions of the LaTeX Project Public License.
20 (see: http://www.latex-project.org/lppl.txt)
21 ----------------------------------------------------------------
22 \endpreamble
23 \askforoverwritefalse
24 \generate{\file{rectopma.sty}{\from{rectopma.dtx}{package}}}
25 \generate{\file{TestTitle.tex}{\from{rectopma.dtx}{example}}}
26 \endgroup
27 %</ins>
28 %\fi
29 %\iffalse
30 %<*driver>
31 \documentclass[a4paper,10pt]{ltxdoc}
32 \title{The \texttt{rectopma} package:
33 \\ recicle top matter, i.e.
34 \\ reuse the title and author(s)}
35 \author{Battista Benciolini
36 \thanks{e-mail: benciolinibattista at gmail dot com}}
37 \begin{document}
38 \maketitle
39 \DocInput{rectopma.dtx}
40 \end{document}
41 %</driver>
42 %\fi
43 %
44 %\section{Introduction}
45 % The package |rectopma| makes it possible to reuse the main
46 % content of |\title| and |\author| in different parts of a
47 % document. It is also possible to force linebreaks in the title with
48 % a command that has no effect
49 % when the title is re-printed.
50 % The file |TestTitle.tex| is an example of the use
51 % of the functions made available by the package.
52 %
53 %
54 %\iffalse
55 %<*example>
56 %\fi
57 %\section{Suggestions for the use and an example}
58 %
59 % I first present the suggestions for the use of |rectopma.sty|
60 % and the example that will be available in |TestTitle.tex|
61 % The example must obviously start loading the class (I use article)
62 % and the package rectopma
63 % \begin{macrocode}
64 \documentclass{article}
65 \usepackage{rectopma}
66 % \end{macrocode}
67 %
68 % In the preamble I define the title and the authors.
69 % The authors must be separated by |\and|. Title and authors
70 % can have a note using |\thanks|, and the note will disappear when
71 % the title and the author will be reused.
72 % When a long title is present it is
73 % \DescribeMacro{\intitlebreak}
74 % \DescribeMacro{\intitlebreakvs}
75 % perhaps useful to force linebreaks in some special position.
76 % The new commands |\intitlebreak| and |\intitlebreakvs|
77 % (vs= vertical skip) are used for this purpose, and their effect
78 % will disappears when the title itself is re-used in the document.
79 % \begin{macrocode}
80 \title{Test of the package \texttt{rectopma}
81 \intitlebreak and suggestions for its use
82 \intitlebreakvs (I need a long title)%
83 \thanks{Comments are welcome !}}
84 \author{Battista Benciolini%
85 \thanks{e-mail: benciolinibattista at gmail dot com}%
86 \and No Second Author\thanks{No-Where Institute}}%
87 % \end{macrocode}
88 %
89 %\par
90 % The main part of the document starts as usual.
91 % The command \DescribeMacro{\SaveTopMatter} |\SaveTopMatter|
92 % must be used before |maketitle| to save the title and the author(s).
93 %
94 % \begin{macrocode}
95 \begin{document}
96 \SaveTopMatter
97 \maketitle
98 % \end{macrocode}
99 %
100 % The title and the authors can be reprinted with the commands
101 % \DescribeMacro{\SavedTitle} \DescribeMacro{\SavedAuthor}
102 %|\SavedTitle| and |\SavedAuthor|. When they are
103 % reprinted the names of the various authors are simply separated
104 % by commas and the content of |\thanks| is ignored.
105 %
106 % \begin{macrocode}
107 The authors are listed here after: \SavedAuthor.
108 This is obtained with \verb|\SavedAuthor|.
109 It is also possible to reprint the title,
110 by means of \verb|\SavedTitle|,
111 and the result is: \SavedTitle.
112 % \end{macrocode}
113 %
114 % And this is the end of the example.
115 % \begin{macrocode}
116 \end{document}
117 % \end{macrocode}
118 %
119 %\iffalse
120 %</example>
121 %<*package>
122 %\fi
123 %\section{Code of the package}
124 %
125 % \begin{macrocode}
126 \ProvidesPackage{rectopma}[2024/04/04]
127 % \end{macrocode}%
128 %
129 % \begin{macro}{\declarecommand}
130 % I need |\declarecommand| !
131 % The definition is due to egreg in
132 % a comment to question 128797 in |tex.stackexchange.com|.
133 % \begin{macrocode}
134 \newcommand\declarecommand[1]{\providecommand{#1}{}\renewcommand{#1}}
135 % \end{macrocode}
136 % \end{macro}
137 %
138 % \begin{macro}{\intitlebreak}
139 % The command |\intitlebreak| is used to force a line break in the title.
140 % \begin{macrocode}
141 \newcommand{\intitlebreak}{\\}
142 % \end{macrocode}
143 % \end{macro}
144 %
145 % \begin{macro}{\intitlebreakvs}
146 % The comman |\intitlebreakvs| (vs= vertical skip)
147 % produces a line break and a vertical skip.
148 % \begin{macrocode}
149 \newcommand{\intitlebreakvs}{\\ \vskip 4mm }
150 % \end{macrocode}
151 % \end{macro}
152 %
153 % \begin{macro}{\@outsidetitle}
154 % The commands |\intitlebreak|, |\intitlebreakvs|,
155 % |\and| and |\thanks| need a redefinition for the
156 % correct output of title and authors in a generic
157 % position in the document.
158 % The redefinition is operated by the command |\@outsidetitle|.
159 % (I follow the old tradition of inserting a |@| in the
160 % commands that are of internal use, not available to the user.)
161 % \begin{macrocode}
162 \newcommand{\@outsidetitle}{%
163 \renewcommand{\intitlebreak}{\relax}%
164 \renewcommand{\intitlebreakvs}{\relax}%
165 \declarecommand{\thanks}[1]{\relax}%
166 \declarecommand{\and}{\unskip,\ }}%
167 % \end{macrocode}
168 % \end{macro}
169 %
170 % \begin{macro}{\SaveTopMatter}
171 % The new command |\SaveTopMatter| saves the contents of |\@title|
172 % and |\@author| in |\@SavedTitle| and |\@SavedAuthor| respectively,
173 % so that they can be re-used anywhere in the document.
174 % \begin{macrocode}
175 \newcommand{\SaveTopMatter}{%
176 \global\let\@SavedTitle\@title%
177 \global\let\@SavedAuthor\@author}
178 % \end{macrocode}
179 % \end{macro}
180 %
181 % \begin{macro}{\SavedTitle}
182 % The command |\SavedTitle|
183 % actually prints the title.
184 % \begin{macrocode}
185 \newcommand{\SavedTitle}{\@outsidetitle\@SavedTitle}
186 % \end{macrocode}
187 % \end{macro}
188 %
189 % \begin{macro}{\SavedAuthor}
190 % The command |\SavedAuthor|
191 % actually prints the authors.
192 % \begin{macrocode}
193 \newcommand{\SavedAuthor}{\@outsidetitle\@SavedAuthor}
194 % \end{macrocode}
195 % \end{macro}
196 %
197 % The package is now complete.
198 %
199 %\iffalse
200 %</package>
201 %\fi
202 %\section{History}
203 %\begin{description}
204 %\item[2002] first release in CTAN,
205 %\item[2024] second release in CTAN,
206 % complete re-coding of |rectopma.sty|,
207 % some changes in |TestTitle.sty|,
208 % new documentation,
209 % all stuff collected in |rectopma.dtx|.
210 %\end{description}
211 %\section{Recommendation}
212 % I recommend all the users of |rectopma|, and all the
213 % persons that by chance encounter it,
214 % to send me any comment about it.
215 % \vfill\centerline{\Large ***}\vfill
216 %
217 %\iffalse
218 % END OF FILE rectopma.dtx
219 %\fi