I recently updated my MikTeX distribution (The new interface is really nice by the way, Thank You to the contributors/developers) and I got curious about the path resolution of files when compiling a document.

I have an experimental TikZ package that I've been fiddling with for a while. It's notihing fancy it simply defines a base length, that defaults to 1 em, and allows me to set this value to something else during the compilation of the document. I use this to draw a set of tikz pics, also provided by the package, to a consistent scale.

Initially I was linking the files the package produces, *.code.tex and *.sty files, directly into MikTeX's TeXMF tree, using the mklink function available under windows 10. That is I was placing these files under MikTeX/TeXMF/tex/generic/pgf{/libraries,/libraries/shapes,/fronendlayer/tikz/libraries}.

I have now setup a local TeXMF tree which I'm populating instead; this resides next to my source code and I can simply copy the files across. That is I am now copying these files to LOCAL/TeXMF/tex/generic/pgf{/libraries,/libraries/shapes,/fronendlayer/tikz/libraries} and have added LOCAL/TeXMF as an additional directory for MikTeX to scan under Settings>Directories>Paths and I include this path before the MikTeX one.

Now I'm unsure if the paths under the local tree are masking or conflicting with those in the MikTeX one or not, it seems a possiblity. That is does LOCAL/TeXMF/tex/some/path/ block MikTeX/TeXMF/tex/some/path/ at all ?


The reason for the question is that I'm not sure if I broke my installation or not or if I simply updated to an intermediate version of PGF from MikTeX and need to simply wait a week for the next patch. LuaLaTeX started reporting the following error shortly after I updated my system and migrated my experimental package; I did both at the same time and I'm not sure if this is my fault or not.

! Package pgf Error: Graph drawing library 'force' not found.

See the pgf package documentation for explanation.
Type  H <return>  for immediate help.

Googling about takes one to this question which links to Github and finally SourceForge. The issue it seems has been reported and fixed and I suspect there is a bit of lead time to wait before MikTeX gets and distributes the update. So on the PGF side it looks all hunky dory which leads me to think that migrating my package broke the graphdrawing look up of LuaLaTeX but I'm not sure.

  • MikTeX maintains its own filename database (FNDB) for .sty and .cls files which can be be updated using the console Tasks->Refresh name database. You can add additional root directories using the Settings->Directories page. Jan 15 '19 at 15:05
  • AFAIK the local is intended to override the defaults otherwise they would not be used when you want them. So it would seem (as you surmise) that your custom files can mask / break the compilation I cant remember the alternatives to \tracingall command but the compilation log files should give you a clue as to which versions & texmf/paths are in use. see also tex.stackexchange.com/questions/351066/… and watch for suitable "related" topics on the right of this page as you browse
    – user170109
    Jan 15 '19 at 15:47
  • 1
    Files in a local texmf are found first and so can mask global files. It is easy to test if your local texmf is a problem: simply deactivate the local texmf in the miktex console. Jan 15 '19 at 16:22
  • 1
    The issue with the graphdrawing library is resolved with the newest pgf, which is already in miktex. If you still have problem you perhaps haven't updated everything - run the update manager as user and as admin. And check the log-files for the pathes and versions of your files. Jan 15 '19 at 20:56
  • 1
    @UlrikeFischer Oh drat, I had been managing everything as the admin user. I just tried as the normal user and saw that PGF was installed under it. Updating removed PGF under the user account falling back to the updated version under the admin account. Thanks for mentioning the user account (I feel a bit daft now).
    – Carel
    Jan 15 '19 at 21:13

The TeX directory structure (TDS) ( PDF | HTML ) defines where a TeX distributions find the source files during the compilation of a document. The following set of root folders are traversed in order:

  1. Additional root folders specified upon the command line (MikTeX : -include-dir=PATH)
  2. The working directory, where the file being compiled is located
  3. The local TeXMF tree (There may be more then one of these)
  4. The users TeXMF tree
  5. The system/admin users TeXMF tree

When searching for a file the source tree is scanned roughly in the order shown but this may be altered by a given source file or by the active compilation engine (Ulrike Fischer) e.g. when building code specific to TeX/LuaTeX/PDFTeX.

The TDS enforces the structure and naming conventions for the base folders near to the root of the tree, e.g. ensuring there are subfolders for METAFONT/METAPOST/TeX and friends. Duplicate packages and source files are then allowed under these base folders.

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.