I am trying to set up a multi-file document where I use \input
to add different .tex files to my main document. Each .tex file is in its own directory/folder. There is also a separate directory for figures. When I compile one of the .tex files (called 'Methods') which contains a figure, the image loads as expected.
However, when I add this file to the main document and compile, the image is missing and I get the following error message:
File `Testimage' not found. ...ludegraphics[width=1\textwidth]{Testimage}
Can I have some advice please?
I have included the following MWE:
Main document
\documentclass[12pt,a4paper]{report}
\usepackage{graphicx}
% put all the other packages here:
\usepackage{My_style_package}
\usepackage{hyperref}
\begin{document}
%TITLE PAGE AND ABSTRACT
\input{./Title_and_abstract/Title_and_abstract.tex}
%\tableofcontents
%\listoffigures
%\listoftables
\input{./Intro/Introduction_v0.1.tex}
\input{./Methods/Methods.tex}
%\maketitle
%\input{./tex/intro.tex}
%\input{./tex/main_part.tex}
%\input{./tex/conclusions.tex}
%\appendix
%\input{./tex/myappendix.tex}
% Bibliography:
%\clearpage
%\input{./tex/mybibliography.tex}
\end{document}
My style package - contains all of the preamble from the various .tex files.
\ProvidesPackage{mystyle}
\usepackage{color}
\usepackage{graphicx, epstopdf}
\usepackage{etoolbox}%This package combined with the \pathcmd rewrites the standard style for 'Chapter' to allow the fancy horizontal and vertical lines.
\patchcmd{\chapter}{\thispagestyle{plain}}{\thispagestyle{mystyle}}{}{}
\graphicspath{{"C:/Users/User/Documents/LaTex_issues/Test_for_linking_docs_from_differrent_folders/Visuals"}}
\usepackage{gensymb}
\usepackage{times}
\usepackage{adjustbox}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs,caption, makecell}
\usepackage{pdflscape,afterpage,caption}
\usepackage[british]{babel}
\usepackage[backend=bibtex, citestyle=ieee, bibstyle=ieee]{biblatex}
\usepackage[section]{placeins}%Allows you to permanently fix figures.
\addbibresource{library}
\usepackage{titleps}%fancy page borders?
\usepackage[left=2.8cm, right=2.8cm, top=3.5cm, bottom=3.5cm]{geometry}
%\usepackage{caption}
\captionsetup[figure]{font=scriptsize,labelfont=scriptsize}
\usepackage{microtype}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{datetime}
\newdate{date}{28}{02}{2018}
\date{\displaydate{date}}
\onehalfspacing
\sloppy%Makes sure that none of the text exceeds text width. Useful if have long chemical words.
\newpagestyle{mystyle}{%
\widenhead[\marginparwidth][0pt]{0pt}{\marginparwidth}
\headrule
\sethead[~\color{black}\enspace][][]{}{}{\color{black}\enspace}
\setfoot[{\makebox[\marginparwidth][r]{\thepage~}\smash{\rule[-20ex]{0.6pt}{22ex}}}][][]{}{}{\smash{\rule[-20ex]{0.6pt}{22ex}}\makebox[\marginparwidth][l]{~\thepage}
}
}%This part creates the fancy top (horizontal) and bottom (verticle) lines that you see from the 'Abstrct' page onwards.
Methods .tex file - contains the image.
\chapter{Methods}
Video provides a powerful way to help you prove your point. When you click Online Video, you can paste in the embed code for the video you want to add. You can also type a keyword to search online for the video that best fits your document.
To make your document look professionally produced, Word provides header, footer, cover page, and text box designs that complement each other. For example, you can add a matching cover page, header, and sidebar. Click Insert and then choose the elements you want from the different galleries.
Themes and styles also help keep your document coordinated. When you click Design and choose a new Theme, the pictures, charts, and SmartArt graphics change to match your new theme. When you apply styles, your headings change to match the new theme.
Save time in Word with new buttons that show up where you need them. To change the way a picture fits in your document, click it and a button for layout options appears next to it. When you work on a table, click where you want to add a row or a column, and then click the plus sign.
Reading is easier, too, in the new Reading view. You can collapse parts of the document and focus on the text you want. If you need to stop reading before you reach the end, Word remembers where you left off - even on another device.
\begin{figure}[h!]
\centering
\includegraphics[width=1\textwidth]{Testimage}%Since we have identified the graohic location we just need the file name.
\caption{Test image}
\end{figure}
Thanks in advance.
/
at the end is missing.\input
and\graphicspath
commands are compatible in the same document?graphicx
not finding an image and nevertheless including it. Are you testing with the real document? If so, are all images in the same folder? And if this is also the case, you may want to check for typos in the file names.