Re: [NTG-context] Using metapost figures in context (offlist)
Am Mittwoch, 14. Juni 2006 09:35 schrieb Hans Hagen: if data =~ /output files* written\:\s*(.*)$/mois then I am no ruby programmer, but although the above works, it should be if data =~ /output files? written ... Uwe ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
Uwe Koloska wrote: Am Mittwoch, 14. Juni 2006 09:35 schrieb Hans Hagen: if data =~ /output files* written\:\s*(.*)$/mois then I am no ruby programmer, but although the above works, it should be if data =~ /output files? written ... well, s* means zero or more s's so we also catch future typos in metapost, i.e. output files -) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. ah ... typo in base/tex.rb: @@pdftex = 'pdftex' # new default, pdfetex is gone ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| ^^ Can you test that? Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. ah ... typo in base/tex.rb: @@pdftex = 'pdftex' # new default, pdfetex is gone ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| ^^ Can you test that? Yes, this works. The formats are generated correctly. However, texmfstart texexec --mpgraphic file.mp does not give me a pdf file. I do understand why this is happening. I will dig into it a bit more and see what is going wrong. Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
On Tue, 13 Jun 2006, Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. ah ... typo in base/tex.rb: @@pdftex = 'pdftex' # new default, pdfetex is gone ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| ^^ Can you test that? Yes, this works. The formats are generated correctly. However, texmfstart texexec --mpgraphic file.mp does not give me a pdf file. I do understand why this is happening. I will dig into it a bit more and see what is going wrong. In tex.rb def processmpgraphic ... if data =~ /output files written\:\s*(.*)$/mois then However, if the mp file contains only one figure, the output in the log is 1 output file written: figures-axis.1 Notice /file/ instead of /files/. So the regex should be changed according. Then everything works. Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
Aditya Mahajan wrote: On Tue, 13 Jun 2006, Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. ah ... typo in base/tex.rb: @@pdftex = 'pdftex' # new default, pdfetex is gone ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| ^^ Can you test that? Yes, this works. The formats are generated correctly. However, texmfstart texexec --mpgraphic file.mp does not give me a pdf file. I do understand why this is happening. I will dig into it a bit more and see what is going wrong. In tex.rb def processmpgraphic ... if data =~ /output files written\:\s*(.*)$/mois then However, if the mp file contains only one figure, the output in the log is 1 output file written: figures-axis.1 Notice /file/ instead of /files/. So the regex should be changed according. Then everything works. if data =~ /output files* written\:\s*(.*)$/mois then Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context (offlist)
On Wed, 14 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. Something is wrong with the new beta. I downloaded the zip and regenerated the formats, but only metafun format is created. I am attaching the output of texmfstart --verbose texexec --verbose --make --all actually, the problem is that the latest pdfetex is not called pdftex; can you remove all traces or pdftex[.exe] in your bin path and see what happens then? No pdftex is in the path. I call context by using set PATH=E:\Ruby\bin call E:\isoimage\usr\local\context\tex\setuptex.bat E:\isoimage\usr\local\context\tex so there should not be any mismatched executables. ah ... typo in base/tex.rb: @@pdftex = 'pdftex' # new default, pdfetex is gone ENV['PATH'].split(File::PATH_SEPARATOR).each do |p| ^^ Can you test that? Yes, this works. The formats are generated correctly. However, texmfstart texexec --mpgraphic file.mp does not give me a pdf file. I do understand why this is happening. I will dig into it a bit more and see what is going wrong. In tex.rb def processmpgraphic ... if data =~ /output files written\:\s*(.*)$/mois then However, if the mp file contains only one figure, the output in the log is 1 output file written: figures-axis.1 Notice /file/ instead of /files/. So the regex should be changed according. Then everything works. if data =~ /output files* written\:\s*(.*)$/mois then That does the trick. --mpgraphic is working correctly. However, there is no message on the console saying that a pdf file is created. Can you add report ({#name}.#{number} converted to #{filename}.#{number}.pdf) and report (#{name}.#{number} converted to #{filename}.pdf) after File.silentrename lines. Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context
On Tue, 13 Jun 2006, Hans Hagen wrote: Aditya Mahajan wrote: I have right now kept the command as MPfigure. grep MPfigure in meta-fig -) Now I am using staticMPfigure. This is the final version \def\startstaticMPfigure#1#2\stopstaticMPfigure {\bgroup \setMPrandomseedfalse %Otherwise randomseed := number line always differ \doifmodeelse{*pdf} {\def\executeMPTEX##1% {texmfstart --verbose --ifchanged=##1.mp texexec --mpgraphic ##1.mp} \let\executeMPOST=\executeMPTEX} {\def\executeMPOST##1% {texmfstart --verbose --ifchanged=##1.mp bin:mpost \ifcase\interactionmode\MPOSTbatchswitch\or\MPOSTnonstopswitch\fi \space\ifuseMETAFUNformat \MPOSTformatswitch metafun \fi ##1} \def\executeMPTEX##1% slower, due to nested texexec call {texmfstart --verbose --ifchanged=##1.mp texexec --batch \ifcase\interactionmode --logfile='mptex.log' \fi --output=\MPOSTdriver\space \ifuseMETAFUNformat --mpformat=metafun \fi --mptex --nomp --once ##1}} \def\MPgraphicfile{\jobname-#1} \newcount\currentMPgraphic \startMPgraphic #2 \stopMPgraphic\egroup\deallocateMPslot\currentMPgraphic} \def\usestaticMPfigure{\dosingleempty\dousestaticMPfigure} \def\dousestaticMPfigure[#1]% {\doifmodeelse{*pdf} {\externalfigure[\jobname-#1.pdf]} {\externalfigure[\jobname-#1.1]}} \starttext \startstaticMPfigure{circle} fill fullcircle scaled 10cm; \stopstaticMPfigure \startstaticMPfigure{axis} drawarrow (0,0)--(1cm,0) ; drawarrow (0,0)--(0,1cm) ; label.llft(textext((0,0)) ,origin) ; \stopstaticMPfigure \hbox to \hsize \bgroup \hss \usestaticMPfigure[circle][width=1cm] \hss \usestaticMPfigure[axis] \hss \egroup \stoptext Thanks, Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context
Aditya Mahajan wrote: I have right now kept the command as MPfigure. grep MPfigure in meta-fig -) Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context
Aditya Mahajan wrote: n lines deleted I added to texexec: texexec --mpgraphic somefile.mp which will run mp and make a pdf file. when more graphics are in the file, names become somefile-1.pdf etc one can always say: \useexternalfigure[whatever][somefile-123.pdf] to have more symbolic names Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context
On Mon, 12 Jun 2006, Aditya Mahajan wrote: 2. How to get textext to work? startMPrun not check for textext. Consider % \forceMPTEXgraphictrue % Does not make a difference! \starttext \startMPrun{testmp} beginfig(1) drawarrow (0,0)--(1cm,0) ; drawarrow (0,0)--(0,1cm) ; label.llft(textext((0,0)),origin) ; endfig; \stopMPrun \externalfigure[testmp.1] \stoptext which gives the dreaded unknown string, while \starttext \startMPgraphic beginfig(1) drawarrow (0,0)--(1cm,0) ; drawarrow (0,0)--(0,1cm) ; label.llft(textext((0,0)),origin) ; endfig; \stopMPgraphic \externalfigure[\jobname-mpgraph.1] \stoptext works. I can get my previous macro to work for textext using startMPgraphic. \def\startMPfigure#1#2\stopMPfigure {\bgroup \setMPrandomseedfalse %Otherwise randomseed := number line always differ \def\executeMPOST##1% {texmfstart --verbose --ifchanged=##1.mp bin:mpost \ifcase\interactionmode\MPOSTbatchswitch\or\MPOSTnonstopswitch\fi \space\ifuseMETAFUNformat \MPOSTformatswitch metafun \fi ##1} \def\executeMPTEX##1% slower, due to nested texexec call {texmfstart --verbose --ifchanged=##1.mp texexec --batch \ifcase\interactionmode --logfile='mptex.log' \fi --output=\MPOSTdriver\space \ifuseMETAFUNformat --mpformat=metafun \fi --mptex --nomp --once ##1} \def\MPgraphicfile{\jobname-#1} \newcount\currentMPgraphic \startMPgraphic #2 \stopMPgraphic\egroup\deallocateMPslot\currentMPgraphic} \def\useMPfigure{\dosingleempty\douseMPfigure} \def\douseMPfigure[#1]% {\externalfigure[\jobname-#1.1]} \starttext \startMPfigure{circle} fill fullcircle scaled 10cm; \stopMPfigure \startMPfigure{axis} drawarrow (0,0)--(1cm,0) ; drawarrow (0,0)--(0,1cm) ; label.llft(textext((0,0)) ,origin) ; \stopMPfigure \hbox to \hsize \bgroup \hss \useMPfigure[circle][width=1cm] \hss \useMPfigure[axis] \hss \egroup \stoptext Right now I have a big speed improvement as metapost is not executed each time. I only need to convert the mps files to pdf to save a bit on pdf conversion. Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
[NTG-context] Using metapost figures in context
Hi, Does there exist a startstop command (say startMPfigure) for managing figures drawn using MP such that 1. I can use \startMPfigure{label} .. \stopMPfigure and then use \useexternalMPfigure{label} to include the figure. 2. The figures are converted into pdf once. If the code inside \startstop MPfigures changes, the pdf for each figure is recreated. Basically, I want MPfigures to be converted into pdf for faster inclusion in the main document, the figure should be recompiled if necessary and I should be able to include the figure using a label (so that I can separate the figures from the main document). uniqueMPgraphic provides the first functionality, but the figure is converted into pdf on runtime (thereby increasing the processing time of the document). I can use a separate document with each figure inside a \startMPpage ... \stopMPpage, but (i) I need to remember figure numbers manually, (ii) after making change in one figure, the whole file needs to be recompiled. Another possibility is to use one tex file for each figure, compile them separately and then then use figure library to get a label for each figure. But this becomes difficult to manage, as soon as I get large number of files. Is their something basic that I am missing here? How do others manage mpfigures? To Hans: is it possible to have a \startMPfigure command such that 1. \startMPfigure[label] figure code \stopMPfigure creates a \jobname-figure-\nofMPfigurefile file with current MP environment current MP inclusion figure code (from inside \startstop MPfigure) Convert this into \jobname-figure-\nofMPfigurefile.pdf only if something changes (similar to what is done in m-r module). 2. The resultant pdf can be included using \useMPfigure{label}. Would such a feature make sense? Aditya ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context
Re: [NTG-context] Using metapost figures in context
Aditya Mahajan wrote: Hi, Does there exist a startstop command (say startMPfigure) for managing figures drawn using MP such that 1. I can use \startMPfigure{label} .. \stopMPfigure and then use \useexternalMPfigure{label} to include the figure. grep for \startMPrun .. \stopMPrun 2. The figures are converted into pdf once. If the code inside \startstop MPfigures changes, the pdf for each figure is recreated. Basically, I want MPfigures to be converted into pdf for faster inclusion in the main document, the figure should be recompiled if necessary and I should be able to include the figure using a label (so that I can separate the figures from the main document). you can use the figure database mechanism (davids arnold does that) or make individual files, say 'thatfile.tex' \starttext \startMPpage fill fullcircle scaled 10cm; \stopMPpage \stoptext and then in test.tex say: \def\MyMpgraphic[#1]% {\executesystemcommand{texmfstart --ifchanged=#1.tex texexec #1.tex} \externalfigure[#1.pdf]} \starttext \MyMpgraphic[thatfile] \MyMpgraphic[thatfile][width=3cm] \stoptext (you need a version of texmfstart that provided the -ifchanged) uniqueMPgraphic provides the first functionality, but the figure is converted into pdf on runtime (thereby increasing the processing time of the document). expect this to be sped up later this year (neglectable) I can use a separate document with each figure inside a \startMPpage ... \stopMPpage, but (i) I need to remember figure numbers manually, (ii) after making change in one figure, the whole file needs to be recompiled. so who not filenames like whateverprefix-somelabel Another possibility is to use one tex file for each figure, compile them separately and then then use figure library to get a label for each figure. But this becomes difficult to manage, as soon as I get large number of files. Is their something basic that I am missing here? How do others manage mpfigures? To Hans: is it possible to have a \startMPfigure command such that 1. \startMPfigure[label] figure code \stopMPfigure creates a \jobname-figure-\nofMPfigurefile file with current MP environment current MP inclusion figure code (from inside \startstop MPfigure) Convert this into \jobname-figure-\nofMPfigurefile.pdf only if something changes (similar to what is done in m-r module). see prev example for a starter 2. The resultant pdf can be included using \useMPfigure{label}. Would such a feature make sense? would be a different command remind me later this week Hans -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ ntg-context mailing list ntg-context@ntg.nl http://www.ntg.nl/mailman/listinfo/ntg-context