I would like to ask if there is an easy way to auto-include a "Ref." word before any of my citations ie if I do
Have a look in \cite{pub1}
then to show up like
Have a look in Ref. [1]
I would like to ask if there is an easy way to auto-include a "Ref." word before any of my citations ie if I do
Have a look in \cite{pub1}
then to show up like
Have a look in Ref. [1]
If you are using biblatex you can put the following modification into your preamble.
\DeclareCiteCommand{\cite}[Ref.~\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
if you do not want to override the standard behaviour of \cite, go with
\DeclareCiteCommand{\refcite}[Ref.~\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
instead.
The full MWE
\documentclass[ngerman, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage{xpatch}% to patch the editor macros
\usepackage[style=numeric, backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\DeclareCiteCommand{\cite}[Ref.~\mkbibbrackets]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{filecontents}{\jobname.bib}
@article{testart,
author = {Arnold Uthor and William Riter},
title = {A Very Interesting Article},
journal = {Journal of Articles},
volume = {7},
number = {3},
pages = {1-5},
date = {2010},
}
@book{testbook,
author = {Arnold Uthor},
title = {A Book},
subtitle = {Some Books Have Subtitles},
date = {2013},
publisher = {Peter Ublisher & Co.},
location = {Place City},
}
\end{filecontents}
\begin{document}
Let's cite \cite{testbook} and \cite{testart}.
\nocite{*}
\printbibliography
\end{document}
then yields

As per @henrique's suggestion, we can also define a bibstring reference via
\NewBibliographyString{reference}
\DefineBibliographyStrings{english}{%
reference = {ref\adddot},
}
and use that in our definition of \refcite
\newrobustcmd*{\Refcite}{\bibsentence\refcite}
\DeclareCiteCommand{\refcite}[\bibstring{reference}\addnbspace\mkbibbrackets]% or \addnbthinspace
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
One can now use \refcite and \Refcite just like all the other \cite/\Cite commands.
\documentclass[american, a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style=numeric, backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\NewBibliographyString{reference}
\DefineBibliographyStrings{english}{%
reference = {ref\adddot},
}
\newrobustcmd*{\Refcite}{\bibsentence\refcite}
\DeclareCiteCommand{\refcite}[\bibstring{reference}\addnbspace\mkbibbrackets]% or \addnbthinspace
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\usebibmacro{cite}}
{\multicitedelim}
{\usebibmacro{postnote}}
\begin{filecontents}{\jobname.bib}
@article{testart,
author = {Arnold Uthor and William Riter},
title = {A Very Interesting Article},
journal = {Journal of Articles},
volume = {7},
pages = {1-5},
date = {2010},
}
@book{testbook,
author = {Arnold Uthor},
title = {A Book},
date = {2013},
publisher = {Peter Ublisher & Co.},
location = {Place City},
}
\end{filecontents}
\begin{document}
Let's cite \refcite{testbook} and \refcite{testart}. \Refcite{testbook} and \refcite{testbook}.
\nocite{*}
\printbibliography
\end{document}
yields

bibstring in order to have language-specific citations (mostly for case-sensitive citation commands such as \cite and \Cite).
– henrique
Sep 16 '13 at 18:42
Regardless of the reference package you're using, the following should work:

\documentclass{article}
\usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro
\LetLtxMacro\oldcite\cite% Store \cite in \oldcite
\renewcommand*{\cite}{Ref.~\oldcite}% Prepend \cite with Ref.~
\begin{document}
See \cite{abc}.
\begin{thebibliography}{x}
\bibitem{abc} Some reference
\end{thebibliography}
\end{document}
The approach is to firstly save \cite in some other macro via \LetLtxMacro and then prepend Ref.~ to it. Alternatively, xpatch can also be used to prepend <code> to robust commands using
\xpretocmd{\cite}{Ref.~}{}{}% \xpretocmd{<cmd>}{<code>}{<success>}{<failure>}
\citecommand: what if you later realize that you want to cite something without the "Ref." string? then you won't be able to! So I suggest creating a new command with the requested functionality and using that instead. – nplatis Sep 16 '13 at 22:23