blog about text processing; in drei Sprachen; на три езика
  • Home

BibTeX output to XML

11. März 2010 – 16:51

Publishing online BibTeX references is not just matter of converting a .bib
file to XML/HTML. If there is a print (PDF) edition, two very important items
should be the same in both print and online versions:

  1. same entries
  2. same sorting

Further editing of the online references includes for example

  • abreviation of the author/editor names
  • inclundig and formatting the needed fields

The publisher’s demands for the online references are often included in the
DTD describing the XML tags for the online documents. In the worst case the
online formatting differs from the print formatting. Nevertheless, if there is
already a LaTeX/BibTeX workflow, and especially a BibTeX style file, it is
better to use directliy BibTeX (the program) to produce the XML output instead
of external converters. Using BibTeX guaranties automatically that the both
items above are true.
Further, if one is familiar with the BibTeX programming
syntax and with the used style file, it is easy to modify the functions to
produce the XML output, while keeping the framework unchanged.

Below is an example of a BibTeX function which formats the author names
acoording to the Springer A++ DTD. It is part of an BibTeX style file, which I
wrote years ago for the print and online references in the Springer series
Topics in Applied Physics. The first names are abbreviated and put in
<Initials> tag, the whole name is in <BibAthorName> and so on.

FUNCTION {format.authornames.online}
{ 'bibinfo :=
  duplicate$ empty$ 'skip$ {
  's :=
  "" 't :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { " <BibAuthorName> "
      s nameptr "{f.}" format.name$
      duplicate$ empty$
        { " <NoInitials/>" * * }
        {  "<Initials>" swap$ * * "</Initials>" * }
        if$
      s  nameptr
      " <FamilyName>{ll}</FamilyName> " format.name$ *
      s nameptr "{vv{}}" format.name$
      duplicate$ empty$
        { * }
        { "<Particle>" swap$ * * "</Particle>" * }
        if$
      s nameptr "{jj{}}" format.name$
      duplicate$ empty$
        { * }
        { "<Suffix>" swap$ * * "</Suffix>" * }
        if$
      "</BibAuthorName> " *
      bibinfo bibinfo.check
      't :=
      nameptr #1 >
        {
          namesleft #1 >
            {  " " * t * }
            {
              "" *
              s nameptr "{ll}" format.name$ duplicate$ "others" =
                { 't := }
                { pop$ }
              if$
              t "others" =
                {
                  " " * bbl.etal.online *
                }
                { " " * t * }
              if$
            }
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
  } if$
}

So, processing for example the bib entry

@article{lee07,
  1. author = {J. U. Lee and
  2. P. J. Codella and
  3. M. Pietrzykowski},
  4. journal = {Appl. Phys. Lett.},
  5. volume = {90},
  6. pages = {053103},
  7. year = {2007},
  8. }

yields to the XML code

<Citation ID=”CR4″>
  1. <!– BibTeX Label: lee07 –>
  2. <!– BibTeX Type: article –>
  3. <BibArticle>
  4. <BibAuthorName>
  5. <Initials>J. U.</Initials>
  6. <FamilyName>Lee</FamilyName>
  7. </BibAuthorName>
  8. <BibAuthorName>
  9. <Initials>P. J.</Initials>
  10. <FamilyName>Codella</FamilyName>
  11. </BibAuthorName>
  12. <BibAuthorName>
  13. <Initials>M.</Initials>
  14. <FamilyName>Pietrzykowski</FamilyName>
  15. </BibAuthorName>
  16. <Year>2007</Year>
  17. <NoArticleTitle/>
  18. <JournalTitle>Appl. Phys. Lett.</JournalTitle>
  19. <VolumeID>90</VolumeID>
  20. <FirstPage>053103</FirstPage>
  21. </BibArticle>
  22. <BibUnstructured>
  23. J. U. Lee, P. J. Codella, M. Pietrzykowski: Appl. Phys. Lett. <Emphasis Type="Bold">90</Emphasis>, 053103 (2007)
  24. </BibUnstructured>
  25. </Citation>

The XML code can be then validated and integrataded in the whole online file.

Tags: A++, BibTeX, DTD, online, references, Springer, TAP, Topics Applied Physics, XML

Post a Comment

  • Letzte Artikel

    • Typesetting Fight Club: 3B2 vs. TeX
    • BibTeX output to XML
    • No Comment. Ohne Worte
    • “Ша” (Ш) като “Шин” (ש)
    • Die neue (Typo-)Epidemie: Ligaturen an den Wortfugen
  • Kategorien

    • Allgemein (7)
    • BibTeX (1)
    • Code (6)
    • Database Publishing (4)
    • Deutsch (8)
    • English (17)
    • Examples (6)
    • Fonts (5)
    • Kvetch (7)
    • LaTeX (8)
    • Math Examples (1)
    • Math Fonts (4)
    • Math Typography (3)
    • Mikrotypografie (1)
    • OpenType (1)
    • TeX (7)
    • Text Processing (7)
    • Typografie (3)
    • Typography (3)
    • Umbruch (3)
    • Work (8)
    • На български (3)
  • Tags

    Ж Курсив Berthold Binnen-I Binnenmajuskel comparing ConTeXt cyrillic diff Ediff Emacs englaufend Font fontinst Formelsatz Geistes- und Sozialwissenschaftler Glyph hanging index italic Katalogproduktion Lindenberg Linotype maiola math Mathesatz Minion Multiple Master online OpenType Piska raggedright register Satz Schrift Slimbach Stempel Garamond TeX tfcpr Times Trennen Umbruch Wortzwischenraum WZR zhe
TANOVSKI & PARTNERS 2.0 is proudly powered by WordPress Entries (RSS) and Comments (RSS). Designed by Bob