[tex-k] cascading config files for dvips(k) and dvipdfmx

Norbert Preining preining at logic.at
Thu Mar 29 03:39:57 CEST 2012


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.");


More information about the tex-k mailing list