4

My question is simple, are there some predefined directories (in the texmf file system) where I can save my .tex files for further inclusions ?

If yes :

  • which ones are they ?
  • Can I defined mine manually editing a configuration file ?

If not :

  • Is there some way to include a .tex file (placed anywhere on the disk) in a .tex file I write (anywhere on the disk too) ?

For instance :

I'm writing a document located at /media/XXX/documents/latex/foo/bar.tex And I need to include a file let's say located at ~/texmf/includes/style1.tex

ps : and between include or input, which one seems more appropriate in my case ?

vdegenne
  • 822
  • Your local ~/texmf should mimic the structure of your installed 'tex tree'. That means your personal LaTeX .sty files (and the like) should be located in ~/texmf/tex/latex/ (with further personal subdivisions if you like/need). .bib files could be put in ~/texmf/bibtex/bib/. And so on. I made the following, e.g.: mkdir -p ~/texmf/{bibtex,doc,fonts,tex,texdoc} (some of these have sub-directories as well). – jon Feb 21 '13 at 19:36
  • thanks for your answer but that doesn't really help to answer my question. where should I include my .tex include file ? – vdegenne Feb 21 '13 at 20:30
  • If it is a 'style' file as the name suggests, you 'should' give it a .sty extension (= style) and put it where I said the first time around. If it is a regular .tex file containing text that will be printed as part of the main file, I would keep it in the same directory as your 'masterfile'. And you should 'include' a .sty file in the preamble of your document; e.g., \usepackage{style1}. – jon Feb 21 '13 at 21:33
  • You need to explain better what this included-from-elsewhere .tex file contains. If it contains things like configuration parameters and \newcommands (etc.), then you can put it where I said and load it with \usepackage. If, however, it is something like a chapter or section of text that you want to include in the body of a 'masterfile', then there are different reasons why you might want to use \include or \input. – jon Feb 21 '13 at 23:30
  • 2
    ~/texmf/tex/latex/personal is the preferred directory (the innermost one can have any name you like). – egreg Feb 21 '13 at 23:47
  • @egreg this is working nicely, can you post a short answer to validate the question ? – vdegenne Feb 22 '13 at 07:02
  • 1
    For MiKTeX users this should help: Create a local texmf tree in MiKTeX. – Speravir Feb 22 '13 at 17:17

1 Answers1

2

On GNU/Linux systems using TeX Live, the best place for input files you commonly include is

~/texmf/tex/latex/personal

(in place of personal use any name you like), because this tree is always searched for input files and does not require any hashing (like in the main trees).

On Mac OS X with the MacTeX version of TeX Live, use

~/Library/texmf/tex/latex/personal
egreg
  • 1,121,712