Unfortunately, there is no canonical solution here. The base BibTeX styles were written back in the late eighties when URLs and electronic journal publishing were not really a thing and journal articles and conference proceedings mostly had page numbers, so there was no need to mark up "article numbers" or "paper numbers".
Since the core styles have no provision for this, many contributed styles also don't — and if they have something, they roll their own solution; there is no standard that would encompass more styles than that of a family or of the same author.
biblatex
knows the eid
field, but even there I can't promise that all contributed styles make use of it as intended.
You will have to decide if the output looks OK on a case-by-case basis, I'm afraid.
As it so happens, you mention IEEEtran
which has a paper
field for @inproceedings
that can be used here. That field is by no means universal and I have not seen it before, but it should hopefully give the expected output here.
How can I create entirely new data types with BibLaTeX/Biber? has a guide to defining new entry types in biblatex
.
In principle that guide can be used for all biblatex
styles, but integrating the new type into the style so that everything works seamlessly can be a bit of a challenge especially with a complex style such as biblatex-chicago
.
The following code seems to work OK-ish with biblatex-chicago
.
The main obstacle to using the code from How can I create entirely new data types with BibLaTeX/Biber? directly was that biblatex-chicago
needs specific drivers for citations as well, so that each \DeclareBibliographyDriver{<new type>}
needs a corresponding \DeclareBibliographyDriver{cite:<new type>}
for citations.
\begin{filecontents}{stackexchange.dbx}
\DeclareDatamodelEntrytypes{stackexchange}
\DeclareDatamodelFields[type=field,datatype=literal]{
sitekey,
sitetopic,
}
\DeclareDatamodelFields[type=list,datatype=name]{
askp,
ansp,
}
\DeclareDatamodelFields[type=field, datatype=date, skipout]{
askdate,
ansdate,
askeditdate,
anseditdate}
\DeclareDatamodelFields[type=field, datatype=verbatim]{
askid,
askpid,
anspid,
ansid,
}
\DeclareDatamodelEntryfields[stackexchange]{
sitekey,
sitetopic,
askid,
askp,
askpid,
ansp,
anspid,
ansid,
askyear,
askmonth,
askday,
ansyear,
ansmonth,
ansday,
askedityear,
askeditmonth,
askeditday,
ansedityear,
anseditmonth,
anseditday,
title}
\end{filecontents}
\documentclass[english]{article}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[datamodel=stackexchange,backend=biber]{biblatex-chicago}
\usepackage{hyperref}
\begin{filecontents*}{english-stack.lbx}
\ProvidesFile{english-stack.lbx}[2014/05/07 english with additions for stackexchange]
\InheritBibliographyExtras{english}
\NewBibliographyString{asked,answered,edited}
\DeclareBibliographyStrings{%
inherit = {english},
asked = {{asked}{asked}},
answered = {{answered}{answered}},
edited = {{edited}{edited}},
}
\end{filecontents*}
\DeclareLanguageMapping{english}{english-stack}
\DeclareFieldFormat[stackexchange]{title}{\mkbibquote{#1\isdot}}
\DeclareFieldFormat{askpid}{%
\mkbibparens{\ifhyperref
{\href{http://tex.stackexchange.com/users/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}}
\DeclareFieldFormat{anspid}{%
\mkbibparens{\ifhyperref
{\href{http://tex.stackexchange.com/users/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}}
\DeclareFieldFormat{askid}{%
\mkbibparens{\ifhyperref
{\href{http://tex.stackexchange.com/q/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}}
\DeclareFieldFormat{ansid}{%
\mkbibparens{\ifhyperref
{\href{http://tex.stackexchange.com/a/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}}}
\newbibmacro*{stackexchangequestion}{%
\printfield{title}%
\setunit{\addspace}%
\printfield{askid}%
}
\newbibmacro*{stackexchangeask}{%
\bibstring{asked}%
\setunit{\addspace}%
\printaskdate%
\iffieldundef{askedityear}%
{}
{\printtext[parens]{%
\bibstring{edited}%
\setunit{\addspace}%
\printaskeditdate}}%
\setunit{\addspace}%
\bibstring{byauthor}%
\setunit{\addspace}%
\printnames{askp}%
\setunit{\addspace}%
\printfield{askpid}%
}
\newbibmacro*{stackexchangeans}{%
\bibstring{answered}%
\setunit{\addspace}%
\printansdate%
\iffieldundef{ansedityear}
{}
{\printtext[parens]{%
\bibstring{edited}%
\setunit{\addspace}%
\printanseditdate}}%
\setunit{\addspace}%
\bibstring{byauthor}%
\setunit{\addspace}%
\printnames{ansp}%
\setunit{\addspace}%
\printfield{anspid}%
}
\newbibmacro*{stackexchangesite}{%
\printfield{sitetopic}}
\DeclareBibliographyDriver{stackexchange}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{stackexchangequestion}%
\newunit\newblock
\usebibmacro{stackexchangeask}%
\newunit\newblock
\usebibmacro{stackexchangeans}%
\newunit\newblock
\usebibmacro{stackexchangesite}%
\newunit\newblock
\usebibmacro{finentry}}
\DeclareBibliographyDriver{cite:stackexchange}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{stackexchangequestion}%
\newunit\newblock
\usebibmacro{stackexchangeask}%
\newunit\newblock
\usebibmacro{stackexchangeans}%
\newunit\newblock
\usebibmacro{stackexchangesite}%
\newunit\newblock
\usebibmacro{finentry}}
\begin{filecontents*}{\jobname.bib}
@stackexchange{se:l3help,
sitetopic = {tex},
title = {What can \textit{I} do to help the \LaTeX3 Project},
askdate = {2012-02-26},
askid = {45838},
askp = {Brent Longorough},
askpid = {344},
ansp = {Frank Mittelbach},
anspid = {10109},
ansdate = {2012-03-01},
ansid = {46427},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}
\begin{document}
Lorem\autocite{se:l3help}
ipsum\autocite{sigfridsson}
Lorem\autocite{se:l3help}
ipsum\autocite{sigfridsson}
\printbibliography
\end{document}
As mentioned in the comments \DeclareBibliographyAlias{cite:stackexchange}{stackexchange}
might be cheaper than having to copy the entire driver definition if they are the same, but I believe there are subtle differences between citations and references in Chicago style, so you may have to have two independent declarations after all.
Best Answer
With the
plain
bibliography style, I was able to useIt worked perfectly. It shows up as this in the document:
However, I have no solution for the other bibliography styles.