|
From: <mw...@gm...> - 2007-11-19 14:13:23
|
Hi, when using set terminal epslatex set output "foo.tex" cd ".." plot sin(x) there is a file foo.tex in the subdir and a file foo.eps in the top dir. On the contrast, when using absolut paths: set terminal epslatex set output "~/subdir/foo.tex" cd ".." plot sin(x) both files are inside the subdir. For me as a user, the first behavior is very irritating. I would call it a bug. I think that foo.tex and foo.eps should be in the same directory. cd should not have an effect on an already specified output file. Thank you, Micha -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer |
|
From: Thomas S. <t.s...@fz...> - 2007-11-19 16:09:59
|
i wouldn't call it a bug, it's a feature...
it's documented ('help set terminal pslatex': the section about 'auxfile')
what happens is:
'set output "foo.tex"' opens the file 'foo.tex' in the current directory
and creates a filehandle which is used for writing into it.
you change the directory ('cd ..')
'plot' produces the output file, which is 'subdir/foo.tex', because
the filehandle was already existing before you changed the directory.
'foo.tex' (which in reality is 'subdir/foo.tex') is then closed and the
output file for writing the eps code is opened using
'EPSLATEX_reopen_output()'
in 'pslatex.trm' simply by cutting off the extension from 'foo.tex',
so the output file is now 'foo.eps'.
and it is opened in the actual directory because gnuplot doesn't
care for directories (why should it?) as long as you don't specify
one (like in your 2nd example).
so, 'cd' doesn't have an effect on an already specified output file,
but it does have an effect an the auxiliary output file which is
produced after the main output file is written.
you shouldn't change directories between 'set output' and 'plot'
commands.
mw-u2 wrote:
>=20
> Hi,
>=20
> when using=20
> set terminal epslatex
> set output "foo.tex"
> cd ".."
> plot sin(x)
>=20
> there is a file foo.tex in the subdir and a file foo.eps in the top dir.
>=20
> On the contrast, when using absolut paths:
> set terminal epslatex
> set output "~/subdir/foo.tex"
> cd ".."
> plot sin(x)
>=20
> both files are inside the subdir.
>=20
> For me as a user, the first behavior is very irritating. I would call it =
a
> bug. I think that foo.tex and foo.eps should be in the same directory.
> cd should not have an effect on an already specified output file.
>=20
> Thank you,
> Micha
> --=20
> Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!=20
> Ideal f=C3=BCr Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>=20
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Gnuplot-info mailing list
> Gnu...@li...
> https://lists.sourceforge.net/lists/listinfo/gnuplot-info
>=20
>=20
--=20
View this message in context: http://www.nabble.com/epslatex-outputs-into-d=
ifferent-directories-sometimes-tf4836648.html#a13839359
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: <mw...@gm...> - 2007-11-22 11:56:34
|
Thomas Sefzick <t.s...@fz...> wrote:
> i wouldn't call it a bug, it's a feature...
This comment realy made me smile :-)
> it's documented ('help set terminal pslatex': the section about 'auxfile')
>
> what happens is:
> 'set output "foo.tex"' opens the file 'foo.tex' in the current directory
> and creates a filehandle which is used for writing into it.
>
> you change the directory ('cd ..')
>
> 'plot' produces the output file, which is 'subdir/foo.tex', because
> the filehandle was already existing before you changed the directory.
>
> 'foo.tex' (which in reality is 'subdir/foo.tex') is then closed and the
> output file for writing the eps code is opened using
> 'EPSLATEX_reopen_output()'
> in 'pslatex.trm' simply by cutting off the extension from 'foo.tex',
> so the output file is now 'foo.eps'.
> and it is opened in the actual directory because gnuplot doesn't
> care for directories (why should it?) as long as you don't specify
> one (like in your 2nd example).
>
> so, 'cd' doesn't have an effect on an already specified output file,
> but it does have an effect an the auxiliary output file which is
> produced after the main output file is written.
>
> you shouldn't change directories between 'set output' and 'plot'
> commands.
Thank you for your explanations. From a technical point of view now I can understand what's going on.
My point is that this should be changed for usability reasons. In my opinion a user changing output via ``set output "foo.tex"'' expects foo.tex and foo.eps to be in the same directory. Do you disagree?
Of course I have no idea how difficult it is to change that and how many things it breaks.
Yours, Micha
> mw-u2 wrote:
> >
> > Hi,
> >
> > when using
> > set terminal epslatex
> > set output "foo.tex"
> > cd ".."
> > plot sin(x)
> >
> > there is a file foo.tex in the subdir and a file foo.eps in the top dir.
> >
> > On the contrast, when using absolut paths:
> > set terminal epslatex
> > set output "~/subdir/foo.tex"
> > cd ".."
> > plot sin(x)
> >
> > both files are inside the subdir.
> >
> > For me as a user, the first behavior is very irritating. I would call it
> a
> > bug. I think that foo.tex and foo.eps should be in the same directory.
> > cd should not have an effect on an already specified output file.
> >
> > Thank you,
> > Micha
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
|
|
From: Thomas S. <t.s...@fz...> - 2007-11-23 08:33:13
|
mw-u2 wrote: > > ... > > My point is that this should be changed for usability reasons. In my > opinion a user changing output via ``set output "foo.tex"'' expects > foo.tex and foo.eps to be in the same directory. Do you disagree? > no i was thinking about how it could be done: a) open the 2nd file for specific terminals when the 1st one is opened (with 'set output ...') but what if the user specifies the terminal after 'set output'? then the problem is the same as before. b) use getcwd, get_current_dir_name, or getwd to determine the full path in 'EPSLATEX_reopen_output()' in 'pslatex.trm', this would be the best solution. but are these functions existing on all platforms? i don't think so (but i'm not sure). who knows? -- View this message in context: http://www.nabble.com/epslatex-outputs-into-different-directories-sometimes-tf4836648.html#a13908521 Sent from the Gnuplot - User mailing list archive at Nabble.com. |
|
From: Thomas S. <t.s...@fz...> - 2007-11-23 14:46:15
|
the easiest way to solve the problem:
replace the output filename ('dest') in routine 'term_set_output' in
'term.c' with the fully expanded filename just before opening the file.
there would be two functions for this:
realpath() and canonicalize_file_name()
but
realpath() - it's manpage says one should avoid this function
canonicalize_file_name() - is only existing on systems with glibc
and - both are unable to do tilde-expansion.
this wouldn't be a problem, if they would return NULL in this case, but
realpath() produces a segmentation fault on some systems (e.g. SuSE 10.3).
i think, a remark in the manual that 'cd' shouldn't be used after 'set
output ...' and before 'plot ...' is the best one could do in the moment.
--
View this message in context: http://www.nabble.com/epslatex-outputs-into-different-directories-sometimes-tf4836648.html#a13913440
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|
|
From: <mw...@gm...> - 2008-01-01 11:13:45
|
Hi, Sorry for the delay. The problem was: With epslatex terminal (and possibly other terms too) using 'cd' between 'set output ...' and 'plot ..' is broken. (see <http://sourceforge.net/mailarchive/forum.php?thread_name=20071119141314.119800%40gmx.net&forum_name=gnuplot-info>) The reason is that 'set output ...' opens the outputfile whereas the plot command opens the secondary outputfile via 'EPSLATEX_reopen_output()'. > Thomas Sefzick <t.s...@fz...> wrote: > mw-u2 wrote: > > > > My point is that this should be changed for usability reasons. In my > > opinion a user changing output via ``set output "foo.tex"'' expects > > foo.tex and foo.eps to be in the same directory. > > i was thinking about how it could be done: > > a) open the 2nd file for specific terminals when the 1st one is opened > (with 'set output ...') > but what if the user specifies the terminal after 'set output'? then the > problem is the same as before. > > b) use getcwd, get_current_dir_name, or getwd to determine the full path > in > 'EPSLATEX_reopen_output()' > in 'pslatex.trm', this would be the best solution. > but are these functions existing on all platforms? > i don't think so (but i'm not sure). > who knows? In my opinion the best would be to open the 1st output file during the 'plot' command, but I don't know about gnuplot internals and can imagine that this is impossible. What about saving the current working directory in the call of term_set_output and (temporarily) reset the path in EPSLATEX_reopen_output while the 2nd file is created. -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser |
|
From: <HBB...@t-...> - 2007-11-19 23:00:58
|
mw...@gm... wrote: > For me as a user, the first behavior is very irritating. I would call it a bug. I think that foo.tex and foo.eps should be in the same directory. > cd should not have an effect on an already specified output file. The problem is that "set output" really only _specifies_ the output file. It doesn't open it. And since it's a relative path, the meaning of that specification changes on-the-fly if you change directories. There's not terribly much that could be done about that. |
|
From: Thomas S. <t.s...@fz...> - 2007-11-20 08:33:14
|
Hans-Bernhard Br=C3=B6ker-2 wrote: >=20 > mw...@gm... wrote: >> For me as a user, the first behavior is very irritating. I would call it >> a bug. I think that foo.tex and foo.eps should be in the same directory. >> cd should not have an effect on an already specified output file. >=20 > The problem is that "set output" really only _specifies_ the output=20 > file. It doesn't open it. And since it's a relative path, the meaning= =20 > of that specification changes on-the-fly if you change directories. >=20 sorry, no 'set output' opens the output file: gnuplot> !ls ts.ps ls: cannot access ts.ps: No such file or directory ! gnuplot> set output 'ts.ps' gnuplot> !ls ts.ps ts.ps ! if 'set output' would only specifiy, then micha's problem wouldn't arise. --=20 View this message in context: http://www.nabble.com/epslatex-outputs-into-d= ifferent-directories-sometimes-tf4836648.html#a13852778 Sent from the Gnuplot - User mailing list archive at Nabble.com. |