On Mon, Jun 30, 2025 at 11:30:30PM +0100, Gavin Smith wrote:
> So just using @maketitle to produce the copyright page too is
> a real possibility.

So I've been seeing what I can implement in texinfo.tex as a prototype
for this feature area.

The idea is that the user specifies information in their document in
@documentinfo (or possibly elsewhere like @insertcopying).  These
are components for the title page, and the copyright page, which are
output as a single unit based on what information is available.

I've implemented this for @title, @subtitle (the output of which component
is dependent on the presence of @title), any number of @author lines,
and @copying.

Here's a demonstration of how it can be used, with info-stnd.texi:

diff --git a/doc/info-stnd.texi b/doc/info-stnd.texi
index ef1525b975..278e6c7927 100644
--- a/doc/info-stnd.texi
+++ b/doc/info-stnd.texi
@@ -39,15 +39,14 @@
 * info stand-alone: (info-stnd).           Read Info documents without Emacs.
 @end direntry
 
-@titlepage
+@documentinfo
 @title Stand-alone GNU Info
 @subtitle for version @value{VERSION}, @value{UPDATED}
 @author Brian J. Fox
 @author and Texinfo maintainers
-@page
-@vskip 0pt plus 1filll
-@insertcopying
-@end titlepage
+@end documentinfo
+
+@maketitle
 
 @contents


It would be good in my opinion to get rid of the @vskip line as it
looks ugly and confusing and probably turns people off.

If this basic design looks good we can try to add other components, such
as:

* Publisher address (related to the concept of an "imprint" or "impressum").
* Acknowledgements and credits (in texinfo.texi, "Cover art by Etienne
Suvasa.").
* If we wanted to support the bastard title page, we could easily add a new
command @shorttitle that doesn't produce any output (unlike the existing
command @shorttitlepage).
* Dedication pages
* Anything else we find is frequent on title pages or copyright pages in the
wild.

We would only add something if it was used in a lot of manuals and would
help a lot with reducing explicit use of @titlepage.

If a user wants an output that differs from the default, then they would
use @titlepage as before, perhaps with format-specific conditionals:

@ifnottex
@maketitle
@end ifnottex
@iftex
@titlepage
@dots{}
@page
@dots{}
@end titlepage
@end iftex


Here's my work so far on texinfo.tex:

diff --git a/doc/texinfo.tex b/doc/texinfo.tex
index ea64476d77..7055dd33f6 100644
--- a/doc/texinfo.tex
+++ b/doc/texinfo.tex
@@ -483,8 +483,8 @@
 %   \envdef\foo{...}
 %   \def\Efoo{...}
 %
-% It's the responsibility of \envdef to insert \begingroup before the
-% actual body; @end closes the group after calling \Efoo.  \envdef also
+% \envdef inserts \begingroup before the actual body; @end calls
+% \Efoo then closes the group with \endgroup.  \envdef also
 % defines \thisenv, so the current environment is known; @end checks
 % whether the environment name matches.  The \checkenv macro can also be
 % used to check whether the current environment is the one expected.
@@ -3911,33 +3911,92 @@ $$%
 \let\subtitlerm=\rmfont
 \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}
 
+\let\savedtitle\empty
+\let\savedsubtitle\empty
+\let\savedauthorgroup\empty
+
 \parseargdef\title{%
-  \checkenv\titlepage
-  \vbox{\titlefonts \raggedtitlesettings #1\par}%
-  % print a rule at the page bottom also.
-  \finishedtitlepagefalse
-  \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+  \expandafter\ifx\thisenv\documentinfo
+    \gdef\savedtitle{#1}%
+  \else
+    \checkenv\titlepage
+    \vbox{\titlefonts \raggedtitlesettings #1\par}%
+    % print a rule at the page bottom also.
+    \finishedtitlepagefalse
+    \vskip4pt \hrule height 4pt width \hsize \vskip4pt
+  \fi
 }
 
 \parseargdef\subtitle{%
-  \checkenv\titlepage
-  {\subtitlefont \rightline{#1}}%
+  \expandafter\ifx\thisenv\documentinfo
+    \gdef\savedsubtitle{#1}%
+  \else
+    \checkenv\titlepage
+    {\subtitlefont \rightline{#1}}%
+  \fi
 }
 
+\tracingmacros=1
+
 % @author should come last, but may come many times.
 % It can also be used inside @quotation.
 %
 \parseargdef\author{%
-  \def\temp{\quotation}%
-  \ifx\thisenv\temp
-    \def\quotationauthor{#1}% printed in \Equotation.
+  \expandafter\ifx\thisenv\documentinfo
+    \ifx\savedauthorgroup\empty
+      \gdef\savedauthorgroup{\savedauthor{#1}}%
+    \else
+      \expandafter\gdef\expandafter\savedauthorgroup\expandafter{%
+        \savedauthorgroup\savedauthor{#1}}%
+    \fi
   \else
-    \checkenv\titlepage
-    \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
-    {\secfonts\rm \leftline{#1}}%
+    \def\temp{\quotation}%
+    \ifx\thisenv\temp
+      \def\quotationauthor{#1}% printed in \Equotation.
+    \else
+      \checkenv\titlepage
+      \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
+      {\secfonts\rm \leftline{#1}}%
+    \fi
   \fi
 }
 
+% @maketitle
+{\obeylines
+\gdef\maketitle{%
+\titlepage
+
+\ifx\savedtitle\empty\else
+  \title \savedtitle
+  \ifx\savedsubtitle\empty\else
+    \subtitle \savedsubtitle
+\fi\fi
+
+
+\ifx\savedauthorgroup\empty\else
+  \savedauthorgroup
+\fi
+\ifx\copyingtext\relax\else
+  \page
+  \vskip 0pt plus 1filll
+  \insertcopying
+\fi
+\end titlepage
+}
+
+% \savedauthor{#1}, called with braces.  output an @author line.
+\gdef\savedauthor#1{%
+\author#1
+}
+}
+
+
+\envdef\documentinfo{%
+}
+
+\def\Edocumentinfo{}%
+
+
 
 % Set up page headings and footings.
 
@@ -7809,6 +7868,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
 {\catcode`\ =\other
 \gdef\docopying#1@end copying{\endgroup\def\copyingtext{#1}}
 }
+\let\copyingtext\relax
 
 \def\insertcopying{%
   \begingroup


Reply via email to