This is the structure of my directories -
- Main tex file
/Diss/main.tex - chapter tex files
Diss/chap1/chap1.tex,Diss/chap2/chap2.texetc - Images
Diss/chap1/images/f1.png,Diss/chap2/images/f2.pngetc
I would like to compile main file as well as each chapter standalone. So, I find subfile package useful. for e.g.
main.tex
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
%here is the path
\graphicspath{{chap1/images/}{images/}}
\usepackage{subfiles}
\usepackage{blindtext}
\begin{document}
\subfile{chap1/chap1}
\end{document}
chap1.tex
\documentclass[../main.tex]{subfiles}
\begin{document}
\begin{figure}[bh]
\centering
\includegraphics[width=4cm]{f1}
\label{fig:img1}
\caption{ShareLaTeX learn logo}
\end{figure}
Hello, here is some text...
\end{document}
This works nicely. So far so good.
Now, I have several chapters, and most likely, using \graphicspath{{chap*/images/}{images/}} before each call of chapter will work (* is the chapter number). But, I don't really like it because, I must add it several times. Is there a better way to manage this type of structure.
P.S. - I invested a lot of time on it, but could not find a satisfactory answer, probably my search direction is wrong.
chap1/images/f1.pngthus, I would use\includegraphics[...]{images/f1}. That is also great. However, if possible, I would love to use it something like\includegraphics[...]{f1}only. – novice Jan 26 '16 at 12:41