mailing-list for TeXmacs Users

Text archives Help


Finding style file in same directory as document


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Finding style file in same directory as document
  • Date: Wed, 26 Dec 2001 00:29:28 +0100

When you design a new TeXmacs stylesheet, and you distribute a document which
uses this stylesheet, you want TeXmacs to find it without requiring your
"users" to put your stylesheet in their personal ~/.TeXmacs/styles directory.
Most of the time, the custom stylesheet will be located in the same directory
as the document using it.

Currently, TeXmacs will look for stylesheets in the directories specified by
the TEXMACS_STYLE_PATH environment variable, which defaults to
".:$HOME/.TeXmacs/styles:$TEXMACS_PATH/styles". But here, "." refers to the
directory where TeXmacs was started.

In most modern desktop setups, "." will always be $HOME since TeXmacs will be
started from a laucher bar or an application menu. So TeXmacs will NOT find
the custom stylesheet.

Attached is a somewhat kludgy patch to make stylesheets located in the
directory of the document take precedence over any stylesheet found by
searching TEXMACS_STYLE_PATH. This solution was inspired by the way linked
images are found while typesetting the <postscript> element.

I think there would be two more elegant ways to do it:

-- Change the working directory to the directory where the current document
is located. For consistency, this should be done every time a TeXmacs window
gets the focus and every time the buffer associated with the currently
focused window is changed. Unamed documents could be associated with the
directory where TeXmacs was started. This behavior is inspired by Emacs.

-- Define an new environment variable that holds name of the directory
where the current document is located, one could name it
TEXMACS_DOCUMENT_PATH. The value of this variable should be updated in the
same way as the working directory in the previous solution. This would allow
the best control from the TEXMACS_*_PATH environment variables.

Since implementing one of these two solutions would require some discussion,
I have sticked to the simplest solution I could find.

If anyone here have some opinion on this question, please tell me.

If anyone is getting really pissed off of me flooding his/her mailbox, please
tell me, too ;-)


*** TeXmacs-0.3.5.11-src/src/Edit/Editor/edit_typeset.gen.cc
--- TeXmacs-0.3.5.11-src/src/Edit/Editor/edit_typeset.gen.cc
***************
*** 64,70 ****
    int i, n= N (style);
    for (i=0; i<n; i++) {
      tree   doc;
!     string styp= "$TEXMACS_STYLE_PATH";
      string name= as_string (style[i]) * ".ts";
      if ((!load_tree (styp, name, doc, FALSE)) && is_compound (doc)) {
        typeset_style (extract (doc, "style"));
--- 64,71 ----
    int i, n= N (style);
    for (i=0; i<n; i++) {
      tree   doc;
!     string styp=
! 	get_radical_file_name(env->base_file_name) * ":$TEXMACS_STYLE_PATH";
      string name= as_string (style[i]) * ".ts";
      if ((!load_tree (styp, name, doc, FALSE)) && is_compound (doc)) {
        typeset_style (extract (doc, "style"));



Archive powered by MHonArc 2.6.19.

Top of page