Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the superscript citation style and sometimes in the text I need to print the citation number is square brackets like [6]. I read I could use \citenum but [\citenum{myref}] leaves some big space before the number [ 6]. Is there anyway I can achive this nicely?

EDIT. These are my natbib options:

 \usepackage[square, comma, sort&compress,authoryear]{natbib}
 \bibpunct{[}{]}{,}{s}{}{;}
share|improve this question
    
Please consider to upvote helpful answers to your older questions (this has to be done separately from accepting them). –  lockstep Jul 31 '11 at 12:07
    
Thanks for the solution. I will do as per the other post. –  Godey Jul 31 '11 at 12:27

3 Answers 3

The following attempt (a redefinition of \citenum) removes most (?) of the spacing. Sorry for not providing a real solution, but the natbib internals are nothing one wants to delve into.

\documentclass{article}

\usepackage[square,comma,sort&compress,authoryear]{natbib}
\bibpunct{[}{]}{,}{s}{}{;}

\makeatletter
\DeclareRobustCommand\citenum
   {\begingroup
%      \NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\let\textsuperscript\NAT@spacechar% DELETED
     \NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\let\textsuperscript\relax% NEW
     \NAT@citexnum[][]}
\makeatother

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
\end{filecontents}

\begin{document}

Some text \citep{A01}.

[\citenum{A01}]

\bibliographystyle{plainnat}
\bibliography{\jobname}

\end{document}
share|improve this answer

I found that inserting a couple of negative spaces (\!) works fine. e.g.

These are outlined in an excellent review by Foo [\!\!\citenum{Foo2012}]; however, we choose to...

Perhaps this is not a very elegant solution in terms of understanding the problem, but it is concise!

share|improve this answer

I know you are using natbib's options; but, have you tried to use revtex as your documentclass? Using the same example as lockstep, I can write:

\documentclass[aip]{revtex4-1}    
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
@misc{B01,
  author = {Author, B.},
  year = {2001},
  title = {Beta},
}
\end{filecontents}

\begin{document}
Some text with superscript citation.~\citep{A01}

Another text with in-line citation.~[\onlinecite{B01}]

\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
share|improve this answer
1  
It's quite a substantial change to suggest using a specific document class. –  Werner Jul 1 '13 at 1:55
1  
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Kurt Jul 1 '13 at 1:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.