3

I am writing a thesis and I am organizing the contents in the way described on this page.

In my project folder, the main document is thesis.tex. It looks like this:

% Write the thesis in report format (thesis.tex)
\documentclass[12pt,letterpaper]{report}

% Insert packages
\usepackage{style}

% Insert preamble
\input{./tex/preamble}

% Begin the thesis
\begin{document}

% Insert title
\input{./tex/title}

% Insert table of contents, figures, and tables
\tableofcontents
\listoffigures
\listoftables

% Insert the introduction
\input{./tex/introduction}

% Insert the conclusion
\input{./tex/conclusion}

% Insert the bibliography
\input{./tex/bibliography}

\end{document}

As you can see, all the chapters are located in the tex subdirectory. In particular, the tex subdirectory contains a bib file tex/references.bib and a file tex/bibliography.tex that looks like this:

% Bibliography (tex/bibliography.tex)

% Make the bibliography
\bibliographystyle{plain}
\bibliography{./references}

Now when I compile thesis.tex, the bibliography doesn't appear and I get

Warning: Citation 'aslam2013' undefined on page 4 on input line 4

However, if I instead put the following directly in thesis.tex:

\bibliographystyle{plain}
\bibliography{./tex/references} 

then I get no warning and the bibliography appears.

It's not such a big deal, but I would have liked my bibliography to be organized in a tex file just like the others. Why can't I include the bibliography the way I do? It must be quite obvious for some of you but I really can't see what's wrong...

I'm using Texnic Center on Windows 10.

1 Answer 1

4

Your paths always have to be relative to the main document - i.e. thesis.tex. This applies to \bibliography, as well as to \inputs and \includegraphics. Thus, you have to call

\bibliography{./tex/references} 

inside your file ./tex/bibliography.tex - even though both files are located in the same directory.

The same applies e.g. to images: in your file ./tex/introduction.tex, you'll have to include an example image located at ./tex/images/intro_image.jpg with

\includegraphics{./tex/images/intro_image.jpg}

and not with ./images/intro_image.jpg.

1
  • UGH. It was so simple lol. It works now, thanks very much for the help. It's a good general principle to be aware of.
    – Ben
    Commented Oct 6, 2016 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .