2

I have a folder Report, that contains the file Report.tex and the subfolder References, which contains the files ref.tex and references.bib. In ref.tex I can reference a citation of references.bib. However, when in Report.tex it is not recongized (displayed as [?]). Does anyone know how I can solve this?

These are the files:

  • Report.tex:

    \documentclass{book}
    \usepackage{subfiles}
    
    \begin{document}
    \subfile{References/ref.tex}
    \end{document}
    
  • ref.tex:

    \documentclass[../Report.tex]{subfiles}
    
    \begin{document}
    \chapter{References}\label{chapter:references} Please just be a nice citation: \cite{fasshauer2011positive}.
    \bibliography{references}  \bibliographystyle{ieeetr}
    \end{document}
    
  • references.bib

    @article{fasshauer2011positive,
       title={Positive definite kernels: past, present and future},
       author={Fasshauer, Gregory E},  
       journal={Dolomite Research Notes on Approximation},
       volume={4},  
       pages={21--63},
       year={2011}
    }
    

I though I ran all the necessary files in latex/bibtex, as the references is displayed as "[1]" in ref.tex, but it still doesn't show up in Report.tex.

moewe
  • 175,683
Eric
  • 255
  • 1
    I have re-tagged your question (it is not really about biblatex, you use standard BibTeX) and made the markup a bit easier on the eye (you should use the code button to format source code, not the quotation button). I suspect this has something to do with which files one needs BibTeX to compile. Maybe Handle .bib in subfiles can help you. – moewe Jan 14 '16 at 09:19
  • Thank you for the edit. I consecutively run: references.bib in BibTeX, ref.tex in pdfLaTeX,BibTeX and pdfLaTeX, which works, then I run Report.tex as well in pdfLaTeX,BibTeX and pdfLaTeX, which does not work :( – Eric Jan 14 '16 at 09:51
  • 1
    I can't test your example right now, but it might be a problem with file paths and needed files. Maybe you can move the files to the same directory? Also, do you really need to use subfiles that is, do you have to be able to compile ref.tex on its own, or would you be fine with standard \input/\include? – moewe Jan 14 '16 at 09:55
  • @moewe, thanks! I do need subfiles (I am working on my thesis, so I want to be able to write each chapter seperately), by the file ref.tex was unnecessary. It works now, I'll write an answer, in case it'll help anyone else. – Eric Jan 14 '16 at 10:10
  • Ah, I see, maybe you should have a look at \includeonly and friends ... – moewe Jan 14 '16 at 18:13

2 Answers2

0

Thanks to moewe, I now have it working. Changing Report.tex into

\documentclass{book}
\usepackage{subfiles}

\begin{document}
This is a reference: \cite{fasshauer2011positive}.

\bibliography{References/references}
\bibliographystyle{ieeetr}

\end{document}

and removing ref.tex did the trick!

Eric
  • 255
0

First of all, deleted you temporary files especially these two files .aux, .bbl. These temporary files you will get in the same folder where you have saved your .tex file and .bib file. Then you should insert \usepackage{natbib} in your .tex file. Then compiled as a LaTex, then complied BibTeX, then compiled LaTex then dvi>ps, then ps>pdf. I think it will work. Best of luck!

  • 1
    There is no need here for natbib since BibTeX can handle things on their own, nor does the question request that (even of a solution). – Werner Jan 09 '17 at 07:32
  • Indeed, plus I came up with the solution 4 days short of a year ago. – Eric Jan 10 '17 at 13:30