0

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)

M.A
  • 101
  • What document class are you using? – user94293 Dec 17 '19 at 09:38
  • \documentclass[10pt,a4paper,reqno]{amsart} – M.A Dec 17 '19 at 10:43
  • Is this about your previous question? If so, you should add a link to it, so people know what your requirements are. – Disenchanted Lurker Dec 17 '19 at 12:51
  • In general terms \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 .log and .blg files (the .log file 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
  • Are you sure that you generate your bibliography correctly? Does "A1" appear in the list of references at the end of your document? With your formatting setup it would be easy to mistake an undefined reference for a working one, since they will both show in bold. – Disenchanted Lurker Dec 18 '19 at 09:53
  • I have the message: Package biblatex Error: '\bibliographystyle' invalid. This is the code source: https://pastebin.com/raw/XV1mpKeG. – M.A Dec 18 '19 at 11:12
  • The [A1] appears using the \begin{thebibliography}{1} \bibitem[A1]{A1} \end{thebibliography}. But not with the new \bibliographystyle{amsalpha} \bibliography{\jobname}. – M.A Dec 18 '19 at 11:43

2 Answers2

2

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

In [GMS94, Theorem 1]

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.

moewe
  • 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. The filecontents environment is just there to make the example self-contained. Usually you would not have a \begin{filecontents}...\end{filecontents}, instead you would produce the .bib file directly. – moewe Dec 23 '19 at 21:00
0
\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}
user94293
  • 4,254