Download - Demonstration of TpX import capabilities
Demonstration of TpX import capabilities
Alexander Tsyplakov
January 31, 2006
Abstract
TpX (http://tpx.sourceforge.net/) is a lightweight, easy-to-use graph-ical editor for Windows platform for creation of drawings and inclusionthem into LATEX files in publication-ready form. It can also be used as astand-alone editor for vector graphics.
Under Windows most reasonable programs, which produce graphs, caneither export them as EMF files, or copy to clipboard as EMF. TpX can im-port Enhanced Metafiles (EMF) though not 100% correctly. Old-style Win-dows Metafiles (WMF) are imported by converting them to EMF. TpX canalso import simple SVG pictures.
This document demonstrates TpX import capabilities. Examples are ex-ported from many well-known as well as less known Windows programs.
1
2
Contents
1 Forewarning 3
2 Some remarks 4
3 Windows metafile (EMF) import 53.1 Histogram from Mathematica . . . . . . . . . . . . . . . . . . . . 53.2 Vector field from Mathematica . . . . . . . . . . . . . . . . . . . . 63.3 3D plot from Mathematica . . . . . . . . . . . . . . . . . . . . . . 73.4 3D plot from Matlab . . . . . . . . . . . . . . . . . . . . . . . . . 83.5 Contour plot in polar coordinates from Matlab . . . . . . . . . . . 93.6 Stem plot from Matlab . . . . . . . . . . . . . . . . . . . . . . . . 103.7 Diagram from SmartDraw . . . . . . . . . . . . . . . . . . . . . . 113.8 Flowchart from SmartDraw . . . . . . . . . . . . . . . . . . . . . 123.9 Chart from MS Excel #1 . . . . . . . . . . . . . . . . . . . . . . . 133.10 Chart from MS Excel #2 . . . . . . . . . . . . . . . . . . . . . . . 143.11 Table from MS Word . . . . . . . . . . . . . . . . . . . . . . . . . 153.12 Tulips, Microsoft clipart . . . . . . . . . . . . . . . . . . . . . . . 163.13 “No smoking”, SVG clipart from KOffice converted by Adobe Il-
lustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173.14 Tomato, EPS clipart from freeclipart.nu . . . . . . . . . . . . . . . 183.15 Brick wall bitmap image vectorized by AutoTrace . . . . . . . . . 193.16 3D plot from Gnuplot . . . . . . . . . . . . . . . . . . . . . . . . . 203.17 Multiple plot from Gnuplot . . . . . . . . . . . . . . . . . . . . . 213.18 Matrix plot from Statistica . . . . . . . . . . . . . . . . . . . . . . 223.19 3D plot from SWP/MuPAD . . . . . . . . . . . . . . . . . . . . . . 233.20 Function plot from OriginPro . . . . . . . . . . . . . . . . . . . . 243.21 Bubble color plot from Axum . . . . . . . . . . . . . . . . . . . . 25
4 Scalable vector graphics (SVG) import 264.1 Polar plot from Gnuplot . . . . . . . . . . . . . . . . . . . . . . . 264.2 Scanned signature vectorized by AutoTrace . . . . . . . . . . . . 274.3 Books, SVG clipart from openclipart.org created with Inkscape . . 284.4 “Symbols”, standard XFig example . . . . . . . . . . . . . . . . . 294.5 Diagram from OpenOffice . . . . . . . . . . . . . . . . . . . . . . 314.6 XY plot from Grace . . . . . . . . . . . . . . . . . . . . . . . . . . 324.7 MiKTeX logo imported as SVG via pstoedit . . . . . . . . . . . . . 33
3
1 Forewarning
The aim of this document is to show the potential of using TpX for importingWindows metafile and SVG graphics into LATEX documents and to reveal pos-sible complications related to using TpX for this purpose. The author has nointension to evaluate the programs which were used to create the pictures. Pos-sibly, some problems are due to misuse of those programs. Also, some problemsmight have been fixed in recent versions.
4
2 Some remarks
X TpX can add TEX formulas to graphs (see 3D plot from Gnuplot below).X It is possible to edit imported images and correct their deficiencies. For
example, TpX can help to shift misplaced text labels.X Common problem with metafile images exported from Windows pro-
grams is low resolution used to represent coordinates inside metafile. Thiscauses bad quality of some metafile images.
X Some programs use the same line width (e.g. 1 pixel) for all lines inmetafile, though in other export formats (for example, PostScript) lines havedifferent widths.
X For some programs metafile is not the preferred export format and canbe of lower quality than, for example, PostScript images.
X Some features of the original metafile image are not preserved, like bitmaps,font styles.
X It is possible to mimic the fonts of the original image to some extent, butit needs manual editing. In most cases fonts from LATEX are good enough anyway.
X As SVG format is very rich TpX can understand only some basic subset ofit.
5
3 Windows metafile (EMF) import
3.1 Histogram from Mathematica
14 16 18 20 22
5
10
15
20
Figure 1: Mathematica source
14 16 18 20 22
5
10
15
20
Figure 2: TpX output
6
3.2 Vector field from Mathematica
Figure 3: EPS file exported from Mathematica
Figure 4: TpX output
7
3.3 3D plot from Mathematica
-1
-0.5
0
0.5
1
-0.5
0
0.5
1
-1
-0.5
0
0.5
-1
-0.5
0
0.5
Figure 5: EPS file exported from Mathematica
- 1
- 0.5
0
0.5
1
- 0.5
0
0.5
1
- 1
- 0.5
0
0.5
1
0.5
0
0.5
1
Figure 6: TpX output
Comment: Mathematica exported EMF at low resolution. This could be seenfrom inaccurate tick marks.
8
3.4 3D plot from Matlab
−4
−2
0
2
4
−4
−2
0
2
4−0.8
−0.6
−0.4
−0.2
0
0.2
0.4
0.6
0.8
1
Figure 7: EPS file exported from Matlab
-4
-2
0
2
4
-4
-2
0
2
4-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Figure 8: TpX output
Comment: When exporting to EMF Matlab made all lines the same width.This was corrected manually to make dashed lines two times thinner.
9
3.5 Contour plot in polar coordinates from Matlab
0.2
0.4
0.6
0.8
1
30
210
60
240
90
270
120
300
150
330
180 0
Figure 9: EPS file exported from Matlab
0.2
0.4
0.6
0.8
1
30
210
60
240
90
270
120
300
150
330
180 0
Figure 10: TpX output
10
3.6 Stem plot from Matlab
0 2 4 6 8 10 12 14 16 18 20−0.2
−0.15
−0.1
−0.05
0
0.05
0.1
0.15
0.2
Lag
Aut
ocov
aria
nces
Figure 11: EPS file exported from Matlab
0 2 4 6 8 10 12 14 16 18 20-0.2
-0.15
-0.1
-0.05
0
0.05
0.1
0.15
0.2
Lag
Aut
ocov
aria
nces
Figure 12: TpX output
11
3.7 Diagram from SmartDraw
Figure 13: SmartDraw source
Figure 14: TpX output
Comment: SmartDraw (http://www.smartdraw.com/). Interiors of lettersin trial copy logo were left white.
12
3.8 Flowchart from SmartDraw
Enter
Mike ishome
Wait 10 min.
Speak toMike
Toolate
Saygoodbye
No
No
Yes
Yes
Go away
Start / End
Decision
Process
Connec-
tor
Direction
of
flow
Mike ishome
Yes
No
A B C D
1 dog sad pick
2 cat bad lock
3 rat fat get
4 frog wet spot
Figure 15: SmartDraw source
Enter
Mike ishome Wait 10 min.
Speak toMike
Toolate
Saygoodbye
No
NoYes
Yes
Go away
Start / End
Decision
Process
Connec-tor
Directionof
flow
Mike ishomeYes
No
A B C D
1 dog sad pick
3 cat bad lock
3 rat fat get
4 frog wet spot
Figure 16: TpX output
Comment: TEX bf and sf fonts were introduced by hand.
13
3.9 Chart from MS Excel #1
12
3
4
5
6
A
B
C0
1
2
3
4
5
A
B
C
Figure 17: Excel source
12
34
56
A
B
C0
1
2
3
4
5
A
B
C
Figure 18: TpX output
Comment: Hatching step in Excel source is very small, that is why the firstfigure seems pink.
14
3.10 Chart from MS Excel #2
0
1
2
3
4
5
1 2 3 4 5 6
any both cir
Figure 19: Excel source
0
1
2
3
4
5
1 2 3 4 5 6
any both cir
Figure 20: TpX output
15
3.11 Table from MS Word
Anyway
Nobody
No Try it or
buy itGBR 10 M 12/87
USA 9 F 11/87
ESP 11 M 03/87Yes
SWE 10 F 04/88
Figure 21: Word source
Anyway
Nobody
No
Try it orbuy it
GBR 10 M 12/87
USA 9 F 11/87
ESP 11 M 03/87Yes
SWE 10 F 04/88
Figure 22: TpX output
Comment: Word copies to clipboard in multiple formats including EMF. It ispossible in principle (though could not be recommended) to cut and paste anyWord text.
16
3.12 Tulips, Microsoft clipart
Figure 23: Clipart source
Figure 24: TpX output
Comment: Clipart was taken from MS site as EMF. It is quite easy to importMS clipart because it uses only polygons.
17
3.13 “No smoking”, SVG clipart from KOffice converted byAdobe Illustrator
Figure 25: PDF exported from Adobe Illustrator
Figure 26: TpX output
Comment: SVG was converted to PDF and EMF by Adobe Illustrator.
18
3.14 Tomato, EPS clipart from freeclipart.nu
Figure 27: Source EPS
Figure 28: TpX output
Comment: The source of image is http://www.freeclipart.nu site. EPS isnot the original one, created with Adobe Illustrator. It was converted from EPSto EPS using Ghostscript epswrite device. Imported to TpX using pstoedit(http://www.pstoedit.net/pstoedit). Free version of pstoedit somewhat distortedimage by converting Bezier curves to polygons.
19
3.15 Brick wall bitmap image vectorized by AutoTrace
Figure 29: Source bitmap image
Figure 30: TpX output
Comment: AutoTrace is a free utility for converting bitmap into vector graph-ics (http://autotrace.sourceforge.net/). EMF is one of AutoTrace outputformats. It mostly uses Bezier curves.
20
3.16 3D plot from Gnuplot
10
12
14
16
18
20
22
10 11 12 13 14 15 16 17 18
f(x,y) = sqrt(300-x**2-y**2)
f(x,y)25-0.3*f(x, y)
-10-5
0 5
10-10
-5
0
5
10
10
12
14
16
18
20
22
Figure 31: EPS produced by Gnuplot
10
12
14
16
18
20
22
101112131415161718
f(x, y) =√
300− x2 − y2
f(x, y)25− 0.3 · f(x, y)
-10-5
05
10−10-5
05
10
Figure 32: TpX output
Comment: Gnuplot is a free command-line driven function plotting utility(http://gnuplot.sourceforge.net/). Gnuplot has many ”terminals” for ex-porting graphics, including EMF and PostScript. This 3D plot was copied toWindows clipboard from Gnuplot window. (EMF terminal output lacked colorsurface).
21
3.17 Multiple plot from Gnuplot
-2
0
2
4
5 10 15 20
Y s
erie
s
time
ϕ = 0.1
0
5
10
5 10 15 20
Y s
erie
s
time
ϕ = 0.9
0
10
20
5 10 15 20
Y s
erie
s
time
ϕ = 1
0
40
80
120
160
200
5 10 15 20Y
ser
ies
time
ϕ = 1.2
Figure 33: EPS produced by Gnuplot
-2
0
2
4
5 10 15 20
Yse
ries
time
ϕ = 0.1
0
5
10
5 10 15 20
Yse
ries
time
ϕ = 0.9
0
10
20
5 10 15 20
Yse
ries
time
ϕ = 1
0
40
80
120
160
200
5 10 15 20
Yse
ries
time
ϕ = 1.02
Figure 34: TpX output
Comment: Gnuplot treats different terminals somewhat differently
22
3.18 Matrix plot from Statistica
Matrix Plot
-7.1808 -3.1808 0.8192 4.8192 8.8192
Body
-1.9661 1.5727 5.1115 8.6503
-5.2983
-2.9481
-0.5979
1.7523
4.1026
6.4528
8.8030
-5.2983 -0.5979 4.1026 8.8030
-1.9661
-0.1967
1.5727
3.3421
5.1115
6.8809
8.6503
-3.8776 0.1224 4.1224 8.1224
Brain
Figure 35: Statistica source
Matrix Plot
-7.1808 -3.1808 0.8192 4.8192 8.8192
Body
-1.9661 1.5727 5.1115 8.6503
-5.2983
-2.9481
-0.5979
1.7523
4.1026
6.4528
8.8030
-5.2983 -0.5979 4.1026 8.8030
-1.9661
-0.1967
1.5727
3.3421
5.1115
6.8809
8.6503
-3.8776 0.1224 4.1224 8.1224
Brain
Figure 36: TpX output
23
3.19 3D plot from SWP/MuPAD
52.5
0-2.5
-5
42
0-2
-4
5
2.5
0
-2.5
-5
x
y
z
Figure 37: SWP/MuPAD source
52.5
0-2.5
-5
42
0-2
-4
52.50-2.5-5
xy
z
Figure 38: TpX output
Comment: The graph was generated by MuPAD within Scientific WorkPlace(http://www.mackichan.com/). Axes labels were shifted manually in TpX .
24
3.20 Function plot from OriginPro
0 . 0 1 0 . 1 1 1 00 . 0 1
0 . 5
2
1 0
3 0
5 0
F 1S m o o t h e d 1 _ F 1
Proba
bility
scale
L o g 1 0 s c a l e
Figure 39: PDF file exported from OriginPro
0.01 0.1 1 10
0.01
0.5
2
10
30
50
F1Smoothed1˙F1
Pro
bability
scale
Log10 scale
Figure 40: TpX output
Comment: OriginPro (http://www.OriginLab.com/). OriginPro can exportPDF and EPS.
25
3.21 Bubble color plot from Axum
1.8 1.9 2.0 2.1 2.2 2.3 2.4
V3
5
7
5
7V
2
V2: 4.5 to 5.9
V2: 5.9 to 7.6
Reference
0
5
10
0
5
10
Figure 41: EPS file exported from Axum
1.8 1.9 2.0 2.1 2.2 2.3 2.4
V3
5
7
5
7
V2
V2: 4.5 to 5.9
V2: 5.9 to 7.6
Referen
ce
0
5
10
0
5
10
Figure 42: TpX output
26
4 Scalable vector graphics (SVG) import
4.1 Polar plot from Gnuplot
Figure 43: Source Gnuplot SVG as converted to EPS by Inkscape
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Y
X
Polar plot
Figure 44: TpX output
Comment: Axes lines style was converted to dashed manually.
27
4.2 Scanned signature vectorized by AutoTrace
Figure 45: Scanned signature
Figure 46: TpX output
Comment: The picture was exported from AutoTrace as SVG and importedinto TpX .
28
4.3 Books, SVG clipart from openclipart.org created with Inkscape
Figure 47: Screenshot from Adobe SVG viewer
Figure 48: TpX output
Comment: Public domain clipart by A. J. Ashton from http://openclipart.org/. SVG was imported with all colors lost (because TpX do not understandgradients). The colors were introduced manually to approximate original draw-ing.
29
4.4 “Symbols”, standard XFig example
Q
Q’
D
+
−
RTCT
Q
Q’
+
B
A
A0
A1
A2
Y0
Y1
Y2
Y3
Y5
Y6
Y7
Y4
E1
$\overline{E2}$
$\overline{E3}$
CHARPIXEL
Figure 49: EPS file produced by fig2dev
30
E1
E2
E3
Q
Q’
D
+
-
RTCT
Q
Q’
+
B
A
A0
A1
A2
Y0
Y1
Y2
Y3
Y5
Y6
Y7
Y4
E1
CHARPIXEL
Figure 50: TpX output
Comment: An electrical and logic symbols figure from XFig (http://www.xfig.org) examples library. The figure was converted from FIG format to SVGusing fig2dev (cygwin compilation). Many circles in SVG file have wrong radius(e.g. zero). Most probably, fig2dev had some bug.
31
4.5 Diagram from OpenOffice
Figure 51: EPS file exported from OpenOffice
AA BB CC DD EE
00
11
22
33
44
55
66
77
88
99
10
11
12
11
22
33
44
55
66
77
88
99
10
Header
II
II
III
Figure 52: TpX output
Comment: The diagram was produced using OpenOffice.org Draw (http://www.openoffice.org/). OpenOffice can export in many format includingEPS and SVG. Stroke width was incorrect for SVG.
32
4.6 XY plot from Grace
1700 1750 1800 1850 1900 1950year
0
0.2
0.4
0.6
0.8
1su
nspo
ts
Sunspot data
Tue Jan 24 02:57:19 2006
Figure 53: EPS file exported from Grace
1700 1750 1800 1850 1900 1950year
0
0.2
0.4
0.6
0.8
1
suns
pots
Sunspot data
Tue Jan 24 02:57:19 2006
Figure 54: TpX output
Comment: Grace (http://plasma-gate.weizmann.ac.il/Grace/) is a freeplotting program which is available on Windows platform under Cygwin (http://cygwin.com/).
33
4.7 MiKTeX logo imported as SVG via pstoedit
Figure 55: Original EPS file
Figure 56: TpX output
Comment: The logo was taken from MiKTeX (http://www.miktex.org/)documentation in EPS format. It was converted to SVG using pstoedit (http://www.pstoedit.net/pstoedit) plot-svg format based on GNU libplot. Thelogo was rotated inside TpX .