From hurak at fel.cvut.cz Thu Oct 2 13:27:39 2008 From: hurak at fel.cvut.cz (=?UTF-8?B?WmRlbsSbayBIdXLDoWs=?=) Date: Thu, 02 Oct 2008 13:27:39 +0200 Subject: [metapost] Troubles to display text in a Metapost figure Message-ID: Hello, as a beginner with Metapost, I am having troubles to use text labels in a Metapost figure. The code is simple beginfig(1); label.lft("A",(1cm,1cm)); endfig; end; The trouble is that the postscript generated using mpost gives no visible text when viewed with gsview or kghostview. The source code for the postscript is %!PS %%BoundingBox: 17 24 26 32 %%HiResBoundingBox: 17.87445 24.94255 25.34645 31.75035 %%Creator: MetaPost 1.001 %%CreationDate: 2008.10.01:2100 %%Pages: 1 %*Font: cmr10 9.96265 9.96265 41:8 %%BeginProlog %%EndProlog %%Page: 1 1 0 0 0 setrgbcolor 17.87445 24.94255 moveto (A) cmr10 9.96265 fshow showpage %%EOF Apparently something is wrong because when I am trying to convert this to PDF using epstopdf, I get an error message starting with Error: /undefined in cmr10 I estimate that this must be related to missing or unlinked fonts. I have the same problem on a Linux platform (Gentoo + Texlive) and Windows platform (XP + Miktex) and therefore I would appreciate a systematic solution, if possible. Thanks for a hint. -- Zdenek Hurak From thenders at gmail.com Thu Oct 2 13:34:21 2008 From: thenders at gmail.com (Troy Henderson) Date: Thu, 2 Oct 2008 06:34:21 -0500 Subject: [metapost] Troubles to display text in a Metapost figure In-Reply-To: References: Message-ID: Place a prologues:=3; at the beginning of your file, and that will embed all fonts into your output EPS. Conversion to PDF should then work. Note that the prologues:=3 option will only work for MetaPost version 0.970 or greater. Troy From akk64 at quick.cz Thu Oct 2 13:55:56 2008 From: akk64 at quick.cz (=?windows-1252?Q?Karel_Hor=E1k?=) Date: Thu, 02 Oct 2008 13:55:56 +0200 Subject: [metapost] Troubles to display text in a Metapost figure In-Reply-To: References: Message-ID: <48E4B6CC.8020903@quick.cz> Zdene(k Hur?k napsal(a): > Hello, > > as a beginner with Metapost, I am having troubles to use text labels in a > Metapost figure. The code is simple > > beginfig(1); > label.lft("A",(1cm,1cm)); > endfig; > end; > > The trouble is that the postscript generated using mpost gives no visible > text when viewed with gsview or kghostview. The source code for the > postscript is In that case you must configure gs to know about /cmr10 (thru fontmap file, see also the corresponding file fontmap.cm in your /gs/lib directory; the path to cmr10.pfb must of course correspond to your real path). But if you will use the same code with prologues:=3; you will obtain eps file with cmr10.pfb included which will than work correctly in any further processing. Happy mp-ing, > > %!PS > %%BoundingBox: 17 24 26 32 > %%HiResBoundingBox: 17.87445 24.94255 25.34645 31.75035 > %%Creator: MetaPost 1.001 > %%CreationDate: 2008.10.01:2100 > %%Pages: 1 > %*Font: cmr10 9.96265 9.96265 41:8 > %%BeginProlog > %%EndProlog > %%Page: 1 1 > 0 0 0 setrgbcolor > 17.87445 24.94255 moveto > (A) cmr10 9.96265 fshow > showpage > %%EOF > > > Apparently something is wrong because when I am trying to convert this to > PDF using epstopdf, I get an error message starting with > > Error: /undefined in cmr10 > > I estimate that this must be related to missing or unlinked fonts. I have > the same problem on a Linux platform (Gentoo + Texlive) and Windows > platform (XP + Miktex) and therefore I would appreciate a systematic > solution, if possible. > > Thanks for a hint. > From mojca.miklavec.lists at gmail.com Wed Oct 8 19:34:20 2008 From: mojca.miklavec.lists at gmail.com (Mojca Miklavec) Date: Wed, 8 Oct 2008 19:34:20 +0200 Subject: [metapost] "Math drawings for dummies" Message-ID: <6faad9f00810081034y2f79ad10ic1f6934474977239@mail.gmail.com> Hello, for those who are afraid of Metapost (or simply think that it takes too much time to program a simple figure with not too fancy features), there's a magnificent point-and-click tool for creating mathematical drawings with "perfect precision" and TeX labels matching the style of your document. (If you want to find itersection of curves, or curves going through several points, you don't need to "pretend that you have hit the intersection" as you would do in Corel Draw.) The prerelease version has TikZ export (with plain/LaTeX/ConTeXt support included). http://www.geogebra.org -> future Mojca From mojca.miklavec.lists at gmail.com Wed Oct 8 19:34:20 2008 From: mojca.miklavec.lists at gmail.com (Mojca Miklavec) Date: Wed, 8 Oct 2008 19:34:20 +0200 Subject: [metapost] "Math drawings for dummies" Message-ID: <6faad9f00810081034y2f79ad10ic1f6934474977239@mail.gmail.com> Hello, for those who are afraid of Metapost (or simply think that it takes too much time to program a simple figure with not too fancy features), there's a magnificent point-and-click tool for creating mathematical drawings with "perfect precision" and TeX labels matching the style of your document. (If you want to find itersection of curves, or curves going through several points, you don't need to "pretend that you have hit the intersection" as you would do in Corel Draw.) The prerelease version has TikZ export (with plain/LaTeX/ConTeXt support included). http://www.geogebra.org -> future Mojca From xpdf at wp.pl Wed Oct 15 21:11:10 2008 From: xpdf at wp.pl (xpdf) Date: Wed, 15 Oct 2008 21:11:10 +0200 Subject: [metapost] Error: /undefined in cmr10 Message-ID: <48F6404E.80605@wp.pl> I get this in my "gv" What add this font to gv or metapost change to normal fonts From thenders at gmail.com Wed Oct 15 21:35:11 2008 From: thenders at gmail.com (Troy Henderson) Date: Wed, 15 Oct 2008 14:35:11 -0500 Subject: [metapost] Error: /undefined in cmr10 In-Reply-To: <48F6404E.80605@wp.pl> References: <48F6404E.80605@wp.pl> Message-ID: Place prologues:=3; in your source file and your fonts should be embedded into your output EPS. Troy From xpdf at wp.pl Wed Oct 15 23:07:28 2008 From: xpdf at wp.pl (xpdf) Date: Wed, 15 Oct 2008 23:07:28 +0200 Subject: [metapost] intersectiontimes Message-ID: <48F65B90.1030806@wp.pl> What get four points intersections 2 path path fa; path fb; fa=( (0,0)..(10,11)..... fb=..... a intersectiontimes b 4 points A,B,C, D look this http://images37.fotosik.pl/20/c49a9eb1afea743b.jpg From thenders at gmail.com Wed Oct 15 23:45:17 2008 From: thenders at gmail.com (Troy Henderson) Date: Wed, 15 Oct 2008 16:45:17 -0500 Subject: [metapost] intersectiontimes In-Reply-To: <48F65B90.1030806@wp.pl> References: <48F65B90.1030806@wp.pl> Message-ID: Try this: --- begin cut code --- path p,q,r; p:=fullcircle xscaled 72 yscaled 36; q:=fullcircle xscaled 36 yscaled 72; r:=p; draw p withcolor green; draw q withcolor red; for n=1 upto 4: (t[n],whatever) = r intersectiontimes q; z[n] = point t[n] of r; r:= subpath (t[n]+epsilon,length r) of r; fill fullcircle scaled 2 shifted z[n] withcolor blue; endfor; --- end cut code --- In this case, p and q are the two paths and r is simply a copy of p that is going to be trimmed along the way. Basically, you continually trim r so that the "first" point for which r intersects q is *strictly* further (hence the need for epsilon) along than the previous intersection point. Repeating this process 4 times gets them all. I hope this is not too difficult to understand. Also, anyone with a better solution please let me know as I would love to hear it. Troy From reinhard.kotucha at web.de Wed Oct 15 23:53:42 2008 From: reinhard.kotucha at web.de (Reinhard Kotucha) Date: Wed, 15 Oct 2008 23:53:42 +0200 Subject: [metapost] Error: /undefined in cmr10 In-Reply-To: <48F6404E.80605@wp.pl> References: <48F6404E.80605@wp.pl> Message-ID: <18678.26214.976242.279942@zaphod.ms25.net> xpdf writes: > ... Dear xpdf, I'm just wondering about your name. Are you the author of xpdf or do just want to kid us? Regards, Reinhard -- ---------------------------------------------------------------------------- Reinhard Kotucha Phone: +49-511-3373112 Marschnerstr. 25 D-30167 Hannover mailto:reinhard.kotucha at web.de ---------------------------------------------------------------------------- Microsoft isn't the answer. Microsoft is the question, and the answer is NO. ---------------------------------------------------------------------------- From luecking at uark.edu Thu Oct 16 21:45:07 2008 From: luecking at uark.edu (Dan Luecking) Date: Thu, 16 Oct 2008 14:45:07 -0500 Subject: [metapost] intersectiontimes In-Reply-To: References: <48F65B90.1030806@wp.pl> Message-ID: <200810161945.m9GJj7Le023870@comp.uark.edu> At 04:45 PM 10/15/2008, Troy Henderson wrote: >Try this: > >--- begin cut code --- > >path p,q,r; >p:=fullcircle xscaled 72 yscaled 36; >q:=fullcircle xscaled 36 yscaled 72; >r:=p; >draw p withcolor green; >draw q withcolor red; >for n=1 upto 4: > (t[n],whatever) = r intersectiontimes q; % in a general purpose macro one might want: exitif t[n]<0; > z[n] = point t[n] of r; > r:= subpath (t[n]+epsilon,length r) of r; > fill fullcircle scaled 2 shifted z[n] withcolor blue; >endfor; Dan Daniel H. Luecking Department of Mathematical Sciences University of Arkansas "Dubito ergo cogito, cogito ergo sum" --Descartes From thenders at gmail.com Thu Oct 16 21:47:10 2008 From: thenders at gmail.com (Troy Henderson) Date: Thu, 16 Oct 2008 14:47:10 -0500 Subject: [metapost] intersectiontimes In-Reply-To: <200810161945.m9GJj7Le023870@comp.uark.edu> References: <48F65B90.1030806@wp.pl> <200810161945.m9GJj7Le023870@comp.uark.edu> Message-ID: >>for n=1 upto 4: >> (t[n],whatever) = r intersectiontimes q; > > % in a general purpose macro one might want: > exitif t[n]<0; Indeed! Thanks Dan. Troy From rasch at vtxmail.ch Sun Oct 19 02:02:57 2008 From: rasch at vtxmail.ch (Raphael Schweizer) Date: Sun, 19 Oct 2008 02:02:57 +0200 Subject: [metapost] [bug] graph.mp ignores defaultfont Message-ID: <000001c9317e$0b5e4ea0$221aebe0$@ch> Taco Hoekwater wrote: > Stephan Hennig wrote: >> Hi, >> >> in the following example x-axis labels are set in Palatino, but the >> y-axis labels are set in CM. > My guess is that you can fix your problem with an appropriate > verbatimtex ... etex preamble. I have a similar problem. The following will only typeset the label in Helvetica, the ticks on the axis' won't. I tried adding verbatimtex \usepackage[math]{iwona} etex (using this in latex sets the font correctly) but I didn't succeed. Can you please explain the proper preamble? If you also happen to know a math font which better matches Helvetica, I would greatly appreciate any hint. %&latex defaultfont:="phvr8y"; %Helvetica input graph; beginfig(1) draw begingraph(3cm,2cm) gdata("Timings.d", v, path p; augment p (v1,0); augment p (v1,v2); gdraw p withpen pensquare xscaled 8bp; ); endgraph; label.llft("Foo", (3cm,2cm)); endfig; bye; Thanks a lot, Raphael From thenders at gmail.com Sun Oct 19 02:36:16 2008 From: thenders at gmail.com (Troy Henderson) Date: Sat, 18 Oct 2008 19:36:16 -0500 Subject: [metapost] [bug] graph.mp ignores defaultfont In-Reply-To: <000001c9317e$0b5e4ea0$221aebe0$@ch> References: <000001c9317e$0b5e4ea0$221aebe0$@ch> Message-ID: Raphael, > defaultfont:="phvr8y"; %Helvetica Fmfont_:="phvr8y"; %Helvetica You need to redefine Fmfont_ in order to change the graph axis font. Troy Henderson From christian.salas at yale.edu Tue Oct 21 01:56:28 2008 From: christian.salas at yale.edu (Christian Salas) Date: Mon, 20 Oct 2008 19:56:28 -0400 Subject: [metapost] question about 'Trees' in metapost Message-ID: <48FD1AAC.8090005@yale.edu> hi there, i am following the examples given by Goossens et al book (2008) on the use of 'Trees' in metapost. My question is simple: they provide an example with 3 leves (Food; fruits/vegetable; apples--bananas/potatoes-peas). Now i want to add one more level, let say within the sub-sublevel potatoes, i want to create 2 new subsubsub levels. How can i achieve that? below is the code that i am compiling with $mptopdf XXX.mp my problem is that this line > newTree.food(fo)(fruits,vegetables) "hsep(1cm)", "treemode(R)"; does not recognize that potatoes [that belong to 'vegetables'] have a subdivision as well I tried to add 'potag' to that line [after vegetables], but in that case, metapost recognize it as it were 3 main branches, which is not my case. please, help %###################################################### verbatimtex \documentclass{article} \usepackage{times} \begin{document} etex; input metaobj beginfig(1); beginfig(136); newBox.a(btex apples etex); newBox.b(btex oranges etex); newBox.c(btex bananas etex); newBox.f(btex fruits etex); newTree.fruits(f)(a,b,c) "Ralign(right)", "treemode(R)"; newBox.da(btex papaA etex); %i modified this newBox.db(btex papaB etex); %i modified this newBox.d(btex potatoes etex); newBox.e(btex peas etex); newBox.v(btex vegetables etex); newTree.vegetables(v)(d,e) "Ralign(center)", "treemode(R)"; newTree.potag(d)(da,db) "Ralign(center)", "treemode(R)"; %i modi.this newBox.fo(btex food etex); newTree.food(fo)(fruits,vegetables) "hsep(1cm)", "treemode(R)"; scaleObj(food,.5); food.c=origin; drawObj(food); endfig; verbatimtex \end{document} etex; end %###################################################### c From mailing_list at arcor.de Tue Oct 21 14:01:43 2008 From: mailing_list at arcor.de (Stephan Hennig) Date: Tue, 21 Oct 2008 14:01:43 +0200 Subject: [metapost] question about 'Trees' in metapost In-Reply-To: <48FD1AAC.8090005@yale.edu> References: <48FD1AAC.8090005@yale.edu> Message-ID: <48FDC4A7.7080305@arcor.de> Christian Salas schrieb: > i am following the examples given by Goossens et al book (2008) on the > use of 'Trees' in metapost. Interesting, I have to watch out for that book in the library. > My question is simple: they provide an example with 3 leves (Food; > fruits/vegetable; apples--bananas/potatoes-peas). Now i want to add one > more level, let say within the sub-sublevel potatoes, i want to create 2 > new subsubsub levels. How can i achieve that? There are no sub-...-levels in MetaObj's trees. All tree objects actually have height two (or one in some terminology). That is, tree objects consist of exactly one root node (first argument) and an arbitrary number of direct child nodes (second list argument). Trees (in computer science terminology) that have second order child nodes have to be constructed by nesting tree objects. In the example below a frame is drawn around all tree objects to emphasize tree structure. One problem of MetaObj trees is that construction needs an enormous number of variables. There is an alternative, streamlined construcors, described in section "Advanced operations" in the MetaObj manual, but that doesn't really make the code more readable. What's missing for MetaObj is a macro (or even an external tool) that translates a graph from one of the standard graph formats into MetaObj code. One last hint: if you read the MetaObj manual, start with section 7, "Standard Library -- Gallery", and section 5, "Advanced operations" in that order. Best regards, Stephan Hennig verbatimtex \documentclass{article} \usepackage{times} \begin{document} etex input metaobj prologues:=2; beginfig(1); setObjectDefaultOption("Tree")("treemode")("R"); setObjectDefaultOption("Tree")("framed")(true); setObjectDefaultOption("Tree")("dx")(5bp); setObjectDefaultOption("Tree")("dy")(5bp); %%% Create tree 'potatoes'. newBox.potR(btex potatoes etex); newBox.potA(btex papaA etex); newBox.potB(btex papaB etex); newTree.potatoes(potR)(potA, potB); %%% Create tree 'vegetables'. newBox.pea(btex peas etex); newBox.vegR(btex vegetables etex); newTree.vegetables(vegR)(potatoes, pea); %%% Create tree 'fruits'. newBox.fruR(btex fruits etex); newBox.fruA(btex apples etex); newBox.fruB(btex oranges etex); newBox.fruC(btex bananas etex); newTree.fruits(fruR)(fruA, fruB, fruC); %%% Create tree 'food'. newBox.fooR(btex food etex); newTree.food(fooR)(fruits, vegetables); food.c = origin; drawObj(food); endfig; end From christian.salas at yale.edu Tue Oct 21 17:13:21 2008 From: christian.salas at yale.edu (Christian Salas) Date: Tue, 21 Oct 2008 11:13:21 -0400 Subject: [metapost] question about 'Trees' in metapost In-Reply-To: <48FDC4A7.7080305@arcor.de> References: <48FD1AAC.8090005@yale.edu> <48FDC4A7.7080305@arcor.de> Message-ID: <48FDF191.3070408@yale.edu> thanks stephan!!! this is exactly what i want!!! cheers ------------------------------------------------------------------------------- Christian Salas E-mail:christian.salas at yale.edu PhD student http://environment.yale.edu/salas School of Forestry and Environmental Studies Yale University Tel: +1-(203)-432 5126 360 Prospect St Fax:+1-(203)-432 3809 New Haven, CT 06511-2189 Office: Room 35, Marsh Hall USA Yale Biometrics Lab http://environment.yale.edu/biometrics ------------------------------------------------------------------------------- Stephan Hennig wrote: > Christian Salas schrieb: > >> i am following the examples given by Goossens et al book (2008) on the >> use of 'Trees' in metapost. > > Interesting, I have to watch out for that book in the library. > > >> My question is simple: they provide an example with 3 leves (Food; >> fruits/vegetable; apples--bananas/potatoes-peas). Now i want to add one >> more level, let say within the sub-sublevel potatoes, i want to create 2 >> new subsubsub levels. How can i achieve that? > > There are no sub-...-levels in MetaObj's trees. All tree objects > actually have height two (or one in some terminology). That is, tree > objects consist of exactly one root node (first argument) and an > arbitrary number of direct child nodes (second list argument). Trees > (in computer science terminology) that have second order child nodes > have to be constructed by nesting tree objects. In the example below a > frame is drawn around all tree objects to emphasize tree structure. > > One problem of MetaObj trees is that construction needs an enormous > number of variables. There is an alternative, streamlined construcors, > described in section "Advanced operations" in the MetaObj manual, but > that doesn't really make the code more readable. What's missing for > MetaObj is a macro (or even an external tool) that translates a graph > from one of the standard graph formats into MetaObj code. > > One last hint: if you read the MetaObj manual, start with section 7, > "Standard Library -- Gallery", and section 5, "Advanced operations" in > that order. > > Best regards, > Stephan Hennig > > > verbatimtex > \documentclass{article} > \usepackage{times} > \begin{document} > etex > input metaobj > prologues:=2; > > beginfig(1); > setObjectDefaultOption("Tree")("treemode")("R"); > setObjectDefaultOption("Tree")("framed")(true); > setObjectDefaultOption("Tree")("dx")(5bp); > setObjectDefaultOption("Tree")("dy")(5bp); > > %%% Create tree 'potatoes'. > newBox.potR(btex potatoes etex); > newBox.potA(btex papaA etex); > newBox.potB(btex papaB etex); > newTree.potatoes(potR)(potA, potB); > > %%% Create tree 'vegetables'. > newBox.pea(btex peas etex); > newBox.vegR(btex vegetables etex); > newTree.vegetables(vegR)(potatoes, pea); > > %%% Create tree 'fruits'. > newBox.fruR(btex fruits etex); > newBox.fruA(btex apples etex); > newBox.fruB(btex oranges etex); > newBox.fruC(btex bananas etex); > newTree.fruits(fruR)(fruA, fruB, fruC); > > %%% Create tree 'food'. > newBox.fooR(btex food etex); > newTree.food(fooR)(fruits, vegetables); > > food.c = origin; > drawObj(food); > endfig; > end