TransWikia.com

How to cite text of bibitem?

TeX - LaTeX Asked by batonas su braškėm on January 13, 2021

I’m struggling to enter the whole text of citation. I have added bibliography into the document:

begin{document}
...
begin{thebibliography}{99}
bibitem{stern} 
Frederick Stern, Conditional expectation of the duration in the classical ruin problem, Math. Mag. 48 (4) (1975) 200-203
.....
end{thebibliography}
end{document}

Is it possible to cite the text without mentioning the number?

For example, I want to insert all information of bibitem{stern} in document:

We present a unified approach which uses generating functions to prove and extend some results that were obtained in [Frederick Stern, Conditional expectation of the duration in the classical ruin problem, Math. Mag. 48 (4) (1975) 200-203]

cite{stern} gives just a number – [1]

One Answer

You have to define new macros to do this. One way is to take a leaf out of harvard.sty and write

documentclass{article}

makeatletter
%% this is from harvard.sty -- used inside "long" cites to prevent expansion
{catcode`:=12 catcode`-=12 catcode`>=12 catcode`<=12 %
 gdefcodeof#1{expandaftercodeof@meaning#1<-:}%
 gdefcodeof@#1:->#2<-:{#2}}
%% wrapper around the bibitems
defbibwrap#1#2{%
bibitem{#1}#2%
if@filesw{defnext{{#2}}%
           immediatewrite@auxout{stringlong@bibcite{#1}codeofnext}}%
fi}
%% commands for "long" cites
deflong@bibcite{@newl@bel y} %in .aux file
deflong@cite#1{csname y@#1endcsname% for use by user
    immediatewrite@auxout{stringcitation{#1}}}
deflongcite#1{[long@cite{#1}]}
makeatother

begin{document}
... longcite{stern}

begin{thebibliography}{99}
bibwrap{stern}{Frederick Stern, Conditional expectation of the duration in the classical ruin problem, Math. Mag. 48 (4) (1975) 200-203}
.....
end{thebibliography}
end{document}

(I don't quite remember where I first found the code snippets in question, they are not entirely original.)

Correct answer by gmvh on January 13, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP