[comp.text.tex] system identification

mdeck@sybil.cs.Buffalo.EDU (Mary Deck) (10/12/90)

Here's a question for anyone who wants to answer it (and can): Is
there a way in (La)TeX to identify the type of system one is on?  For
instance, I have several files which I'll be using in both a VAX/VMS
environment and a Sun/Unix environment.  I have a macro file, same
thing on both systems but different filename, which I want to include
in these documents.  I want to put a line in the file to include my
macros which will pick the proper file name for the current system.
Is there a way to do this?  (I know I'm being really lazy for not
wanting to edit the files when I port them from one place to the
other, but I'm always looking for an easy way out of things....)

Thanks....

					....Mary
---
Mary M. Deck,  Student Assistant,  User Services
University Computing Services, State University of New York at Buffalo
mdeck@cs.buffalo.edu [Unix]
acsgmmd@ubvms.cc.buffalo.edu [VAX/VMS]

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (10/12/90)

mdeck@sybil.cs.Buffalo.EDU (Mary Deck) writes:

>Here's a question for anyone who wants to answer it (and can): Is
>there a way in (La)TeX to identify the type of system one is on?  For

Interesting question.

Direct answer: no. TeX doesn't have many bindings to the
operating system it lives on.

Indirect answer: sure. You can for instance make the plain.fmt
or lplain.fmt (whatever you use, plain TeX or LaTeX) again,
but add statements
\everyjob{\def\system{VAX}}
and
\everyjob{\def\system{Sun}}
at the end. The \everyjob commands are automatically
executed at the start of a job, so the macro \system
will always be defined, and you can simply check what it
is defined like.

This may mean that you'll have to persuade systems people
to redump the formats, but I think this is the simplest solution.

Victor.

mdeck@acsu.buffalo.edu (Mary Deck) (10/12/90)

In article <1990Oct12.002015.14152@csrd.uiuc.edu> eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) writes:
>...
>Indirect answer: sure. You can for instance make the plain.fmt
>or lplain.fmt (whatever you use, plain TeX or LaTeX) again,
>...
>This may mean that you'll have to persuade systems people
>to redump the formats, but I think this is the simplest solution.

I'm just a lowly student who upkeeps the TeX distribution on one
system.  I don't have enough pull to get the university-wide formats
changed, and I don't have enough space to keep my own copies of
formats.  But thanks to all who suggested this. :)

Maybe I'll search for a particular Unix file, and if TeX can't find
that file, I'll have it look for the corresponding VAX file.  There
must be some way to do this without changing the format.....

						.....Mary

---
Mary M. Deck,  Student Assistant,  User Services
University Computing Services, State University of New York at Buffalo
mdeck@cs.buffalo.edu [Unix]
acsgmmd@ubvms.cc.buffalo.edu [VAX/VMS]

jwright@cfht.hawaii.edu (Jim Wright) (10/13/90)

mdeck@acsu.buffalo.edu (Mary Deck) writes:
>Maybe I'll search for a particular Unix file, and if TeX can't find
>that file, I'll have it look for the corresponding VAX file.  There
>must be some way to do this without changing the format.....

How about this:

    ln -s STUPID$VAX$NAME.STY unixname.sty

--
Jim Wright
jwright@cfht.hawaii.edu
Canada-France-Hawaii Telescope Corp.

spqr@ecs.soton.ac.uk (Sebastian Rahtz) (10/13/90)

In article <40309@eerie.acsu.Buffalo.EDU> mdeck@sybil.cs.Buffalo.EDU (Mary Deck) writes:

   Here's a question for anyone who wants to answer it (and can): Is
   there a way in (La)TeX to identify the type of system one is on?  For
   instance, I have several files which I'll be using in both a VAX/VMS
   environment and a Sun/Unix environment.  I have a macro file, same
   thing on both systems but different filename, which I want to include
   in these documents.  I want to put a line in the file to include my
   macros which will pick the proper file name for the current system.
I `support' TeX on various systems, and one solution I adopt for a
similar problem is to define my own symbol (a TeX counter), set the
value of that when I build a .fmt file, and then check its value in
style files with a case statement.

a hackier way would be to check for the existence of the VMS name and
if that failed, try the unix one.....

so far as I know there is no generic answer, but it is perfectly
permissible to build something into the format file. but please test
in the style file to see if your trap is defined at all! then other
people can use your files too.....


--
Sebastian Rahtz                        S.Rahtz@uk.ac.soton.ecs (JANET)
Computer Science                       S.Rahtz@ecs.soton.ac.uk (Bitnet)
Southampton S09 5NH, UK                S.Rahtz@sot-ecs.uucp    (uucp)

mdeck@acsu.buffalo.edu (Mary Deck) (10/18/90)

In article <SPQR.90Oct13151836@bright.ecs.soton.ac.uk> spqr@ecs.soton.ac.uk (Sebastian Rahtz) writes:
>In article <40309@eerie.acsu.Buffalo.EDU> mdeck@sybil.cs.Buffalo.EDU (Mary Deck) writes:
>[about system identification in TeX]
>I `support' TeX on various systems, and one solution I adopt for a
>similar problem is to define my own symbol (a TeX counter), set the
>value of that when I build a .fmt file, and then check its value in
>style files with a case statement.

...Except that then I have to either own a copy of the format on each
system, or convince the powers that be that this is worth changing the
formats for.  Neither is likely.

>a hackier way would be to check for the existence of the VMS name and
>if that failed, try the unix one.....

I thought of that, but I don't like it, either...

>so far as I know there is no generic answer, but it is perfectly
>permissible to build something into the format file. but please test
>in the style file to see if your trap is defined at all! then other
>people can use your files too.....

I don't think anyone else will use my files, but I will check. 

What I'm going to do (when I get around to it) is make a file
'system.tex' which contains lines like this:
	\let\VMSTeX\relax
Then, in my (La)TeX document, after including 'system.tex', I can say
	\ifx\VMSTeX\relax
		% VMS-specific stuff
	\fi
With similar definitions for other systems, this should do just what I
need it to do.  And it requires only trivial amounts of disk space,
and doesn't involve changing any system files. 

Thanks for all suggestions, especially Raymond Chen
(raymond@math.berkely.edu), who suggested this.

					....Mary
---
Mary M. Deck,  Student Assistant,  User Services
University Computing Services, State University of New York at Buffalo
mdeck@cs.buffalo.edu [Unix]
acsgmmd@ubvms.cc.buffalo.edu [VAX/VMS]