3

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.

jjankowiak
  • 3,010
  • 6
  • 28
  • 45
  • 5
    I'd try moving the `\documentclass[12 pt, a4paper]{article}` out of `preamble.Rnw` and into the first line of `raport.Rnw`. I don't guess that it matters, but it wouldn't hurt to also rename `preamble.Rnw` to `preamble.tex`. – Josh O'Brien May 11 '14 at 14:12

0 Answers0