grodvi Command in Linux



grodvi stands for Groff Device Interface. It is a driver in Linux that is used to translate or convert the troff output to a Tex Devi format. It processes the document and loads specific macro files needed for DVI formatting. If you use eqn (for mathematical formatting), additional font files will be loaded automatically.

The DVI file produced by the grodevi command can be printed with any correctly-written DVI driver. Moreover, the drawing commands in troff are handled using a special set of commands known as tpic version 2. If the printer driver doesn't support these commands, certain drawings won't appear.

In this tutorial, we will discuss what is grodvi command and how we can use it in Linux to convert the groff output to TeX DVI format.

Table of Contents

Here is a comprehensive guide to the options available with the grodvi command −

Installation of Grodvi Command

Grodvi belongs to the groff package which is not pre-installed on most Linux distributions. Therefore, to use this driver, first, you need to install the groff package on your Linux distribution using one of the following commands −

# Ubuntu/Debian
sudo apt install groff

# Fedora
sudo dnf install groff

# Arch Linux
sudo pacman -S groff

What is grodvi Command?

Grodvi is a driver in Unix/Linux systems used with the groff text formatting system. It outputs in TeX DVI format, which allows further processing with TeX-compatible tools.

When we execute groff with the "-Tdvi" option, it uses grodevi to manage the conversion to DVI format. Moreover, the grodvi driver uses specific macros and font files to ensure that the output is properly formatted for DVI output. These DVI files/output can be printed using any compatible DVI driver.

Syntax of Grodvi Command

You can use this command in Linux by executing the following syntax −

grodvi [ -dv ] [ -wn ] [ -Fdir ] [ files... ]

You can include whitespace between a command-line option and its parameter.

Options Grodvi Command

The available options for the grodvi command are listed in the following table along with respective descriptions −

Option Description
-dv It disables the use of tpic specials for drawing commands. Horizontal and vertical lines will be drawn using rules, while other drawing commands will be skipped.
-wn It sets the default line thickness to n thousandths of an em. If not specified, the default thickness is 0.04 em.
-Fdir It adds the directory dir/devname to the search path for font and device description files, where name typically refers to the device, commonly dvi.
-v, --version It displays the version information.

Usage of grodvi Command in Linux

There are four styles available: R (Regular), I (Italic), B (Bold), and BI (Bold Italic). These styles are found in two font families, T and H −

Tag Description
TR CM Roman (cmr10)
TI CM Text Italic (cmti10)
TB CM Bold Extended Roman (cmbx10)
TBI CM Bold Extended Text Italic (cmbxti10)
HR CM Sans Serif (cmss10)
HI CM Slanted Sans Serif (cmssi10)
HB CM Sans Serif Bold Extended (cmssbx10)
HBI CM Slanted Sans Serif Bold Extended (cmssbxo10)

Individual Fonts

Apart from the T and H font families, there are also individual fonts outside these families that are listed below:

Tag Description
CW CM Typewriter Text (cmtt10)
CWI CM Italic Typewriter Text (cmitt10)

Special fonts

Special fonts include MI (cmmi10), S (cmsy10), and EX (cmex10). Apart from these, some fonts like TR, TI, and CW use different font encodings.

Symbol Fonts

Mathematical symbol fonts from the American Mathematical Society are also available as SA (msam10) and SB (msbm10). However, they aren't loaded by default.

By using the -mec option (loading the file ec.tmac), you can access EC and TC fonts, which are similar to CM fonts but provide better symbol coverage in groff. However, make sure to load ec.tmac before any language-specific settings, as it doesn't handle character codes on its own.

Important Files for Using grodvi

The following table illustrates some important files related to grodvi:

File Description
/usr/share/groff/1.18.1.1/font/devdvi/DESC This is the device description file.
/usr/share/groff/1.18.1.1/font/devdvi/F It describes the font F.
/usr/share/groff/1.18.1.1/tmac/dvi.tmac These are macros for use with grodvi.
/usr/share/groff/1.18.1.1/tmac/ec.tmac This file contains macros to switch to EC fonts.

Grodvi Command Manual Page

For more details, you can access the grodvi commands official manual page by executing the following command −

man grodvi

The manual page shows the command name, synopsis, description, typefaces, font description files, drawing commands, and available options along with their working −

Grodvi Command Manual Page

This sums up the use of grodvi command in Linux.

Conclusion

Grodvi is an important driver in Linux that converts troff output into TeX DVI format. It uses specific macros and font files to make sure the output looks right. You can customize your output with different command options, and any correctly written DVI driver can print the files produced by grodvi. By knowing the basic commands, options, and key files related to grodvi, you can effectively manage your document formatting in a Unix/Linux system.

In this tutorial, we covered the installation, usage, and important files associated with the grodvi command. These concepts provide you a solid foundation to use this command in Linux.

Advertisements