Found a "fix"!
The problem happens only if you have a fresh TeXstudio session (i.e. if you properly exited each individual file shown in the tabs above the editor). So with a fresh session,
- Open the
main.tex
and the chapter_1.tex
files. You should(?) see my problem mentioned in this post.
- Now, close the entire TeXstudio session without first exiting the individual files.
- Open either
.tex
file again. The problem should now be fixed in chapter_1
.
Notes: If you open another chapter file after step 3, for example chapter_2.tex
, the problem will exist for chapter_2.tex
until you do steps 2-3 again. Also, if you close main.tex
(the file with the packages) and try to exit and restart your TeXstudio session then any chapters that you kept open will have the problem again. main.tex
must always be open before exiting the session.
Good enough for me.
It seems that you have the error (created with a wrong \addbibresource {\jobname.bib}
in line 67)
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.67 \addbibresource
{\jobname.bib} % <=======================================
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
That means you should move the command \addbibresource {\jobname.bib}
into the preamble.
Please see the following MWE (package filecontents
is only used to have the bib file and the TeX code in one MWE!) mwe.tex
:
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@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{goossens,
author = {Goossens, Michel and Mittelbach, Frank and
Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994},
}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980},
}
\end{filecontents}
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[%
backend=biber,
articletitle=true,
style=chem-rsc,
doi=false
]{biblatex}
\addbibresource{\jobname.bib} % <========================== okay! ======
\begin{document}
\tableofcontents
\section{Introduction}
Add \nocite{*} to call all bib entrys or cite at last one
like~\cite{adams} or~\textcite{goossens}.
%\addbibresource{\jobname.bib} % <======================= wrong!!=======
%\phantomsection
%\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography[heading=bibnumbered] % <=============================
\end{document}
and the resulting pdf (compiled without errors and only one warning, comming from filecontents
(okay)):
If you editor does not show resulting error messages and warnings check the files mwe.log
and mwe.blg
for errors and warnings.
EDIT:
Your next step can be to validate your bib file.
Copy my file mwe.tex
to your computer, compile it three times and check that there are no errors.
Now copy your first bib entry from file PhylogeneticApproach.bib
to the bib file in mwe.tex
, compile three times and check for errors and warnings.
Correct them. Recompile three times and check for errors ...
copy the second bib entry from file PhylogeneticApproach.bib
...
...
Best Answer
As of version 2.8.10, accelerator keys for setting the explicit root document do no longer work.
However, TeXStudio supports a magic comment (at the beginning of the document)
that allows setting file that is used when Options > Root Document > Detect automatically is enabled.
So basically, the root-document resolution order is
% !TeX root
magic comment.