From: Jerry <je...@se...> - 2013-01-14 17:31:19
|
On Mon, 14 Jan 2013 17:53:08 +0100 Matthias Pospiech articulated: > Am 14.01.2013 14:23, schrieb Jerry: > > I am a fairly new user of TexStudio. I have it installed on a > > Windows machine where it works for the most part quite well. I do > > have a question though. Is it possible to create and use a custom > > ".sty" file. > > > > I created a document and started it with the > > "\ProvidesPackage{my_file}" directive. I then added the packages I > > wanted it to encompass. I then saved the file with a ".sty" > > extension. > > > > Now, when I create a new document and include the > > "\includepackage{my_file} directive, I receive a warning that the > > file cannot be found. > I think you have misunderstood a few general LaTeX things. > > 1. I do not know the command \includepackage, you probably mean > \usepackage Yes, I had not finished my coffee when I wrote that. > 2. A style file is only for packages that provide new > functionality. If you only want to have a collection of packages and > if it is only for yourself it absolutely makes no sense to write a > package. It is much simpler to put everything in .tex file and > load it with \input. Perhaps. I got the information from a friend who uses Latex on a *.nix machine. I also got this from "LATEX" published by "Platypus Global Media", page 258. It details the entire concept. > 3. If you really want to create a sty file you need to specify the > LaTeX format and > should load packages with \RequirePackage, see this example: > > \NeedsTeXFormat{LaTeX2e}[1994/12/01] > \ProvidesPackage{templatetools} > [2013/01/13 v0.1 Collection of conditional commands useful > inside templates] > %%% --- Necessary Packages > \RequirePackage{ifpdf} > \RequirePackage{etoolbox} > ... > > 4. sty files are found in the same path as your main file, or in any > tex folder, such as > texmf-local (texlive) after updating the file database. > > 5. I hope you did not name it "my_file.sty", I do not know if the > underscore is a problem. No, that name was just a place holder. > Hope this helps. Anyway if LaTeX can not find a file it is not the > editor who is to blame. -- Jerry ♔ Disclaimer: off-list followups get on-list replies or get ignored. Please do not ignore the Reply-To header. __________________________________________________________________ |