I have a project whose directory structure looks like the following, which I would strongly prefer not to alter:

    fileA.tex % uses a documentclass defined in this_project.sty
    fileB.tex % uses a documentclass defined in this_project.sty

When I attempt to compile fileA.tex, it cannot find this_project.sty. I am using TeXnicCenter with MikTeX on Windows 10, though I've also tried TeXworks.

On Linux systems, where I have used projects like this before, I just added the LaTeX directory to the PATH and it was automatically recognized. I have attempted to add the LaTeX directory to every configuration option that looks like it might go on the PATH, to no avail.

How can I make this work? Most suggestions I see in my searches assume that the .sty file can be moved, usually into some common directory instead of something specific to the project. In particular, I'd like to avoid copying it into both Dir1 and Dir2 where the versions can diverge.

  • latex (on linux or windows) does not search for .sty files on the PATH on both it uses the TEXINPUTS environment variable Jul 18, 2019 at 21:31
  • @DavidCarlisle is there a good way to set that variable? Jul 18, 2019 at 21:32
  • beside setting texinputs you can also call pdflatex with --include-directory=DIR. Jul 18, 2019 at 21:35
  • If you want to set the environment variable (rather then a miktex config) then as on linux you just need to do whatever you do to set the environment, typically the control panel, but i don't use miktex, Ulrike's suggestion of a miktex specific option may be easier to set up. Jul 18, 2019 at 21:39
  • I would define a TeXmf-local directory (to be validated via MiKTeX Settings) in which I'd put a directory latex/this_project.sty (but not the files to be compiled) and refresh the filename database. This should be enough.
    – Bernard
    Jul 18, 2019 at 21:40

1 Answer 1


You can call pdflatex with the option --include-directory=DIR see the documentation https://docs.miktex.org/2.9/manual/miktex-pdftex.html.

miktex also knows the TEXINPUTS environment variable. See https://docs.miktex.org/2.9/manual/envvars.html.

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.