[Tex/LaTex] How to change citation style for specific sentence

biblatexbibliographiescitingnatbib

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

Best Answer

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