Discussion:
[pdftex] Access value of output-directory
Johannes Burtscher
2016-12-07 20:59:28 UTC
Permalink
Hi,

am I right that there is no way to access the value of the
'-output-directory' command line option from within pdfTeX?
If true, I think it would be very convenient for package authors
if you could provide a new primitive to do so.

I understand that one can access the argument vector from within
LuaTeX, but I think a lot of authors would rather not make their
packages LuaTeX-only (at least for now).

Regards,
Johannes
Karl Berry
2016-12-07 22:39:28 UTC
Permalink
am I right that there is no way to access the value of the
'-output-directory' command line option from within pdfTeX?

As far as I can recall (and discern from a quick glance at the sources),
that is correct. I'm sure someone will correct me if I'm wrong.

If true, I think it would be very convenient for package authors
if you could provide a new primitive to do so.

It could be done. But what do you want to do with the value?

I understand that one can access the argument vector from within
LuaTeX, but I think a lot of authors would rather not make their
packages LuaTeX-only (at least for now).

Fully agreed. Although it's clear that "a lot of authors" don't need
the output-directory value, since it has never been available at the TeX
level -- yours is the first request I remember ever seeing, anywhere.

best,
karl
Johannes Burtscher
2016-12-08 11:28:09 UTC
Permalink
It could be done. But what do you want to do with the value?

I only recently wrote a small package for a co-worker and had to
rely on an external tool and shell-escape. In such a case it would
be very convenient to know whether the user wants all newly created
files in another directory or not. (To be honest, this is the only
use case where I can imagine beeing in need of this value).
I also found it rather awkward that I can read files from the
output-directory whereas \pdffilemoddate, for example, has no idea
where to find them.

... Although it's clear that "a lot of authors" don't need the
output-directory value, since it has never been available at the TeX
level -- yours is the first request I remember ever seeing, anywhere.

"A lot of authors" was certainly exaggerated but every now and then
such a question pops up:

- http://tex.stackexchange.com/q/136012/10350
- http://tex.stackexchange.com/q/294931/10350

In fact, the first question mentions a request posted right here on
this mailing list.


Regards,
Johannes
Karl Berry
2016-12-10 23:58:04 UTC
Permalink
rely on an external tool and shell-escape.
...
- http://tex.stackexchange.com/q/136012/10350
- http://tex.stackexchange.com/q/294931/10350

Indeed, all of these examples use \write18.

My intuitive reaction is that once \write18 is involved, you have full
access to the entire system, and shouldn't (don't) need the engine's
help to get access to the value. Enrico showed one way.

I can agree it would be nice, in a way, but to me, the benefit of a
minor cleanliness doesn't justify a new primitive at this late date.

In another way, I also wouldn't want to do anything to encourage use of
\write18.

But, it's not up to me alone. Thanh (and anyone else), what do you
think?

best,
karl
Johannes Burtscher
2016-12-12 09:08:57 UTC
Permalink
Final comment Karl; I promise! :)

Enrico showed one way.

He kind of did. But I think the whole point of a new primitive would be to
release the user of the duty to specify the output directory *twice* (please
correct me if you're not referring to https://goo.gl/gs3r5g). My experience is
that as soon as you have to change something at two places, you sooner or later
forget about one.

In another way, I also wouldn't want to do anything to encourage use of
\write18.

I am not fully convinced that it would encourage the use of \write18. For sure,
it would be convenient for a few *package authors*, but I don't think that it
would get a "normal" user to turn on \write18 any sooner.

... the benefit of a minor cleanliness doesn't justify a new primitive
at this late date.

Fully understandable.

Thanks!
Johannes

Loading...