Re: automate journal abbreviations?



On Mar 11, 1:42 pm, alistair k <alistai...@xxxxxxxxxxxxxx> wrote:

In the past I've tried out some automated stuff at the LaTeX level.
However, you either need to do a rather long match for a full title
(which might have varying braces, etc.) or do something on a
word-by-wrod basis (which is problematic with things like "J. Phys.
Chem. A": the "A" is a pain).

As things stand, I have full titles in the .bib file.  BibDesk's
autocomplete function keeps everything consistent so long matches for
full titles should be ok.

Where can I find out more about how to do this?  This kind of LaTeX work
is new to me.

Okay, this is not a "one change" thing to do. At a LaTeX level, you
need a function which reads a journal title, then sees if there is an
abbreviation that matches. Two macros are needed: one to create
abbreviations and one to try to abbreviate a title. I'll assume that e-
TeX is available for this.

\documentclass{article}
\makeatletter

% Here, a macro is created for each journal title, storing the
% abbreviation.
\newcommand*{\DefineJournalAbbreviation}[2]{%
\@namedef{journal@#1}{#2}%
}
\DeclareRobustCommand*{\AbbreviateJournal}[1]{%
\ifcsname journal@#1\endcsname % Look for macro
\@nameuse{journal@#1}% Use macro
\else
#1% No luck - use original text
\fi
}
\makeatother

\DefineJournalAbbreviation{Journal of the American Chemical Society}
{J.~Am.\ Chem.\ Soc.}

\begin{document}
\AbbreviateJournal{Journal of the American Chemical Society}
\AbbreviateJournal{An unknown journal}
\end{document}

You also need get \AbbreviateJournal wrapped around the text of the
titles in the bibliography. If you use biblatex this would be done by
modifying your .bbx file. For standard BibTeX, you need to create a
modified .bst file which does this. Most BibTeX styles have lines
such as:

journal emphasize "journal" output.check

which we could modify to:

"\AbbreviateJournal"{ journal * "}" * emphasize "journal" output.check

to wrap the title up inside the appropriate macro.

Hope this helps.
--
Joseph Wright



.



Relevant Pages

  • Re: automate journal abbreviations?
    ... I have full titles in the .bib file. ... abbreviation that matches. ... % Here, a macro is created for each journal title, storing the ... it definitely points me in a useful direction. ...
    (comp.text.tex)
  • Re: automate journal abbreviations?
    ... I have full titles in the .bib file. ... abbreviation that matches. ... % Here, a macro is created for each journal title, storing the ... For standard BibTeX, ...
    (comp.text.tex)
  • Re: setf with two lists
    ... is another abbreviation" "This is yet a third abbreviation"). ... to associate the corresponding expansion to the abbreviation. ... available to you at compile time* because that is when the macro needs the data. ... You can't do this with a macro if the data is not available until run-time without doing special tricks: the data the macro can see needs to be part of the source of your program. ...
    (comp.lang.lisp)
  • Re: Macro to write new commands?
    ... then use the abbreviation from then on. ... | ...rescued by the Boston Fire Department... ... How do I write a macro to write the macros? ... You are wasting a counter for each acronym. ...
    (comp.text.tex)
  • Re: Header lists chapter title as "CONTENTS"
    ... the TOC are too close to the chapter titles. ... Look in book.cls for the macro \l@chapter and in latex.ltx for \numberline. ... Or just set the documentclass option oneside. ...
    (comp.text.tex)