bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with @setcontentsaftertitlepage


From: Gavin Smith
Subject: Re: Problem with @setcontentsaftertitlepage
Date: Tue, 2 Feb 2016 18:25:20 +0000

On 2 February 2016 at 16:31, Akim Demaille <address@hidden> wrote:
> Hi!
>
> I must be doing something wrong, but I get failures when using 
> @setcontentsaftertitlepage in TeX (other backends are happy with it).  This 
> is Texinfo 6.0.  I tried with the current texinfo.tex.
>
> $ cat foo.texi
> \input texinfo @c -*-texinfo-*-
> @c %**start of header
>
> @setfilename foo.info
> @setcontentsaftertitlepage
> @settitle Foo
>
> @titlepage
> @title Foo
> @end titlepage
>
> @contents
>
> @bye
> $ texi2dvi foo.texi
> This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/MacPorts 
> 2015_8) (preloaded format=etex)
>  restricted \write18 enabled.
> entering extended mode
> (./foo.texi (./texinfo.tex Loading texinfo [version 2016-02-02.07]: pdf,
> fonts, markup, glyphs, page headings, tables, conditionals, indexing,
> sectioning, toc, environments, defuns, macros, cross references, insertions,
> (/opt/local/share/texmf/tex/generic/epsf/epsf.tex
> This is `epsf.tex' v2.7.4 <14 February 2011>
> ) localization, formatting, and turning on texinfo input format.) [1]
> ./foo.texi:10: This command can appear only outside of any environment, not in
> environment @titlepage.
> @badenverr ...temp , not @inenvironment @thisenv }
>
> @checkenv address@hidden @thisenv @temp @else @badenverr
>                                                   @fi
> @chapmacro #1#2#3->@checkenv {}
>                                @let @prevchapterdefs address@hidden @let ...
>
> @startcontents ... @chapmacro {#1}{Yomitfromtoc}{}
>                                                   @savepageno = @pageno 
> @beg...
>
> @contents ->@startcontents address@hidden }
>                                          @openin 1 @tocreadfilename @space 
> @...
>
> @Etitlepage ...etcontentsaftertitlepage @contents
>                                                   @global @let @contents = 
> @...
> ...
> l.10 @end titlepage
>
> ? x
> Output written on foo.dvi (1 page, 240 bytes).
> Transcript written on foo.log.
> /opt/local/bin/texi2dvi: etex exited with bad status, quitting.
>
>
> There’s no big deal: the generated PDF is fine, and anyway, it’s just simpler 
> to place @contents at its appropriate place.  But maybe you wanted to know.

Thanks for reporting it; even though it's not very important, as you
say, it's better to get it fixed to stop others wasting time with in
it the future.

I found that your test file stops working at revision 6900, on
2014-10-29 (below).

I don't have anything to suggest yet, nor have I looked into the
motivation for this change in the first place.

I don't think that there's a good reason to use
@setcontentsaftertitlepage in any Texinfo file anyway, but it exists
so I suppose we have to make it work.

Index: ChangeLog
===================================================================
--- ChangeLog   (revision 5899)
+++ ChangeLog   (revision 5900)
@@ -1,3 +1,16 @@
+2014-10-29  Karl Berry  <address@hidden>
+
+       * doc/texinfo.tex (\chapmacro): \checkenv, since chapters
+       should presumably not appear inside environments.
+       (\sectionheading): allow @heading-series commands, but not others,
+       to appear inside environments.  Report from Mahlon Smith,
+       25 Aug 2014 09:42:16; original change made following
+       https://savannah.gnu.org/bugs/?15514.
+       * doc/texinfo.texi (@t{@@unnumberedsec @@appendixsec @@heading})
+       <@@heading>: @heading-series cannot appear literally "anywhere",
+       though they can appear inside most environments, unlike the
+       normal sectioning commands.
+
 2014-10-29  Gavin Smith  <address@hidden>

        * info/session.c (gc_file_buffers_and_nodes): Keep on checking
Index: doc/texinfo.texi
===================================================================
--- doc/texinfo.texi    (revision 5899)
+++ doc/texinfo.texi    (revision 5900)
@@ -4670,8 +4670,13 @@
 command is used only within appendices.

 @item @@heading
-You may use the @code{@@heading} command anywhere you wish for a
+You may use the @code{@@heading} command (almost) anywhere for a
 section-style heading that will not appear in the table of contents.
+The @code{@@heading}-series commands can appear inside most
+environments, for example, though pathological and useless locations
+such as inside @code{@@titlepage}, as an argument to another command,
+etc., are not allowed.
+
 @end table


Index: doc/texinfo.tex
===================================================================
--- doc/texinfo.tex     (revision 5899)
+++ doc/texinfo.tex     (revision 5900)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2014-05-20.16}
+\def\texinfoversion{2014-10-29.10}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -5739,13 +5739,16 @@
 %
 % #1 is the text, #2 is the section type (Ynumbered, Ynothing,
 % Yappendix, Yomitfromtoc), #3 the chapter number.
+% Not used for @heading series.
 %
 % To test against our argument.
 \def\Ynothingkeyword{Ynothing}
+\def\Yappendixkeyword{Yappendix}
 \def\Yomitfromtockeyword{Yomitfromtoc}
-\def\Yappendixkeyword{Yappendix}
 %
 \def\chapmacro#1#2#3{%
+  \checkenv{}% chapters, etc., should not start inside an environment.
+  %
   % Insert the first mark before the heading break (see notes for \domark).
   \let\prevchapterdefs=\lastchapterdefs
   \let\prevsectiondefs=\lastsectiondefs
@@ -5891,22 +5894,28 @@

 % Print any size, any type, section title.
 %
-% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is
-% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the
-% section number.
+% #1 is the text of the title,
+% #2 is the section level (sec/subsec/subsubsec),
+% #3 is the section type (Ynumbered, Ynothing, Yappendix, Yomitfromtoc),
+% #4 is the section number.
 %
 \def\seckeyword{sec}
 %
 \def\sectionheading#1#2#3#4{%
   {%
-    \checkenv{}% should not be in an environment.
+    \def\sectionlevel{#2}%
+    \def\temptype{#3}%
     %
+    % It is ok for the @heading series commands to appear inside an
+    % environment (it's been historically allowed, though the logic is
+    % dubious), but not the others.
+    \ifx\temptype\Yomitfromtockeyword\else
+      \checkenv{}% address@hidden should not be in an environment.
+    \fi
+    %
     % Switch to the right set of fonts.
     \csname #2fonts\endcsname \rmisbold
     %
-    \def\sectionlevel{#2}%
-    \def\temptype{#3}%
-    %
     % Insert first mark before the heading break (see notes for \domark).
     \let\prevsectiondefs=\lastsectiondefs
     \ifx\temptype\Ynothingkeyword



reply via email to

[Prev in Thread] Current Thread [Next in Thread]