Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include *.sty file from a super/subdirectory of main *.tex file

Tags:

latex

I want to share a latex document via git with many other people. Therefore we decided to put all the special sty files, that are not present in everyones latex-installation, into a resources directory. It would be cool, if this dir would be a superdir. of the actual working directory How exactly can I import those style files?

It is important that even the dependencies of those remote styles are resolved with other remote styles.

like image 826
wuschelhase Avatar asked May 13 '11 15:05

wuschelhase


People also ask

How do I include a .STY file in LaTeX?

sty ) into your document in two ways: If you have it in your path or in the same folder as the . tex file, simply include this line in your preamble: \usepackage{mystyle} If you have it in a different folder, you can access using its full path as \usepackage{/path/to/folder/mystyle}

What is .STY file in LaTeX?

sty files are loaded by LATEX to provide and improve methods that are used to create documents. Generally speaking, class files implement the specific structure of the document, whereas packages are used to provide either generic functionality to any document, or to 'style' the methods provided by a specific class.

Which is the best directory to keep my .STY files?

sty files? If you want to install your own . sty files, then you should copy the files into the directory tex/latex/mystuff relative to a new TEXMF root directory.

Where are .STY files stored Linux?

sty or . cls files must be in some subdirectory of tex\latex which can be in any directory of any drive.


1 Answers

You can import a style file (mystyle.sty) into your document in two ways:

  1. If you have it in your path or in the same folder as the .tex file, simply include this line in your preamble: \usepackage{mystyle}
  2. If you have it in a different folder, you can access using its full path as \usepackage{/path/to/folder/mystyle}

That said, if you're not sure if the style file is in everyone's installation, simply include it in the same directory and make sure you do git add mystyle.sty and track it along with the rest of your files (although most likely there won't be any changes to it). There is no need for a parent directory. But if you insist on a different directory, see option 2 above.

It would be better if it were in a subdirectory than in a parent directory, as you can still call the file as \usepackage{subdir/mystyle} and be certain that you are invoking your style file. However, if you escape out to the parent directory, you never know if the other users have a similarly named folder that is not part of your package, which can result in errors.

like image 184
abcd Avatar answered Oct 14 '22 11:10

abcd