1 Brekke S. Sample article title. Sample journal 2004; 22: 55--66.
The article is written in latex and processed with MiKTeX v2.1 on
WindowsXP. I have (almost) achieved the correct bibliography layout by
hacking the nature.sty version 1.06 that I downloaded from
http://www.ccl.net/cca/text-processing/tex/bibtex/nature.bst
So far so good, but here comes the strange thing: I rename nature.bst
to ul-obst-gynecol.bst, modify my .tex file to say
\bibliographystyle{ul-obst-gynecol}
, remember to run "initexmf -u" in the shell, and then rerun latex
(i.e. pdflatex; bibtex; pdflatex; pdflatex). And, voilla, the citation
style is back to (1), and the reference style to
[1] Brekke S. Sample article title. Sample journal 2004; 22: 55--66.
So my questions are:
How can the output depend on the *name* of the .bst file?
Is nature.bst hardcoded in any way in latex/bibtex?
The only occurance of the string "nature" in my .tex file is in the
\bibliographystyle
A .tex file demonstrating the problem:
%%%%%%%%%%%%%%%%%%%%%%%%% problem.tex start
\documentclass[english]{report}
\usepackage[authoryear]{natbib}
\begin{document}
A text with citation \citep{myref}
\bibliographystyle{nature}
% toggle with this: \bibliographystyle{ul-obst-gynecol}
\bibliography{problembib}
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%% problem.tex end
%%%%%%%%%%%%%%%%%%%%%%%% problembib.bib start
@article{myref,
author={Svein Brekke},
title={Sample article title},
journal={Sample journal},
year={2004},
volume={22},
pages={55-66},
}
%%%%%%%%%%%%%%%%%%%%%%%% problembib.bib end
This seems *very* strange. Thanks for any help.
Svein Brekke
It is hardcoded into natbib.sty, which you are using. See section '4.8
Selecting Citation Punctuation' in natbibs doc, especially the
\citestyle command.
cheerio
ralf
Thank you for pointing it out. I tried to add in my preabmle:
\usepackage{natbib}
% And I tried this, too: \usepackage[authoryear]{natbib}
\newcommand\bibstyle@us-obstet-gynecol{\bibpunct{}{}{,}{s}{}%
{\textsuperscript{,}}%
\gdef\NAT@biblabelnum##1{##1{\hspace 2mm}}}
to get it to work with the original natbib.sty and my own .bst file,
but the change had no impact unless I made modifications inside
natbib.sty. Nevertheless, I can live with hacking in my extra journals
in natbib.sty like this (just below where bibstyle@nature is
hardcoded):
\newcommand\bibstyle@us-obstet-gynecol{\bibpunct{}{}{,}{s}{}%
{\textsuperscript{,}}%
\gdef\NAT@biblabelnum##1{##1{\hspace 2mm}}}
Thanks a lot,
Svein Brekke
> Thank you for pointing it out. I tried to add in my preabmle:
>
> \usepackage{natbib}
> % And I tried this, too: \usepackage[authoryear]{natbib}
> \newcommand\bibstyle@us-obstet-gynecol{\bibpunct{}{}{,}{s}{}%
> {\textsuperscript{,}}%
> \gdef\NAT@biblabelnum##1{##1{\hspace 2mm}}}
>
> to get it to work with the original natbib.sty and my own .bst file,
> but the change had no impact
No impact? Normally LaTeX should produce an error here due to the use of
'@' in command names. Adding \makeatletter before and \makeatother after
the \newcommand should make things work.
> unless I made modifications inside
> natbib.sty. Nevertheless, I can live with hacking in my extra journals
> in natbib.sty like this (just below where bibstyle@nature is
> hardcoded):
Though it is allowed by the license to change natbib.sty, it is not a
good idea. Normally you should either change (and use) a renamed copy of
natbib.sty or use the natbib.cfg mechanism (also in section 4.8).
If you don't need this bibstyle often, it might be easier to use
\citestyle{nature} (also in section 4.8). Note that this is the only way
your LaTeX document will be correctly translated on other systems
without also transfering your modified natbib.sty or your natbib.cfg.
cheerio
ralf
[...]
>> \gdef\NAT@biblabelnum##1{##1{\hspace 2mm}}}
[...]
Ralf Stubner wrote:
> No impact? Normally LaTeX should produce an error here due to the use of
> '@' in command names.
No error here! This globally defines a command \NAT that, when used in
the document, *must* be followed by the character sequence
``@biblabelnum''. Failing to do so will trigger the TeX error ``Use of
\NAT doesn't match its definition.'' And, of course, the intended
command \NAT@biblabelnum will not be defined.
> Adding \makeatletter before and \makeatother after
> the \newcommand should make things work.
[...]
Agreed. Or put the definition in a sty-file.
Greetz,
--
Arjen Bax
s/-/./g for my real e-mail address
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
http://www.faqs.org/rfcs/rfc1855.html
> No error here! This globally defines a command \NAT that, when used in
> the document, *must* be followed by the character sequence
> ``@biblabelnum''. Failing to do so will trigger the TeX error ``Use of
> \NAT doesn't match its definition.'' And, of course, the intended
> command \NAT@biblabelnum will not be defined.
But the full definition was
\newcommand\bibstyle@us-obstet-gynecol{\bibpunct{}{}{,}{s}{}%
{\textsuperscript{,}}%
\gdef\NAT@biblabelnum##1{##1{\hspace 2mm}}}
and that produces a
ERROR: LaTeX Error: Command \bibstyle already defined.
here.
BTW, \makeatletter and \makeatother don't help either, as the '-' is
category 'other', too. So I am surprised that the above definiton worked
in a style file as the OP said. Maybe I missed something ...
cheerio
ralf