ARCHIVED: In LaTeX or TeX in Unix, how do I create and print a document?
To create a TeX or LaTeX file, use a Unix editor
(such as Pico, Emacs, or vi) to
create a file with embedded TeX commands. Then, save the file
with the extension .tex
(e.g., chapter1.tex
).
At the Unix prompt, enter one of the following:
tex filename latex filename
Replace filename
with the name of your file.
If your file is syntactically correct for TeX, you won't see any error
messages, but you will see some informational messages. These appear
on the screen and are written to a file with the .log
extension.
If TeX or LaTeX can process your file, it will create a file with the
extension .dvi
(Device Independent), which is a
binary file and cannot be displayed on the screen. Do not
try to edit this file.
If you need to correct errors, make the changes to the
.tex
file and run latex
or tex
again.
Once you have a .dvi
file, create a PostScript
file with the dvips command. At the prompt, enter:
dvips filename -o filename
You will again see informational messages on the screen. The PostScript file is a large text file that contains PostScript commands.
To print your file, use the print command appropriate to your system. This will be either lp or lpr, depending on whether your system uses BSD or System V (many systems use both). In BSD, enter:
lpr -Pprintername filename
The System V equivalent is:
lp -d printername filename
Replace printername
with the name of the printer you're
using and filename
with the name of your PostScript file.
For more help with printing, see ARCHIVED: In Unix, how do I print files and list or remove print jobs?
You may also use dvips
as a filter and pipe it into the
print command, for example:
dvips -f dvifile | lpr -Pprintername
The -f
option to the dvips
command makes it
a filter, allowing you to use it in a pipeline and avoid generating
temporary files. In the above example, you would replace
dvifile
with the name of your own DVI format file, and
printername
with the name of the printer you're using.
For further information on these topics, check the online manual pages. At the Unix prompt, enter one of the following:
man dvips man lpr man lp
At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.
Related documents
This is document abcc in the Knowledge Base.
Last modified on 2018-01-18 08:52:43.