* Using metapost figures in context
@ 2006-06-12 18:48 Aditya Mahajan
2006-06-12 21:43 ` Hans Hagen
0 siblings, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-12 18:48 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-12 18:48 Using metapost figures in context Aditya Mahajan
@ 2006-06-12 21:43 ` Hans Hagen
2006-06-12 23:29 ` Aditya Mahajan
0 siblings, 1 reply; 16+ messages in thread
From: Hans Hagen @ 2006-06-12 21:43 UTC (permalink / raw)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-12 21:43 ` Hans Hagen
@ 2006-06-12 23:29 ` Aditya Mahajan
2006-06-13 0:16 ` Aditya Mahajan
` (2 more replies)
0 siblings, 3 replies; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-12 23:29 UTC (permalink / raw)
On Mon, 12 Jun 2006, Hans Hagen wrote:
> 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
Thanks! This was almost what I needed.
>> 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)
I have a simple version using this idea that is working. See at the
end.
>> 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
Did not think of that. Was too busy trying to figure out how to do
number to label mapping :)
>> 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
I have right now kept the command as MPfigure.
The following works, but I can not figure out
1. How to force texexec to give pdf output from an mp file. Do I need
to start another mptopdf process?
2. How to get textext to work?
3. I needed to set randomseed to false. Does this have any drawbacks?
supp-mps.tex says that this feature is optional. Does metapost have a
good random seed initializer now?
\def\startMPfigure#1#2\stopMPfigure
{\bgroup
\setMPrandomseedfalse
%Otherwise randomseed := number line always differ
% \forceMPTEXgraphictrue %Does not work
\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}
\startMPrun{\jobname-#1}
beginfig(1)
#2
endfig;
\stopMPrun\egroup}
\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(btex (0,0) etex,origin) ;
\stopMPfigure
\hbox to \hsize \bgroup
\hss \useMPfigure[circle][width=1cm] \hss \useMPfigure[axis] \hss
\egroup
\stoptext
Aditya
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-12 23:29 ` Aditya Mahajan
@ 2006-06-13 0:16 ` Aditya Mahajan
2006-06-13 8:12 ` Hans Hagen
2006-06-13 9:38 ` Hans Hagen
2 siblings, 0 replies; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-13 0:16 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-12 23:29 ` Aditya Mahajan
2006-06-13 0:16 ` Aditya Mahajan
@ 2006-06-13 8:12 ` Hans Hagen
2006-06-14 15:00 ` Aditya Mahajan
2006-06-13 9:38 ` Hans Hagen
2 siblings, 1 reply; 16+ messages in thread
From: Hans Hagen @ 2006-06-13 8:12 UTC (permalink / raw)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-12 23:29 ` Aditya Mahajan
2006-06-13 0:16 ` Aditya Mahajan
2006-06-13 8:12 ` Hans Hagen
@ 2006-06-13 9:38 ` Hans Hagen
[not found] ` <Pine.WNT.4.63.0606131213490.892@nqvgln>
2 siblings, 1 reply; 16+ messages in thread
From: Hans Hagen @ 2006-06-13 9:38 UTC (permalink / raw)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
[not found] ` <Pine.WNT.4.63.0606131213490.892@nqvgln>
@ 2006-06-13 20:16 ` Hans Hagen
2006-06-13 20:33 ` Aditya Mahajan
0 siblings, 1 reply; 16+ messages in thread
From: Hans Hagen @ 2006-06-13 20:16 UTC (permalink / raw)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-13 20:16 ` Using metapost figures in context (offlist) Hans Hagen
@ 2006-06-13 20:33 ` Aditya Mahajan
2006-06-13 21:16 ` Hans Hagen
0 siblings, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-13 20:33 UTC (permalink / raw)
Cc: c
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-13 20:33 ` Aditya Mahajan
@ 2006-06-13 21:16 ` Hans Hagen
2006-06-14 1:52 ` Aditya Mahajan
0 siblings, 1 reply; 16+ messages in thread
From: Hans Hagen @ 2006-06-13 21:16 UTC (permalink / raw)
Cc: c
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-13 21:16 ` Hans Hagen
@ 2006-06-14 1:52 ` Aditya Mahajan
2006-06-14 2:03 ` Aditya Mahajan
0 siblings, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-14 1:52 UTC (permalink / raw)
Cc: c
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-14 1:52 ` Aditya Mahajan
@ 2006-06-14 2:03 ` Aditya Mahajan
2006-06-14 7:35 ` Hans Hagen
0 siblings, 1 reply; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-14 2:03 UTC (permalink / raw)
Cc: c
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-14 2:03 ` Aditya Mahajan
@ 2006-06-14 7:35 ` Hans Hagen
2006-06-14 14:41 ` Aditya Mahajan
2006-06-16 9:47 ` Uwe Koloska
0 siblings, 2 replies; 16+ messages in thread
From: Hans Hagen @ 2006-06-14 7:35 UTC (permalink / raw)
Cc: c
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-14 7:35 ` Hans Hagen
@ 2006-06-14 14:41 ` Aditya Mahajan
2006-06-16 9:47 ` Uwe Koloska
1 sibling, 0 replies; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-14 14:41 UTC (permalink / raw)
Cc: c
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context
2006-06-13 8:12 ` Hans Hagen
@ 2006-06-14 15:00 ` Aditya Mahajan
0 siblings, 0 replies; 16+ messages in thread
From: Aditya Mahajan @ 2006-06-14 15:00 UTC (permalink / raw)
Cc: mailing list for ConTeXt users
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-14 7:35 ` Hans Hagen
2006-06-14 14:41 ` Aditya Mahajan
@ 2006-06-16 9:47 ` Uwe Koloska
2006-06-16 10:10 ` Hans Hagen
1 sibling, 1 reply; 16+ messages in thread
From: Uwe Koloska @ 2006-06-16 9:47 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: Using metapost figures in context (offlist)
2006-06-16 9:47 ` Uwe Koloska
@ 2006-06-16 10:10 ` Hans Hagen
0 siblings, 0 replies; 16+ messages in thread
From: Hans Hagen @ 2006-06-16 10:10 UTC (permalink / raw)
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 filesssss -)
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
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-06-16 10:10 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-12 18:48 Using metapost figures in context Aditya Mahajan
2006-06-12 21:43 ` Hans Hagen
2006-06-12 23:29 ` Aditya Mahajan
2006-06-13 0:16 ` Aditya Mahajan
2006-06-13 8:12 ` Hans Hagen
2006-06-14 15:00 ` Aditya Mahajan
2006-06-13 9:38 ` Hans Hagen
[not found] ` <Pine.WNT.4.63.0606131213490.892@nqvgln>
2006-06-13 20:16 ` Using metapost figures in context (offlist) Hans Hagen
2006-06-13 20:33 ` Aditya Mahajan
2006-06-13 21:16 ` Hans Hagen
2006-06-14 1:52 ` Aditya Mahajan
2006-06-14 2:03 ` Aditya Mahajan
2006-06-14 7:35 ` Hans Hagen
2006-06-14 14:41 ` Aditya Mahajan
2006-06-16 9:47 ` Uwe Koloska
2006-06-16 10:10 ` Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).