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.

In my main LaTeX file I'm using a number of input files which are dynamics (changing the contents). I want to put some of these files in a higher order folder but at the same time don't want to fix it name.

Filefolder\Latexmainfile

how can I change it so that it looks files in Latexmainfile as well as ONLY in (Filefolder)

\input{./deckblatt.tex} 
share|improve this question
    
Use IfFileExists see tex.stackexchange.com/questions/36511/… –  Yiannis Lazarides Jan 4 '13 at 9:14
    
I don't want to fix path just one folder at higher order. –  user31177 Jan 4 '13 at 9:29
2  
Are you looking for .. ? As . represents the active folder, .. represents the parent directory (since there is no order in filesystems only parents and sub-dirs i guess this is what you mean). You may specify \input{../some_file_in_parent} right beneath \input{file_in_active_folder}. –  bloodworks Jan 4 '13 at 10:47
    
@ bloodworks Is it also valid for graphics \includegraphics[width=1.4\textwidth, angle=0]{myimage.jpg} and \IfFileExists{myfile} –  user31177 Jan 4 '13 at 11:00
add comment

1 Answer

up vote 1 down vote accepted

The following is written to accord to Mac OS Xs' FHS implementation. This is principally valid for any UNIX-like OS. Pdflatex allows you to specify complete paths:

\input{/Users/user_name/some/path}

Under Unix-Like systems you may even use shell(bash) variables in you paths:

\input{$HOME/some/path}

or common abbreviations

\intput{\string~/some/path}

(note: using \string here to tell latex to pass the character to shell instead of taking the "meaning")

Of course you may also specify relative paths. This means of course you need to know what your active path is. For pdflatex this is most commonly the path (or directory) were yout main document lies (which is given pdflatex as an argument).

\input{some_file}

This will tell pdflatex to use some_file which is located in the active dir. (If not an error will be raised.)

\input{./some_file}

Will do exactly the same, while

\input{../some_file}

will tell pdflatex to use some_file which lies in the parent folder (one level above.)

So one might ask why? Well under common OSs like UNIX or Windows the dot representations are in charge, so that . represents the current/active folder and .. the parent. Therefore ../../ will represent a folder two levels above (the parent of the parent). This is possible, since the directory tree only knows one parent a a certain level. So 'going up' is all the same on any level.

share|improve this answer
1  
AFAIK reading files from the parent folder (..) will typically be denied by TeX due to security reasons. –  Martin Schröder Jan 4 '13 at 12:54
    
really? i nevers checked this for tex but for my pdflatex (TL 2012) i never experienced any restrictions on that. Do you know where this can be configured? –  bloodworks Jan 4 '13 at 13:00
1  
Check you texmf.cnf for the description of openout_any and openin_any. The default is to allow all inputs (I was wrong) and only allow output in the current dir or subdirs of it and restrict absolute paths to $TEXMFOUTPUT. –  Martin Schröder Jan 4 '13 at 13:57
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.