19

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?

11
  • 11
    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} Jun 27, 2014 at 16:37
  • 1
    Related: where to put .sty and .cls file for project
    – mvkorpel
    Jun 27, 2014 at 17:17
  • If you're using MiKTeX, see How do I set the search path for MikTeX?
    – Werner
    Jun 27, 2014 at 17:25
  • @Werner: Can I include something like CWD in the search path?
    – einpoklum
    Jun 27, 2014 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, 2014 at 22:21

2 Answers 2

7

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

5
  • 4
    Well, I guess that'd work, but it's a workaround rather than a solution...
    – einpoklum
    Mar 18, 2015 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, 2015 at 8:17
  • ... but the document can't really make assumptions about the environment variables.
    – einpoklum
    Apr 18, 2015 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, 2016 at 17:12
  • 2
    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, 2016 at 20:57
2

I encountered a similar problem recently. The issue was that I'd copied original.sty in order to have a modified version modified.sty, but I'd forgotten to change \ProvidesPackage{original}[...] to \ProvidesPackage{modified}[...] in modified.sty. As such, I got the error You have requested package 'original', but the package provides 'modified'. Making the above change resolved the error.

2
  • Welcome to TeX.SE!
    – Mensch
    Jan 7, 2023 at 14:58
  • Thanks! Happy to help where I can!
    – Matt
    Jan 17, 2023 at 14:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .