I want to have separated file with preamble and include it to the main document. So I created file. preamble.Rnw
:
\documentclass[12 pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{geometry}
\geometry{total={210mm, 297mm}, left=17mm, right=17mm, top=17mm, bottom=17mm}
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{url}
\usepackage[colorlinks=true]{hyperref}
\hypersetup{linkcolor=blue}
and main dokument raport.Rnw
:
\input{preamble.Rnw}
\begin{document}
\title{mytitle}
\author{my name}
\date{\today}
\maketitle
\newpage
<<child='chapter.Rnw'>>=
@
\end{document}
As you can see I include also child document. If I have only a text in my child document it works. But if I want to add some graphics to chapter.Rnw
like this:
\begin{figure}[ht!]
\begin{center}
\includegraphics[scale=0.6]{graphics/perception1.png}
\caption{something}
\label{fig:lol}
\end{center}
\end{figure}
it doesn't work - I can't compile the main document. BUT if I include preamble
to the raport
so I delete the file preamble
and paste its content to the report
(at the top) it works. How is that possible?
Thank you.