Skip to content

Instantly share code, notes, and snippets.

@adityam
Created July 28, 2017 18:22
Show Gist options
  • Save adityam/afda949f76676055e7906679599ec937 to your computer and use it in GitHub Desktop.
Save adityam/afda949f76676055e7906679599ec937 to your computer and use it in GitHub Desktop.
publ-imp-ieee.mkiv
%D \module
%D [ file=publ-imp-ieee,
%D version=2015.03.22,
%D title=APS bibliography style,
%D subtitle=Publications,
%D author=Alan Braslau and Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is therefore copyrighted
%D by \PRAGMA. See mreadme.pdf for details.
\startbtxrenderingdefinitions[ieee]
%D Reference:
%D \startTEX
%D @Book{APS2011,
%D title ={Physical Review Style and Notation Guide}
%D year ={2011},
%D month ={June}
%D edition ={Revised},
%D editor ={Waldron, A and Judd, P. and Miller, V.},
%D address ={Ridge, NY},
%D publisher={American Physical Society},
%D Xpages ={26},
%D url ={http://journals.ieee.org/files/styleguide-pr.pdf}
%D }
%D \stopTEX
% set ALL specific APS compliant values
\definebtx
[ieee]
[\c!default=default,
\c!specification=ieee,
\c!otherstext={\btxspace{\it\btxlabeltext{ieee:others}}},
\c!etallimit=10,
\c!etaldisplay=\btxparameter\c!etallimit,
%c!journalconversion=\v!normal,
\c!monthconversion=\v!month,
\c!title=\v!yes,
\c!separator:names:2={\btxcomma},
\c!separator:names:3={\btxcomma\btxlabeltext{ieee:and}\space},
\c!separator:names:4={\btxspace\btxlabeltext{ieee:and}\space}]
% First, define and set list and rendering parameters
\definebtxrendering
[ieee]
[\c!specification=ieee,
\c!sorttype=\v!default,
\c!numbering=num]
\setupbtxlist
[ieee]
[\c!alternative=b] % spaces
\definebtx
[ieee:\s!list]
[ieee]
[\c!authorconversion=normalshort]
\definebtx
[ieee:\s!list:author]
[ieee:\s!list]
\definebtx
[ieee:\s!list:editor]
[ieee:\s!list:author]
\definebtx
[ieee:\s!list:suffix]
[ieee:\s!list]
\definebtx
[ieee:\s!list:url]
[ieee:\s!list]
\definebtx
[ieee:\s!list:doi]
[ieee:\s!list]
\definebtx
[ieee:\s!list:\s!page]
[ieee:\s!list]
[\c!separator:2={\btxcomma},
\c!separator:3={\btxcomma\btxlabeltext{ieee:and}\space},
\c!separator:4={\btxspace\btxlabeltext{ieee:and}\space},
\c!left={\btxleftparenthesis},
\c!right={\btxrightparenthesis},
\c!command={\wordright}]
\definebtx
[ieee:\s!list:numbering]
[ieee:\s!list]
[left={[},
right={]}]
\definebtx
[ieee:\s!list:numbering:default]
[ieee:\s!list:numbering]
\definebtx
[ieee:\s!list:numbering:num]
[ieee:\s!list:numbering]
\definebtx
[ieee:\s!list:numbering:short]
[ieee:\s!list:numbering]
\definebtx
[ieee:\s!list:numbering:tag]
[ieee:\s!list:numbering]
\definebtx
[ieee:\s!list:numbering:index]
[ieee:\s!list:numbering]
%D In order to be able to get journals expanded (or normalized or abbreviated) you need
%D to load a list:
%D
%D \starttyping
%D \btxloadjournallist[journals.txt] % the jabref list
%D \stoptyping
% TODO
\definebtx
[ieee:\s!list:booktitle]
[ieee:\s!list]
[\c!style=\v!italic,
\c!command=\Word]
\definebtx
[ieee:\s!list:journal]
[ieee:\s!list]
[\c!style=\v!italic]
%command=\btxexpandedjournal] % btxabbreviatedjournal
\definebtx
[ieee:\s!list:volume]
[ieee:\s!list]
[\c!style=\v!normal]
\definebtx
[ieee:\s!list:title]
[ieee:\s!list]
[\c!style=\v!italic,
\c!command=\Word]
\definebtx
[ieee:\s!list:title:article]
[ieee:\s!list:title]
[\c!style=,
\c!command=\quotation] % journal is set in italics
\definebtx
[ieee:\s!list:title:magazine]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:newspaper]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:periodical]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:standard]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:book]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:inbook]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:incollection]
[ieee:\s!list:title]
[\c!style=]
\definebtx
[ieee:\s!list:title:proceedings]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:inproceedings]
[ieee:\s!list:title]
[\c!style=]
%\c!command=\quotation] % booktitle is set in italics
\definebtx
[ieee:\s!list:title:conference]
[ieee:\s!list:title]
[\c!style=] % booktitle is set in italics
\definebtx
[ieee:\s!list:title:thesis]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:phdthesis]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:mastersthesis]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:booklet]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:manual]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:techreport]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:unpublished]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:patent]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:electronic]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:other]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:misc]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:title:literal]
[ieee:\s!list:title]
\definebtx
[ieee:\s!list:type]
[\c!command=\Word]
% Then define and set all cite parameters
\definebtx
[ieee:\s!cite]
[ieee]
[\c!alternative=num,
\c!authorconversion=\v!name,
\c!compress=\v!yes,
\c!sorttype=normal]
\definebtx
[ieee:\s!cite:name]
[ieee:\s!cite]
[\c!authorconversion=\v!name]
\definebtx
[ieee:\s!cite:inverted]
[ieee:\s!cite]
[\c!authorconversion=\v!invertedshort]
\definebtx
[ieee:\s!cite:invertedshort]
[ieee:\s!cite]
[\c!authorconversion=\v!invertedshort]
\definebtx
[ieee:\s!cite:normalshort]
[ieee:\s!cite]
[\c!authorconversion=\v!normalshort]
\definebtx
[ieee:\s!cite:normal]
[ieee:\s!cite]
[\c!authorconversion=\v!normal]
\definebtx
[ieee:\s!cite:author]
[ieee:\s!cite]
\definebtx
[ieee:\s!cite:authoryear]
[ieee:\s!cite:author]
[\c!left={(},
\c!right={)},
\c!inbetween={\btxcomma}]
\definebtx
[ieee:\s!cite:authoryears]
[ieee:\s!cite:authoryear]
[\c!left=,
\c!right=,
\c!inbetween={\btxspace}]
\definebtx
[ieee:\s!cite:authornum]
[ieee:\s!cite:author]
[\c!left={(},
\c!right={)}]
\definebtx
[ieee:\s!cite:author:num] % todo
[ieee:\s!cite:authornum]
[\c!left={\btxspace[},
\c!right={]}]
\definebtx
[ieee:\s!cite:author:year] % todo
[ieee:\s!cite:authoryear]
[\c!left=,
\c!right=]
\definebtx
[ieee:\s!cite:author:years] % todo
[ieee:\s!cite:authoryears]
[\c!inbetween=,
\c!left={\btxspace(},
\c!right={)}]
\definebtx
[ieee:\s!cite:year]
[ieee:\s!cite]
\definebtx
[ieee:\s!cite:title]
[ieee:\s!cite]
[\c!command={\language[\currentbtxlanguage]}, % BAH
\c!sorttype=none,
\c!style=\v!italic]
\definebtx
[ieee:\s!cite:booktitle]
[ieee:\s!cite:title]
[\c!style=\v!italic]
\definebtx
[ieee:\s!cite:tag]
[ieee:\s!cite]
[\c!left={[},
\c!right={]}]
\definebtx
[ieee:\s!cite:index]
[ieee:\s!cite]
[\c!left={[},
\c!right={]}]
\definebtx
[ieee:\s!cite:page]
[ieee:\s!cite]
[\c!left=,
\c!right=,
\c!separator:2={\btxcomma}, % :0 and :1 - between items of a list
\c!separator:3={\btxcomma\btxlabeltext{ieee:and}\space},
\c!separator:4={\btxspace\btxlabeltext{ieee:and}\space}]
\definebtx
[ieee:\s!cite:pages]
[ieee:\s!cite:page]
\definebtx
[ieee:\s!cite:keywords]
[ieee:\s!cite]
[\c!left={(},
\c!right={)}]
\definebtx
[ieee:\s!cite:short]
[ieee:\s!cite]
[\c!left={[},
\c!right={]}]
\definebtx
[ieee:\s!cite:category]
[ieee:\s!cite]
\definebtx
[ieee:\s!cite:url]
[ieee:\s!cite]
[\c!left={[},
\c!right={]}]
\definebtx
[ieee:\s!cite:doi]
[ieee:\s!cite:url]
\definebtx
[ieee:\s!cite:num]
[ieee:\s!cite]
[\c!left={[},
\c!right={]},
%\c!left=, % TODO: PRB uses superscript references...
%\c!right=, % and after punctuation, PRA, C, D, E, and L are before!
%\c!command={\high},
\c!separator:2={\btxcommabreak},
\c!separator:3=\btxparameter{\c!separator:2},
\c!separator:4=\btxparameter{\c!separator:2}]
\definebtx
[ieee:\s!cite:default]
[ieee:\s!cite:num]
\definebtx
[ieee:\s!cite:textnum]
[ieee:\s!cite:num]
[\c!left={Ref.\nbsp},
\c!command=,
\c!separator:2={\btxcomma},
\c!separator:3={\btxspace\btxlabeltext{ieee:and}\space},
\c!separator:4={\btxspace\btxlabeltext{ieee:and}\space}]
\definebtx
[ieee:\s!cite:entry]
[ieee:\s!cite]
[\c!left=,
\c!right=,
\c!inbetween={\btxspace},
\c!separator:2={\btxsemicolon},
\c!separator:3=\btxparameter{\c!separator:2},
\c!separator:4=\btxparameter{\c!separator:2}]
%D Sometimes we have verbose injections in an entry and these can be language
%D dependent, so we use labels.
%D
%D Because we want to mix rendering (in the manual) we need a namespace in label
%D texts:
\setupbtxlabeltext
[en]
[ieee:and=and,
ieee:number={no.},
ieee:edition={ed.},
ieee:Editor={Ed.},
ieee:Editors={Eds.},
ieee:Volume={Vol.},
ieee:Volumes={Vols.},
ieee:others={et al.},
ieee:page={p. },
ieee:pages={pp. },
ieee:mastersthesis={Master's thesis},
ieee:phdthesis={PhD thesis},
ieee:technicalreport={Tech. Rep.}, % Technical report
ieee:supplement={Suppl.}, % Supplement (not used?)
ieee:patent=Patent,
ieee:inpress={in press},
ieee:tobe={to be published},
ieee:unpublished={unpublished},
ieee:In=in]
% Check this (google translate!!):
% cite setups
\startsetups btx:ieee:nd
\doifelse {\currentbtxcategory} {article} {
\btxlabeltext{ieee:tobe}
} {
\doifelse {\currentbtxcategory} {book} {
\btxlabeltext{ieee:inpress}
} {
\btxlabeltext{ieee:unpublished}
}
}
\stopsetups
\startsetups btx:ieee:cite:author:year
\texdefinition{\s!btx:\s!cite:concat}
\ifx\currentbtxfirst\empty
\fastsetup{btx:ieee:nd}
\else
\texdefinition {\s!btx:\s!cite:inject} {
\btxcitereference
\currentbtxfirst
}
\ifx\currentbtxsecond\empty \else
\btxparameter\c!inbetween
\texdefinition {\s!btx:\s!cite:inject} {
\currentbtxsecond
}
\fi
\btxflushsuffix
\fi
\stopsetups
\startsetups btx:ieee:cite:author:years
\fastsetup{btx:ieee:cite:author:year}
\stopsetups
% used in publ-imp-page.mkvi
\startsetups [btx:ieee:list:page-or-pages]
\ifx\currentbtxlastpage\empty
\btxlabeltext{ieee:page}
\else
\btxlabeltext{ieee:pages}
\fi
\btxnbsp
\stopsetups
%D Instead of texdefinitions without arguments, we could have used setups but in my
%D editor (hh, scite) the commands stand out better. It also saves an additional
%D component in the name (e.g. common:) because commands and setups have a different
%D namespace, so similar calls don't clash. Performance of definitions is somewhat
%D better.
%D We use "texdefinitions" (with eventual arguments) for helpers that are used
%D in the rendering "setups" defined for each category below.
%D Note that \btxdoif... and \btxflush rely on the definitions in
%D publ-imp-ieee.lua: fields that are not listed as required nor optional are
%D IGNORED. We also make heavy use of the notion of sets - comma-separated lists
%D of alternative fields to be used in hierarchal order. For example:
%D author = { "author", "editor", "publisher", "title" }, will return the
%D author field if it exists; if not, the editor field will be returned, if it
%D exists; if not, the publisher field will be returned, if it exists; if not,
%D the title field will be returned, it it exists; if not, nothing will be
%D returned. In lua syntax, it can be understood as
%D author or editor or publisher or title or ""
\starttexdefinition btx:ieee:composed-title #title
\btxstartstyleandcolor [ieee:\s!list:title:\currentbtxcategory]
\begingroup
\language[\currentbtxlanguage]
\btxusecommand [ieee:\s!list:title:\currentbtxcategory] {
\btxflush{#title}
\btxdoif {sub#title} {
\btxcolon
\btxflush{sub#title}
}
}
\endgroup
\btxstopstyleandcolor
\stoptexdefinition
\starttexdefinition btx:ieee:title
\btxdoif {title} {
% we make the title active, opening file
\btxdoifelse {file} {
\texdefinition{btx:format:inject}
{url(file:\btxflush{file})}
{
\texdefinition{btx:ieee:composed-title}{title}
}
} {
\texdefinition{btx:ieee:composed-title}{title}
}
\btxcomma
}
\stoptexdefinition
\starttexdefinition btx:ieee:optional-title
\doif{\btxparameter{\c!title}}\v!yes {
\texdefinition {btx:ieee:title}
}
\stoptexdefinition
\starttexdefinition btx:ieee:year
\btxdoifelse {year} {
\btxflush{year}
} {
\fastsetup{btx:ieee:nd}
}
\stoptexdefinition
% #author may be author(set) or editor
\starttexdefinition btx:ieee:author-or-editor #author
\btxdoif {#author} {
\btxflush{#author}
\doifelse {\btxfoundname{#author}} {editor} {
\btxleftparenthesis
\btxsingularorplural {editor} {
\btxlabeltext{ieee:Editor}
} {
\btxlabeltext{ieee:Editors}
}
\btxrightparenthesis
} {
\btxdoif {collaboration} {
\btxleftparenthesis
\btxflush{collaboration}
\btxrightparenthesis
}
}
}
\stoptexdefinition
\starttexdefinition btx:ieee:author
\btxflush{author}
\btxcomma
\stoptexdefinition
\starttexdefinition btx:ieee:editor-in
\btxdoif {booktitle} {
\btxlabeltext{ieee:In}
\doifnot {\btxfoundname{author}} {editor} {
\btxspace
\texdefinition{btx:ieee:author-or-editor} {editor}
}
\btxspace
\texdefinition{btx:ieee:composed-title} {booktitle}
\btxcomma
}
\stoptexdefinition
\starttexdefinition btx:ieee:editionset
\doif {\currentbtxcategory} {techreport} {
\btxdoifelse {type} {
\btxusecommand [\currentbtx:type] {
\btxflush{type}
}
} {
\btxlabeltext{ieee:technicalreport}
}
\btxcomma
}
\btxdoif {volume} {
\btxoneorrange {volume} {
\btxlabeltext{ieee:Volume}
} {
\btxlabeltext{ieee:Volumes}
}
\btxspace
\btxflush{volume}
\btxcomma
}
\btxdoif {number} {
\btxlabeltext{ieee:number}
\btxspace
\btxflush{number}
\btxcomma
}
\btxdoif {edition} {
\btxflush{edition}
\btxspace
\btxlabeltext{ieee:edition}
\btxcomma
}
\btxdoif {pages} {
\btxoneorrange {pages} {
\btxlabeltext{ieee:page}
} {
\btxlabeltext{ieee:pages}
}
\btxnbsp
\btxflush{pages}
\btxcomma
}
\stoptexdefinition
\starttexdefinition btx:ieee:journal-volume-year
\btxdoif {journal} {
\btxstartstyleandcolor [ieee:\s!list:journal]
% expandedjournal abbreviatedjournal
\btxflush{expandedjournal -> journal}
\btxstopstyleandcolor
\btxcomma
\btxdoifelse {volume} {
\btxspace
\btxstartstyleandcolor [ieee:\s!list:volume]
vol.~\btxflush{volume}
\btxcomma
\btxstopstyleandcolor
\btxdoif {number} {
no.~\btxflush{number}
\btxcomma
}
} {
\btxdoif {number} {
\btxspace
\btxflush{number}
\btxcomma
}
}
\btxdoif {pages} {
\btxspace
pp.~\btxflush{pages}
\btxcomma
}
}
\texdefinition{btx:ieee:year}
\stoptexdefinition
\starttexdefinition btx:ieee:publisher-wherefrom-year
\removeunwantedspaces
\btxspace
\btxflush{publisher}
\btxdoifelse {address} {
\btxdoif {publisher} {
\btxcomma
}
\btxflush{address}
\btxdoif {country} {
\btxcomma
\btxflush{country}
}
\btxcomma
} {
\btxdoif {publisher} {
\btxcomma
}
}
\texdefinition{btx:ieee:year}
\stoptexdefinition
\starttexdefinition btx:ieee:note
\btxperiod
\btxdoif {note} {
\btxleftparenthesis
\btxflush{note}
\btxrightparenthesis
}
\stoptexdefinition
\starttexdefinition btx:ieee:doi-url #text
\ifconditional\btxinteractive
\btxdoifelse {doi} {
\goto {#text} [url(http://dx.doi.org/\btxflush{doi})]
} {
\btxdoifelse {url} {
\goto {#text} [url(\btxflush{url})]
} {
#text
}
}
\else
#text
\fi
\stoptexdefinition
% Then setups, by category
% An article from a journal
% Required fields: author or editor or title, journal, (year).
% Optional fields: volume, number, pages, type, doi, url, note.
% Note that bibtex (and tools) do not include editor (e.g. special issue or section)
\startsetups btx:ieee:list:article
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:optional-title}
\texdefinition{btx:ieee:doi-url} {\texdefinition{btx:ieee:journal-volume-year}}
\texdefinition{btx:ieee:note}
\stopsetups
% An article from a magazine.
% Required fields: author or title, journal, (year).
% Optional fields: number, pages, type, month, day, doi, url, note.
\startsetups btx:ieee:list:magazine
\fastsetup{btx:ieee:list:article}
\stopsetups
% An article from a newspaper.
% Required fields: author or title, journal, (year).
% Optional fields: number, pages, type, month, day, doi, url, note.
\startsetups btx:ieee:list:newspaper
\fastsetup{btx:ieee:list:article}
\stopsetups
% A complete issue of a periodical, such as a special issue of a journal.
% Required fields: title, year
% Optional fields: editor, publisher, subtitle, series, volume, number, month, organization, doi, url, issn, note
% needs to be tuned...
\startsetups btx:ieee:list:periodical
\fastsetup{btx:ieee:list:article}
\stopsetups
% National and international standards issued by a standards body
% Required fields: author, institution, or organization, year, title
% Optional fields: subtitle, doi, url, note
\startsetups btx:ieee:list:standard
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\texdefinition{btx:ieee:note}
\stopsetups
% year?
% A book with an explicit publisher.
% Required fields: author or editor or publisher, title, (year).
% Optional fields: volume or number, series, address, edition, month, day, note.
% APS? ignores: month, day
% todo: series?
\startsetups btx:ieee:list:book
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\texdefinition{btx:ieee:editionset}
\texdefinition{btx:ieee:doi-url} {\texdefinition{btx:ieee:publisher-wherefrom-year}}
\texdefinition{btx:ieee:note}
\stopsetups
% There is some debate about how inbook should differ from incollection
% A part of a book, which may be a chapter (or section or whatever) and/or a range of pages.
% (note that inbook is handled differently by bibtex and biblatex)
% Required fields: author or editor, title, chapter and/or pages, publisher, year.
% Optional fields: volume or number, series, type, address, edition, month, note.
% We add optional: booktitle.
% APS? ignores: chapter, month
\startsetups btx:ieee:list:inbook
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\texdefinition{btx:ieee:editor-in}
\texdefinition{btx:ieee:editionset}
\texdefinition{btx:ieee:doi-url} {\texdefinition{btx:ieee:publisher-wherefrom-year}}
\texdefinition{btx:ieee:note}
\stopsetups
% chapter?
% A part of a book having its own title.
% Required fields: author, title, booktitle, publisher, year.
% Optional fields: editor, volume or number, series, type, chapter, pages, address, edition, month, note.
% APS? ignores: chapter, month
\startsetups btx:ieee:list:incollection
\fastsetup{btx:ieee:list:inbook}
\stopsetups
% The proceedings of a conference.
% Required fields: title, year.
% Optional fields: editor, volume or number, series, address, month, organization, publisher, note.
% todo: series?
\startsetups btx:ieee:list:proceedings
\fastsetup{btx:ieee:list:book}
\stopsetups
% An article in a conference proceedings.
% Required fields: author, title, booktitle, year.
% Optional fields: editor, volume or number, series, pages, address, month, organization, publisher, note.
\startsetups btx:ieee:list:inproceedings
\texdefinition{btx:ieee:author}
\quotation{\texdefinition{btx:ieee:title}\removeunwantedspaces}
\btxspace
\italic{\texdefinition{btx:ieee:editor-in}}
\texdefinition{btx:ieee:editionset}
\btxdoif {organization} {
\btxspace
\btxflush{organization}
\btxcomma
}
\texdefinition{btx:ieee:doi-url} {\texdefinition{btx:ieee:publisher-wherefrom-year}}
\texdefinition{btx:ieee:note}
\stopsetups
\startsetups btx:ieee:list:conference
\fastsetup{btx:ieee:list:inproceedings}
\stopsetups
% A thesis.
% Required fields: author, title, school, year.
% Optional fields: type, address, month, note.
\startsetups btx:ieee:list:thesis
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\btxdoifelse {type} {
\btxusecommand [ieee:list:type] {
\btxflush{type}
}
} {
\btxlabeltext{ieee:\currentbtxcategory}
}
\btxcomma
\btxdoif {school} {
\btxperiod
\btxflush{school}
}
\btxdoif {address} {
\btxdoifelse {school} {
\btxcomma
} {
\btxperiod
}
\btxflush{address}
\btxdoif {country} {
\btxcomma
\btxflush{country}
}
}
\btxcomma
\texdefinition{btx:ieee:year}
\texdefinition{btx:ieee:note}
\stopsetups
\startsetups btx:ieee:list:phdthesis
\fastsetup{btx:ieee:list:thesis}
\stopsetups
\startsetups btx:ieee:list:mastersthesis
\fastsetup{btx:ieee:list:thesis}
\stopsetups
% A work that is printed and bound, but without a named publisher or sponsoring institution.
% Required field: title.
% Optional fields: author, howpublished, address, month, year, note.
\startsetups btx:ieee:list:booklet
\fastsetup{btx:ieee:list:book}
\stopsetups
% Technical documentation.
% Required field: title.
% Optional fields: author, organization, address, edition, month, year, note.
\startsetups btx:ieee:list:manual
\fastsetup{btx:ieee:list:book}
\stopsetups
% A report published by a school or other institution, usually numbered within a series.
% Required fields: author, title, institution, year.
% Optional fields: type, number, address, month, note.
\startsetups btx:ieee:list:techreport
\fastsetup{btx:ieee:list:book}
\stopsetups
% A document having an author and title, but not formally published.
% Required fields: author, title, note.
% Optional fields: month, year.
\startsetups btx:ieee:list:unpublished
\fastsetup{btx:ieee:list:book}
\stopsetups
% A patent. Note that this category was not defined with BIBTEX. Below from JabRef:
% Required fields: nationality, number, year, yearfiled
% Optional fields: author, title, assignee, address, type, number, day, dayfiled, month, monthfiled, note, url
% Also optional: publisher
% todo: yearfiled, monthfiled, dayfiled
\startsetups btx:ieee:list:patent
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\begingroup
\it
\btxdoif {nationality} {
\btxspace
\btxflush{nationality}
}
\btxspace
\btxlabeltext{ieee:patent}
\btxdoif {number} {
\btxspace
\btxlabeltext{ieee:number}
\btxspace
\btxflush{number}
}
\btxperiod
\italiccorrection
\endgroup
\texdefinition{btx:ieee:doi-url} {\texdefinition{btx:ieee:publisher-wherefrom-year}}
\texdefinition{btx:ieee:url}
\texdefinition{btx:ieee:note}
\stopsetups
% Electronic. Note that this category was not defined with BIBTEX. Below from JabRef:
% Required fields: title
% Optional fields: address, author, howpublished, month, note, organization, url, year, doi
% Also optional: type
% Like Misc below but includes organization.
\startsetups btx:ieee:list:electronic
\texdefinition{btx:ieee:author}
\texdefinition{btx:ieee:title}
\btxdoif {organization} {
\btxspace
\btxflush{organization}
\btxperiod
}
\btxdoif {howpublished} {
\btxspace
\btxflush{howpublished}
}
\btxleftparenthesis
\texdefinition{btx:ieee:year}
\btxrightparenthesis
\texdefinition{btx:ieee:note}
\stopsetups
% Other. Note that this category was not defined with BIBTEX. Below from JabRef:
% Required fields: author or title, year
% Optional fields: note, doi, url
\startsetups btx:ieee:list:other
\fastsetup{btx:ieee:list:book}
\stopsetups
% Use this type when nothing else fits.
% Required fields: none.
% Optional fields: author, title, howpublished, month, year, note.
\startsetups btx:ieee:list:misc
\fastsetup{btx:ieee:list:electronic}
% Note that organization is an "ignored" field.
\stopsetups
% If all else fails to match:
\startsetups btx:ieee:list:literal
%\btxleftparenthesis
\removeunwantedspaces(
\btxflush{tag}
\btxrightparenthesis
\btxdoif {text} {
\btxflush{text}
}
\stopsetups
\stopbtxrenderingdefinitions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment