0

I’m trying to learn Texinfo to write a book.

I started from the sample file here.

As far as I understand from this page Contents is created automatically. And it works for the PDF output.

But I don’t see the Contents or Index on the HTML output.

By "Contents" I mean a page like this.

Also, I’m using makeinfo —html file-name.texi but on this page they recommend texi2any. When I try texi2any —html file-name.texi I get "no such command error".

(I'm using emacs Texinfo Minor Mode.)

I copy my Texfinfo file below:

@title Sample Title
@page
@vskip 0pt plus 1filll
@insertcopying
@end titlepage
     
@c Output the table of the contents at the beginning.
@contents
     
@ifnottex
@node Top
@top GNU Sample
     
@insertcopying
@end ifnottex
     
@menu
* First Chapter::    The first chapter is the
                           only chapter in this sample.
* Second Chapter::
* Third Chapter::
* Index::            Complete index.
@end menu
     
     
@node First Chapter
@chapter First Chapter
     
@cindex chapter, first
     
This is the first chapter.
@cindex index entry, another
     
Here is a numbered list.
     
@enumerate
@item
This is the first item.
     
@item
This is the second item.
@end enumerate

@node Second Chapter
@chapter Second Chapter
     This is the second chapter

@node Third Chapter
@chapter Third Chapter
     This is the third chapter

@node Index
@unnumbered Index
     
@printindex cp
     
@bye

2 Answers 2

1

Don't waste your time learning TexInfo ... instead rely on org-mode to create texi and info files.

FWIW, The Org manual itself is written in org and gets exported via ox-texinfo to texi and other formats like info, html and pdf files.


Do

(require 'ox-texinfo)

and while visiting a org file, do C-c C-e i o.

If you take a look Org mode's Makefile, you will get recipes for converting texi files to html and pdf.

  1. https://github.com/bzg/org-mode/blob/4d8d7d6cb42e388572b4f5d227e9b3c9da6ca4a7/mk/default.mk#L173

ox-texinfo

12
  • That's great, thanks! Do you know if I can add to the org file Texinfo commands like @smallbook? And there were some errors added during conversion like it added @documentencoding UTF-8 which gives an error.
    – zeynel
    Commented Sep 21, 2022 at 13:29
  • 1
    Why don't you update the question with a small org snippet that you want to convert in to a book. It is better if you share it as a gist on github or as pastebin text. It is easier to understand your problems, if you give me examples. Post the org file, post the errors etc. and let me see if I can help you in anyway.
    – user31220
    Commented Sep 21, 2022 at 13:36
  • 1
    Support for math equations in texinfo is only couple of days old PATCH Re: No mathematics in Texinfo exports. If you want the nodes to be NOT split then do, makeinfo --html --number-sections --number-sections --no-split --css-ref "https://www.gnu.org/software/emacs/manual.css". I don't know how you setup file is ` ~/.emacs.d/org-templates/level-0.org`. Anyways, looks like you have figured out most of the things.
    – user31220
    Commented Sep 22, 2022 at 2:12
  • 1
    Are you running org-mode from git? If C-h v org-texinfo-with-latex doesn't report anything, you aren't running the very very latest org version. If you know how to patch locally, apply this patch git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/….
    – user31220
    Commented Sep 22, 2022 at 7:39
  • 1
    If you are in a hurry, download git.savannah.gnu.org/cgit/emacs/org-mode.git/plain/lisp/…. Do M-x load-file <downloaded-ox-texinfo.el> and try exporting it again. MAY BE MAY BE it works, if luck is on your side.
    – user31220
    Commented Sep 22, 2022 at 7:45
1

If you are interested in creating Table of Contents ...

When in an org buffer do

C-c C-e d #

and make sure that the option toc has value t.


If you are interested in creating index-es look for #+cindex, #+vindex etc in the org-manual.org.

See also Org Manual: Texinfo Export: Indices

or

Copy the following snippet to your *scratch* buffer, go to the end of line and do C-x C-e.

(info "(org) Indices")

Support for math equations in texinfo is only couple of days old PATCH Re: No mathematics in Texinfo exports.


If you want the nodes to be NOT split then do,

makeinfo --html --number-sections --number-sections --no-split --css-ref "https://www.gnu.org/software/emacs/manual.css"`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.