3

For my thesis I'm using a given package from my university (titlepage.sty). Inside this package a figure is included VUB_logo. However, I wanted to put the packages I use in a folder named packages and then include them. This makes my root directory less polluted with files.

So what I did was create a directory structure as such:

master-thesis
├── bibli.bib
├── images
├── _introduction.tex
├── listings
│   ├── ...
├── packages
│   ├── VUB_logo.pdf
│   ├── VUB_schild.pdf
│   ├── vubtitlepage.sty
│   └── mathpartir.sty
├── _prescience.tex
├── _relatedwork.tex
├── _ruleshorthands.sty
├── _semantic.tex
├── thesis.bbl
├── thesis.tex
└── todo.md

In thesis.tex I included my titlepage package as such \usepackage{packages/vubtitlepage}.

Inside the vubtitlepage.sty there is an include:

\includegraphics[width=75.5mm,height=15.25mm]{VUB_logo}

As I understand it the path is relative to the root directory (i.e., the path of thesis.tex). Consequently it tries to load the image from there. It would be a solution to change the path of VUB_logo to packages/VUB_logo but that would couple my packages folder to parent directory. I was hoping to resolve this.

So far I also tried using subimport as per this question, but it doesn't seem to work. Or I am doing something wrong.

1 Answers1

4

\usepackage{packages/vubtitlepage} is incorrect, the argument to \usepackage should be a name not a file path (if the package had a \ProvidesPackage line you would get a warning about this).

Just use \usepackage{vubtitlepage} and arrange that the packages directory is in your TEXINPUTS path, then the package and its related images will be found.

David Carlisle
  • 757,742
  • Not to be pedantic, but wouldnt this require anyone who wants to compile this document to modify their environment? I would like a solution keeps the document autonomous (for lack of a better term). – Christophe De Troyer Apr 15 '15 at 08:24
  • 1
    not necessarily their OS environment, and not necessarily globally, you could set it in a texmf.cnf file or you could use TEXINPUTS=.//: pdflatex thesis as your commandline or you could not set TEXINPUTS at all and put the vubtitlepage in an existing tex input directory such as ~/texmf/tex/latex/vub – David Carlisle Apr 15 '15 at 08:26
  • Aha! This is excellent. I just used the alternative command for compilation. Since the document uses a makefile putting TEXINPUTS=.//: in front of the command was the easiest and most portable solution. Thank you very much! – Christophe De Troyer Apr 15 '15 at 08:34