diff options
author | Karl Berry <karl@freefriends.org> | 2011-02-12 18:24:48 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-02-12 18:24:48 +0000 |
commit | 851c5cd1c1560e02f19d028dfbd42d5c0c02a984 (patch) | |
tree | fd1e2c6f33163ed0d4a88e3ca7c565cdab75081b /Master/texmf-dist | |
parent | f6afc691ea3c34d61357db2f13abb9df541b0cd5 (diff) |
context-gnuplot (11feb11)
git-svn-id: svn://tug.org/texlive/trunk@21379 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/context/third/gnuplot/examples/example.plt | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.pdf | bin | 0 -> 10875 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.tex | 297 | ||||
-rw-r--r-- | Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.pdf | bin | 0 -> 63663 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.tex | 284 | ||||
-rw-r--r-- | Master/texmf-dist/tex/context/third/gnuplot/t-gnuplot.tex | 174 |
6 files changed, 722 insertions, 37 deletions
diff --git a/Master/texmf-dist/doc/context/third/gnuplot/examples/example.plt b/Master/texmf-dist/doc/context/third/gnuplot/examples/example.plt new file mode 100644 index 00000000000..b81e8dce2f2 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/gnuplot/examples/example.plt @@ -0,0 +1,4 @@ +set term context size 5in,3in standalone +set output "fullpage-example.tex" +plot sin(x) +plot cos(atan(x))*sin(x) diff --git a/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.pdf b/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.pdf Binary files differnew file mode 100644 index 00000000000..23230b5b0ad --- /dev/null +++ b/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.pdf diff --git a/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.tex b/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.tex new file mode 100644 index 00000000000..ccf83859412 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/gnuplot/examples/fullpage-example.tex @@ -0,0 +1,297 @@ +% Written by ConTeXt terminal for GNUPLOT on: Thu Feb 10 09:02:54 2011 +% GNUPLOT version 4.5 patchlevel 0 +% See also http://wiki.contextgarden.net/Gnuplot +% +\usemodule + [gnuplot] +\setupcolors + [state=start] +\setupbodyfont + [12pt] +\setupGNUPLOTterminal + [context] + [linejoin=mitered, % *mitered* | rounded | beveled + linecap=butt, % *butt* | rounded | squared + dashed=yes, % *yes* | no + dashlength=1, % scaling factor for dash lengths + linewidth=1, % scaling factor for line widths (1.0 means 0.4bp) + %textscale=1, % scaling factor for text labels + points=metapost] % *metapost* | tex (Should points be drawn with MetaPost or TeX?) + +\starttext + +\startGNUPLOTpage % Graphic Nr. 1 +gnuplotversion := "4.5"; +% width and height of the figure +w:=5in; h:=3in; +% horizontal and vertical scaling factors +a:=w/120.00; b:=h/72.00; +% temporary variable for storing the path +save p; path p; +% +% ------------------------- +% Different initialisations +% ------------------------- +% for additional user-defined settings +gp_setup_before; +% text scaling factor for the whole figure +gp_scale_text := 1; +% pointsize scaling factor +gp_set_pointsize(1); +% linewidth scaling factor for individual lines +gp_set_linewidth(1); +% for additional user-defined settings +gp_setup_after; +% ------------------------- +gp_set_linetype(-2); +p := (12.61a,7.96b)--(13.77a,7.96b); +gp_draw(p); +p := (114.17a,7.96b)--(113.01a,7.96b); +gp_draw(p); +gp_put_text((10.67a, 7.96b), align(right), \sometxt[gp]{-1}); +p := (12.61a,13.98b)--(13.77a,13.98b); +gp_draw(p); +p := (114.17a,13.98b)--(113.01a,13.98b); +gp_draw(p); +gp_put_text((10.67a, 13.98b), align(right), \sometxt[gp]{-0.8}); +p := (12.61a,19.99b)--(13.77a,19.99b); +gp_draw(p); +p := (114.17a,19.99b)--(113.01a,19.99b); +gp_draw(p); +gp_put_text((10.67a, 19.99b), align(right), \sometxt[gp]{-0.6}); +p := (12.61a,26.00b)--(13.77a,26.00b); +gp_draw(p); +p := (114.17a,26.00b)--(113.01a,26.00b); +gp_draw(p); +gp_put_text((10.67a, 26.00b), align(right), \sometxt[gp]{-0.4}); +p := (12.61a,32.02b)--(13.77a,32.02b); +gp_draw(p); +p := (114.17a,32.02b)--(113.01a,32.02b); +gp_draw(p); +gp_put_text((10.67a, 32.02b), align(right), \sometxt[gp]{-0.2}); +p := (12.61a,38.04b)--(13.77a,38.04b); +gp_draw(p); +p := (114.17a,38.04b)--(113.01a,38.04b); +gp_draw(p); +gp_put_text((10.67a, 38.04b), align(right), \sometxt[gp]{0}); +p := (12.61a,44.05b)--(13.77a,44.05b); +gp_draw(p); +p := (114.17a,44.05b)--(113.01a,44.05b); +gp_draw(p); +gp_put_text((10.67a, 44.05b), align(right), \sometxt[gp]{0.2}); +p := (12.61a,50.07b)--(13.77a,50.07b); +gp_draw(p); +p := (114.17a,50.07b)--(113.01a,50.07b); +gp_draw(p); +gp_put_text((10.67a, 50.07b), align(right), \sometxt[gp]{0.4}); +p := (12.61a,56.08b)--(13.77a,56.08b); +gp_draw(p); +p := (114.17a,56.08b)--(113.01a,56.08b); +gp_draw(p); +gp_put_text((10.67a, 56.08b), align(right), \sometxt[gp]{0.6}); +p := (12.61a,62.10b)--(13.77a,62.10b); +gp_draw(p); +p := (114.17a,62.10b)--(113.01a,62.10b); +gp_draw(p); +gp_put_text((10.67a, 62.10b), align(right), \sometxt[gp]{0.8}); +p := (12.61a,68.11b)--(13.77a,68.11b); +gp_draw(p); +p := (114.17a,68.11b)--(113.01a,68.11b); +gp_draw(p); +gp_put_text((10.67a, 68.11b), align(right), \sometxt[gp]{1}); +p := (12.61a,7.96b)--(12.61a,9.12b); +gp_draw(p); +p := (12.61a,68.11b)--(12.61a,66.95b); +gp_draw(p); +gp_put_text((12.61a, 3.98b), align(center), \sometxt[gp]{-10}); +p := (38.00a,7.96b)--(38.00a,9.12b); +gp_draw(p); +p := (38.00a,68.11b)--(38.00a,66.95b); +gp_draw(p); +gp_put_text((38.00a, 3.98b), align(center), \sometxt[gp]{-5}); +p := (63.39a,7.96b)--(63.39a,9.12b); +gp_draw(p); +p := (63.39a,68.11b)--(63.39a,66.95b); +gp_draw(p); +gp_put_text((63.39a, 3.98b), align(center), \sometxt[gp]{0}); +p := (88.78a,7.96b)--(88.78a,9.12b); +gp_draw(p); +p := (88.78a,68.11b)--(88.78a,66.95b); +gp_draw(p); +gp_put_text((88.78a, 3.98b), align(center), \sometxt[gp]{5}); +p := (114.17a,7.96b)--(114.17a,9.12b); +gp_draw(p); +p := (114.17a,68.11b)--(114.17a,66.95b); +gp_draw(p); +gp_put_text((114.17a, 3.98b), align(center), \sometxt[gp]{10}); +p := (12.61a,68.11b)--(12.61a,7.96b)--(114.17a,7.96b)--(114.17a,68.11b) + --(12.61a,68.11b)--cycle; +gp_draw(p); +gp_set_pointsize(1.000); +gp_set_linetype(0); +gp_set_color(lt(-2)); +gp_put_text((99.43a, 64.96b), align(right), \sometxt[gp]{sin(x)}); +gp_set_linetype(0); +p := (101.37a,64.96b)--(110.29a,64.96b); +gp_draw(p); +p := (12.61a,54.40b)--(13.64a,49.00b)--(14.66a,43.16b)--(15.69a,37.11b) + --(16.71a,31.09b)--(17.74a,25.36b)--(18.77a,20.15b)--(19.79a,15.66b) + --(20.82a,12.08b)--(21.84a,9.56b)--(22.87a,8.20b)--(23.89a,8.05b) + --(24.92a,9.12b)--(25.95a,11.36b)--(26.97a,14.69b)--(28.00a,18.97b) + --(29.02a,24.03b)--(30.05a,29.65b)--(31.08a,35.62b)--(32.10a,41.68b) + --(33.13a,47.60b)--(34.15a,53.12b)--(35.18a,58.04b)--(36.20a,62.14b) + --(37.23a,65.26b)--(38.26a,67.27b)--(39.28a,68.09b)--(40.31a,67.69b) + --(41.33a,66.09b)--(42.36a,63.34b)--(43.39a,59.56b)--(44.41a,54.91b) + --(45.44a,49.57b)--(46.46a,43.77b)--(47.49a,37.73b)--(48.52a,31.70b) + --(49.54a,25.93b)--(50.57a,20.65b)--(51.59a,16.08b)--(52.62a,12.40b) + --(53.64a,9.77b)--(54.67a,8.28b)--(55.70a,8.01b)--(56.72a,8.95b) + --(57.75a,11.08b)--(58.77a,14.31b)--(59.80a,18.50b)--(60.83a,23.48b) + --(61.85a,29.06b)--(62.88a,35.00b)--(63.90a,41.07b)--(64.93a,47.01b) + --(65.95a,52.59b)--(66.98a,57.57b)--(68.01a,61.76b)--(69.03a,64.99b) + --(70.06a,67.12b)--(71.08a,68.06b)--(72.11a,67.79b)--(73.14a,66.30b) + --(74.16a,63.67b)--(75.19a,59.99b)--(76.21a,55.42b)--(77.24a,50.14b) + --(78.26a,44.37b)--(79.29a,38.34b)--(80.32a,32.30b)--(81.34a,26.50b) + --(82.37a,21.16b)--(83.39a,16.51b)--(84.42a,12.73b)--(85.45a,9.98b) + --(86.47a,8.38b)--(87.50a,7.98b)--(88.52a,8.80b)--(89.55a,10.81b) + --(90.58a,13.93b)--(91.60a,18.03b)--(92.63a,22.95b)--(93.65a,28.47b) + --(94.68a,34.39b)--(95.70a,40.45b)--(96.73a,46.42b)--(97.76a,52.04b) + --(98.78a,57.10b)--(99.81a,61.38b)--(100.83a,64.71b)--(101.86a,66.95b) + --(102.89a,68.02b)--(103.91a,67.87b)--(104.94a,66.51b)--(105.96a,63.99b) + --(106.99a,60.41b)--(108.01a,55.92b)--(109.04a,50.71b)--(110.07a,44.98b) + --(111.09a,38.96b)--(112.12a,32.91b)--(113.14a,27.07b)--(114.17a,21.67b); +gp_draw(p); +gp_set_linetype(-2); +p := (12.61a,68.11b)--(12.61a,7.96b)--(114.17a,7.96b)--(114.17a,68.11b) + --(12.61a,68.11b)--cycle; +gp_draw(p); +gp_set_pointsize(1.000); +setbounds currentpicture to unitsquare xyscaled (w,h); % 0 0 1 1 +\stopGNUPLOTpage +\startGNUPLOTpage % Graphic Nr. 2 +gnuplotversion := "4.5"; +% width and height of the figure +w:=5in; h:=3in; +% horizontal and vertical scaling factors +a:=w/120.00; b:=h/72.00; +% temporary variable for storing the path +save p; path p; +% +% ------------------------- +% Different initialisations +% ------------------------- +% for additional user-defined settings +gp_setup_before; +% text scaling factor for the whole figure +gp_scale_text := 1; +% pointsize scaling factor +gp_set_pointsize(1); +% linewidth scaling factor for individual lines +gp_set_linewidth(1); +% for additional user-defined settings +gp_setup_after; +% ------------------------- +gp_set_linetype(-2); +p := (12.61a,7.96b)--(13.77a,7.96b); +gp_draw(p); +p := (114.17a,7.96b)--(113.01a,7.96b); +gp_draw(p); +gp_put_text((10.67a, 7.96b), align(right), \sometxt[gp]{-0.6}); +p := (12.61a,17.99b)--(13.77a,17.99b); +gp_draw(p); +p := (114.17a,17.99b)--(113.01a,17.99b); +gp_draw(p); +gp_put_text((10.67a, 17.99b), align(right), \sometxt[gp]{-0.4}); +p := (12.61a,28.01b)--(13.77a,28.01b); +gp_draw(p); +p := (114.17a,28.01b)--(113.01a,28.01b); +gp_draw(p); +gp_put_text((10.67a, 28.01b), align(right), \sometxt[gp]{-0.2}); +p := (12.61a,38.04b)--(13.77a,38.04b); +gp_draw(p); +p := (114.17a,38.04b)--(113.01a,38.04b); +gp_draw(p); +gp_put_text((10.67a, 38.04b), align(right), \sometxt[gp]{0}); +p := (12.61a,48.06b)--(13.77a,48.06b); +gp_draw(p); +p := (114.17a,48.06b)--(113.01a,48.06b); +gp_draw(p); +gp_put_text((10.67a, 48.06b), align(right), \sometxt[gp]{0.2}); +p := (12.61a,58.08b)--(13.77a,58.08b); +gp_draw(p); +p := (114.17a,58.08b)--(113.01a,58.08b); +gp_draw(p); +gp_put_text((10.67a, 58.08b), align(right), \sometxt[gp]{0.4}); +p := (12.61a,68.11b)--(13.77a,68.11b); +gp_draw(p); +p := (114.17a,68.11b)--(113.01a,68.11b); +gp_draw(p); +gp_put_text((10.67a, 68.11b), align(right), \sometxt[gp]{0.6}); +p := (12.61a,7.96b)--(12.61a,9.12b); +gp_draw(p); +p := (12.61a,68.11b)--(12.61a,66.95b); +gp_draw(p); +gp_put_text((12.61a, 3.98b), align(center), \sometxt[gp]{-10}); +p := (38.00a,7.96b)--(38.00a,9.12b); +gp_draw(p); +p := (38.00a,68.11b)--(38.00a,66.95b); +gp_draw(p); +gp_put_text((38.00a, 3.98b), align(center), \sometxt[gp]{-5}); +p := (63.39a,7.96b)--(63.39a,9.12b); +gp_draw(p); +p := (63.39a,68.11b)--(63.39a,66.95b); +gp_draw(p); +gp_put_text((63.39a, 3.98b), align(center), \sometxt[gp]{0}); +p := (88.78a,7.96b)--(88.78a,9.12b); +gp_draw(p); +p := (88.78a,68.11b)--(88.78a,66.95b); +gp_draw(p); +gp_put_text((88.78a, 3.98b), align(center), \sometxt[gp]{5}); +p := (114.17a,7.96b)--(114.17a,9.12b); +gp_draw(p); +p := (114.17a,68.11b)--(114.17a,66.95b); +gp_draw(p); +gp_put_text((114.17a, 3.98b), align(center), \sometxt[gp]{10}); +p := (12.61a,68.11b)--(12.61a,7.96b)--(114.17a,7.96b)--(114.17a,68.11b) + --(12.61a,68.11b)--cycle; +gp_draw(p); +gp_set_pointsize(1.000); +gp_set_linetype(0); +gp_set_color(lt(-2)); +gp_put_text((99.43a, 64.96b), align(right), \sometxt[gp]{cos(atan(x))*sin(x)}); +gp_set_linetype(0); +p := (101.37a,64.96b)--(110.29a,64.96b); +gp_draw(p); +p := (12.61a,40.75b)--(13.64a,39.89b)--(14.66a,38.92b)--(15.69a,37.87b) + --(16.71a,36.78b)--(17.74a,35.70b)--(18.77a,34.66b)--(19.79a,33.72b) + --(20.82a,32.91b)--(21.84a,32.28b)--(22.87a,31.85b)--(23.89a,31.66b) + --(24.92a,31.73b)--(25.95a,32.06b)--(26.97a,32.66b)--(28.00a,33.52b) + --(29.02a,34.62b)--(30.05a,35.93b)--(31.08a,37.41b)--(32.10a,39.01b) + --(33.13a,40.67b)--(34.15a,42.34b)--(35.18a,43.94b)--(36.20a,45.41b) + --(37.23a,46.68b)--(38.26a,47.68b)--(39.28a,48.36b)--(40.31a,48.66b) + --(41.33a,48.52b)--(42.36a,47.93b)--(43.39a,46.86b)--(44.41a,45.31b) + --(45.44a,43.27b)--(46.46a,40.78b)--(47.49a,37.88b)--(48.52a,34.62b) + --(49.54a,31.09b)--(50.57a,27.37b)--(51.59a,23.57b)--(52.62a,19.82b) + --(53.64a,16.26b)--(54.67a,13.08b)--(55.70a,10.47b)--(56.72a,8.67b) + --(57.75a,7.98b)--(58.77a,8.77b)--(59.80a,11.45b)--(60.83a,16.39b) + --(61.85a,23.72b)--(62.88a,33.01b)--(63.90a,43.06b)--(64.93a,52.35b) + --(65.95a,59.68b)--(66.98a,64.62b)--(68.01a,67.30b)--(69.03a,68.09b) + --(70.06a,67.40b)--(71.08a,65.60b)--(72.11a,62.99b)--(73.14a,59.81b) + --(74.16a,56.25b)--(75.19a,52.50b)--(76.21a,48.70b)--(77.24a,44.98b) + --(78.26a,41.45b)--(79.29a,38.19b)--(80.32a,35.29b)--(81.34a,32.80b) + --(82.37a,30.76b)--(83.39a,29.21b)--(84.42a,28.14b)--(85.45a,27.55b) + --(86.47a,27.41b)--(87.50a,27.71b)--(88.52a,28.39b)--(89.55a,29.39b) + --(90.58a,30.66b)--(91.60a,32.13b)--(92.63a,33.73b)--(93.65a,35.40b) + --(94.68a,37.06b)--(95.70a,38.66b)--(96.73a,40.14b)--(97.76a,41.45b) + --(98.78a,42.55b)--(99.81a,43.41b)--(100.83a,44.01b)--(101.86a,44.34b) + --(102.89a,44.41b)--(103.91a,44.22b)--(104.94a,43.79b)--(105.96a,43.16b) + --(106.99a,42.35b)--(108.01a,41.41b)--(109.04a,40.37b)--(110.07a,39.29b) + --(111.09a,38.20b)--(112.12a,37.15b)--(113.14a,36.18b)--(114.17a,35.32b); +gp_draw(p); +gp_set_linetype(-2); +p := (12.61a,68.11b)--(12.61a,7.96b)--(114.17a,7.96b)--(114.17a,68.11b) + --(12.61a,68.11b)--cycle; +gp_draw(p); +gp_set_pointsize(1.000); +setbounds currentpicture to unitsquare xyscaled (w,h); % 0 0 1 1 +\stopGNUPLOTpage +\stoptext diff --git a/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.pdf b/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.pdf Binary files differnew file mode 100644 index 00000000000..23e3883496b --- /dev/null +++ b/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.pdf diff --git a/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.tex b/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.tex new file mode 100644 index 00000000000..3e82e2d26c4 --- /dev/null +++ b/Master/texmf-dist/doc/context/third/gnuplot/gnuplot-context-doc.tex @@ -0,0 +1,284 @@ +\setupcolors + [state=start] +\enableregime + [utf-8] +\setupinteraction + [state=start] + +\usemodule + [gnuplot] + +\setupexternalfigures + [directory={.,examples}] + +\setuplayout + [backspace=1in, + width=middle, + topspace=1in, + heigh=middle, + header=0pt, + headerdistance=0pt] + +\setuphead + [title] + [align=middle, + style=\bfc] +\setuphead + [section] + [style=\bfb] +\setuphead + [subsection] + [style=\bfa] + +\setupitemize + [headstyle=bold] + +% \usetypescript +% [antykwa-torunska] +% \setupbodyfont +% [antykwa] + +\beginNEWTEX\usetypescript[lucida] \endNEWTEX +\beginOLDTEX\usetypescript[lucida][ec]\endOLDTEX +\setupbodyfont + [lucida] + +\definecolor + [maincolor] + [darkblue] +\definecolor + [lightblue] + [r=0.9,g=0.9,b=1] +\definecolor + [screen] + [s=0.9] + +\setuptyping + [TEX] + [tab=4] + +\logo [TEXLIVE] {\TeX\ Live} +\logo [MIKTEX] {Mik\TeX} +\logo [TIKZ] {Tik{\it Z}} + +\defineframedtext + [background] + [background=color,backgroundcolor=gray,width=\textwidth,frame=off,offset=2pt,style=type] + +\defineframedtext + [myinput] + [background=color,backgroundcolor=lightblue,width=\textwidth,frame=off,offset=2pt,style=type] + +% \setupbackgrounds +% [background] +% [background=color,backgroundcolor=gray,width=\textwidth,frame=off] + +\starttext + +\title{Using \color[maincolor]{\tt\bf context} and \color[maincolor]{\tt\bf tikz} terminal for gnuplot} + +\centerline{Mojca Miklavec, \date[y=2011,m=2,d=10]} + +\blank + +\placelist[section] + +\blank + +\section{Requirements} + +\startitemize[n,packed] +\item Any working \ConTeXt\ installation (\ConTeXt\ Minimals, \TEXLIVE\ 2010 or \MIKTEX\ 2.9 or newer). +\item The {\tt gnuplot} binary (or {\tt gnuplot.exe} under Windows) has to be in {\tt PATH} and needs to have support for {\tt context} and/or {\tt tikz} terminal built in. +\item The latest version of gnuplot module for ConTeXt. +\stopitemize + + +\section{Installation} + +\subsection{\CONTEXT} + +TODO + +\subsection{Gnuplot} + +TODO + +You can check the list of supported terminals by typing \startlines +\tt{gnuplot>} \bf set term +\stoplines +into gnuplot shell. + +\subsection{{\tt\bf t-gnuplot} module for \CONTEXT} + +Under \CONTEXT\ Minimals you can install the gnuplot module and \TIKZ\ with an additional switch when running {\tt f\/irst-setup}, for example: +\startbackground +\tt f\/irst-setup.sh -\/-extras=t-gnuplot,t-tikz +\stopbackground + +If you have installed a {\tt complete} or {\tt context} scheme under \TEXLIVE, gnuplot module and \TIKZ\ might already be installed. Else you can use: +\startbackground +tlmgr install context-gnuplot\\ +tlmgr install pgf +\stopbackground + +Under \MIKTEX\ the module is installed automatically when it is first used. + +\section{Simple examples} + +\subsection{Calling gnuplot directly} + +Let's first create a simple file (we will call it {\tt\it example.plt}, but you may choose any name) with the contents below. + +For {\tt context} terminal: +\startmyinput +set term context size 5in,3in standalone\\ +set output "fullpage-example.tex"\\ +plot sin(x)\\ +plot cos(atan(x))*sin(x) +\stopmyinput + +For {\tt tikz} terminal: +\startmyinput +set term tikz context size 5in,3in standalone createstyle\\ +set output "fullpage-example.tex"\\ +plot sin(x)\\ +plot cos(atan(x))*sin(x) +\stopmyinput + +In both cases the option {\tt standalone} is used to create a complete \CONTEXT\ document with one plot per page, including header and {\tt\textbackslash starttext \dots\ \textbackslash stoptext}, so that it can be compiled directly. The option {\tt createstyle} is used to create three files with required macros in working directory\footnote{An alternative is to place those three files somewhere where kpathsea can find them and omit the option {\tt createstyle}, just make sure that the versions of {\tt tikz} terminal and the files in your \TeX\ tree remain compatible.} + +Both terminals should give you almost equivalent results apart from default plot size. You are highly encouraged to specify the disired plot size explicitely. You may scale the plot later on, but you probably want to get the desired proportions from the start. + +Run gnuplot with +\startbackground +gnuplot example.plt +\stopbackground +and compile the result with any of the following three commands (depending on your preferred engine): +\startbackground +\hbox{\hbox to 25em{context fullpage-example.tex \hss} {\rm\# for \LuaTeX}} +\hbox{\hbox to 25em{texexec fullpage-example.tex \hss} {\rm\# for \pdfTeX}} +\hbox{\hbox to 25em{texexec --xtx fullpage-example.tex \hss} {\rm\# for \XeTeX} } +\stopbackground + +They are almost equivalent except that \XeTeX\ lacks some advanced features (some patterns). The only major difference is the choice of fonts. If you want to typeset Arabic labels or use system fonts, you will probably want to choose \LuaTeX\ or \XeTeX. If you are using many graphical elements (like in 3D plots), you might want to go for \LuaTeX. + +You should get a {\sc pdf} document with two full-page plots that you can include into your document with \type{\externalfigure[fullpage-example][page=2]} for example. + +\placefigure[force]{}{\externalfigure[fullpage-example][page=2]} + + +\subsection{Calling gnuplot from \TeX} + +As you can see you will always get Latin Modern font at 12pt unless you explicitely change it with {\tt header "\textbackslash setupbodyfont[...]"}. An easier way to make sure that the same font is used and to avoid having to call gnuplot manually is to simply type the gnuplot code inside your \CONTEXT\ document: + +\startTEX +\usemodule + [gnuplot] +\setupGNUPLOTterminal + [context] + [width=5in,height=2.5in,textscale=0.8] +\setupGNUPLOTterminal + [tikz] + [width=5in,height=2.5in] +\starttext + +\startGNUPLOTscript[myfunction] +set samples 400 +set key left Left reverse +set format y "%.1f" +plot sin(x) t '$\sin(x)$' lw 3 +plot cos(atan(x))*sin(x) t '$\cos(\arctan(x))\sin(x)$' lw 3 lc 3 +\stopGNUPLOTscript + +\placefigure{none}{\useGNUPLOTgraphic[myfunction][2]} + +\setupGNUPLOT + [terminal=tikz] + +\placefigure{none}{\useGNUPLOTgraphic[myfunction][1]} + +\stoptext +\stopTEX + +\bgroup +\setupGNUPLOTterminal + [context] + [width=5in,height=2.5in,textscale=0.8] +\setupGNUPLOTterminal + [tikz] + [width=5in,height=2.5in] +\startGNUPLOTscript[myfunction] +set samples 400 +set key left Left reverse +set format y "%.1f" +plot sin(x) t '$\sin(x)$' lw 3 +plot cos(atan(x))*sin(x) t '$\cos(\arctan(x))\sin(x)$' lw 3 lc 3 +\stopGNUPLOTscript +\placefigure[force]{Framed second plot using {\tt context} terminal} + {\framed[offset=overlay,frame=off,background=color,backgroundcolor=lightblue]{\useGNUPLOTgraphic[myfunction][2]}} +\setupGNUPLOT[terminal=tikz] +\placefigure[force]{Framed first plot using {\tt tikz} terminal} + {\framed[offset=overlay,frame=off,background=color,backgroundcolor=lightblue]{\useGNUPLOTgraphic[myfunction][1]}} +\egroup + + +\subsection{Including pre-generated plots} + +TODO + +This is the syntax: +\startTEX +\processGNUPLOTfile[name][filename.tex] +\useGNUPLOTgraphic[name] +\stopTEX + +\section{Terminal options} + +\subsection{\tt\bf context} + +TODO + +\starttyping +set term context {default} + {defaultsize | size <scale> | + size <xsize> {in|cm}, <ysize> {in|cm}} + {input | standalone} + {noheader | header "<header>"} + {color | colour | monochrome} + {mitered | rounded | beveled} + {butt | round | squared} + {dashed | solid} + {dashlength | dl <DL>} + {linewidth | lw <LW>} + {textscale <textscale>} + {pointswithmetapost | pointswithmp | pointswithtex} + {defaultfont | font {<fontsize>} | + font "<fontname>{,<fontsize>}" {fontsize}} +\stoptyping + +\subsection{\tt\bf tikz} + +TODO + +\section{High-level configuration from \ConTeXt} + +TODO + +\section{Comparison of supported terminals} + +The gnuplot module for \ConTeXt\ supports the following terminals: +\startitemize[packed] +\head bitmap terminals\par + \startitemize[packed,joinedup] + \item\tt png, pngcairo + \stopitemize +\head vector terminals\par + \startitemize[packed,joinedup] + \item\tt {\bf context}, {\bf tikz} + \item\tt metapost, postscript, pdf, pdfcairo + \stopitemize +\stopitemize + + +\stoptext diff --git a/Master/texmf-dist/tex/context/third/gnuplot/t-gnuplot.tex b/Master/texmf-dist/tex/context/third/gnuplot/t-gnuplot.tex index f5fcff50815..365c229c17b 100644 --- a/Master/texmf-dist/tex/context/third/gnuplot/t-gnuplot.tex +++ b/Master/texmf-dist/tex/context/third/gnuplot/t-gnuplot.tex @@ -1,6 +1,6 @@ %D \module %D [ file=t-gnuplot, -%D version=2011.01.10, +%D version=2011.02.10, %D title=\CONTEXT\ Extra Modules, %D subtitle=\GNUPLOT\ Inclusion, %D author={Hans Hagen, Taco Hoekwater, Mojca Miklavec, (Aditya Mahajan)}, @@ -11,6 +11,15 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. +% begin info +% +% title : Gnuplot module +% +% comment : simplifies inclusion of gnuplot-generated graphs into ConTeXt documents +% status : stable, supports both MKII and MKIV +% +% end info + %D This module is used for creating gnuplot graphs on-the-fly and including them %D into documents. %D @@ -163,6 +172,18 @@ %\runMPTEXgraphicstrue \newcounter\GNUPLOTnumber +\newdimen\GNUPLOThcharsize +\newdimen\GNUPLOTvcharsize +\newcounter\tikzGNUPLOTnumber + +% macro to calculate true character size from current font +% (However it is not 100 % that it gets the job properly done +% in case that other font settings are used inside the picture.) +\def\calculateGNUPLOTcharsize{% + \global\GNUPLOThcharsize=1.05\fontcharwd\font`0% + \global\GNUPLOTvcharsize=1.05\fontcharht\font`0% + \global\advance\GNUPLOTvcharsize by 1.05\fontchardp\font`g% +} %D \macros %D {startGNUPLOTinclusions, resetGNUPLOTinclusions} @@ -379,6 +400,10 @@ % it would be better to call this \undefineMPgraphic{gpg:#1:\recurselevel} or something similar {\letbeundefined{@@MPGgpg:#1:\recurselevel}}% {\exitloop}}% + \doloop + {\doifdefinedelse{TKZp:#1:\recurselevel}% + {\letbeundefined{TKZp:#1:\recurselevel}}% + {\exitloop}}% }% % TODO: this can probably be done in a better way @@ -406,6 +431,9 @@ % call to gnuplot and processing/converting the graphics is only needed in the first ConTeXt run \doifmode{*\v!first}{% (perhaps also: if files haven't changed) \bgroup + % for TikZ we want to calculate character size, so that it gets printed + % to inclusions with \@@GNUPLOToptions + \calculateGNUPLOTcharsize % catcodes trickery & alike %\the\everyGNUPLOTscript % open file for writing @@ -443,6 +471,7 @@ }% % for ConTeXt terminal only - read the result \doif{\@@GNUPLOTterminal}{context}{\processGNUPLOTfile[#1][\@@GNUPLOTresult]}% + \doif{\@@GNUPLOTterminal}{tikz} {\processGNUPLOTfile[#1][\@@GNUPLOTresult]}% }}} % \dodouseGNUPLOTgraphic[name][numbers][options] @@ -450,7 +479,7 @@ {\bgroup \doifdefinedelse{gps:n:#1} {\edef\GNUPLOTnumber{\getvalue{gps:n:#1}}% - \edef\GNUPLOTfile {\bufferprefix gnuplot-\GNUPLOTnumber}% + \edef\GNUPLOTfile {\jobname-gnuplot-\GNUPLOTnumber}% \writeandprocessGNUPLOTscript{#1}% % "ctxtools --purge" should delete the gnuplot script and other intermediate files % (but it seems that they are deleted automatically already; preferred or not?) @@ -475,6 +504,25 @@ \processcommalist[#2]\useGNUPLOTgraphicN \endgroup }% + }{% + % for TikZ terminal only + \doifelse{\@@GNUPLOTterminal}{tikz}% + {\doifelse{#2}{}% + % if no explicit figure number was specified, include all the figures + {\doloop + {\doifdefinedelse{TKZp:#1:\recurselevel}% + {\scale[#3]{\getvalue{TKZp:#1:\recurselevel}}}% + {\exitloop}}}% + % if numbers were specified, include the figures specified in the list only + {\begingroup + \def\useGNUPLOTgraphicN##1{\doifdefinedelse + {TKZp:#1:##1}% + {\scale[#3]{\getvalue{TKZp:#1:##1}}}% + % if graphic doesn't exist: draw a dummy frame instead and warn the user + {\scale[#3]{\framed[frame=on,width=5in,height=3in,align={middle,lohi}]{GNUPLOT graphic #1, Nr. ##1 doesn't exist}}}}% + \processcommalist[#2]\useGNUPLOTgraphicN + \endgroup + }% }% % for all the other terminals % TODO: add more safety switches (if pages don't exist for example) @@ -489,7 +537,7 @@ \processcommalist[#2]\useGNUPLOTgraphicN \endgroup }% - }% + }}% }% % else part - in case that graphic gets included with \processGNUPLOTfile[name][file] {\doifelse{\@@GNUPLOTterminal}{context} @@ -548,6 +596,9 @@ \doloop{\doifelseconversionnumber{\@@GNUPLOTpointset}{\recurselevel}% {\edef\gp:num:pointswithtex{\recurselevel}}% {\exitloop}}% + % in case of TikZ terminal we have to generate the needed style files first + \doif{\@@GNUPLOTterminal}{tikz} + {\executesystemcommand{gnuplot -e "set term tikz context createstyle"}\usemodule[gnuplot-lua-tikz]} % TODO: % - issue a warning if user wants to use points with TeX, % but pointset= is undefined (if the first point doesn't exist) @@ -588,38 +639,48 @@ {\dodoubleargument\doprocessGNUPLOTfile} \def\doprocessGNUPLOTfile[#1][#2]% - {% we first define two commands: \startGNUPLOTgraphic & \stopGNUPLOTgraphic to read the files in; - % files that gnuplot creates in non-standalone mode look approximately like this: - % - % \startGNUPLOTgraphic[1] - % ... metapost commands to draw the graph ... - % \stopGNUPLOTgraphic - % \startGNUPLOTgraphic[2] - % ... metapost commands to draw the graph ... - % \stopGNUPLOTgraphic - % ... - % - % while reading the file in, metapost graphics named "gpg:{name}:{number}" are defined - % - % (we might need some additional arguments later on, but for now the figure number should suffice) - \def\startGNUPLOTgraphic - {%\obeyMPlines % <- no longer a problem - \def\obeyedline{}% <- thanks to this - \dosingleargument\dostartGNUPLOTgraphic}% - \long\def\dostartGNUPLOTgraphic[##1]##2\stopGNUPLOTgraphic - {\startreusableMPgraphic{gpg:#1:##1}##2\stopreusableMPgraphic}% - % - % if gps:n:{name} (which is a number) is not defined, - % then we first have to increase the \GNUPLOTnumber counter and associate this name with the new number - - % , then we should now also define - % gpe:{number}:context which should signal later on that the graphic -% \doifdefined{gps:n:#1} - % input the file - % TODO: error / warning if the files doesn't exist - \readlocfile{#2}{}{}% the third argument should be: if file not found - % this file is known - % TODO \letgvalue{gpf:#1}\plusone + {\bgroup + % for ConTeXt teminal + %-------------------- + % we first define two commands: \startGNUPLOTgraphic & \stopGNUPLOTgraphic to read the files in; + % files that gnuplot creates in non-standalone mode look approximately like this: + % + % \startGNUPLOTgraphic[1] + % ... metapost commands to draw the graph ... + % \stopGNUPLOTgraphic + % \startGNUPLOTgraphic[2] + % ... metapost commands to draw the graph ... + % \stopGNUPLOTgraphic + % ... + % + % while reading the file in, metapost graphics named "gpg:{name}:{number}" are defined + % + % (we might need some additional arguments later on, but for now the figure number should suffice) + \def\startGNUPLOTgraphic + {%\obeyMPlines % <- no longer a problem + \def\obeyedline{}% <- thanks to this + \dosingleargument\dostartGNUPLOTgraphic}% + \long\def\dostartGNUPLOTgraphic[##1]##2\stopGNUPLOTgraphic + {\startreusableMPgraphic{gpg:#1:##1}##2\stopreusableMPgraphic}% + %------------------ + % for TikZ terminal + %------------------ + \setcounter\tikzGNUPLOTnumber\zerocount + \let\normalstarttikzpicture=\starttikzpicture + \let\normalstoptikzpicture=\stoptikzpicture + \long\def\starttikzpicture##1\stoptikzpicture% + {\increment\tikzGNUPLOTnumber + % \long\setgvalue{TKZp:#1:\tikzGNUPLOTnumber}{##1}} + \long\setgvalue{TKZp:#1:\tikzGNUPLOTnumber}{\hbox{\starttikzpicture##1\stoptikzpicture}}} + %--------- + % for both + %--------- + % input the file + % TODO: error / warning if the files doesn't exist + \readlocfile{#2}{}{}% the third argument should be: if file not found + % this file is known + % TODO \letgvalue{gpf:#1}\plusone + \egroup } %D \macros @@ -673,6 +734,9 @@ {pdf}{pdf}{pdf}{} {\GNUPLOTfile-pdf.pdf}{\GNUPLOTfile-pdf.pdf} \defineGNUPLOThandle + {pdfcairo}{pdfcairo}{pdf}{} + {\GNUPLOTfile-pdfcairo.pdf}{\GNUPLOTfile-pdfcairo.pdf} +\defineGNUPLOThandle {metapost}{mp}{mp}{mtxrun mptopdf \GNUPLOTfile-mp.mp} {\GNUPLOTfile-mp.mp}{\GNUPLOTfile-mp-0.pdf} \defineGNUPLOThandle @@ -682,7 +746,16 @@ {png}{png}{png}{} {\GNUPLOTfile-png.png}{\GNUPLOTfile-png.png} \defineGNUPLOThandle - {context}{context textscale \@@GNUPLOT@term@context@textscale}{tex}{} + {pngcairo}{pngcairo}{png}{} + {\GNUPLOTfile-pngcairo.png}{\GNUPLOTfile-pngcairo.png} +\defineGNUPLOThandle + {tikz}{tikz context createstyle + size \@@GNUPLOT@term@tikz@width,\@@GNUPLOT@term@tikz@height\space + charsize \the\GNUPLOThcharsize,\the\GNUPLOTvcharsize + }{tex}{} + {\GNUPLOTfile-tikz.tex}{\GNUPLOTfile-tikz.tex} +\defineGNUPLOThandle + {context}{context size \@@GNUPLOT@term@context@width,\@@GNUPLOT@term@context@height\space textscale \@@GNUPLOT@term@context@textscale}{tex}{} {\GNUPLOTfile-ctx.tex}{\GNUPLOTfile-ctx.tex} % \doifnotempty{\@@GNUPLOT@term@context@textscale}{textscale \@@GNUPLOT@term@context@textscale} @@ -746,6 +819,15 @@ convertwith=, finalresult=\GNUPLOTfile-pdf.pdf, ] +\defineGNUPLOTterminal + [pdfcairo] + [terminal=pdfcairo, + defaultoptions=, + suffix=pdf, + result=\GNUPLOTfile-pdfcairo.pdf, + convertwith=, + finalresult=\GNUPLOTfile-pdfcairo.pdf, + ] %D \METAPOST\ terminal: %D - deprecated: use the \CONTEXT\ terminal instead, @@ -780,7 +862,15 @@ convertwith=, finalresult=\GNUPLOTfile-png.png, ] - +\defineGNUPLOTterminal + [pngcairo] + [terminal=pngcairo, + defaultoptions=, + suffix=png, + result=\GNUPLOTfile-pngcairo.png, + convertwith=, + finalresult=\GNUPLOTfile-pngcairo.png, + ] %D \CONTEXT\ terminal (native) \defineGNUPLOTterminal [context] @@ -806,6 +896,10 @@ \doifsamestringelse{\@@GNUPLOT@term@context@dashed}{yes}% yes or no {\edef\@@GNUPLOT@term@context@is@dashed{true}}% {\edef\@@GNUPLOT@term@context@is@dashed{false}}% + \doifsamestring{\@@GNUPLOT@term@context@width}{default} + {\edef\@@GNUPLOT@term@context@width{5in}} + \doifsamestring{\@@GNUPLOT@term@context@height}{default} + {\edef\@@GNUPLOT@term@context@height{3in}} % {\edef\gp:term:context:dashed{true}}% % {\edef\gp:term:context:dashed{false}}% % % dashlength scale @@ -827,6 +921,12 @@ textscale=1, % scaling factor for text labels points=metapost] % *metapost* | tex (Should points be drawn with MetaPost or TeX?) +\setupGNUPLOTterminal + [tikz] + [width=5in, % *5in* | default (todo) | <dimension> + height=3in, % *3in* | default (todo) | <dimension> + ] + % TODO: better scaling \defineconversion [gnuplot:pointset] |