11

I have the following files:

my_folder/
   include/
       mypackage.sty
   main.tex

The package's name is 'mypackage'. Now, in main.tex I do

\usepackage{include/mypackage}

using the file path rather than the package name. This works, but warns me:

You have requested package `include/foo' but the package provides `foo'

How do I avoid this without placing the document class file elsewhere?

  • 8
    The warning is there specifically so you don't do \usepackage{include/mypackage} do \usepackage{mypackage} instead. The argument is a package name not a file path, just as you don't do \documentclass{tex/macros/latex/base/article} – David Carlisle Jun 27 '14 at 16:37
  • Related: where to put .sty and .cls file for project – mvkorpel Jun 27 '14 at 17:17
  • If you're using MiKTeX, see How do I set the search path for MikTeX? – Werner Jun 27 '14 at 17:25
  • @Werner: Can I include something like CWD in the search path? – einpoklum Jun 27 '14 at 18:41
  • 2
    Something like CWD is already in the search path. If you put the packages in the same directory as the document, it will work fine. – cfr Jun 27 '14 at 22:21
5

You can disable the warning using silence package:

\documentclass{article}

\usepackage{silence}
%Disable all warnings issued by latex starting with "You have..."
\WarningFilter{latex}{You have requested package}
\usepackage{include/mypackage}

\begin{document}
\end{document}

Another solution was proposed here: https://tex.stackexchange.com/a/31950/65072

  • 1
    Well, I guess that'd work, but it's a workaround rather than a solution... – einpoklum Mar 18 '15 at 3:54
  • Based on other answers: tex.stackexchange.com/questions/31925/…, you can add "include" directory to your TEXINPUTS environment variable, that's the only other solution to my knowledge. But in this case you'll have a problem -- all your documents will be compiled with this new TEXINPUTS value. I use the solution with silence myself, it seems more modular. – Desik Mar 18 '15 at 8:17
  • ... but the document can't really make assumptions about the environment variables. – einpoklum Apr 18 '15 at 15:56
  • do you have any idea how I can file this as a bug report / feature request with the LaTeX project, officially? – einpoklum Jan 16 '16 at 17:12
  • 1
    I was searching for bug reporting many times - Latex community doesn't seem to use public bug trackers. You should probably contact the authors of latex/miktex/whatever by email. – Desik Jan 16 '16 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.