A block is a separate part of the text that must be treated in a specific way. Blocks can be a separate consttruct or an inline version. for a separate construct, add a blank line above and below the block definition. For an in-line, keep the block within the current construct.
The following block-types exist:
Type
|
Description
|
pre
|
Preformatted text enclosed by a box
|
lst
|
Listing; preformatted, but without box
|
pic
|
Simple graphics with groff's pic
|
eqn
|
Simple equations with groff's eqn
|
gnuplot
|
Plots using gnuplot
|
music
|
Music format using Lilypond
|
texeqn
|
More elaborate equations using Tex
|
Most block types will accept a format line
.block format <format>
with <format>:
<format>
|
meaning
|
full
|
Block is displayed over about the full width
|
half
|
Block is displayed over about the half width
|
quart
|
Block is displayed over a quarter of the width
|
left
|
block is displayed on the left side
|
right
|
Block is displayed on the right side
|
A combination like halfright or leftquart is possible as long as they are sensical.
A pre-formatted block is made with the .pre requests. A pre-formatted block should never be in-line but always a separate construct. As an example:
.pre aaaaa aa aaaaa .pre
gives:
aaaaa aa aaaaa
A preformatted text that is longer (for example a listing) or a text that doesn't need the enclosing box can be handled as .lst block.
.lst #include <stdio.h> .lst int main() { .lst printf("Hello, World!"); .lst return 0; .lst }
gives:
Pic is a language for drawing simple pictures. The pic block allows the use of these pictures.
.block pic circle arrow box arrow circle "with text" .block
gives:
Contrary to groff's use of pic, pic blocks can also be used in-line
like this.
Like pic, eqn allows embedding equations in the text.
.block eqn pi r sup 2 .block
gives
Eqn blocks can also be used in-line. For simple, in-line equations, the request .eqn is available. So,
.eqn pi r sup 3
gives
as result.
Gnuplot can be used to draw plots. Only the plot needs to be specified. In3 will automatically set display, papersize et cetera. As an example:
.block gnuplot $mydata <<EOD 1 0-10 8 2.67 2 10-15 14 4.67 3 15-20 43 14.33 4 20-25 106 35.33 5 25-30 166 55.33 6 30-35 240 80 7 35-40 269 89.67 8 40-45 283 94.33 9 45-50 298 99.33 10 >50 300 100.00 EOD set yrange [0:110] set title "Speed cumulative" set arrow from 1,50 to 4.74,50 nohead set arrow from 4.74,0 to 4.74,50 nohead plot $mydata using 1:4:xtic(2) w lp notitle .block
For the use of gnuplot blocks it is required that gnuplot is installed on the system.
Like gnuplot, Lilypond can be used to create music staffs.
.block music \relative c'' { \new PianoStaff << \new Staff { \time 2/4 c4 e | g g, | } \new Staff { \clef "bass" c,,4 c' | e c | } >> } .block
produces:
Again, all the paper, display etc. options will be set by In3.
Some people dislike the eqn-formatting and/or need more complex equations. For those cases, the texeqn block can be used. Normally, Tex requires a lot of document definitions before anything can be written. In3 takes care of all that. So
.block texeqn \begin{align*} S(\omega) &= \frac{\alpha g^2}{\omega^5} e^{[ -0.74\bigl\{\frac{\omega U_\omega 19.5}{g}\bigr\}^{\!-4}\,]} \\ &= \frac{\alpha g^2}{\omega^5} \exp\Bigl[ -0.74\Bigl\{\frac{\omega U_\omega 19.5}{g}\Bigr\}^{\!-4}\,\Bigr] \end{align*} .block
becomes:
With the distribution you might get a copy of Sam Hocevar's piechart program. Because it has a DWTFYW-license I incorporated it in the ditribution of in3xml. The tables must have the order value, explode, color and legend. So, for example, if the data is:
25
|
10
|
red
|
not ok
|
25
|
20
|
yellow
|
warn
|
25
|
30
|
blue
|
unknown
|
150
|
0
|
green
|
ok
|
The block would be:
.block piechart 25,10,red,not ok 25,20,yellow,warn 25,30,blue,unknown 150,0,green,ok .block
with the result:
Note that the format for the block is a combined format here: left for having the piechart on the left and quart for the size.