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.

For many of my recent documents, I have started using a rather specific set of packages, settings, fonts and configuration. In one rare case, I even adapted one of the included fonts (in my opinion the \partial d should not be slanted when used as a derivative sign; if it is slanted, it specifies the boundary of a set).

All of these settings are of course only made on one computer and specifically the font things had to be put into the texlive/local tree which makes sharing the settings on several computers a pain (not to think of synchronisation issues) and sharing with collaborators virtually impossible.

Ideally, I’d want to create a git repository (or any other DVCS) for all those settings and for each new tex project, I’d copy (or clone or link or use a submodule) this repository into a subdirectory of the main tex file and have it automatically included somehow, so that all my private fonts, settings and packages are found and added without problems.

Is this possible without large problems or will tex need some special initialisation routines and fixed paths for this even today?

I suspect, I’m not the only one with those problems. How is such a thing solved by others?

Edit / Explanation

I more or less think of the optimal solution to work like a style folder in a HTML file. So, I’d have a folder style with all fonts and images in it and a special style sheet, which references all those files. This solution would be totally local and portable. I could move the folder around, rename it or even use the very same folder for all my HTML files, as long as I can reference the main style sheet file. This works because all paths inside the CSS file are relative to that file.

The only adaptations I’d have to make are copying/linking/cloning the style folder and figuring out the path to the CSS file.

I don’t expect the tex solution to be identical. It is a completely different system. But it would be great to do just these two things:

  • clone the style/font repository into some subfolder of the current main tex file
  • inside the main tex file: include the style file
  • done

Including the main file might even take a couple of lines to write, no problem there. But I’d very much appreciate it if all of these changes could be local to the folder of the main tex file.

share|improve this question
add comment

4 Answers

If I understand you correctly, then this is exactly what I do. I have a standard location for all my tex style files, classes and so forth which are all in DVCS repositories (happens to be BZR, but don't hold that against me). I then symlink the ones that I want in to my TEXMFHOME tree. The reason for symlinking is that I may not necessarily want all of the junk in my BZR repositories to be in my TEX tree, so I don't want to make the texmf directories part of the repository set, but I also want things to update automatically so I don't want to just copy them over. As you say, this makes keeping things up to date across different computers much, much easier.

To answer your specific question, I've not encountered any problems with this setup.

share|improve this answer
    
But that means I have to overcome a setup hurdle for each new installation? (E.g. I need to maintain a directory outside the current folder.) Or can I include the current folder in TEXMFHOME? –  Debilski Feb 23 '11 at 13:24
    
@Debilski: You can mess around with TEXMFHOME (see the question linked by Matthew in his comment to Ulrike's answer). Or you can make your TEXMFHOME directory the repository directly - there's nothing wrong with this. I was just describing what I do to show that there's no inherent difficulties with the scheme. Of course, there are variations. –  Andrew Stacey Feb 23 '11 at 15:57
    
@Debilski: I might have misunderstood your comment. The current folder (ie where you run latex from) is always in the search path (as are any subdirectories, I think). The point of the TEXMFHOME stuff is to have a central place where all your class and style and stuff files reside so that you don't need to branch them in to the current folder each time. (I'm no expert on the search paths, for that you should ask a new question.) –  Andrew Stacey Feb 23 '11 at 15:59
add comment

In miktex I would put all the stuff together in a special new local texmf-tree and "mount" this tree by adding its root folder as a new root. It's easy to put a such a texmf tree in a git (or whatever) repository.

In TeXLive this is also possible. While in general people think that there exist only one local texmf-tree it is actually possible to have more then one. In the TeXlive list this command was sent some month ago (untested as I have miktex):

 tlmgr conf texmf TEXMFLOCAL '{/path/to/tree1;/path/to/tree2;...}'

After updates/changes of the tree you must call texhash and perhaps call updmap(-sys).

share|improve this answer
    
Joseph Wright writes in an answer to "How to add an extra searchable dir with personal style files to TeXLive, NOT under ~/Library/texmf? " that texhash is not necessary if you change TEXMFHOME. –  Matthew Leingang Feb 23 '11 at 13:00
    
Do you know, if I can add the current folder, e.g. the folder with my main tex file to TEXMFLOCAL/TEXMFHOME? –  Debilski Feb 23 '11 at 13:26
    
With Miktex you can get problems if you compile files in a active texmf: auxiliary files are often not found. I don't know if it works in TeXlive. But I wouldn't do it. A texmf-tree is for "tools" (packages, fonts, documentation), not for documents. –  Ulrike Fischer Feb 23 '11 at 14:13
    
Ah, okay, I see. An if I specified it as ./local/texmf? –  Debilski Feb 23 '11 at 14:59
add comment

The best way is to create your own package. This is simple a text file that you save with a .sty extension for example mypreamble.sty

A minimum example is shown below:

\ProvidesPackage{mypreamble}
\def\test{...}

You use the ProvidePackage command to make sure that LaTeX knows about it and give you some sensible errors if it is loaded twice.

Personally I have quite a few private packages, one is called typography where I keep all typographical tweaks and settings. Another one is specialmaths etc.

These can be installed as all other packages so you do not have any problems with paths etc.

share|improve this answer
    
Packaging the style files is a good thing of course but does not solve the sychronisation problem and the font files. –  Debilski Feb 23 '11 at 13:19
add comment

You seem to have competing goals. If you want modularity, break off the code you reuse in your documents and distribute it separately. If you want portability, keep it within the single file.

share|improve this answer
add comment

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.