1

Everyone!

I'm a bit new with latex and I'm trying to create a project with a few subfiles and I found a problem that I just dont understand. I will first put you in context. My directory distribution is as follows:

Apuntes/
|Apuntes_radio.tex  (This is the main file)
|paquetes.sty   (This is the preamble file)
|temas/
|->Introduccion/
|->|->Introduccion.tex (This is the subfile)
|->|->img_intro/  (And this is the folder where the images for this subfile will be)
|->|->|->espc_EM.png

My main file is

\documentclass[a4paper,11pt]{book}
\usepackage{import}
\usepackage{paquetes}
\usepackage{subfiles}

\usepackage{makeidx}
\makeindex

\title{Apuntes de Radiactividad y Aplicaciones (3º Física)}
\author{Samuel G. Guerrero}
\date{Febrero 2020}

\begin{document}

\frontmatter
\maketitle


\mainmatter
\chapter{Introducción}

\subfile{temas/Introduccion/Introduccion}

\end{document}

And the subfile is a bit long, so I'll show you where latex says the problems are:

\documentclass[../../Apuntes_radio.tex]{subfiles}

\graphicspath{
  {"temas/Introduccion/img_intro/"} %images path for the main file
  {"img_intro/"}                    %images path for THIS subfile
}

\begin{document}

.....[some junk]....

\begin{figure}[h!]
\centering
\includegraphics[scale=0.5]{espc_EM}
\caption{Espectro electromagnético.}
\label{fig:espc_EM}
\end{figure}

.....[some junk]....

\begin{wrapfigure}{l}{0.46\textwidth}
\includegraphics[scale=0.5]{espc_incandesc}
\label{fig:espc_incandesc}
\caption{Espectro de una lámpara incandescente}
\end{wrapfigure}

.....[some junk]....

\end{document}

And the preamble file is:

\ProvidesPackage{paquetes}

\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[spanish, es-tabla]{babel}
\usepackage{url}
\usepackage{amsmath}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{appendix}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{listings}
\usepackage{titlesec}
\usepackage{csquotes}

\topmargin=-2cm
\oddsidemargin=-1cm
\evensidemargin=-1cm
\textwidth=17.5cm
\textheight=25cm
\footskip=20pt

\addto\captionsspanish{\renewcommand{\chaptername}{Tema}} %cambiar "capitulo" por " tema%


\titleformat{\chapter}[hang] 
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter.}{10pt}{}

Now the problem

As it is, I have no trouble compiling the subfile individualy. It shows me no errors and looks as I want it. The problem comes when I try to compile the main file (Apuntes_radio.tex), it gives me this error: enter image description here

the long one saying:

! Package pdftex.def Error: File `\es@period@code espc_EM.pdf' not found: usingdraft setting.See the pdftex.def package documentation for explanation.Type H for immediate help.... \includegraphics[scale=0.5]{espc_EM}

Can anyone tell what it is? I've sorted the 'Missing $ inserted' error before, but this time I'm pretty sure it's not a symbol missing, mainly because the subfile does compile by itself without problems! I've lost a day and a half already to this...

Thanks in advance!!

14
  • 1
    Welcome to TeX-SX! As a new member, it is recommended to visit the Welcome and the Tour pages to be informed about our format and also to know about Minimal Example. Otherwise, more specifically about your question: try to use \includegraphics[scale=0.5]{espc_EM.png} rather than espc_EM without extension.
    – R. N
    Feb 16, 2020 at 20:22
  • Hi Samuel, are you compiling with pdflatex or xelatex? Did you consult this question? maybe it can help you: tex.stackexchange.com/questions/473062/… Feb 16, 2020 at 20:57
  • @Annie I've seen that question, but I dont really understand it. I've checked, and i have perl but not gswin32c installed. And i dont really know what to do. About the first question, im compiling with pdflatex. Feb 16, 2020 at 21:06
  • i deepen the research: never had this problem .. give me time :) Feb 16, 2020 at 21:12
  • 1
    Try if works if you remove the quotes from the graphicspath declaration. Feb 16, 2020 at 23:16

1 Answer 1

1

Remove the quotes from the graphicspath declaration. Quote are unneeded as there are not spaces (and with a current latex also in the other case) and with spanish they actually harm here as spanish makes the " active.

\graphicspath{
  {temas/Introduccion/img_intro/} %images path for the main file
  {img_intro/}                    %images path for THIS subfile
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.