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

zeynel
  • 371
  • 1
  • 11

2 Answers2

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

  • 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 Sep 21 '22 at 13:29
  • Also menu items did not work well, I don't know how to handle that. Otherwise it looks great. So, I compose the whole book as one org file with Chapters as first headings, and subsections as secondary headings and then convert the file to .texi, right? – zeynel Sep 21 '22 at 13:32
  • 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. –  Sep 21 '22 at 13:36
  • Ok. I added a test org file and resulting .texi file to github https://github.com/azeynel/texinfo It looks good but, one major issue is that it did not recognize the Latex equations. I think Texinfo only uses plain text Tex. Is there a way to make Texinfo recognize the Latex code? – zeynel Sep 21 '22 at 15:07
  • I put the html here http://cavendish-deneyi.com/test/Introduction.html#Introduction – zeynel Sep 21 '22 at 15:08
  • It would be nice to have the Contents on a separate page like this https://www.gnu.org/software/texinfo/manual/texinfo/html_node/index.html#SEC_Contents but I don't know how this is done. – zeynel Sep 21 '22 at 15:11
  • 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. –  Sep 22 '22 at 02:12
  • I have Texinfo 6.8 installed, I exported again but still does not recognize the equations. Do I need to make any changes? – zeynel Sep 22 '22 at 07:27
  • 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 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=c940b460c7bb31e98089286a5a45306cc27034cc. –  Sep 22 '22 at 07:39
  • 1
    If you are in a hurry, download https://git.savannah.gnu.org/cgit/emacs/org-mode.git/plain/lisp/ox-texinfo.el?id=c940b460c7bb31e98089286a5a45306cc27034cc. 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. –  Sep 22 '22 at 07:45
  • You referenced this: makeinfo --html --number-sections --number-sections --no-split --css-ref "https://www.gnu.org/software/emacs/manual.css" but it gave an error for —css-ref. Instead I used --css-include="file-path-to-css" I didn't get an error with the command but it could not open the GNU css file. I tried my own css file, --css-include="http://cavendish-deneyi.com/css/worg-classic-new.css" it could not open that either. Any suggestions? – zeynel Sep 22 '22 at 09:45
  • I don't know how to patch locally. I thought of writing equations as text. http://cavendish-deneyi.com/test/Introduction.html#Introduction – zeynel Sep 22 '22 at 09:50
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"`