GNU Ghostscript
Viewing an Encapsulated PostScript recycling logo in a TeX document should have been simple enough. Instead, a blank space marked the position on the display where the logo should have appeared. A quick look through all of my LaTeX documentation, including the xdvi man page, provided no answer. There seemed to be no way for xdvi to display a TeX \special command in the dvi output; in this case, an embedded PostScript image. I considered this to be a major shortcoming of xdvi, and, of course, TeX. After all, isn't combining text and graphics on a page part of what computer publishing is all about? Why should TeX, one of the most sophisticated typesetting systems in the world, be constrained by the lack of a PostScript previewer? Or the requirement for a PostScript printer, for that matter? It is said that the longest journey begins with a single step. The journey I'm about to describe has brought me a considerable distance toward professional-quality publishing, via a utility that had been sitting quietly in a subdirectory of my /usr partition all along.
The utility is Ghostscript. GNU Ghostscript, Version 3.33, is the Swiss Army knife of graphics programs. Essentially, it's a PostScript language interpreter. More specifically, Ghostscript renders PostScript code to any bitmapped device on your system, whether it be the screen, printer, or G3 fax file. The man page says, “Ghostscript is a programming language similar to Adobe System's PostScript language, which is in turn similar to Forth.” (This statement comes almost verbatim from the book: Adobe Systems, Incorporated: PostScript: Language Tutorial and Cookbook, Addison-Wesley, 1986.) Ghostscript also substitutes fonts from its own library when rendering documents if the fonts are not otherwise available, scales and rotates text, and performs any of the other typographical feats for which PostScript is famous. Despite the apparent complexity of the task, no knowledge of the PostScript language is required. For the most part, a little experimentation with the command-line options is all that's needed. Yet Ghostscript's PostScript interpreter is fully accessible.
If I want to print that EPS recycling logo at the bottom of a page of DVI output, I would insert the following commands in my LaTeX input file:
\usepackage{graphics} ... \vfil \includegraphics{recycle.eps}
Then, it is simply a matter of running the input file through teTeX, using the command line:
pslatex letter.texand then converting teTeX's dvi output to PostScript with dvips:
dvips -f <letter.dvi >letter.psThe -f command-line option tells dvips to act as a filter, reading from standard input and writing to standard output. Now, we have a PostScript file ready for printing. Ghostscript images this file in a format that's understandable to any bitmapped device on your system, whether it is a VGA display or a laser printer.
Ghostscript's command-line options are numerous. Look at ghostscript's USE.DOC file for an complete description. You can view a brief summary with the command:
gs -help | less
For example, if I want to print the file letter.ps on a Hewlett Packard DeskJet printer, I would use the command line:
gs -q -dNOPAUSE -sDEVICE=deskjet
/-sOutputFile=-\
letter.ps quit.ps >gs.out
The first option, -q, suppresses messages to the
console. However, to run Ghostscript in batch mode, the
-q option on its own is not enough. That's
because Ghostscript uses its own PostScript code at run time to
output the image.
From the command line, we define several variables, the first being NOPAUSE, which tells Ghostscript's showpage() routine not to pause after each page is output. When viewing output on a screen, it is best to leave NOPAUSE unset and let Ghostscript prompt you to view each page in turn.
Next, we set the DEVICE variable. In the example above, the output device is a HP Deskjet. Ghostscript's dictionary has output parameters defined for all the devices documented in its command-line help.
The next variable which needs defining is OutputFile. Here, we set it to - or standard output. This is the file to which Ghostscript will write its image. In most instances, however, Ghostscript provides no means for that image to be displayed. We'll get to that in a moment. Then we specify letter.ps on the command line as our target input file.
When we write a file with the pslatex command, LaTeX uses the font metrics available to it; that is, it uses Computer Modern Roman as its default font. However, the pslatex command has been implemented in teTeX so that dvips, which does the DVI to PostScript conversion, will request PostScript fonts. These fonts can be provided via either the printer or via software. In the latter case, Ghostscript produces the output image using Type 1 fonts from its own library.
Finally, we input the file quit.ps. This file is part of Ghostscript's standard library and is simply the command quit followed by a newline character. It is read into the Ghostscript interpreter just like any other input.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.
Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.
Sponsored by ActiveState
| Containers—Not Virtual Machines—Are the Future Cloud | Jun 17, 2013 |
| Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer | Jun 12, 2013 |
| Weechat, Irssi's Little Brother | Jun 11, 2013 |
| One Tail Just Isn't Enough | Jun 07, 2013 |
| Introduction to MapReduce with Hadoop on Linux | Jun 05, 2013 |
| Android's Limits | Jun 04, 2013 |
- Containers—Not Virtual Machines—Are the Future Cloud
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Linux Systems Administrator
- Introduction to MapReduce with Hadoop on Linux
- Senior Perl Developer
- Technical Support Rep
- Weechat, Irssi's Little Brother
- UX Designer
- One Tail Just Isn't Enough
- Android's Limits
- Reply to comment | Linux Journal
36 min 51 sec ago - Reply to comment | Linux Journal
37 min 18 sec ago - Replica Watches
3 hours 2 min ago - Reply to comment | Linux Journal
7 hours 12 min ago - on the path to understanding
7 hours 16 min ago - As a fisher,we know that a
1 day 2 hours ago - All I Say Is Worth Share!
1 day 3 hours ago - GeekSays
1 day 4 hours ago - thanks
1 day 7 hours ago - You should consider visiting
1 day 8 hours ago
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
Emacs Tex mode printing via Ghostscript shell scripts
The section "Ghostscript as a Document Post-Processor and Previewer" of this article sounds very interesting but doesn't work. More explanation would be nice.
Alex.
Re: Emacs TeX mode printing via Ghostscript shell scripts
Try to isolate the problem. Do the individual utilities run correctly from the shell prompt? Then, do the shell scripts run correctly from the shell? If they don't, then try to include the error messages. If they do, then try to include the debug output from the Emacs interpreter. Also include the version of each utility, so I can duplicate the errors produced by newer versions. Or, you can follow these procedures, and submit a patch.
Robert Kiesling