I need to write several documents (mainBook1.tex
, mainBook2.tex
,..), all with the same layout. So basically I moved all common settings to outer file (baseSettings.sty
) extension, which is pleaced in other path from docs main TeX files. See my files tree:
+-Documents
+-Base
| +-baseSettings.sty
| +-BaseImages
| +-headerImage.jpg
| +-footerImage.jpg
+-Book1
| +-mainBook1.tex
+-Book2
+-mainBook2.tex
mainBook1.tex
:
\documentclass[12pt]{article}
\usepackage{import}
\usepackage{../Base/baseSettings}
\begin{document}
...
baseSettings.sty
:
\ProvidesPackage{baseSettings}
\usepackage{geometry}
\newgeometry{margin=2.0cm, bottom=3.5cm, top=2.5cm}
\usepackage{...}
% HEADER AND FOOTER:
\rhead{\includegraphics[scale=0.3]{BaseImages/headerImage.jpg}}
\rfoot{\includegraphics[scale=0.2,valign=c]{BaseImages/footerImage.jpg}}
...
And problem is, that those .jpg
files cant be found. If I move folder BaseImages
into Book1
folder, everything works fine. But I would like to have base images stored only once.
So the question is: How to set those paths in .sty
file as relative from this file?
I use: MiKTeX with TeXworks. I just press the Typeset button to create PDFs – I'm not familiar wih all the magic behind.
Is it possible to compile it with command?
TEXINPUTS
environment variable to ssomething../Base;../Base/BaseImages;
and then you should be able to use\usepackage{baseSettings}
and the images will work. See tex.stackexchange.com/questions/149714/….