## #Latex Nested folder with Subfiles package

I got a handy and pretty solution to deal with a nested files issue while I am using subfiles package. I am a fan of subfiles because we can compile and see a latex file without involving the main latex file.

suppose that, we have a latex project:
main.tex
-chapter1
–chapter1.tex
-figures
–chapter1
—figure.jpg

then we should write the main.tex and chapter1.tex as follows:

main.tex:
\usepackage{graphicx, epsfig} \usepackage{graphics} \usepackage{subfiles} \begin{document} \newcommand{\main}{.} \subfile{chapter1/chapter1.tex} \end{document}

chapter1.tex
\documentclass[../main.tex]{subfiles}
\providecommand{\main}{..}
\begin{document}
\includegraphics[width=0.6\textwidth]{\main/figures/chapter1/figure.jpg}
{document}

Iklan