5

When I make a reference at the beginning of a sentence I have one citation style, but when I make a reference at the end I have another.

The class I'm using has the \cite{} command containing only the latter style.

How can I change the citation style for some specific citation?

Example:

The citation style for \cite{kahneman1979prospect} is:

[Kahneman and Tversky 1979]

But I can only use this style at the end of a sentence.

If I start the sentence citing something such as:

"According to..."

My citation style should be:

Kahneman and Tversky (1979)

Is it possible to create this new style (preferably a new command in the preamble)?

I've looked some other classes and they have it implemented in a new command such as\citeN{}:

\def\citeN{\def\@citeseppen{-1000}%
    \def\@cite##1##2{##1\if@tempswa , ##2]\else{]}\fi}%
    \def\citeauthoryear##1##2##3{##2 [##3}\@citedata}

I used the above code in my current class and preamble. Unfortunately it is still not working, but hopefully gives a starting point.

EDIT:

This is a minimal example with correct and incorrect style for each case.

main.tex

\documentclass{article}

\usepackage{natbib}
\bibliographystyle{abbrvnat}

\begin{document}

\section{Citation Style I}

\begin{itemize}
\item According to \cite{kahneman1979prospect} \dots is incorrect.
\item According to \citet{kahneman1979prospect} \dots is incorrect.
\item According to Kahneman and Tversky (1979) \dots is correct.
\end{itemize}

\section{Citation Style II}

\begin{itemize}
\item This is correct \dots \citep{kahneman1979prospect}.
\item This is incorrect \dots (Kahneman and Tversky, 1979).
\end{itemize}

\bibliography{references}

\end{document}

references.bib

@article{kahneman1979prospect,
  title={Prospect theory: An analysis of decision under risk},
  author={Kahneman, Daniel and Tversky, Amos},
  journal={Econometrica: Journal of the econometric society},
  pages={263--291},
  year={1979},
  publisher={JSTOR}
}

Output file

enter image description here

  • 1
    @Ruben I looked up Natbib reference sheet and could get very close to what I need using \bibpunct{[}{]}{,}{a}{}{;}. This makes \citep{} style correct: [Kahneman and Tversky 1979], but makes \cite{} output Kahneman and Tversky [1979]. I just need the year inside parentheses. Is it possible? Thanks! – yellow01 Sep 12 '17 at 22:58
  • 1
    Did you try \citet{}? Worked fine for me until I switched to Biber/Biblatex. If not, please provide a minimal working example which we can compile to reproduce the problem. That is, code for a small document and one or two bib entries, obviously, since you'll need to cite something. – cfr Sep 13 '17 at 2:17
  • 1
    Are you up for using biblatex as tagged? Since your MWE does not use biblatex I'm not sure if you really want that. With biblatex you'd probably use \parencite and \textcite, but you would have to change the bracketing. – moewe Sep 13 '17 at 12:07
  • 2
    A quick and dirty natbib solution would be to use \bibpunct{(}{)}{,}{a}{}{;} and then make your own version of \citet defined as [\citealt{...}]. – Alan Munn Sep 13 '17 at 13:04
  • 1
    You can't use a .bst with Biblatex, but it is generally easier to customise than BibTeX as you use regular LaTeX to style things. – cfr Sep 13 '17 at 13:50
5

Here's a quick and dirty solution using natbib which won't require you to change any of your existing code. The idea is to set natbib to use round parentheses for regular \citet citations and redefine \citep to use the unbracketed \citealp with your own square brackets added.

We redefine \citep rather than \citet since the latter is much more likely to be used with its optional argument for pages etc., whereas \citep is typically used with a simple list of citations.

Here's a full example:

\documentclass{article}
\begin{filecontents}{\jobname.bib}

@article{kahneman1979prospect,
  title={Prospect theory: An analysis of decision under risk},
  author={Kahneman, Daniel and Tversky, Amos},
  journal={Econometrica: Journal of the econometric society},
  pages={263--291},
  year={1979},
  publisher={JSTOR}
}
\end{filecontents}

\usepackage{natbib}
\bibpunct{(}{)}{,}{a}{}{;}
\bibliographystyle{abbrvnat}
\renewcommand{\citep}[1]{[\citealp{#1}]}

\begin{document}

\section{Citation Style I}

\begin{itemize}
\item According to \cite{kahneman1979prospect} \dots is now correct.
\item According to \citet{kahneman1979prospect} \dots is now correct.
\item According to Kahneman and Tversky (1979) \dots is correct.
\end{itemize}

\section{Citation Style II}

\begin{itemize}
\item This is now correct \dots \citep{kahneman1979prospect}.
\item This is incorrect \dots (Kahneman and Tversky, 1979).
\end{itemize}

\bibliography{\jobname}

\end{document}

output of code

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.