Demonstration of Tpx Import Capabilities
Total Page:16
File Type:pdf, Size:1020Kb
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 inclusion them into LATEX files in publication-ready form. It can also be used as a stand-alone editor for vector graphics. Under Windows most reasonable programs, which produce graphs, can either 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 can also 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 5 3.1 Histogram from Mathematica .................... 5 3.2 Vector field from Mathematica .................... 6 3.3 3D plot from Mathematica ...................... 7 3.4 3D plot from Matlab ......................... 8 3.5 Contour plot in polar coordinates from Matlab ........... 9 3.6 Stem plot from Matlab ........................ 10 3.7 Diagram from SmartDraw ...................... 11 3.8 Flowchart from SmartDraw ..................... 12 3.9 Chart from MS Excel #1 ....................... 13 3.10 Chart from MS Excel #2 ....................... 14 3.11 Table from MS Word ......................... 15 3.12 Tulips, Microsoft clipart ....................... 16 3.13 “No smoking”, SVG clipart from KOffice converted by Adobe Il- lustrator ................................ 17 3.14 Tomato, EPS clipart from freeclipart.nu ............... 18 3.15 Brick wall bitmap image vectorized by AutoTrace ......... 19 3.16 3D plot from Gnuplot ......................... 20 3.17 Multiple plot from Gnuplot ..................... 21 3.18 Matrix plot from Statistica ...................... 22 3.19 3D plot from SWP/MuPAD ...................... 23 3.20 Function plot from OriginPro .................... 24 3.21 Bubble color plot from Axum .................... 25 4 Scalable vector graphics (SVG) import 26 4.1 Polar plot from Gnuplot ....................... 26 4.2 Scanned signature vectorized by AutoTrace ............ 27 4.3 Books, SVG clipart from openclipart.org created with Inkscape .. 28 4.4 “Symbols”, standard XFig example ................. 29 4.5 Diagram from OpenOffice ...................... 31 4.6 XY plot from Grace .......................... 32 4.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 importing Windows metafile and SVG graphics into LATEX documents and to reveal pos- sible complications related to using TpX for this purpose. The author has no intension to evaluate the programs which were used to create the pictures. Pos- sibly, some problems are due to misuse of those programs. Also, some problems might 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. This causes bad quality of some metafile images. X Some programs use the same line width (e.g. 1 pixel) for all lines in metafile, though in other export formats (for example, PostScript) lines have different widths. X For some programs metafile is not the preferred export format and can be 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, but it 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 of it. 5 3 Windows metafile (EMF) import 3.1 Histogram from Mathematica 20 15 10 5 14 16 18 20 22 Figure 1: Mathematica source 20 15 10 5 14 16 18 20 22 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 0.5 0 1 -0.5 0.5 -1 -1 0 -0.5 0 -0.5 0.5 1 Figure 5: EPS file exported from Mathematica 0.5 0 1 - 0.5 0.5 - 1 - 1 0 - 0.5 0 - 0.5 0.5 1 Figure 6: TpX output Comment: Mathematica exported EMF at low resolution. This could be seen from inaccurate tick marks. 8 3.4 3D plot from Matlab 1 0.8 0.6 0.4 0.2 0 −0.2 −0.4 −0.6 −0.8 4 2 4 2 0 0 −2 −2 −4 −4 Figure 7: EPS file exported from Matlab 1 0.8 0.6 0.4 0.2 0 -0.2 -0.4 -0.6 -0.8 4 2 4 2 0 0 -2 -2 -4 -4 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 90 1 120 60 0.8 0.6 150 30 0.4 0.2 180 0 210 330 240 300 270 Figure 9: EPS file exported from Matlab 90 1 120 60 0.8 0.6 150 30 0.4 0.2 180 0 210 330 240 300 270 Figure 10: TpX output 10 3.6 Stem plot from Matlab 0.2 0.15 0.1 0.05 0 Autocovariances −0.05 −0.1 −0.15 −0.2 0 2 4 6 8 10 12 14 16 18 20 Lag Figure 11: EPS file exported from Matlab 0.2 0.15 0.1 0.05 0 Autocovariances -0.05 -0.1 -0.15 -0.2 0 2 4 6 8 10 12 14 16 18 20 Lag 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 letters in trial copy logo were left white. 12 3.8 Flowchart from SmartDraw Start / End Enter Mike is No Wait 10 min. Decision Yes home Speak to Mike is Yes Mike home Process No No Say goodbye Too Connec- late tor Yes A B C D Direction 1 dog sad pick of 2 cat bad lock flow Go away 3 rat fat get 4 frog wet spot Figure 15: SmartDraw source Start / End Enter Mike is No Wait 10 min. Decision Yes home Speak to Mike is Yes Mike home Process No No Say goodbye Too Connec- late tor Yes A B C D Direction 1 dog sad pick of 3 cat bad lock flow Go away 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 5 4 3 A 2 B 1 C 0 C 1 2 B 3 4 A 5 6 Figure 17: Excel source 5 4 3 A 2 B 1 C 0 C 1 2 B 3 4 A 5 6 Figure 18: TpX output Comment: Hatching step in Excel source is very small, that is why the first figure seems pink. 14 3.10 Chart from MS Excel #2 any both cir 5 4 3 2 1 0 1 2 3 4 5 6 Figure 19: Excel source any both cir 5 4 3 2 1 0 1 2 3 4 5 6 Figure 20: TpX output 15 3.11 Table from MS Word Anyway Nobody Try it or No buy it GBR 10 M 12/87 USA 9 F 11/87 Yes ESP 11 M 03/87 SWE 10 F 04/88 Figure 21: Word source Anyway Nobody Try it or No buy it GBR 10 M 12/87 USA 9 F 11/87 ESP 11 M 03/87 Yes SWE 10 F 04/88 Figure 22: TpX output Comment: Word copies to clipboard in multiple formats including EMF. It is possible in principle (though could not be recommended) to cut and paste any Word 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 import MS clipart because it uses only polygons. 17 3.13 “No smoking”, SVG clipart from KOffice converted by Adobe 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 is not the original one, created with Adobe Illustrator. It was converted from EPS to EPS using Ghostscript epswrite device. Imported to TpX using pstoedit(http: //www.pstoedit.net/pstoedit). Free version of pstoedit somewhat distorted image 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 output formats. It mostly uses Bezier curves. 20 3.16 3D plot from Gnuplot f(x,y) = sqrt(300-x**2-y**2) f(x,y) 25-0.3*f(x, y) 18 17 22 16 15 20 14 13 12 18 11 10 16 14 12 10 5 10 -10 0 -5 0 -5 5 10-10 Figure 31: EPS produced by Gnuplot √ f(x, y) = 300 − x2 − y2 f(x, y) 25 − 0.3 · f(x, y) 18 17 22 16 15 20 14 13 18 12 11 16 10 14 12 10 10 5 -10 0 -5 0 -5 5 −10 10 Figure 32: TpX output Comment: Gnuplot is a free command-line driven function plotting utility (http://gnuplot.sourceforge.net/).