Discussion:
[tex-k] cascading config files for dvips(k) and dvipdfmx
Norbert Preining
2012-03-29 01:39:57 UTC
Permalink
Dear all,

first a short background: Distributions (like Debian) often want
to change very few things in the config files of some programs,
in our case the paper settings, but not copy the whole config
file into a place where the user can change arbitrary things,
not to break things too easily.

Compare that with the approach we (TeX Live uptream) have taken with
the texmf.cnf file: There is one in ROOT/texmf/web2c/texmf.cnf which
might get updated by us, and if there is one in ROOT/texmf.cnf it
overrides the settings in the former. THe TL installer uses that
to adapt some paths if necessary.

Now we want to do the same for all the paper setting stuff in TeX Live,
that is for
dvips: config.ps
dvipdfmx: dvipdfmx.cfg
xdvi: XDvi
pdftex: pdftexconfig.tex
context: mtx-sys.rme (or what it was, don't know it by heart now)
For some of these programs it is easy to follow this appraoch:
pdftex and context use just plain TeX files, so we can patch the main
files with a simple line
\input pdtexconfig-debian.tex
etc to get the same system working.

For XDvi we can use the #include directive that is supported.

Only for dvips and dvipdfmx there is nothing like this, so one cannot
specify an *additional* config file to be read in the main config
file. So I sat down on the flight from Frankfurt to Tokyo and patched
dvips and dvipdfmx to include support for these additional directives.
In dvips it would be
c<filename>
and in dvipdfmx it would be
i <filename>

The implementation is quite simple by re-calling the config file
reading routing.

Now my questions:
* Is there a specific reason why this functionality has not been added by now?
* Is there any chance to get this functionality into dvips and dvipdmfx?
* Can someone take a look at the attached patches and comment on them?

Thanks a lot and all the best

Norbert

Herzliche Gr??e
Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan TeX Live & Debian Developer
DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
SCRAMOGE (vb.)
To cut oneself whilst licking envelopes.
--- Douglas Adams, The Meaning of Liff
-------------- next part --------------
Add a config.ps directive to dvips
cfile
which treats <file> as another config files that is loaded right there,
this allows inclusion of config file.

(C) 2012 Norbert Preining
Licensed under GPLv2 or any higher at will

---
texk/dvipsk/resident.c | 6 ++++++
1 file changed, 6 insertions(+)

Index: texlive-bin-2011.20120328/texk/dvipsk/resident.c
===================================================================
--- texlive-bin-2011.20120328.orig/texk/dvipsk/resident.c 2011-07-20 16:00:05.000000000 +0900
+++ texlive-bin-2011.20120328/texk/dvipsk/resident.c 2012-03-28 23:58:57.537980183 +0900
@@ -765,6 +765,12 @@
paperfmt = newstring(PSname);
}
break;
+case 'c' :
+ if (sscanf(was_inline+1, "%s", PSname) != 1)
+ bad_config("missing arg to c");
+ else
+ return(getdefaults(PSname));
+ break;
default:
bad_config("strange line");
}
-------------- next part --------------
Add a dvipdfmx.cfg directive to dvipdfmx
i file
which treats <file> as another config files that is loaded right there,
this allows inclusion of config file.

(C) 2012 Norbert Preining
Licensed under GPLv2 or any higher at will

---
texk/dvipdfmx/dvipdfmx-20110311/src/dvipdfmx.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: texlive-bin-2011.20120328/texk/dvipdfmx/dvipdfmx-20110311/src/dvipdfmx.c
===================================================================
--- texlive-bin-2011.20120328.orig/texk/dvipdfmx/dvipdfmx-20110311/src/dvipdfmx.c 2011-03-09 20:02:16.000000000 +0900
+++ texlive-bin-2011.20120328/texk/dvipdfmx/dvipdfmx-20110311/src/dvipdfmx.c 2012-03-29 00:32:17.769014283 +0900
@@ -102,6 +102,9 @@
char *dvi_filename = NULL, *pdf_filename = NULL;

static void
+read_config_file (const char *config);
+
+static void
set_default_pdf_filename(void)
{
const char *dvi_base;
@@ -562,6 +565,11 @@
case 'E':
compat_mode = 1;
break;
+ case 'i':
+ CHECK_ARG(1, "subsidiary config file");
+ read_config_file(argv[1]);
+ POP_ARG();
+ break;
case 'e':
if (compat_mode) {
WARN("dvipdfm \"-e\" option not supported.");
Peter Breitenlohner
2012-03-29 08:28:56 UTC
Permalink
Post by Norbert Preining
Only for dvips and dvipdfmx there is nothing like this, so one cannot
specify an *additional* config file to be read in the main config
file. So I sat down on the flight from Frankfurt to Tokyo and patched
dvips and dvipdfmx to include support for these additional directives.
In dvips it would be
c<filename>
and in dvipdfmx it would be
i <filename>
The implementation is quite simple by re-calling the config file
reading routing.
Hi Norbert,

two comments (I assume you have tried the patches and they compile without
problems):

(1) dvipsk: why abandon the current config file containing 'c<filename>'?
I would replace 'return(getdefaults(PSname))' by 'getdefaults(PSname)'.

(2) dvipdfmx: the config file 'dvipdfmx.cfg' is used by both dvipdfmx and
xdvipdfmx, thus both should be modified in the same way.

Regards
Peter Breitenlohner <peb at mppmu.mpg.de>
Norbert Preining
2012-03-29 13:23:37 UTC
Permalink
Hi Peter,
Post by Peter Breitenlohner
two comments (I assume you have tried the patches and they compile without
And also worked ;-)
Post by Peter Breitenlohner
(1) dvipsk: why abandon the current config file containing
'c<filename>'? I would replace 'return(getdefaults(PSname))' by
'getdefaults(PSname)'.
Right, completely right ... my error.
Post by Peter Breitenlohner
(2) dvipdfmx: the config file 'dvipdfmx.cfg' is used by both dvipdfmx and
xdvipdfmx, thus both should be modified in the same way.
Ok, will send tomorrow new patches for all three of them.

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan TeX Live & Debian Developer
DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
AHENNY (adj.)
The way people stand when examining other people's bookshelves.
--- Douglas Adams, The Meaning of Liff
Peter Breitenlohner
2012-03-29 13:40:48 UTC
Permalink
Post by Norbert Preining
Post by Peter Breitenlohner
(1) dvipsk: why abandon the current config file containing
'c<filename>'? I would replace 'return(getdefaults(PSname))' by
'getdefaults(PSname)'.
Right, completely right ... my error.
Post by Peter Breitenlohner
(2) dvipdfmx: the config file 'dvipdfmx.cfg' is used by both dvipdfmx and
xdvipdfmx, thus both should be modified in the same way.
Ok, will send tomorrow new patches for all three of them.
Hi Norbert,

very good. Please also remember to update the documentation. For dvipsk
that would be
Build/source/texk/dvipsk/contrib/config.proto => dvips.info
Master/texmf/dvips/config/config.ps (Add '%c<filename>' or such)
for (x)dvipdfmx i don't know.

Regards
Peter
Norbert Preining
2012-03-29 23:45:55 UTC
Permalink
Hi Peter, hi Karl, hi all,
Post by Peter Breitenlohner
Post by Norbert Preining
Ok, will send tomorrow new patches for all three of them.
Here they are,
Post by Peter Breitenlohner
very good. Please also remember to update the documentation. For dvipsk
Done that, see the diffstat at the head of the individual patches.

Further remarks appreciated. Esp from Karl about inclusion ;-)

Best wishes

Norbert
------------------------------------------------------------------------
Norbert Preining preining@{jaist.ac.jp, logic.at, debian.org}
JAIST, Japan TeX Live & Debian Developer
DSA: 0x09C5B094 fp: 14DF 2E6C 0307 BE6D AD76 A9C0 D2BF 4AA3 09C5 B094
------------------------------------------------------------------------
MATCHING GREEN (adj.)
(Of neckties.) Any colour which Nigel Rees rejects as unsuitable for
his trousers or jacket.
--- Douglas Adams, The Meaning of Liff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvips-c-support.patch
Type: text/x-diff
Size: 2346 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-k/attachments/20120330/c326bf3d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dvipdfmx-i-support.patch
Type: text/x-diff
Size: 3693 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-k/attachments/20120330/c326bf3d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xdvipdfmx-i-support.patch
Type: text/x-diff
Size: 1874 bytes
Desc: not available
URL: <http://tug.org/pipermail/tex-k/attachments/20120330/c326bf3d/attachment-0002.bin>
Karl Berry
2012-03-31 00:09:35 UTC
Permalink
Done that, see the diffstat at the head of the individual patches.

I installed it for dvips, with doc tweaks.

I await ChoF/et al. reply before doing *dvipdfmx.

Thanks,
karl

Loading...