1

Here's my setup :

  • Two PCs (one desktop and one laptop)
  • Two installations of Texmaker and MikTex (exactly the same versions)

i've created my own package (.sty file) and this package uses external files (that are located in the same directory as the pacakge. the files are added via the \input{...} command

I've used the package for quite a while on both PCs flawlessly and now the laptop throws an error at compilation (of the document which uses the package)

LaTeX Error: File 'basic_packages.tex' not found. Type X...

I've managed to understand what's going on :

  • The desktop interprets "\input{...}" as "go look for the file at the package's directory
  • the laptop looks for the file at the document's directory. Of course i want the included file to stay with the package.

Here are my codes (simplified)

package

\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{sdlibV1}[14/03/2019 custom package]

\newif\if@all\@allfalse
\DeclareOption{all}{\@alltrue}


\ProcessOptions\relax


\input{basic_packages} %<-- this input
%\input{basic_macros} also not useful for the question

\if@all
%stuff, not useful here
\fi

\endinput

basic_packages.tex

\RequirePackage[table,dvipsnames,named]{xcolor}
\RequirePackage{tikz}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{siunitx}
\RequirePackage{enumitem}
\RequirePackage{multicol}
\RequirePackage{tabu}
\RequirePackage{makecell}
\RequirePackage{array}

Document

\documentclass{report}
\usepackage{sdlibV1}% <-- package loaded here

\usepackage[margin=1.5cm]{geometry}

\begin{document}
\subfile{calcul_integral}% I've tried removing those, and only using "hello world"
\subfile{algebre_lineaire}
\subfile{equations_differentielles}
\end{document}

Paths of files :

Document : \HEIG-VD\Cours\Math2\Notes

sdlibV1.sty and basic_packages.text : \HEIG-VD\Notes\LaTex\packages\tex\latex\sdlibV1

(The packages folderhas been configured correctly as a package "source") What i've also tried :

  • Checking pdflatex's command
  • Using a temp document (standalone, without anything in it, just a "hello world")
  • using \include command (did not work at all)
  • putting all my included files (16 elements) inside the .sty file, it worked but it's absolutely disgusting
  • Where are these files placed in the file system in relation to each other? – daleif Apr 4 at 18:40
  • the "document" file is anyhwere (doesn't really matter) the library and included file are in a dedicated folder. (which has been made so that it's recognized as a library) – Klue Apr 4 at 18:44
  • Note that LaTeX does not really have a notion of libraries, so please explain exactly what you have done. – daleif Apr 4 at 18:45
  • yeah sorry, i'm still a bit new so the vocab hadn't time to sink in that much. I've created a .sty file (sdlibV1.sty) and i've used the \usepackage{sdlibV1} to "load" it. So it's more of a package than a library i guess (i tend to get confused coming from C programming) – Klue Apr 4 at 18:50
  • 1
    just saw that you have miktex. Then you need to update the FNDB (in the miktex console, user mode, menu tasks, or with initexmf -u on the command line.) – Ulrike Fischer Apr 4 at 19:05
0

The problem has been solved !

After changes to a package (and/or files included by it) the following command in the MikTex console (ran as admin)

initexmf -u --admin
  • you only need to do this if you add new files, not if you change/edit an existing file. – David Carlisle Apr 5 at 9:01

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.