0

First time using Bibtex. I was reading the tutorial of sharelatex on bibtex, here: https://www.sharelatex.com/learn/Bibliography_management_with_bibtex

I copied the bib file they provide into a file:

@article{einstein,
  author =       "Albert Einstein",
  title =        "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
                 [{On} the electrodynamics of moving bodies]",
  journal =      "Annalen der Physik",
  volume =       "322",
  number =       "10",
  pages =        "891--921",
  year =         "1905",
  DOI =          "http://dx.doi.org/10.1002/andp.19053221004"
}

@book{latexcompanion,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The \LaTeX\ Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}

@misc{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}

Then I copied the tex file:

\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

%Includes "References" in the table of contents
\usepackage[nottoc]{tocbibind}

%Title, date an author of the document
\title{Bibliography management: BibTeX}
\author{Share\LaTeX}

%Begining of the document
\begin{document}

\maketitle

\tableofcontents

\medskip

\section{First Section}
This document is an example of BibTeX using in bibliography management. Three items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}. The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}. 

\medskip

%Sets the bibliography style to UNSRT and imports the 
%bibliography file "samples.bib".
\bibliographystyle{unsrt}
\bibliography{sample}

\end{document}

Saved both files in the same folder, opened the .tex file and clicked on compile. Citations don't appear, I get a [?] instead. I get the warning "Citation 'latexcompanion' on page 1 undefined."

This works on their browser viewer but not on texmaker. What am I doing wrong? https://www.sharelatex.com/project/599adc0ba7ae683b1d0ce92a

Pedro
  • 185
  • 1
    Did you run bibtex? see https://tex.stackexchange.com/questions/63852/question-mark-or-bold-citation-key-instead-of-citation-number for more information – samcarter_is_at_topanswers.xyz Aug 21 '17 at 13:37
  • No, that was it. Thanks! I am confused about the extension, is it .bib or .bibtex? – Pedro Aug 21 '17 at 13:42
  • Ok, it worked previously but now its not working. It says it cannot open the .aux file. – Pedro Aug 21 '17 at 14:03
  • Is there a correct order to run the bibtex and latexPdf? I get the an error message:

    This is Bibtex, version .... The top-level auxiliary file: extract.aux couldnt open database file pat1.bib--line 3 of the file extract.aux : \bibdata{pat1 : } Im skipping whatever remains of this command ...

    – Pedro Aug 21 '17 at 14:06
  • Please have a look at the link in my first comment, there the correct order to run the commands is given – samcarter_is_at_topanswers.xyz Aug 21 '17 at 14:07
  • 2
    From the error message you show, it can not open pat1.bib. Is this the correct name? In the example you showed in your question, the file was named sample.bib - which one is correct? – samcarter_is_at_topanswers.xyz Aug 21 '17 at 14:15
  • 1
    Are you sure the error message is complete? Normally it would say something like I couldn't open database file ... – samcarter_is_at_topanswers.xyz Aug 21 '17 at 14:18

0 Answers0