TransWikia.com

Path dependency of template

TeX - LaTeX Asked by Hanson Ho on February 13, 2021

I created a template (myclass.cls), which includes another file (mystyle.sty) using the input command. Then I used the template in a document (mydocument.tex). The directories are as follow:

mypath/myclass.cls
mypath/mystyle.sty
mypath/project/mydocument.tex

The template file

newcommand{classname}{myclass}
providecommand{baseclass}{article}
LoadClass{baseclass}
NeedsTeXFormat{LaTeX2e}
ProvidesClass{classname}

input{mystyle.sty}

...

endinput

The document file

documentclass{../myclass}

begin{document}

...

end{document}

The document file will not compile because, while mystyle.sty exists relative to myclass.cls, it does not exist relative to project/mydocument.tex, such that when I compile project/mydocument.tex, I receive the error that mystyle.sty cannot be found.

I have seen solutions like defining some path variables, but I am inquiring the possibility of making the path of mystyle.sty relative to myclass.cls (the location of the template) not document.tex (the location of the file that uses the template).

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP