Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a tex project using a custom .cls which builds in Windows 7 with TeXlipse + MikTeX. The .cls has a number of CTAN LaTeX contrib package dependencies, which I installed one-by-one with MikTeX (something is wrong with my auto-installer).

This project has the directory structure:

src/ <- .tex files here
fig/ <- .pdf figures etc
style/ <- .cls file here

This project is checked into a CVS repo and a Mac user needs to be able to checkout and build the latest revision. This user has: Mac OSX 10.5.8, pdfTeXk, Version 3.1415926-1.40.9.

What I'd like is to be able to check in these contrib packages into the style/ directory, and then using some commandline arguments include the style/ directory in pdfTeXk's search path so it can find the .sty files when the user builds src/document.tex.

I don't have access to a Mac, but I did try to accomplish the same thing with CentOS 5.6 with no luck. It seems most pdflatex packages (ie tetex-latex-3.0-33.8.el5_5.6.x86_64.rpm) expect .sty files to be in a strict folder hierarchy. I tried the -input-directory argument and TEXINPUT environment variable with no avail.

I'm aware that TeXShop has a package manager which could download and install the required packages for this user, but I'd like to avoid this for a couple reasons:

  1. I'd rather not encourage messing with their already-working environment with pdfTeXk.

  2. My understanding is that TeXShop won't auto-install packages during the build, which is painful because this .cls has like 10-20 contrib dependencies.

Is there an easy solution here? Perhaps I am just spoiled by the ease of MikTex, but this seems to be a pretty basic functionality.

EDIT: It's worth pointing out that I'm using the commandline on CentOS and I believe the user is doing the same in OSX.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Solution 1: Install MacTeX

If your Mac users install the full MacTeX distribution, then the chances of a package being missing are very minimal, assuming you are using packages that are standardly part of MikTeX. TeXLive does require packages to be in a strict hierarchy unless they are located in the same folder as the source document. There are ways to do what you want, but before exploring them it would be simpler to have the right Mac distribution in place and see if the problem goes away.

Solution 2: Add an extra texmf directory.

It's not hard to add an extra local texmf directory. See How to add an extra searchable dir with personal style files to TeXLive, NOT under ~/Library/texmf? (the second part of the answer).

Note that TeXLive is very strict about the structure of the texmf directory, so LaTeX packages must be in the tex/latex directory. See How to have local package overide default package for details of the structure of the texmf directory.

Solution 3: Make a symbolic link to the extra directory

There is one other way to implement this. On a Mac, local additions are usually expected to be in ~/Library/texmf, which should have the directory structure outlined in the linked question above. Instead of adding an extra local texmf directory and giving your style directory that structure, you could simply put a symbolic link to your style directory in ~/Library/texmf/tex/latex. This way any style/class files will be found as if they were in the right part of the local texmf folder.

share|improve this answer
    
I'll suggest this to the user if I am unable to get it to work with the directory structure I've described and path / commandline flag modifications. As noted in the OP, I'd rather not install additional applications or mess with the current setup if possible. –  BigChief May 15 '11 at 18:57
    
@BigChief This shouldn't be anything extra if the user has an up-to-date MacTeX installation. –  Alan Munn May 15 '11 at 19:04
    
@Alan Munn: Is pdfTeXk == MacTeX ? I don't have a Mac and can't find much info on pdfTeXk. –  BigChief May 15 '11 at 19:08
    
@BigChief pdfTeXk appears in the console banner when pdftex is run with certain extensions. In order to find out whether your user has MacTeX, they'd need to do which pdftex. If MacTeX is installed, this should return /usr/texbin/pdftex. If it returns something like /opt/... or /sw/... then they are using a MacPorts or Fink TeX distribution, which is really not recommended. –  Alan Munn May 15 '11 at 19:25
1  
@BigChief I've added a third solution which won't involve reworking the internal structure of your /style directory. –  Alan Munn May 15 '11 at 20:04

You can redefine the $TEXMFHOME environment variable before running pdflatex. Then you can use another directory for class or style files:

export TEXMFHOME=style

you need only one main tex file in the main directory. For the images you can use the path for \includegraphics[..]{fig/...} or alternatively, define

\graphicspath={{fig/}}

To get all auxiliary files into the source directory run

pdflatex --output-director=src/ main.tex

the file main.tex can use \include or \input for the other tex files. The export TEXMFHOME=... and the optional argument can be added to the setting of an editor, if you use one.

share|improve this answer
    
@Herbert This will only work for running pdflatex from the command line. If you are working from within an editor such as TeXShop, it won't work without further effort. –  Alan Munn May 15 '11 at 17:29
    
@Herbert Nothing is a big deal if you know how to do it. But your solution won't work using TeXShop, for example, without creating a new Engine file. You can't simply add shell commands to the pdflatex command as you suggest. So as a general solution for the average Mac user (who doesn't necessarily use the command line at all) this isn't really one. –  Alan Munn May 15 '11 at 18:24
    
I tried exporting $TEXMFHOME to point to the style/ directory (using the absolute path) as you described, but pdflatex still doesn't find the .sty files in style/. Regarding the graphics, the paths are already set properly. It may be worth noting that I'm building from inside the src directory (cd src; pdflatex document.tex) and figs / cls references are properly relative, but .sty are not because in Windows they've always been on my path. –  BigChief May 15 '11 at 18:54
    
@BigChief TeXLive is very strict about the internal structure of the texmf directories. So minimally, style files have to be in style/tex/latex in order to be found. –  Alan Munn May 15 '11 at 18:59
    
@Alan Munn: Is pdflatex based on TeXLive ? –  BigChief May 15 '11 at 19:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.