Please I need the code to produce something like "[A1, Theorem 1]" instead of [A1]. (the command \cite[Theorem1]{A1} generates just [A1]). There is an additional lines to add in preamble? (This about Citations in Bold)
2 Answers
The bibliographic issues with the code linked in the comments https://pastebin.com/raw/XV1mpKeG can be reproduced in the following shortened MWE
\documentclass[10pt,a4paper]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[style=alphabetic,backend=bibtex]{biblatex}
\DeclareFieldFormat{labelalpha}{\mkbibbold{#1}}
\DeclareFieldFormat{extraalpha}{\mkbibbold{\mknumalph{#1}}}
\AtBeginBibliography{%
\DeclareFieldFormat{labelalpha}{#1}
\DeclareFieldFormat{extraalpha}{\mknumalph{#1}}%
}
\renewcommand*{\multicitedelim}{\addcomma\space}
\begin{filecontents}{\jobname.bib}
@Book{A1,
author = {Goossens, Michel and Mittelbach,
Frank and Samarin, Alexander},
title = {The {LaTeX} Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994}
}
\end{filecontents}
\begin{document}
In \cite[Theorem~1]{A1}
\bibliographystyle{amsalpha}
\bibliography{\jobname}
\end{document}
When run this piece of code will complain
! Package biblatex Error: '\bibliographystyle' invalid.See the biblatex package documentation for explanation. Type H <return> for immediate help. ...
l.30 \bibliographystyle{amsalpha}
and if you continue despite this error also
! LaTeX Error: Can be used only in preamble.See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ...
l.31 \bibliography {\jobname}
The error occurs because you are mixing biblatex and classical BibTeX. For more on the differences between biblatex and BibTeX see bibtex vs. biber and biblatex vs. natbib, What to do to switch to biblatex?, biblatex in a nutshell (for beginners).
For biblatex your document should look like this
\documentclass[10pt,a4paper]{amsart}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[english]{babel}
\usepackage[style=alphabetic, backend=bibtex]{biblatex}
\DeclareFieldFormat{labelalpha}{\mkbibbold{#1}}
\DeclareFieldFormat{extraalpha}{\mkbibbold{\mknumalph{#1}}}
\AtBeginBibliography{%
\DeclareFieldFormat{labelalpha}{#1}%
\DeclareFieldFormat{extraalpha}{\mknumalph{#1}}%
}
\renewcommand*{\multicitedelim}{\addcomma\space}
\begin{filecontents}{\jobname.bib}
@Book{A1,
author = {Goossens, Michel and Mittelbach,
Frank and Samarin, Alexander},
title = {The {LaTeX} Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
In \cite[Theorem~1]{A1}
\printbibliography
\end{document}
After the LaTeX, BibTeX, LaTeX, LaTeX compilation cycle the output is as follows
Note that the output is "GMS94" and not "A1", the entry key (A1) is a purely internal label that is not intended to be printed in the document.
You should also seriously consider using Biber instead of BibTeX. Some of the advanced features of biblatex can only be used with Biber. Usually that is as easy as switching from backend=bibtex to backend=biber and running Biber instead of BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help with your editor.
- 175,683
-
Please the configuration of editor (Texmaker) concern just windows, but not macOS, other question: The file jobname.bib is a new file to create with extension (.bib). – M.A Dec 23 '19 at 19:43
-
@M.A It shouldn't matter a great deal which OS you are using. The gist of the answer is the same (I should add that often it is enough to just give the command, i.e.
biber, instead of the full path, i.e./Library/TeX/texbin/biber). I don't understand your second question, I'm afraid. Thefilecontentsenvironment is just there to make the example self-contained. Usually you would not have a\begin{filecontents}...\end{filecontents}, instead you would produce the.bibfile directly. – moewe Dec 23 '19 at 21:00
\documentclass[10pt,a4paper,reqno]{amsart}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Book{A1,
author = {Goossens, Michel and Mittelbach,
Frank and Samarin, Alexander},
title = {The {LaTeX} Companion},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994}
}
\end{filecontents}
\begin{document}
In \cite[Theorem~1]{A1}, \dots
\bibliographystyle{amsalpha}
\bibliography{\jobname}
\end{document}
- 4,254
![In [GMS94, Theorem 1]](../../images/3732443f8dcc7d2b59b9bb36570d0057.webp)
\cite[Theorem~1]{A1}should work and give you something like "[A1, Theorem 1]" depending on your exact style settings. We need to see a full example document that shows what you are doing (a so-called MWE: https://tex.meta.stackexchange.com/q/228/35864). Please include a screenshot of the output as well as a copy of the relevant bits of the.logand.blgfiles (the.logfile is usually too long to be added to the question, you can upload it to a text-sharing website such as https://pastebin.com/). – moewe Dec 17 '19 at 20:05