5

I'm writing a big thesis using latex and I'm trying to keep organised.

File-tree:

../Thesis/mainfile.tex

../Thesis/Section1/section1.tex

../Thesis/Figures/figure1.png

../Thesis/Figures/figure1.tex

_

mainfile.tex

\documentclass{article}%
\begin{document}
\input{Section1/section1.tex}
\end{document}

section1.tex:

\input{Figures/figure1.tex}
\input{../Figures/figure1.tex}
\input{../../Figures/figure1.tex}

Tried these lines. None of them work.

figure1.tex

\begin{figure}
\centering
\includegraphics[width=0.3\linewidth]{../Figures/figure1.png}
\caption{This is Figure 1}
\label{fig:figure1}
\end{figure}

The problem is how I call for the 'figure1.tex' from 'section1.tex'. I'm trying to input file one directory up and in another subfolder. I keep getting this message.

File `../Figures/figure1.tex' not found. \input{../Figures/figure1.tex}

4
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Commented Aug 28, 2014 at 16:03
  • I just tested it: LaTeX does not change to Section1 directory, but stays in the main (Thesis) directory, so it should be `\input{Figures/figure1.tex}
    – user31729
    Commented Aug 28, 2014 at 16:09
  • Thanks for the answers. I've tried to make the question clearer.
    – Bjartmar
    Commented Aug 28, 2014 at 16:33
  • This has been solved. For some reason this works like a charm like I made it in the beginning. '\input{Figures/figure1.tex}'
    – Bjartmar
    Commented Aug 28, 2014 at 16:51

1 Answer 1

2

Directory/File structure

Thesis/Section1/section1.tex

Thesis/Figures/figure1.tex

main.tex

\documentclass{article}%

\usepackage{graphicx}%

\begin{document}

\input{Section1/section1}

\end{document}

section1.tex

\section{First}

\input{Figures/figure1}

figure1.tex

\begin{figure}
\includegraphics[scale=1]{example-image-a.jpg}
\end{figure}

Output

enter image description here

2
  • May be adding a comment about \graphicspath and \input@path?
    – Manuel
    Commented Aug 28, 2014 at 16:23
  • @Manuel: Where should I add it -- in my solution? I never set those paths explicitly ;-)
    – user31729
    Commented Aug 28, 2014 at 16:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .