I'm new to using Latex. I want to import File reference.bib to my File document.tex. Above is my Code
reference.bib
#article{lin1973,
author = "Shen Lin and Brian W. Kernighan",
title = "An Effective Heuristic Algorithm for the Travelling-Salesman Problem",
journal = "Operations Research",
volume = 21,
year = 1973,
pages = "498-516"
}
And here is my document.tex
\documentclass[a4paper,12pt, fleqn]{scrreprt}
\usepackage{natbib}
\begin{document}
\bibliographystyle{plainnat}
\bibliography{reference}
\end{document}
But nothing happens when i run my Latex. Can anyone help me.
Thanks in Advance ^^
There is a separate platform to ask LateX-related questions.
Apart from that, the question is really vague.
Let's start with your document having no content. Assuming that your LateX environment has been set up properly, adding something to your document should do something.
Compile, run BibteX twice, compile again a few times and you should be set.
EDIT: removed screenshot output file, as it was needlessly taking up space.
BibTeX build is usually found in your interpreter:
\documentclass[a4paper,12pt, fleqn]{scrreprt}
\usepackage{natbib}
\begin{document}
Blablabla happened because I need to cite \cite{lin1973}..
\bibliographystyle{plainnat}
\bibliography{reference}
\end{document}
Related
This is my test.tex file....
\documentclass[oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[
backend=biber,
style=alphabetic,
citestyle=authoryear
]{biblatex}
\addbibresource{ref}
\begin{document}
\frontmatter
\title{\vspace{-1.0cm}\textbf{\Large{This is a title}}} %Title
\mainmatter
some Random Text Yayyyyyyy
some Random Text Yayyyyyyy
some Random Text Yayyyyyyy
Random text here \cite{a1}.
some Random Text Yayyyyyyy
some Random Text Yayyyyyyy \cite{a2}
\backmatter
\printbibliography
\end{document}
and this is my ref.bib file......
#article{a1,
title= "Peter Gabriel Bergmann, Introduction to the theory of relativity",
author= "Infeld, L"
journal="Bulletin of the American Mathematical Society",
volume="49",
number="7",
pages="527--529",
year="1943",
publisher="American Mathematical Society"
"
#book{a2,
title="Matrices and tensors in physics",
author="Joshi, Avinash Wasudeo",
year="1995",
publisher="New Age International"
}
My error message is,
Process started
INFO - This is Biber 2.16 INFO - Logfile is 'test.aux.blg'
ERROR - Cannot find 'test.aux.bcf'! INFO - ERRORS: 1
Process exited with error(s)
Can anybody help i am tired of this and want to solve this so that i can apply it to my thesis. im using TexMaker.
I have verified that the root was to remove the compiler option to create the LATEX files in the build folder, my computer could not find the .bcf file being in this folder. But once I unchecked the box and the files were in the same folder as the .tex files, it was solved.
On the other hand, the code \addbibresource{ref} must appear like \addbibresource{ref.bib}.
In the compiler configuration, I have written the path of biber.exe: "C:/Users/juanf/Documents/Programas/LATEX/miktex/bin/x64/biber" %.bcf
(You must put the path that appears in the properties of your biber.exe)
I hope it helps you or other people with the same problem!
For some days I am trying to solve the following problem for which I wasn't able to find a solution. Help is very much appreciated.
I am writing a long document and for some sections I would like to print a subset of items from the total bibliography that will be included at the very end before the appendix.
Is there a way do this? I was playing with refsection and imagining something like:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\begin{refsection}[references.bib]
\nocite{*}
\printbibliography[heading=none]
\end{refsection}
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}
ownpubs.bib:
#article{einstein1935can,
title={Can quantum-mechanical description of physical reality be considered complete?},
author={Einstein, Albert and Podolsky, Boris and Rosen, Nathan},
journal={Physical review},
volume={47},
number={10},
pages={777},
year={1935},
publisher={APS}
}
#article{einstein1905movement,
title={On the movement of small particles suspended in stationary liquids required by the molecularkinetic theory of heat},
author={Einstein, A},
journal={Ann. d. Phys},
volume={17},
number={549-560},
pages={1},
year={1905}
}
references.bib:
#article{schrodinger1935gegenwartige,
title={Die gegenw{\"a}rtige Situation in der Quantenmechanik},
author={Schr{\"o}dinger, Erwin},
journal={Naturwissenschaften},
volume={23},
number={50},
pages={844--849},
year={1935},
publisher={Springer-Verlag}
}
With the above code I got the bibliographies printed, but the references (numbers) are not consistent.
Does anyone know a way to approach this problem? I am in no means restricted to splitting the files up. That was just the only solution I was able to come up with.
Thanks for your help and warm Greetings!
You could use a similar approach as in https://tex.stackexchange.com/a/166018 and automatically add some keyword to all entries in references.bib. This will allow you to filter for those when using \printbibliography:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\perdatasource{references.bib}
\step[fieldset=keywords, fieldvalue={,Perhalo}, append]
}
}
}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\printbibliography[heading=none,keyword={Perhalo}]
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}
I'm using a LaTeX template (provided by ASME) to write a conference paper.
The asme2e.cls class defines a "nomenclature" environment as follows:
% Nomenclature environment
\newbox\tempbox
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\setbox\tempbox\hbox{##1.\quad}
\hangindent\wd\tempbox\noindent{##1}\quad\ignorespaces##2\par}
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
which is used, in the .tex source file, as follows:
\begin{nomenclature}
% [...]
\entry{$C_{visc}$}{Viscous friction coefficient.}
\entry{$M$}{Spool mass.}
% [...]
\end{nomenclature}
resulting in the description texts not being left justified (since a fixed horizontal space is inserted between the symbol (e.g.: M) and the description (e.g.: Spool mass.), but the symbols have different lengths (e.g.: Cvisc is longer than M).
Is there a way to fix the class to have left-justified descriptions?
(I did a few experiments with \dimexpr and the calc package, but just got a bunch of errors).
(I also asked ASME if they could provide an updated template, but I'm still waiting for their feedback...)
I couldn't solve the problem, but I found a "quick and dirty" workaround, using the Tabbing and setspace packages.
Here is the new .tex source:
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
{\setstretch{1.1}
\begin{tabbing}
\noindent
% [...]
\entry{$C_{visc}$}\quad\quad\={Viscous friction coefficient.}\\
\entry{$M$}\>{Spool mass.}\\
\entry{$v$}\>{Spool velocity.}\\
% [...]
\end{tabbing}
} % end \setstretch
\end{nomenclature}
%[...]
(Clearly, I'm completely bypassing the \entry command defined by the asme2e.cls class for the nomenclature environment).
I also tried to edit the asme2ej.cls file but nothing working for me. Then I ended up using the tabbing and set space packages. However, I did not use the \setstretch, and my document compiled just fine.
%[...]
\usepackage{Tabbing}
\usepackage{setspace}
%[...]
\begin{nomenclature}
\begin{tabbing}
\noindent
\entry{XYZ}\quad\quad\={This is an example}\\
\entry{PQR}\>{This is an example}\\
\entry{ZXC}\>{This is an example}\\
\entry{CVN}\>{This is an example}\\
\end{tabbing}
\end{nomenclature}
%[...]
I ran into a similar issue when submitting a paper to an ASME journal. My solution was to edit the asme2e.cls file:
\newenvironment{nomenclature}{%
\newcommand\entry[2]{\noindent\hbox to 0.05\textwidth{##1}\ignorespaces##2\par}
\section*{Nomenclature}}{\par\addvspace{12pt}}
You can change the amount of indentation by changing "0.05\textwidth".
I'm not sure if this is what you're asking, but see the following MWE:
\documentclass[12pt]{article}
\newlength{\nomenlabelindent}
\setlength{\nomenlabelindent}{4em}
\newenvironment{nomenclature}{%
\newcommand\entry[2]{%
\hangindent\nomenlabelindent\noindent\makebox[\nomenlabelindent][l]{##1\quad}\ignorespaces##2\par}%
\section*{NOMENCLATURE}}{\par\addvspace{12pt}}
\begin{document}
\begin{nomenclature}
\entry{$A$} {Parameter}
\entry{$B$} {Parameter}
\entry{$C$}{Parameter}
\entry{$D$}{Parameter}
\entry{$E$}{Parameter}
\end{nomenclature}
\end{document}
Output:
Nomenclature
I try to use apsrev4-1.bst as bibliographystyle to manage format of my prl (physical review letters) paper. However, I got a error I don't understand. Actually, my code works well if using prl.bst, but report error: "! File ended while scanning use of \#secondoftwo." (the reason I want to use apsrev4-1.bst instead of prl.bst is because prl.bst will show title in reference which I don't know why either). I haven't played with latex for very long time, and this is the first time I deal with bibtex of PRL paper. Can somebody give me a hint how can I solve this problem?
\NeedsTeXFormat{LaTeX2e}
\documentclass[aps,prl,showpacs, superscriptaddress, lengthcheck]{revtex4-1}
%\usepackage{hyperref}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{color}
\usepackage{natbib}
\bibliographystyle{apsrev4-1}
\begin{document}
\bibliography{KZ_PRL_v8}
\end{document}
For me this error was caused by some incompatible items in my bib file.
For example, there was an item in my bib file whose journal was "Computers \& Fluids". After I deleted the "\&", this error message never came out again.
So check the items in your bib file.
By default (using the plain style) BibTeX orders citations alphabetically.
How to order the citations by order of appearance in the document?
There are three good answers to this question.
Use the unsrt bibliography style, if you're happy with its formatting otherwise
Use the makebst (link) tool to design your own bibliography style
And my personal recommendation:
Use the biblatex package (link). It's the most complete and flexible bibliography tool in the LaTeX world.
Using biblatex, you'd write something like
\documentclass[12pt]{article}
\usepackage[sorting=none]{biblatex}
\bibliography{journals,phd-references} % Where journals.bib and phd-references.bib are BibTeX databases
\begin{document}
\cite{robertson2007}
\cite{earnshaw1842}
\printbibliography
\end{document}
Change
\bibliographystyle{plain}
to
\bibliographystyle{ieeetr}
Then rebuild it a few times to replace the .aux and .bbl files that were made when you used the plain style.
Or simply delete the .aux and .bbl files and rebuild.
If you use MiKTeX you shouldn't need to download anything extra.
The best I came up with is using the unsrt style, which seems to be a tweaked plain style. i.e.
\bibliographystyle{unsrt}
\bibliography{bibliography}
However what if my style is not the default?
Just a brief note - I'm using a modified version of plain.bst sitting in the directory with my Latex files; it turns out having sorting by order of appearance is a relatively easy change; just find the piece of code:
...
ITERATE {presort}
SORT
...
... and comment it - I turned it to:
...
%% % avoid sort:
%% ITERATE {presort}
%%
%% SORT
...
... and then, after running bibtex, pdflatex, pdflatex - the citations will be sorted by order of appearance (that is, they will be unsorted :) ).
Cheers!
EDIT: just realized that what I wrote is actually in the comment by #ChrisN: "can you edit it to remove the SORT command" ;)
You answered your own question---unsrt is to be used when you want references to ne listed in the order of appeareance.
But you might also want to have a look at natbib, an extremely flexible citation package. I can not imagine living without it.
I'm a bit new to Bibtex (and to Latex in general) and I'd like to revive this old post since I found it came up in many of my Google search inquiries about the ordering of a bibliography in Latex.
I'm providing a more verbose answer to this question in the hope that it might help some novices out there facing the same difficulties as me.
Here is an example of the main .tex file in which the bibliography is called:
\documentclass{article}
\begin{document}
So basically this is where the body of your document goes.
``FreeBSD is easy to install,'' said no one ever \cite{drugtrafficker88}.
``Yeah well at least I've got chicken,'' said Leeroy Jenkins \cite{goodenough04}.
\newpage
\bibliographystyle{ieeetr} % Use ieeetr to list refs in the order they're cited
\bibliography{references} % Or whatever your .bib file is called
\end{document}
...and an example of the .bib file itself:
#ARTICLE{ goodenough04,
AUTHOR = "G. D. Goodenough and others",
TITLE = "What it's like to have a sick-nasty last name",
JOURNAL = "IEEE Trans. Geosci. Rem. Sens.",
YEAR = "xxxx",
volume = "xx",
number = "xx",
pages = "xx--xx"
}
#BOOK{ drugtrafficker88,
AUTHOR = "G. Drugtrafficker",
TITLE = "What it's Like to Have a Misleading Last Name",
YEAR = "xxxx",
PUBLISHER = "Harcourt Brace Jovanovich, Inc."
ADDRESS = "The Florida Alps, FL, USA"
}
Note the references in the .bib file are listed in reverse order but the references are listed in the order they are cited in the paper.
More information on the formatting of your .bib file can be found here: http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management
I often use the bibliography style natbib because it supplies quite complete set of formats as well as tags for us.
Add this if you want the number of citations to appear in order in the document
they will only be unsorted in the reference page:
\bibliographystyle{unsrt}
I used the following in overleaf and become in ascending order:
\usepackage{cite}
\bibliographystyle{unsrt}
with unsrt the problem is the format. use \bibliographystyle{ieeetr} to get refences in order of citation in document.
If you happen to be using amsrefs they will override all the above - so comment out:
\usepackage{amsrefs}
The datatool package offers a nice way to sort bibliography by an arbitrary criterion, by converting it first into some database format.
Short example, taken from here and posted for the record:
\documentclass{article}
\usepackage{databib}
\begin{document}
% First argument is the name of new datatool database
% Second argument is list of .bib files
\DTLloadbbl{mybibdata}{acmtr}
% Sort database in order of year starting from most recent
\DTLsort{Year=descending}{mybibdata}
% Add citations
\nocite{*}
% Display bibliography
\DTLbibliography{mybibdata}
\end{document}
I use natbib in combination with bibliographystyle{apa}. Eg:
\begin{document}
The body of the document goes here...
\newpage
\bibliography{bibliography} % Or whatever you decided to call your .bib file
\usepackage[round, comma, sort&compress ]{natbib}
bibliographystyle{apa}
\end{document}