10

is there a way to indicate/mark certain selected references in the bibliography section. For example I want to use simple natbib citations (author-year) in the main text (standard as they are). However in my reference list (bibliography) I want mark some references (not all) with an asterisk before the main name. Here a short example, but how to add the asterisk? Do I need to introduce a new field (eg. marker) for @article and define a new bibliography style the accounts for the new field?

\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{test,
author={Name},
journal={Journal},
title={TITLE},
year={2011},
}
\end{filecontents}
\documentclass{article}
\usepackage[authoryear]{natbib}
\bibliographystyle{apalike}
\begin{document}
\cite{test}

\bibliography{test}

\end{document}
1

2 Answers 2

4

Here's a solution that works with BibTeX and the natbib citation management package. It's admittedly quite kludgy. If someone's got a better solution, please step forward.

The solution consists of three parts. First, add the following lines to the top of the .bib file:

@preamble{ " \newcommand{\noopsort}[1]{} "
         # " \newcommand{\bibstar}{\textsuperscript{*}} " }

If necessary, modify the definition of \bibstar so that its output conforms to your needs. The macro \noopsort seems to do nothing but, as will become clear soon, is very useful for sorting purposes.

Second, for each entry that's supposed to be prefixed with a "star" in the references section, modify the (first) author's name as follows: Instead of, say,

author = {Henry Jones},

write

author = {Henry \noopsort{Jones}\bibstar{}Jones},

The instruction \noopsort{Jones} ensures that the entry will be sorted under "J" for "Jones" rather than under whatever BibTeX decides the sorting order may be for "*" (probably after "Z").

Third, for each starred entry, define a "citation alias" using the mechanism provided by natbib. E.g., if the entry for Henry Jones's piece has the key jones11, you'd write

\defcitealias{jones11}{Jones (2011)}

in the preamble (after the natbib package has been loaded).

With these three things put in place, use \citetalias rather than \citet to cite the entry in question, i.e., write \citetalias{jones11}. (If you use \citet you'd get, surprise, *Jones (2011)...)

A full example:

enter image description here

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@preamble{ " \newcommand{\noop}[1]{} "
         # " \newcommand{\bibstar}{\textsuperscript{*}} " }
@article{jones11,
author={Henry \noop{Jones}\bibstar{}Jones},
journal={Circularity Today},
title={Deep thoughts},
year={2011},
volume = 1,
issue  = 1,
pages  = "1-101",
}
\end{filecontents*}
\documentclass{article}
\usepackage[authoryear]{natbib}
\bibliographystyle{apalike}
\defcitealias{jones11}{Jones (2011)}
\begin{document}
\citetalias{jones11}

\bibliography{\jobname}
\end{document}
0

I use the following method: I create a sty file called citestar.sty, which modifies the definition of \cite and \bibitem. And then when citing a reference that needs to be emphasized with asterisk, I cite it as \cite{key1, key2*, key3}. The entry for key2 will be emphasized. The content of citestar.sty is as follows:

% Modify the behavior of \cite and \bibitem commands such that when a
% key is followed by an astarisk (star *), the bibliography entry will have a
% star on the left margin. Example: \cite{key1,key2*,key3}. This will show
% key2 entry with a star on the margin.
%
% \usepackage{citestar}
% \begin{document}

% \cite{key1,key2*,key3}

% \begin{thebibliography}{99}
% \bibitem{key1} First reference.
% \bibitem{key2} Second reference.
% \bibitem{key3} Third reference.
% \end{thebibliography}
% \end{document}

% remove spaces from a string
\def\removeSpaces#1{\expandafter\removeSpacesA#1\relax}
\def\removeSpacesA#1{%
  \ifx\relax#1\else%
    \ifx#1\ \else#1\fi%
    \expandafter\removeSpacesA%
  \fi}

% process a single bib key, check if it ends with *. If so, remembers it.
% Then, strip the *, and put the stripped key back to the list \keysWithoutAster
\newcommand{\processSingleKey}[1]{%
    \expandafter\@checkAsterisk#1*\@nil%
}

\def\@checkAsterisk#1*#2\@nil{%
    \addToCommaSeparatedList{\keysWithoutAster}{#1}%
    \ifx\relax#2\relax% does not end with *
    \else% ends with *
       \expandafter\gdef\csname key@\removeSpaces{#1}\endcsname{}%
    \fi%
}

% Define a macro to add a string to a comma-separated list
\newcommand{\addToCommaSeparatedList}[2]{%
    \edef#1{%
        \ifx#1\empty\else#1,\fi % Add comma if the list is not empty
        #2% Append the new string
    }%
}

% Define a loop macro for comma-separated lists
\newcommand{\foreachcsv}[2]{%
  \@for\tmp:=#1\do{#2{\tmp}}%
}

% Redefine \cite to remember keys with asterisks.
\let\oldcite\cite
\renewcommand{\cite}[1]{%
  \def\keysWithoutAster{}% Clear oldkeys
  \foreachcsv{#1}{\processSingleKey}%
  \expandafter\oldcite\expandafter{\keysWithoutAster}%
}%

% Redefine \bibitem to add an asterisk to labels of remembered keys
\let\oldbibitem\bibitem
\renewcommand{\bibitem}[1]{%
    \ifcsname key@\removeSpaces{#1}\endcsname%
      \oldbibitem{#1}%
        \makebox[0pt][r]{\bfseries*\hspace*{2em}}%
        \hspace*{-7.3pt}
    \else%
        \oldbibitem{#1}%
    \fi%
}

I am sure the code can be improved. In particular, how the asterisk is placed. I didn't know how to place it on the left side without disturbing the spacing after. So I added ad hoc space of -7.3pt, which seems to work.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .