Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

can I put files such as .cls, .bst and .sty in a sub-folder

39 views
Skip to first unread message

Dillon Geo

unread,
Nov 26, 2009, 9:40:48 PM11/26/09
to
Hi All,

I have some files such as IEEEtran.cls, IEEEtranS.bst in my working
directory (i.e., the directory where the .tex files are located), and
it is working well this way. But I want to put these files into a sub-
directory of the current working directory, is it possible? How can I
specify these files' paths in the preamble? The following example
illustrates what I am currently doing and what I want to do:

Currently, my working directory is WD which contains
WD\main.tex
WD\IEEETran.cls
WD\IEEETranS.bst
...

I want to put the .cls and .bst files into a sub-directory, say, MISC.
So my working directory looks like this
WD\main.tex
WD\MISC\IEEETran.cls
WD\MISC\IEEETranS.bst
...

The problem is that latex compiler cannot find the .cls and .bst
files. I understand that here is a latex command line to specify these
files' paths. But, can I specify these files' pahts in the preamble of
main.tex? (This way, if others want to compile my source files, they
don't need to know the specific command line.)

Thanks,
Dillon

Kumaresh PS

unread,
Nov 26, 2009, 11:36:12 PM11/26/09
to
On Nov 27, 7:40 am, Dillon Geo <dillon...@gmail.com> wrote:
> I want to put the .cls and .bst files into a sub-directory, say, MISC.
> So my working directory looks like this
> WD\main.tex
> WD\MISC\IEEETran.cls
> WD\MISC\IEEETranS.bst

Hi,

> The problem is that latex compiler cannot find the .cls and .bst files.

LaTeX can find the list of files available in the File name data base,
if you want to include your templates within the file name data base,
then work based on the TeX Directory Structure (TDS). Otherwise, you
should to specify the template path in your main file. You can find
the below method to do that.

In main.tex:

\def\templatepath{MISC}%Here you can specify your template path%
\documentclass{\templatepath/IEEETran}

&

\bibliographystyle{\templatepath/IEEETranS}

Robin Fairbairns

unread,
Nov 27, 2009, 5:54:22 AM11/27/09
to

kumaresh has provided a good answer, but it's not the "official line".

it would be good to provide the "official line", but...

unfortunately, you don't say what tex system you're using on your
computer (could be miktex or tex live or something i've not thought
of). the systems all have slightly different slants on how the tex
file hierarchy is stored, so one would need to know what system is
involved.
--
Robin Fairbairns, Cambridge

Peter Flynn

unread,
Nov 28, 2009, 5:02:36 PM11/28/09
to
Dillon Geo wrote:
> Hi All,
>
> I have some files such as IEEEtran.cls, IEEEtranS.bst in my working
> directory (i.e., the directory where the .tex files are located), and
> it is working well this way. But I want to put these files into a sub-
> directory of the current working directory, is it possible?

It's possible, but the preferred way is to put them in your personal TeX
tree (or in a shared-local tree if you are working on a multi-user system).

You don't say what operating system and TeX distribution you are using,
so it's impossible to give a concrete example for you, but on a
Unix-based system running TeX Live, your default personal TeX tree would
be in ~/texmf and your shared-local tree would be in
/usr/local/share/texmf, so the files would be

/home/dillon/texmf/tex/latex/IEEEtrans/IEEEtrans.cls
/home/dillon/texmf/tex/bibtex/bst/IEEEtrans/IEEEtranS.bst

or

/usr/local/share/texmf/tex/latex/IEEEtrans/IEEEtrans.cls
/usr/local/share/texmf/tex/bibtex/bst/IEEEtrans/IEEEtranS.bst

You must then run your TeX system indexer to [re]build the ls-R
databases: under Unix-based systems this is the program texhash or mktexlsr.

///Peter

DillonGeo

unread,
Nov 29, 2009, 11:12:54 PM11/29/09
to
Thanks Robin, I am using MikTex

On 27 Nov 2009 10:54:22 GMT, rf...@cl.cam.ac.uk (Robin Fairbairns)
wrote:

Robin Fairbairns

unread,
Nov 30, 2009, 9:09:57 AM11/30/09
to
>I am using MikTex

why then don't you just ask package manager to install the package
ieeetran?
--
Robin Fairbairns, Cambridge

0 new messages