summaryrefslogtreecommitdiffhomepage
path: root/texinfo.html.markdown
blob: c192e9583ee3ab6f01e7a223ba04259b07f5c73e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
language: Texinfo
contributors:
    - ["Julien Lepiller", "https://github.com/roptat"]
filename: learntexinfo.texi
---

Texinfo is a documentation format you can use to create various types of
documents from the same source.  Its main usage is to create documentation
manuals and info pages for GNU projects.

Texinfo is a markup language that contains text and *@-commands* that specify
what the generator should do.

## Initial File

A simple example of a simple manual:

```texinfo
\input texinfo
@setfilename simple-document.info
@documentencoding UTF-8
@settitle simple-document
@c This is a comment
@c Replace simple-document above (twice) with the actual document title

@c Automake will take care of version.texi
@include version.texi

@copying
Copyright @copyright{} YEAR MY NAME

@c GFDL is common for GNU projects
@quotation
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
copy of the license is included in the section entitled ``GNU Free
Documentation License''.
@end quotation
@end copying

@titlepage
@end titlepage

@c Now starts the actual content
@contents

@c The first node must always be Top
@node Top
@c And we give it a title
@top simple-document

This document quickly describes Texinfo features.

@c This is the ToC:
@menu
* Introduction::           A short summary of the chapter

@detailmenu
--- The Detailed Node Listing ---

Introduction

* Formatting::             How to format text nicely
* Links::                  Linking to other resources, pages, or manuals

@end detailmenu
@end menu

@node Introduction
@chapter Introduction

Each node must have the same name as the menu item that was defined in the ToC.

@node Formatting
@section Formatting
@c Add something to the content index, so people can get here when searching
@c for something else
@cindex bold text
@cindex titles

Similar to chapters, sections must have the same name and appear in the same order.

@subsection This is a subsection title
@subsubsection This is a sub-subsection title

Each block of text is a paragraph. You can use multiple lines for the paragraph
like so, only empty lines separate paragraphs.

Common formatting include @emph{emphasis}, @code{inline code}. Specific type of
text can be marked as well: @file{file.txt}, @option{--learn-fast},
@command{ls} or @var{variable}. You can escape the command character like
so: @@, and a newline with a single @@ at the end of the line.

You can add different types of blocks:

@example
Here is an example
@end example

@lisp
'(this is lisp code)
@end lisp

@itemize
@item An element in an unordered list
@item A second element in the same list
@end itemize

@enumerate
@item This list is similar
@item But ordered
@end enumerate

@quotation
A quotation block, by someone famous maybe
@end quotation

@table @asis
@item element title
element description

@item second element title
second element description. Note that the description part can span multiple
paragraphs, contain other blocks etc. This is usually used as a definition
list.

@code{@@asis} wraps the element title, and tells Texinfo to use them as-is.
@end table

@table @code
@item do-x
This item title is now wrapped in a code block, as in @code{@@code{do-x}}
@end table

@c content index can appear at any place in the document, not necessarily after
@c titles.
@cindex function definition
@deffn {Kind of Function} function_name @var{arg1} @var{arg2} @
  @var{arg3} @var{arg4} [@var{optional5}]
This text describes the function. Note how we could use multiple lines for the
function synopsis by escaping the line with a single @@.

This again can contain multiple paragraphs or blocks.
@end deffn

@node Links
@section Links

There are various types of links you can use. A simple link to a URL with
@uref{https://github.com} and optionally with it a title:
@uref{https://github.com, GitHub}. An email address @email{me@@me.me}.
A node in this document, @xref{Introduction}. Always use the exact node name
for that one. @code{xref} will include the text ``see'' before the link. To
insert something different, use @pxref{Introduction} (``See'') or
@xref{Introduction} (nothing is inserted). With an additional argument, you
can change the text of the link, @xref{Introduction, this introduction}.

It is possible to link to external manuals with these commands by adding
more arguments, as in @code{@@xref{Node name,,, manual-name, link text}},
@xref{Overview,,, texinfo, Texinfo's manual} for the complete reference
on Texinfo!

@bye
```

## How to Use It

With `automake`, all you need to do is to give it the path to your manual
in `Makefile.am`:

```
info_TEXINFOS= doc/simple-manual.texi
```

Then, get your info manual with `make doc/simple-manual.info` or in other formats,
e.g. HTML with `make doc/simple-manual.html`.

## Readings

- [Official manual](https://www.gnu.org/software/texinfo/manual/texinfo/html_node/)