1

I'm using TexStudio for my Final Study Project. I've tried so hard and in many different ways to compile my bibliography and the acronyms, but without success.

I'm using XeLaTeX, and BibTeX for the bibliography document. The PDF compiles and everything is OK except the bibliography and the acronyms, which don't appear.

The document Estilo.tex is a .tex document that contains all the packages used. Its code is included at the end.

The document Capitulos.tex is a .tex document that includes all the chapters. This document is OK, there are no errors.

The Bib.bib document that contains all the bibliography is called "Bib".

Main .tex document code

\documentclass[a4paper,openany,10pt,twoside]{report}

\usepackage{Estilo}

\newacronym{ahv}{AHV}{Análisis de Hidrocarburos Volátiles}
\newacronym{ccah}{CCAH}{Comité Científico de la Alimentación Humana}
\newacronym{cee}{CEE}{Comunidad Económica Europea}
\newacronym{cv}{CV}{Cuarzo Verde}
\newacronym{cc}{CC}{Calcita}
\newacronym{din}{DIN}{Departamento de Ingeniería Nuclear}

\begin{document}


\begin{titlepage}
blablabla   
\end{titlepage}

\tableofcontents 

\listoffigures 

\listoftables

\printglossary[type=\acronymtype,title=Acr'{o}nimos]


\include{Capitulos}

\newpage

\bibliographystyle{plainnat}
\addcontentsline{toc}{chapter}{Bibliografia}
\bibliography{Bib}


\end{document}

When compiling the code above I get an error message in the sentence

\bibliographystyle{plainnat}

saying

Package biblatex Error: '\bibliographystyle' invalid. \bibliographystyle

I also get an error message in the sentence

\bibliography{Bib}

saying

Error: can be used only in preamble. \bibliography

For the references citations I've tried both \cite and \citep functions but no one works.

For the acronyms I don't get any error message but the list is not created. In the chapters, I have tried both \acrfull and \gls functions but no one seems to work.

"Estilo" code

\usepackage[spanish, es-tabla]{babel} 
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{amsmath, amsthm,amssymb}
\usepackage{lmodern}
\usepackage{rotating}
\usepackage{textcomp}
\usepackage{url}
\usepackage[square,sort&compress]{natbib}
%\usepackage[maxbibnames=99, backend=bibtex, sorting=none]{biblatex}
%\addbibresource{Bib.bib}
\usepackage[export]{adjustbox}
\usepackage{pdfpages}
\usepackage{graphicx}
\DeclareGraphicsExtensions{.pdf,.png,.eps,.jpg}
\usepackage{sidecap} 
\usepackage{stfloats}
\usepackage{subfig}
\usepackage{epstopdf}
\usepackage{array} %for parragraphs tables
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{fixltx2e} 
\usepackage{fixmath}%\textsubscript
\usepackage{siunitx}
\usepackage{fancyhdr}
\usepackage{color}
\usepackage{verbatim}
\usepackage[acronym,automake]{glossaries}
\makeglossaries
%\glossarystyle{altlistgroup}

\newif\ifabbreviation
\pretocmd{\thebibliography}{\abbreviationfalse}{}{}
\AtBeginDocument{\abbreviationtrue}
\DeclareRobustCommand\acroauthor[2]{%
    \ifabbreviation #2\else #1 (\mbox{#2})\fi}
\newcommand*\NewPage{\newpage\null\thispagestyle{empty}\newpage}

In the last page of the PDF document created there is the word Bib, which is the name of my .bib bibliography document. I don't know what that can mean. I attach a picture of this page.

enter image description here

I would be very thankful if you could help me.

Thank you very much.

0

Well, it seems you copied several parts of your shown code from several internet documents not understanding what they do.

Please do not do that, use only code you understand! Otherwise you will get results you can not correct!

That is very problematic, because you used commands which can not work together. See for example the code snippet:

\usepackage[spanish, es-tabla]{babel} 
%\usepackage{polyglossia}

You can use babel or polyglossia, but not both together. You can read the documentations for both packages using the commands texdoc babel and texdoc polyglossia in your terminal/console.

See the following snippet:

%\usepackage{fontspec}
\usepackage{lmodern}
\usepackage{textcomp}

You can use fontspec for compiling with xelatex or lualatex, but then you should omit packages lmodern and textcomp. From the rest of your code I can not see any reason why you have to use xelatex instead of pdflatex. So I suggest you use pdflatex.

In your shown code you have commented the following lines in your preamble:

%\usepackage[maxbibnames=99, backend=bibtex, sorting=none]{biblatex}
%\addbibresource{Bib.bib}

but the error message you showed

Package biblatex Error: '\bibliographystyle' invalid.

\bibliographystyle Error: can be used only in preamble. \bibliography

shows that you tried to load package biblatex and using bibliographystyle. That simply can not work.

You can use bibtex (no biblatex in preamble!) with the lines

\bibliographystyle{plainnat}
\bibliography{Bib}

or you have to call biblatex in the preamble and use then the line

\printbibliography

where you want to place your bibliography instead of using \bibliographystyle and \bibliography.

Now using

You can see in \cite{Goossens} and \cite{einstein,adams} that \dots

in your code you can use the following bib file

@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},
}
@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},
} 

with the following tex code (I reduced the called packages relevant to the issue here)

\documentclass[a4paper,openany,10pt,twoside]{report}

\usepackage[spanish,es-tabla]{babel} 

\usepackage{amsmath,amsthm,amssymb}

\usepackage{lmodern}
\usepackage{textcomp}

\usepackage{url}
\usepackage[square,sort&compress]{natbib}

%\usepackage{fixltx2e} % <========================================== obsolete

\usepackage{blindtext} % <============================ dummy text in document

\usepackage[acronym,automake]{glossaries}
\makeglossaries
%\glossarystyle{altlistgroup}

\newif\ifabbreviation
\pretocmd{\thebibliography}{\abbreviationfalse}{}{}
\AtBeginDocument{\abbreviationtrue}
\DeclareRobustCommand\acroauthor[2]{%
    \ifabbreviation #2\else #1 (\mbox{#2})\fi}
\newcommand*\NewPage{\newpage\null\thispagestyle{empty}\newpage}

\newacronym{ahv}{AHV}{Análisis de Hidrocarburos Volátiles}
\newacronym{ccah}{CCAH}{Comité Científico de la Alimentación Humana}
\newacronym{cee}{CEE}{Comunidad Económica Europea}
\newacronym{cv}{CV}{Cuarzo Verde}
\newacronym{cc}{CC}{Calcita}
\newacronym{din}{DIN}{Departamento de Ingeniería Nuclear}


\begin{document}

\begin{titlepage}
blablabla   
\end{titlepage}

\tableofcontents 

\listoffigures 

\listoftables

\printglossary[type=\acronymtype,title=Acr'{o}nimos]

\Blindtext
You can see in \cite{Goossens} and \cite{einstein,adams} that \dots

\bibliographystyle{plainnat}
\addcontentsline{toc}{chapter}{Bibliografia}
\bibliography{Bib} 

\end{document}

you get the following result for the bibliography:

citings

and the bibliography

bibliography

Your question about glossaries and acronym is already anwered in this question, please check it!

We try to keep only one question in an question here. Please ask a new question about glossaries if you have problems creating your glossary with the linked question ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.