old-www/LDP/LG/issue96/artime.html

545 lines
22 KiB
HTML

<!--startcut ==============================================-->
<!-- *** BEGIN HTML header *** -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML><HEAD>
<title>Designing a Scientific Poster with Xfig and TEX LG #96</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#0000AF"
ALINK="#FF0000">
<!-- *** END HTML header *** -->
<!-- *** BEGIN navbar *** -->
<A HREF="hughes.html">&lt;&lt;&nbsp;Prev</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="index.html">TOC</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../index.html">Front Page</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue96/artime.html">Talkback</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../faq/index.html">FAQ</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="pramode.html">Next&nbsp;&gt;&gt;</A>
<!-- *** END navbar *** -->
<!--endcut ============================================================-->
<TABLE BORDER><TR><TD WIDTH="200">
<A HREF="http://www.linuxgazette.com/">
<IMG ALT="LINUX GAZETTE" SRC="../gx/2002/lglogo_200x41.png"
WIDTH="200" HEIGHT="41" border="0"></A>
<BR CLEAR="all">
<SMALL>...<I>making Linux just a little more fun!</I></SMALL>
</TD><TD WIDTH="380">
<CENTER>
<BIG><BIG><STRONG><FONT COLOR="maroon">Designing a Scientific Poster with Xfig and TEX</FONT></STRONG></BIG></BIG>
<BR>
<STRONG>By <A HREF="../authors/artime-baro.html">C.E.C. Artime, J.A. Baro</A></STRONG>
</CENTER>
</TD></TR>
</TABLE>
<P>
<!-- END header -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="author" content="Carleos Artime">
<meta name="generator" content="bhl2html">
<link rel="generator-home" href="http://www.nongnu.org/bhl">
<title>Designing a scientific poster</title>
</head>
<body>
<h1 align="center">Designing a scientific poster with Xfig and
T<small>E</small>X</h1>
<p>A traditionally geeky user base has made the free software
panorama plenty of scientifical tools. A key feature of
scientific work is public defense of reseach methods and results
in scientific meetings, and this is usually accomplished by
means of oral presentations or posters. Both require the
authors to develop some visual support: slide shows for oral
presentations, with plenty of tools available (<a
href="http://www.openoffice.org">OpenOffice</a>, <a
href="http://www.latex-project.org">L<sup><small>A</small></sup>T<small>E</small>X</a>,...),
and a poster proper for the poster sessions. These take the
form of an A0-sized paper sheet, and a visual exposition of the
materials involved is crucial. </p>
<p> A general tool for manipulating images, as <a
href="http://www.gimp.org">the GIMP</a>, can be very useful
when most of the poster is to be filled with photos and
analogic images. Notwithstanding, scientific graphics are
best handled with a vectorial graphics tool. This article
will present a brief review of tools for incorporating
graphics in scientific posters. </p>
<img src="misc/artime/gimp0.png" alt="The GIMP interface"
width="800" height="600">
<h2>Designing: Xfig</h2>
<p> The GIMP is a bitmap- or raster-oriented tool, and as such,
aimed at dealing with individual pixels. This approach is
suitable for photos and artistic material. Technical drawings
take a rather different approach: they are better described by
their geometric elements, rather than by their constitutive
pixels. This "vectorial" approach has the additional advantage
that it produces resolution-independent graphics, thus allowing
arbitrary zooming and enlargement. </p>
<img src="misc/artime/gimp1.png" alt="Gfig: the GIMP vectorial tool"
width="776" height="554">
<p> Several free vectorial programs are currently available: <a
href="http://sodipodi.sourceforge.net">Sodipodi</a>, <a
href="http://www.koffice.org/karbon">Karbon14</a>, <a
href="http://sketch.sourceforge.net">Sketch</a>... Some
integrate nicely with the <a
href="http://www.gnome.org">Gnome</a> and <a
href="http://www.kde.org">KDE</a> desktop environments. Even
the GIMP, since version 1.2, includes a plug-in enabling quite
elaborate vectorial design, <a
href="http://www.picnic.demon.co.uk/gfig/gfig_main.html">Gfig</a>;
it lies under the menu (Filters-&gt;Render). However, the
classic among X Window applications is <a
href="http://www.xfig.org">Xfig</a>.
</p>
<img src="misc/artime/xfig0.png" alt="The Xfig initial screen"
width="790" height="544">
<p> Xfig is a thoroughly proven program that makes use of the X
Athena widget toolkit. Thus, it is a very mature product and,
consequently, its stability is beyond doubt. This is a highly
appreciated feature as work on posters frequently goes on until
the very dead line. </p>
<p> A further consequence of being a mature project is that Xfig
has been enriched by contributions of a wide community of users.
This has produced a comprehensive set of galleries for various
fields (electronics, UML, music, maps, etc.). </p>
<p> It is a reliable program as it stores its information in a
readily accessible text format, from which information retrieval
is quite straightforward. This kind of format does not follow
the modern trend, that is, it is not a SGML-based system.
Rather, it consists of the minimal amount of information for
describing the graphic, stored as ASCII characters. A thorough
description is available, e.g., at <a
href="http://www.xfig.org/userman/fig-format.html">The FIG file
format</a> or, in a <a href="http://www.debian.org">Debian</a>
system, in the file <tt>/usr/share/doc/xfig/FORMAT3.2.gz</tt>.
Its regularity makes it suitable to be processed with the
classical Unix/<a href="http://www.gnu.org">GNU</a> text
filters: <a href="http://www.gnu.org/software/sed">sed</a>, <a
href="http://www.gnu.org/software/gawk">awk</a> and such. So
chances are that you prefer ASCII to the XML format. On the
other hand, important applications as <a
href="http://www.gnuplot.info">Gnuplot</a> and GNU <a
href="http://www.gnu.org/software/plotutils">plotutils</a> can
produce FIG files; a comprehensive list is available in the file
FIGAPPS, within the Xfig distribution.</p>
<p> Another nice feature of Xfig lies with its ability to export
using L<sup><small>A</small></sup>T<small>E</small>X friendly
formats. This is true for both text and graphics. A
&#8220;special flag&#8221; is assigned to each piece of text,
signaling whether it is to be exported 'raw' or 'as <a
href="http://www.tug.org">T<small>E</small>X</a>'. Graphics are
coded according to the
L<sup><small>A</small></sup>T<small>E</small>X package options
chosen by the user. More on this later, so keep reading or look
up the LATEX.AND.XFIG and PDFLATEX.AND.XFIG files in the Xfig
distribution
</p>
<p>In order to be fair, it is time now to expose some
not-so-desirable Xfig features. It did not age badly, it is
rather that Xfig drags several drawbacks inherited from old
techniques. </p>
<p>Users of modern programs will certainly get dissapointed by its
single level of undo. So it pays to be a little cautious when
designing. </p>
<p> As mentioned above, Xfig makes use of Athena widgets, and
suffers from their limilations. For example, it is not easy to
handle accented characters in dialog windows (as when using the
Edit tool), a very frustrating feature for most European users.
Note that it allows the use of the Meta key as a Compose key,
thus permitting accented characters when using the Text tool on
the canvas. </p>
<p> On the other hand, Xfig handles a lot of export formats. In
fact, some of them are especially useful for
L<sup><small>A</small></sup>T<small>E</small>X users. However,
its support for modern graphic formats, like XML-based SGV
(Scalable Vector Graphics), is still experimental. </p>
<h2>Post-processing</h2>
<h3>L<sup><small>A</small></sup>T<small>E</small>X</h3>
<p> L<sup><small>A</small></sup>T<small>E</small>X is a set of macros
built on the top of the T<small>E</small>X typesetting
system. It is widely used to publish scientific papers, reports
and books. Despite many users are unaware, slides are easily
composed too. However, designing a full poster with
L<sup><small>A</small></sup>T<small>E</small>X alone is a
daunting task, as many objects must be arranged in a 2D space
with possibly complex interconnections among them. So the
composition can be visually arranged with Xfig, and lately
refined with a T<small>E</small>X editor. </p>
<p>To facilitate the integration of the visual work with the
edition of T<small>E</small>X source code, Xfig users are
empowered with a broad range of options. First, they have the
choice of exporting a file as either a
L<sup><small>A</small></sup>T<small>E</small>X chunk or as a
complete L<sup><small>A</small></sup>T<small>E</small>X file.
Second, a given graphical element is possibly translated to
several T<small>E</small>X expressions, depending of which
macros are available or are preferred by the user; this point is
discussed in the next paragraph. </p>
<h3>fig2dev</h3>
<p>The Xfig web site also hosts <tt>transfig</tt>, which includes
a program to export from Fig format to several
&#8220;devices&#8221;, <tt>fig2dev</tt>. This functionality is
available from the GUI as well, under the Export option of the
File menu. As we intend to finally automatize the full task as
much as possible, emphasis is put on the stand-alone
program.</p>
<p> Transformation of Fig documents into T<small>E</small>X
elements can be accomplished in several ways. Each way differs
in the number of graphical elements it can deal with (for
example: rotated text, filled rectangles), at the cost of
requiring more sophisticated
L<sup><small>A</small></sup>T<small>E</small>X packages: epic,
eepic, eepicemu, pictex. The best results are obtained with
combined <a
href="http://www.cs.indiana.edu/docproject/programming/postscript/postscript.html">PostScript</a>
(or <a
href="http://www.adobe.com/products/acrobat/adobepdf.html">PDF</a>)
and TeX: this assures that all elements seen in the Xfig screen
will be present in the printable output. Two warnings:
<em>specially flagged</em> text will be shown as raw
T<small>E</small>X in Xfig, but nicely typeset in the final
document; and some previewers, as Xdvi (distributed with <a
href="http://www.tug.org/teTeX">teT<small>E</small>X</a>), are
not able to represent some kinds of elements, as rotated text,
so better use <tt>dvips</tt> and a PostScript viewer.</p>
<h3>dvips</h3>
<p> Processing a T<small>E</small>X file produces by default DVI
format files, standing for DeVice Independent. This format is
ready to be transformed into the set of displaying instructions.
The most widespread format for final documents is PostScript,
featuring a complete programming language understood by almost
every high-quality printer. </p>
<p> The program <tt>dvips</tt> converts a DVI file into a
PostScript, and is distributed with the main T<small>E</small>X
packages, like <tt>tetex</tt>. It allows several interesting
options, giving access to the powerful features of PostScript.
One of them is the ability of setting the paper size, be it in a
measure unit, as cm, or by a standard name, as A1. This feature
is accessed by the <tt>-t</tt> and <tt>-T</tt> options. </p>
<h3>poster</h3>
<p> The output of <tt>dvips</tt> is fine if one has access to an
A0-size capable printer. This is often not the case. An
acceptable alternative would be printing 16 A4 pages, or 8 A3
pages. The <tt>poster</tt> package tiles a one-page PostScript
into small pieces, that can be pasted together to form the whole
image. Guide lines indicating where to apply the guillotine
cutter are printed as well. <a
href="http://printing.kde.org/downloads/"><tt>Poster</tt></a> is
available at the KDE web site, and as a Debian package.
<h3>psresize</h3>
<p> Should we give away small copies of our poster,
<tt>psresize</tt> is the tool of choice to build them. It is
included in the <a
href="http://gershwin.ens.fr/vdaniel/Doc-Locale/Outils-Gnu-Linux/PsUtils/"><tt>psutils</tt></a>
Debian package. </p>
<h3>bash</h3>
<p> The entire process must be repeated if any change is made in
the Xfig drawing. We suggest that you consider seriously the
little extra work of gluing all the steps mentioned through a
shell script. <a href="misc/artime/poster.sh.txt">Here</a> we
present one developed for the most widespread shell, GNU <a
href="http://www.gnu.org/software/bash"><tt>bash</tt></a>.
Calling the following script from within the directory
containing the Fig file, the whole proccess is performed. Note
that it appends a L<sup><small>A</small></sup>T<small>E</small>X
preamble and postamble, required by several
L<sup><small>A</small></sup>T<small>E</small>X features used by
the author, and several other as required by Xfig exports. </p>
<p>(We just realised the inclusion of a simple script meant to
perform the conversion from the Fig format to an EPS,
<tt>TeXfig2eps</tt>, in the Xfig distribution. As our
discussion shows, it may not be enough in many cases.)</p>
<pre>
#!/bin/bash
################################################
# Processes the FIG source file for the poster #
################################################
######################################################
# #
# Usage: #
# 1. Design a poster with Xfig. #
# 2. Save it as a normal FIG file, with #
# the name, e.g., `myfile.fig'. #
# 3. Substitute `BASE=myfile' for the line #
# `BASE=poster' in this script. #
# 4. Run this script within the directory #
# where `myfile.fig' lies. #
# 5. The output files will be: #
# `myfile-a0.ps' - one poster-sized page #
# `myfile-a4-1.ps' - a4-sized mini-poster #
# `myfile-a4-16.ps' - sixteen tile pages #
# #
######################################################
# basename
BASE=poster
# convert the FIG into LaTeX + PostScript
echo '
\documentclass{article}
\usepackage{amsmath} % symbols and equations
\usepackage{amsfonts} % needed for blackboard characters
\usepackage[spanish]{babel} % titles in our language
\usepackage[latin9]{inputenc} % accented characters
\usepackage[a0paper,margin=0cm,nohead,nofoot]{geometry} % margins
\usepackage{graphicx} % including figures
\usepackage{color} % import from Xfig
\usepackage{epic} % complements the following
\usepackage{eepic} % Xfig filling
\usepackage{rotating} % text in figures
\usepackage{type1cm} % arbitrarily sized fonts
\begin{document}
' &gt; $BASE.tex
fig2dev -L pstex $BASE.fig &gt; $BASE.pstex
echo -n '
\begin{picture}(0,0)
\includegraphics{'$BASE'.pstex}
\end{picture}
' &gt;&gt; $BASE.tex
fig2dev -L pstex_t $BASE.fig &gt;&gt; $BASE.tex
echo '\end{document}' &gt;&gt; $BASE.tex
# typeset the source LaTeX
latex $BASE
# transform into a PostScript of size almost DIN A0
dvips -o $BASE-a0.ps -T 84cm,118cm $BASE
# build the small A4 version of the poster
psresize -Pa0 -pa4 $BASE-a0.ps $BASE-a4-1.ps
# build the 16 A4 pages composing the poster
dvips -o $BASE.eps -T 84cm,118cm -E $BASE
poster -mA4 -pA0 $BASE.eps &gt; $BASE-a4-16.ps
</pre>
Some of the commands used in the script need further explanation.
The following paragraphs try to clarify these issues.
<p>
The <tt>\usepackage{color}</tt> is suggested in
<tt>/usr/share/doc/xfig/README.Debian</tt> in Debian systems.
Latest versions of Xfig's <tt>pstex</tt> use the <tt>\RGB</tt>
command for setting text's color.
<p>
Other packages were included as needed, often with a trial and
error procedure. The example does not make use of all them, but
it can be illustrative as a comprehensive list of packages that
we have ever needed for our own posters.
<p> Please note that <tt>psresize</tt> operates on <tt>.ps</tt>
files, and <tt>poster</tt> on <tt>.eps</tt> files. Thus
<tt>dvips</tt> is executed twice, without and with the
<tt>-E</tt> option.
<h2>Example</h2>
In order to exemplify the use of this script, we first create the
graphic layout with Xfig. By using the following command
<pre>
$ xfig -paper a0 -portrait
</pre>
the canvas adopts the size and orientation of the poster we need.
We design a sample poster shown <a
href="misc/artime/xfig1.png">here</a> in a screenshot capture and
<a href="misc/artime/poster.fig">here</a> in Fig format. We save
it with the name <tt>poster.fig</tt>. The <i>basename</i>
<tt>poster</tt> is assigned to the <tt>BASE</tt> variable in the
first lines of the script.
After running the script within the same directory where
<tt>poster.fig</tt> lies, the following output files are of
interest:
<ul>
<li> <a
href="misc/artime/poster-a0.ps"><tt>poster-a0.ps</tt></a>:
contains the A0-sized postcript, ready to be printed in an
A0-capable printer or plotter.
<li>
<a
href="misc/artime/poster-a4-1.ps"><tt>poster-a4-1.ps</tt></a>:
the poster scaled down to A4 size, to be printed and
distributed among the poster session attendees.
<li>
<a
href="misc/artime/poster-a4-16.ps"><tt>poster-a4-16.ps</tt></a>:
a postscript file containing sixteen A4 pages that, put
together, form the A0-sized poster.
</ul>
<h2>Very big fonts: a hack is needed</h2>
<p>
The standard <tt>tetex</tt> distribution uses by default
bitmapped fonts, which requires discrete magsteps. This leads
to warnings like
<pre>
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <30> not available
(Font) size <24.88> substituted on input line 5.
LaTeX Font Warning: Size substitutions with differences
(Font) up to 5.12pt have occurred.
</pre>
As stated in the <tt>tetex</tt> documentation,
<tt>\usepackage{type1cm}</tt> allows the use of Computer Modern
fonts at arbitrary type sizes. It must overwrite font
definitions, so it may require to be included <em>after</em> other
packages.
<p>
Note that <tt>transfig</tt> uses a fixed set of font sizes,
handled through the macro
<pre>
#define TEXFONTSIZE(S) (texfontsizes[((S) <= MAXFONTSIZE) ? round(S)\
: (MAXFONTSIZE-1))])
</pre>
that indirectly limits the maximum size of fonts to be of 41
points. For the example being shown, we had to edit
<tt>transfig</tt>'s sources (file <tt>texfonts.h</tt>) in order to
change that macro to
<pre>
#define TEXFONTSIZE(S) (S)
</pre>
The Debian way:
<pre>
$ su
Password:
# apt-get remove transfig
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
transfig
0 packages upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Need to get 0B of archives. After unpacking 799kB will be freed.
Do you want to continue? [Y/n]
(Reading database ... 67797 files and directories currently installed.)
Removing transfig ...
# exit
$ apt-get source transfig
Reading Package Lists... Done
Building Dependency Tree... Done
Need to get 340kB of source archives.
Get:1 ftp://ftp.es.debian.org testing/main transfig 1:3.2.4-rel-4 (dsc) [652B]
Get:2 ftp://ftp.es.debian.org testing/main transfig 1:3.2.4-rel-4 (tar) [326kB]
Get:3 ftp://ftp.es.debian.org testing/main transfig 1:3.2.4-rel-4 (diff) [13.0kB]
Fetched 340kB in 1m51s (3062B/s)
dpkg-source: extracting transfig in transfig-3.2.4-rel
$ vi transfig-3.2.4-rel/fig2dev/dev/texfonts.h
$ cd transfig-3.2.4-rel/
$ dpkg-buildpackage -rfakeroot -uc -us
...
[lots of output]
...
$ cd ..
$ su
Password:
# dpkg -i transfig_3.2.4-rel-4_i386.deb
Selecting previously deselected package transfig.
(Reading database ... 67734 files and directories currently installed.)
Unpacking transfig (from transfig_3.2.4-rel-4_i386.deb) ...
Setting up transfig (3.2.4-rel-4) ...
# exit
</pre>
<p>
If you find this method cumbersome, you can have a look at this
<a
href="http://www.stsci.edu/ftp/software/tex/posters/">directory</a>
where a style file meant to produce big fonts for big pages
(posters) can be found.
</body>
</html>
<!-- *** BEGIN author bio *** -->
<P>&nbsp;
<P>
<!-- *** BEGIN bio *** -->
<P>
<img ALIGN="LEFT" ALT="[BIO]" SRC="../gx/2002/note.png">
<em>
C.E.C. Artime is a GNU fan and a free software advocator since 2000.
<br>
J.A. Baro is a Linux user and a Perl hacker since 1996.
</em>
<br CLEAR="all">
<!-- *** END bio *** -->
<!-- *** END author bio *** -->
<!-- *** BEGIN copyright *** -->
<hr>
<CENTER><SMALL><STRONG>
Copyright &copy; 2003, C.E.C. Artime, J.A. Baro.
Copying license <A HREF="../copying.html">http://www.linuxgazette.com/copying.html</A><BR>
Published in Issue 96 of <i>Linux Gazette</i>, November 2003
</STRONG></SMALL></CENTER>
<!-- *** END copyright *** -->
<HR>
<!--startcut ==========================================================-->
<CENTER>
<!-- *** BEGIN navbar *** -->
<A HREF="hughes.html">&lt;&lt;&nbsp;Prev</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="index.html">TOC</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../index.html">Front Page</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="http://www.linuxgazette.com/cgi-bin/talkback/all.py?site=LG&article=http://www.linuxgazette.com/issue96/artime.html">Talkback</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="../faq/index.html">FAQ</A>&nbsp;&nbsp;|&nbsp;&nbsp;<A HREF="pramode.html">Next&nbsp;&gt;&gt;</A>
<!-- *** END navbar *** -->
</CENTER>
</BODY></HTML>
<!--endcut ============================================================-->