3

I have a long list of references that are of the form, for example:

\bibitem[optionalarg]{label} Text of the reference

When I compile the source, this makes the cited reference to appears as [optionalarg] in the text, instead that as numbers [X].

Is there a way to tell BibTeX to ignore that optional argument?

Here's a minimal example showing my problem:

\documentclass[12pt]{amsart}

\begin{document}

\title[Short title]{Long title}

\maketitle

This is a minimal example of what I wouldn't like (see \cite{ref1}). And of what I would like (see \cite{ref2}).

\begin{thebibliography}{00}
    \bibitem[Author1 and Author2(2013)]{ref1}
    Author1, I., \& Author2, I. (2013). Some title. \emph{Some journal}, X: xx--yy.
    \bibitem{ref2}
    Author3, I., \& Author4, I. (2013). Some other title. \emph{Some other journal}, X: xx--yy.
\end{thebibliography}

\end{document}
  • 2
    But this is what optionalarg is supposed to do. Why did you use it in the first place? And why are you generating your biblography by hand? An automaticc solution would be easier to handle. – Johannes_B Mar 20 '16 at 12:16
  • In a previous version of the paper optionalarg was used to have exactly that effect, that is to have the references to appear as, for example "see [John and Smith (2015)]". But now I have changed paper style and I would like to have it to appear as "see [1]". Of course, I could simply delete that optionarg from each reference, but it is quite an annoying task. I don't understand your remark about generating my bibliography by hand, I am using BibTex. – hardhu Mar 20 '16 at 12:34
  • 1
    It is rather unclear (to me) how you are constructing your .tex file with respect to the bibliography. If you would provide a minimal example (or see here) your question would be much clearer and an answer would be more likely to appear. – jon Mar 20 '16 at 16:43
  • 1
    And of course using external tools to convert \bibitem[optionalarg]{label} to \bibitem{label} would not be difficult if you are writing those 'by hand'. – jon Mar 20 '16 at 16:45
  • Ok I add above a minimal example. I will however consider your suggestion for an external tool. – hardhu Mar 20 '16 at 16:55
3

You can redefine \bibitem[<opt>]{<key>} to ignore [<opt>] by adding the following to your preamble:

\let\oldbibitem\bibitem% Copy \bibitem into \oldbibitem
\renewcommand{\bibitem}[2][]{\oldbibitem{#2}}% Redefine \bibitem to only use mandatory arg

The above code stores \bibitem before redefining it to only pass the mandatory argument and ignore any optional arguments.

enter image description here

\documentclass[12pt]{amsart}

\let\oldbibitem\bibitem
\renewcommand{\bibitem}[2][]{\oldbibitem{#2}}

\begin{document}

\title[Short title]{Long title}

\maketitle

This is a minimal example of what I wouldn't like (see \cite{ref1}). And of what I would like (see \cite{ref2}).

\begin{thebibliography}{00}
  \bibitem[Author1 and Author2(2013)]{ref1}
    Author1, I., \& Author2, I. (2013). Some title. \emph{Some journal}, X: xx--yy.
  \bibitem{ref2}
    Author3, I., \& Author4, I. (2013). Some other title. \emph{Some other journal}, X: xx--yy.
\end{thebibliography}

\end{document}

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.