0

im very new to Latex, and im now trying to make references work. It just doesnt work! I dont know what im doing wring, so in desperation I simply downloaded this https://www.overleaf.com/project/5c8ac946c46f07759d00e065 and compiled it, and i saw no reference (the online compiler in overleaf shows very pretty referencejust as its supposed to)! So i think the reason is some missing package in miktex. I use texmaker and miktex

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[
backend=biber,
style=alphabetic,
sorting=ynt
]{biblatex}

\addbibresource{sample.bib}

\title{Bibliography management: \texttt{biblatex} package}
\author{Share\LaTeX}
\date{ }

\begin{document}

\maketitle

\tableofcontents

\section{First section}

Using \texttt{biblatex} you can display bibliography divided into sections, depending of citation type. 
Let's cite! Einstein's journal paper \cite{einstein} and the Dirac's book \cite{dirac} are physics related items. 
Next, \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Donald Knuth's website \cite{knuthwebsite}, \textit{The Comprehensive Tex Archive Network} (CTAN) \cite{ctan} are \LaTeX\ related items; but the others Donald Knuth's items \cite{knuth-fa,knuth-acp} are dedicated to programming. 

\medskip

\printbibliography[
heading=bibintoc,
title={Whole bibliography}
]

\clearpage

%Filters bibliography
\printbibliography[heading=subbibintoc,type=article,title={Articles only}]
\printbibliography[type=book,title={Books only}]

\printbibliography[keyword={physics},title={Physics-related only}]
\printbibliography[keyword={latex},title={\LaTeX-related only}]

\end{document}

And the .bib 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",
  keywords =     "physics"
}

@book{dirac,
  title={The Principles of Quantum Mechanics},
  author={Paul Adrien Maurice Dirac},
  isbn={9780198520115},
  series={International series of monographs on physics},
  year={1981},
  publisher={Clarendon Press},
  keywords = {physics}
}

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

@online{knuthwebsite,
    author    = "Donald Knuth",
    title     = "Knuth: Computers and Typesetting",
    url       = "http://www-cs-faculty.stanford.edu/~uno/abcde.html",
    addendum = "(accessed: 01.09.2016)",
    keywords  = "latex,knuth"
}

@inbook{knuth-fa,
   author = "Donald E. Knuth",
   title = "Fundamental Algorithms",
   publisher = "Addison-Wesley",
   year = "1973",
   chapter = "1.2",
   keywords  = "knuth,programming"
}

@book{knuth-acp,
   author = "Donald E. Knuth",
   publisher = "Addison-Wesley",
   title = "The Art of Computer Programming",
   series = "Four volumes",
   year = "1968",
   note = "Seven volumes planned",
   keywords  = "knuth,programming"
}

@article{ctan,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    pages   = "342--351",
    keywords  = "latex"
}
moewe
  • 175,683
Hans
  • 53
  • 2
    Please add a compilable MWE and don't add any form of external links. Because, over-time, those links will be dead. – Raaja_is_at_topanswers.xyz Mar 15 '19 at 13:05
  • Okay i did it. could you look at it? – Hans Mar 15 '19 at 13:14
  • 5
    Are you running biber on your computer? – Sigur Mar 15 '19 at 13:17
  • Yea, im figuring it was something about biber. I also got a warning from texmaker to run the tex file with biber. But what is biber? I have a package called biber at least. Although i dont have a program called biber... – Hans Mar 15 '19 at 13:20
  • Ok ill do that... – Hans Mar 15 '19 at 13:30
  • 1
    Kurt's link (https://tex.stackexchange.com/q/154751/35864) already tells you how to set up Biber in your editor. https://tex.stackexchange.com/q/63852/35864 has a great explanation what Biber is and does. – moewe Mar 15 '19 at 13:42
  • Now i get the warning "empty bibliography" on my command \printbibliography when i try on my actual work (not this overleaf example). Can you not use Bibtex only or do you have to have both bibtex and biber? What do the two of them do? I can not understand any tutorial i find online, they are too technical. – Hans Mar 15 '19 at 14:34
  • You need to run LaTeX on your document. Then you need to run Biber. And after that LaTeX twice more. A more in-depth explanation why that is necessary and what each step does can be found in the already linked https://tex.stackexchange.com/q/63852/35864. – moewe Mar 15 '19 at 14:44
  • What does run latex on my document mean? Is that the same as compiling it? Do you want me to compile with Latex instead of PDFlatex? What is Latex? I have texmaker. What file should i run biber on? – Hans Mar 15 '19 at 14:57
  • In this context "LaTeX" is shorthand for your favourite flavour of the TeX engine with LaTeX format. For many people that is pdfLaTeX, but it could also mean LuaLaTeX or XeLaTeX (or LaTeX without pdf which would normally give DVI output). TeXmaker has a Tools menu where you can select "pdfLaTeX" (or press F6), which is quite probably what you want here. If you have configured TeXmaker as in the link, you can then press "BibTeX" (F11) which will run Biber for you. Then run pdfLaTeX (F6) twice more. – moewe Mar 15 '19 at 15:10
  • So am i supposed to run biber and then pdfLaTeX on my main file where all the text is or the .bib file where my references are? – Hans Mar 15 '19 at 15:26
  • All of those steps should be executed with the main .tex file in focus in TeXmaker. (Formally LaTeX is run on the .tex file and Biber on a .bcf file, but you don't have to worry about that if your editor is configured correctly.) None of the programs is run on the .bib file. – moewe Mar 15 '19 at 15:49
  • When i run with BibTeX, i get this error: INFO - This is Biber 2.12 INFO - Logfile is 'GYMNASIEARBETE.blg' INFO - Reading 'GYMNASIEARBETE.bcf' INFO - Found 0 citekeys in bib section 0 WARN - The file 'GYMNASIEARBETE.bcf' does not contain any citations! INFO - Writing 'GYMNASIEARBETE.bbl' with encoding 'UTF-8' INFO - Output to GYMNASIEARBETE.bbl INFO - WARNINGS: 1 – Hans Mar 15 '19 at 15:53
  • That message suggests that you did not \cite anything in GYMNASIEARBETE.tex. Does GYMNASIEARBETE.tex look exactly as in the example above? – moewe Mar 15 '19 at 15:54
  • Any news here? Could you solve your problem? – moewe Mar 16 '19 at 10:44
  • Yes sorry for answering so slow. No the example above is just directly ripped off of overleafs example. In GYMNASIEARBETE (the thing im actually working on) i have not cited anything, no. But I' just want to make sure the \printbibliography command works first, and it doesnt. But is that because i havent cited anything? Cant you produce a bibliography if you havent cited anything? Should i just add a random \cite? – Hans Mar 16 '19 at 11:14
  • Let's continue this discussion in the chat: https://chat.stackexchange.com/rooms/91079/discussion-between-moewe-and-hans That make near-real-time communication easier. – moewe Mar 16 '19 at 11:21
  • Since we apparently solved the issue after a lengthy chat discussion I guess it makes sense to close this question as a duplicate of the classic "run Biber/BibTeX" question (https://tex.stackexchange.com/q/63852/35864). The two other questions https://tex.stackexchange.com/q/154751/35864 and https://tex.stackexchange.com/q/13509/35864 are also very relevant. – moewe Mar 28 '19 at 09:00

0 Answers0