From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24965 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: present for mojca Date: Thu, 05 Jan 2006 19:43:53 +0100 Message-ID: <43BD68E9.5060606@wxs.nl> References: <6faad9f00601030018h35a6a95cj5bf3ce468e39f4eb@mail.gmail.com> <6faad9f00601031227k520f1c82k386b7c246e7031f1@mail.gmail.com> <43BAF5B1.1010703@wxs.nl> <43BBDF7F.5090302@wxs.nl> <43BBEB08.4010707@net-b.de> <43BBF47B.9090507@wxs.nl> <6faad9f00601050757g40bc141bqd01eb1d5e5ef9ab7@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------000403020806070707060303" X-Trace: sea.gmane.org 1136486665 1999 80.91.229.2 (5 Jan 2006 18:44:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 5 Jan 2006 18:44:25 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Thu Jan 05 19:44:17 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1Eua5l-00027Z-EC for gctc-ntg-context-518@m.gmane.org; Thu, 05 Jan 2006 19:44:05 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 44B9A127C2; Thu, 5 Jan 2006 19:44:04 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26501-05; Thu, 5 Jan 2006 19:44:01 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 0B336127AA; Thu, 5 Jan 2006 19:44:01 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id DD440127AA for ; Thu, 5 Jan 2006 19:43:59 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 26671-01 for ; Thu, 5 Jan 2006 19:43:58 +0100 (CET) Original-Received: from mail.pragma-ade.net (dsl-212-84-128-085.solcon.nl [212.84.128.85]) by ronja.ntg.nl (Postfix) with SMTP id 2E11C1278B for ; Thu, 5 Jan 2006 19:43:55 +0100 (CET) Original-Received: from [10.100.1.102] (unverified [10.100.1.102]) by controller-1 (SurgeMail 3.5b3) with ESMTP id 10447 for ; Thu, 05 Jan 2006 19:53:02 +0300 User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: <6faad9f00601050757g40bc141bqd01eb1d5e5ef9ab7@mail.gmail.com> X-Server: High Performance Mail Server - http://surgemail.com r=-274017400 X-Authenticated-User: hagen@controller-1 X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:24965 Archived-At: This is a multi-part message in MIME format. --------------000403020806070707060303 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Mojca Miklavec wrote: >I experience exactly the same problem here both under Windows and >Linux. ^M should be replaced by some "newline". If I do that manually, >the module works perfectly. > > i hate locales >A bit weird request (and not urgent at all since there are other ways >to solve this): could "rotate=" be added to \externalfigure once in >the distant future? The resulting graphs in postscript are rotated 90 >degrees counterclocwise. > > > hm, i have to think about it >>maybe \def\par{; } also works here, i dunny how long gnuplot lines may be >> >> > > > did \def\par{;} work out ok? >The problem is not in \def\par{} I guess. It doesn't have any >influence on the way how input lines appear in the file. Even if I >redefined the \par and put strange chars in there, it didn't have any >influence. > > strange, maybe i have a better tex binary >I tried to play with \obeylines a bit, but without success. I managed >to get ^E (0x05) instead of ^M in the gnuplot file if I redefined >\endchar to be ^^L (if I remember correctly), but just anything else >led to errors. > >Two not-so-important remarks: >1. \immediate\write\scratchwrite{end} >"end" should be changed into "quit" or even better: left out >completely since gnuplot exits anyway after executing the script > > ok, quit then >2. The default file extension is .plt (instead of gpd; the ending >really doesn't matter, but this one is recognized by default when you >"open file" from gnuplot) > > > hm, we don't want to overwrite files, do we? > >Some terminals are more ugly than the others. The best idea to specify >the terminal is really by placing it manually into >\startGNUPLOTinclusion, not by prepending it automatically (as I asked >first), since it can have some additional parameters (color, >landscape, ...). > > it's not prepended now; however, it makes sense to think about it because in the case of mp we need a different treatment >There are also "set terminal pdf" (only in the "latest" versions, >perhaps not even included in the binaries), "set terminal png", "set >terminal mp", "set terminal latex", ... > >Another humble request from me would be to support more than a single terminal: > >%%%%% >\setupGNUPLOT[terminal=postscript] % should result in >\immediate\write\scratchwrite{set output "\bufferprefix >gnuplot-\GNUPLOTnumber.ps"}% >... >\convertGNUPLOTgraphic{\bufferprefix gnuplot-\GNUPLOTnumber}% >% perhaps a better name, suggesting ps2pdf conversion > > >%%%%% >\setupGNUPLOT[terminal=pdf] % only recent; should result in > >\immediate\write\scratchwrite{set output "\bufferprefix >gnuplot-\GNUPLOTnumber.pdf"}% >% no postprocessing/conversion needed. > >%%%%% >\setupGNUPLOT[terminal=png] % should result in > >\immediate\write\scratchwrite{set output "\bufferprefix >gnuplot-\GNUPLOTnumber.png"}% >% no postprocessing/conversion needed. > >%%%%% >\setupGNUPLOT[terminal=mp] % should result in > >\immediate\write\scratchwrite{set output "\bufferprefix >gnuplot-\GNUPLOTnumber.mp"}% >% plus mpost + mptopdf postprocessing > >%%%%% >\setupGNUPLOT[terminal=latex] % somewhat more tricky; should result in > >\immediate\write\scratchwrite{set output "\bufferprefix >gnuplot-\GNUPLOTnumber.tex"}% >% another auxilary file has to be used in this case with \documentclass ... >% \begindocument ... \input \bufferprefix gnuplot-\GNUPLOTnumber.tex >% and then processed with pdflatex; that's what I currently use: most >beautiful results > > > that's a big list ... why isn't there a context mode? >Thanks a lot, > Mojca > >PS: Does this module really mean that I have no more excuses for not >finishing my report(s) for physics in time? ;) > > > > no, worse, you now can finish it faster see attached file (bottom of file); should be enough to get your reports done Hans --------------000403020806070707060303 Content-Type: text/x-tex; name="m-gnuplot.tex" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="m-gnuplot.tex" %D \module %D [ file=m-gnuplot, %D version=2006.01.04, %D title=\CONTEXT\ Extra Modules, %D subtitle=\GNUPLOT\ Inclusion, %D author=Hans Hagen, %D date=\currentdate, %D copyright=\PRAGMA] %C %C This module is part of the \CONTEXT\ macro||package and is %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. % todo: reuse (only if really needed) % \enablemode[demo] %D example: %D %D \starttyping %D texexec --pdf --mode=demo m-gnuplot %D \stoptyping \unprotect \ifx\operatingsystem\undefined \def\operatingsystem{unix} \fi % texexec will set that \newcounter\GNUPLOTnumber \def\startGNUPLOTinclusions {\bgroup \obeylines \dostartGNUPLOTinclusions} \def\dostartGNUPLOTinclusions#1\stopGNUPLOTinclusions {\gdef\GNUPLOTinclusions{#1}% \egroup} \def\startGNUPLOTgraphic#1% {\bgroup \obeylines \dostartGNUPLOTgraphic{#1}} \def\dostartGNUPLOTgraphic#1#2\stopGNUPLOTgraphic {\doglobal\increment\GNUPLOTnumber \letgvalue{gpg:n:#1}\GNUPLOTnumber \setgvalue{gpg:d:\GNUPLOTnumber}{#2}% \egroup} \def\useGNUPLOTgraphic {\dodoubleempty\douseGNUPLOTgraphic} \def\douseGNUPLOTgraphic[#1][#2]% {\iffirstargument \@EA\dodouseGNUPLOTgraphic % like \externalfigure[name][optional args] \else \@EA\redouseGNUPLOTgraphic % like \useMPgraphic{name} \fi[#1][#2]} \def\redouseGNUPLOTgraphic[#1][#2]#3% {\dodouseGNUPLOTgraphic[#3][]} \def\dodouseGNUPLOTgraphic[#1][#2]% {\bgroup \doifdefined{gpg:n:#1} {\edef\GNUPLOTnumber{\getvalue{gpg:n:#1}}% \edef\GNUPLOTfile {\bufferprefix gnuplot-\GNUPLOTnumber}% \bgroup % hm, gnuplot only seems to handle lf so we cannot use \mappartolineend % also, in order to prevent fuzzy runs (or no runs) we add a ; to each line \def\par{;\rawcharacter{10}}% \immediate\openout\scratchwrite=\GNUPLOTfile.gpd \immediate\write\scratchwrite{set terminal "\@@GNUPLOTmethod"}% \immediate\write\scratchwrite{\GNUPLOTinclusions}% \immediate\write\scratchwrite{set output "\GNUPLOTfile.\@@GNUPLOTsuffix"}% \immediate\write\scratchwrite{\getvalue{gpg:d:\GNUPLOTnumber}}% \immediate\write\scratchwrite{quit}% \immediate\closeout\scratchwrite \egroup \processGNUPLOTgraphic \convertGNUPLOTgraphic \externalfigure[\@@GNUPLOTresult][#2]}% \egroup} % we assume pdf inclusion, eps wil be implemented when applicable \def\setupGNUPLOT {\dodoubleempty\getparameters[@@GNUPLOT]} \def\processGNUPLOTgraphic {\doifelse\operatingsystem{mswin} {\executesystemcommand{start pgnuplot \GNUPLOTfile.gpd}} % start is needed else gp fails {\executesystemcommand{gnuplot \GNUPLOTfile.gpd}}} \def\convertGNUPLOTgraphic {\doifsomething\@@GNUPLOThandle{\executesystemcommand{\@@GNUPLOThandle}}} \def\defineGNUPLOThandle#1#2#3#4#5% name output suffix conversion-method result {\setvalue{@@GNUPLOT-#1}{{#2}{#3}{#4}{#5}}} \def\@@GNUPLOToutput{\filterfromvalue{@@GNUPLOT-\@@GNUPLOTmethod}41} \def\@@GNUPLOTsuffix{\filterfromvalue{@@GNUPLOT-\@@GNUPLOTmethod}42} \def\@@GNUPLOThandle{\filterfromvalue{@@GNUPLOT-\@@GNUPLOTmethod}43} \def\@@GNUPLOTresult{\filterfromvalue{@@GNUPLOT-\@@GNUPLOTmethod}44} \defineGNUPLOThandle{postscript}{postscript}{ps} {texmfstart newpstopdf \GNUPLOTfile.ps}{\GNUPLOTfile.pdf} \defineGNUPLOThandle{ps} {postscript}{ps} {texmfstart newpstopdf \GNUPLOTfile.ps}{\GNUPLOTfile.pdf} \defineGNUPLOThandle{pdf} {pdf} {pdf}{} {\GNUPLOTfile.pdf} \defineGNUPLOThandle{metapost} {mp} {mp} {texmfstart mptopdf \GNUPLOTfile.mp}{\GNUPLOTfile-0.pdf} \defineGNUPLOThandle{mp} {mp} {mp} {texmfstart mptopdf \GNUPLOTfile.mp}{\GNUPLOTfile-0.pdf} \defineGNUPLOThandle{png} {png} {png}{} {\GNUPLOTfile.png} \setupGNUPLOT[\c!method=ps] \protect \doifnotmode{demo}{\endinput} \starttext \startGNUPLOTinclusions set title "trigonometry" \stopGNUPLOTinclusions \startGNUPLOTgraphic{sin} plot sin(x) \stopGNUPLOTgraphic \startGNUPLOTgraphic{cos} plot cos(x) \stopGNUPLOTgraphic \useGNUPLOTgraphic{sin} \endgraf \useGNUPLOTgraphic{cos} \endgraf \useGNUPLOTgraphic[cos] \endgraf \setupGNUPLOT[method=ps] \useGNUPLOTgraphic[sin][object=no,height=2cm] \blank %setupGNUPLOT[method=pdf] \useGNUPLOTgraphic[sin][object=no,height=2cm] \blank \setupGNUPLOT[method=png] \useGNUPLOTgraphic[sin][object=no,height=2cm] \blank \setupGNUPLOT[method=mp] \useGNUPLOTgraphic[sin][object=no,height=2cm] \blank \stoptext --------------000403020806070707060303 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context --------------000403020806070707060303--