0

My little example is as follows:

    \documentclass{article}

    \usepackage[round]{natbib}
    \newcommand{\citea}[1]{[\citenum{#1}]}
    %\setcitestyle{comma}

    \begin{document}

    Please ref \citep{efron1996bootstrap,tibshirani1996regression}
    or ref \citea{efron2004least,hastie2015statistical}

    \bibliographystyle{unsrtnat}
    %\nocite{*}
    \bibliography{test}

    \end{document}

where the test.bib contains

    @article{tibshirani1996regression,
        title={Regression shrinkage and selection via the lasso},
        author={Tibshirani, Robert},
        journal={Journal of the Royal Statistical Society: Series B (Methodological)},
        volume={58},
        number={1},
        pages={267--288},
        year={1996},
        publisher={Wiley Online Library}
    }

    @article{efron1996bootstrap,
        title={Bootstrap confidence levels for phylogenetic trees},
        author={Efron, Bradley and Halloran, Elizabeth and Holmes, Susan},
        journal={Proceedings of the National Academy of Sciences},
        volume={93},
        number={23},
        pages={13429--13429},
        year={1996},
        publisher={National Acad Sciences}
    }

    @article{efron2004least,
        title={Least angle regression},
        author={Efron, Bradley and Hastie, Trevor and Johnstone, Iain and Tibshirani, Robert},
        journal={The Annals of Statistics},
        volume={32},
        number={2},
        pages={407--499},
        year={2004},
        publisher={Institute of Mathematical Statistics}
    }

    @book{hastie2015statistical,
        title={Statistical learning with sparsity: the lasso and generalizations},
        author={Hastie, Trevor and Tibshirani, Robert and Wainwright, Martin},
        year={2015},
        address={Boca Raton},
        publisher={CRC press}
    }       

I know that \setcitestyle{comma} can change the punctuation. However, I want keep the colon-separated way for \citep by default, and use the comma-separated way for \citea which is modified from \citenum.

  • Is something stopping you from writing [\citenum{efron2004least},\citenum{hastie2015statistical}]? – Mico Nov 18 '19 at 15:48
  • Incidentally, with your setup, the formatted bib entries will not be associated with numbers such as [1], [2], etc. Hence, your readers may find that citation call-outs of the form [3,4] are not all that helpful. (In fact, readers may find it to be the very opposite of helpful…) – Mico Nov 18 '19 at 15:51
  • You're quite right! Tks! @Mico – John Stone Nov 20 '19 at 2:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.