vtex-soft / texsupport.ims-aos

LaTeX author support files for IMS journal AOS.
https://vtex-soft.github.io/texsupport.ims-aos/
MIT License
6 stars 5 forks source link

Reference #2

Closed nhavt closed 4 years ago

nhavt commented 4 years ago

Hi there,

I have a problem with references when using the command "\citet". It seems that the current template does not support this command? This is because I want to have the author and the reference number at the same time. For example, I wish to have a reference like this : \citet{key} ===> author [1]. Would it be possible? Thanks very much in advance!

edgaras-sakuras commented 4 years ago

Hello,

for \citet to work as You want (when \RequirePackage[numbers]{natbib} is used), bibliography items should be coded accordingly:

\bibitem[\protect\citeauthoryear{Doe}{1990}]{key}...

Or if You use bib file then bst style has to support author-year citations.

More info can be found in natbib documentation:

https://mirror.datacenter.by/pub/mirrors/CTAN/macros/latex/contrib/natbib/natbib.pdf

nhavt commented 4 years ago

Hello edgaras-sakuras, Thanks very much for your quick response. I also tried that but it did not work. I used \RequirePackage[numbers]{natbib}, *.bib file, and \bibliographystyle{plainnat}. But I got this (author?)[23] when using \citet. So, can you please tell me how to fix it? Thanks in advance!

edgaras-sakuras commented 4 years ago

Here is a minimal example.

Contents of the file sample.tex:

\documentclass[aap]{imsart}
\RequirePackage[numbers]{natbib}
\begin{document}
\begin{frontmatter}
\title{Citet sample}
\end{frontmatter}
\string\citep: \citep{green,latexbook}\par
\string\citet: \citet{green,latexbook}\par
\bibliographystyle{plainnat}
\bibliography{sample}
\end{document}

Then file sample.bib

@Book{latexbook,
  author    = {L. Lamport},
  title     = {\LaTeX: a document prapration system},
  publisher = {Addison--Wesley},
  address   = {Reading, MA},
  edition   = {},
  year      = {1994}
}
@Article{green,
 author     = {P. J. Green},
 title      = {Iteratively reweighted least squares for maximum
            likelihood estimation, and some robust 
            and resistant alternatives},
 journal    = {JRSSB},
 volume     = {46},
 number     = {2},
 pages      = {149--192},
 month      = {},
 year       = {1984}
}

Run:

pdflatex sample.tex
bibtex sample.aux
pdflatex sample.tex
pdflatex sample.tex

And You will get sample.pdf

nhavt commented 4 years ago

Hello edgaras-sakuras, thanks very much for this. Yes, I found my mistake. That is because my LaTeX compiler used the old "*.bbl". So, when I deleted this old file and build a new one. It works perfectly. Also, I am able to use "\bibliographystyle{imsart-nameyear}", "\RequirePackage[numbers]{natbib}", and the command "\citet". Thanks very much! Have a nice weekend!