2

I am trying to use a manual/embedded bibiography in a knitR/LaTeX document (long story short but for various reasons I don't want to be using a seperate .bib file because this script will be used many times and moved around etc).

The following code works. However, if I add \cite{edgeRRef} - let's say just after "this report", the compiling suddenly fails. I am at a loss, because all tutorials seem to say that \cite{} should work. Am I missing something? Are some of my other packages "interfering" with my \cite{}

I am using R and knitr to embed some code as well, I should point out.

Thanks.

\documentclass[12pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\hypersetup{
colorlinks   = true, %Colours links instead of ugly boxes
urlcolor     = blue, %Colour for external hyperlinks
linkcolor    = blue, %Colour of internal links
citecolor   = blue %Colour of citations
 }
\usepackage{caption}
\setlength{\parindent}{0pt}
\usepackage{authblk}
\usepackage[nomarkers, nolists]{endfloat} %Positions figures at the end of the document and add no list of names (requires that chunk have fig.cap option)
\usepackage{soul} % Allows underline lines to be broken (use \ul{} instead of \underline{})

\usepackage{helvet} %Set up Arial as font
\renewcommand{\familydefault}{\sfdefault}

\newcommand{\Rfunction}[1]{{\texttt{#1}}}
\newcommand{\Rpackage}[1]{{\textit{#1}}}

\title{\textbf{My report}}
\author{Me}
\date{\today}



\begin{document}

\maketitle

\begingroup
\hypersetup{linkcolor=black} % force independent link colours in table of contents
\tableofcontents
\endgroup

\begingroup
\hypersetup{linkcolor=black} % force independent link colours in list of figures
\listoffigures
\endgroup



\newpage
\section{Introduction} 
This report provides the results blah blah blah.

<<first-chunk>>
print("Hello world")
@

\newpage
\begin{thebibliography}{1}
\bibitem{edgeRRef} Hello, E. 1971
\end{thebibliography}

\end{document}
2

In your example the \end{document} is missing. If I insert this, it seems to work.

This report provides the results blah blah blah.\cite{edgeRRef}

outputs

This report provides the results blah blah blah.[1]
  • Sorry, I forgot the \end{document}. Indeed, if I add it works but ONLY in TeXworks (or I'm guessing any other LaTeX editor). However, in my case, I am using R and knitr to embed some R code. And that context, it's not working. Sorry, I will update my question accordingly. – m93 May 30 at 10:03

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.