As per (this ticket) I tried to figure out how to create a new BibLaTeX entry type and have managed to get a a working MWE.
However, there are still some amendments I need to make and I don't know how and where to start.
This is my current MWE:
% arara: lualatex: { shell: true, synctex: true }
% arara: biber
% arara: lualatex: { shell: true, synctex: true }
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@law{se:l3help,
lawtitle = {Kaisei minp\={o} j\={o}bun},
date = {2012-02-26},
year = {2012},
lawtitleaddon = {{\"U}berarbeiteter Gesetzestext des Zivilgesetzbuchs},
lawsubtitle = {Tsuika},
maintitle = {testmaintitle},
maintitleaddon = {testmaintitleaddon},
urldate = {2019-07-21},
url = {http://dl.ndl.go.jp/info:ndljp/pid/1275567},
organization = {Saik\={o}-saiban-sho},
paragraph = {5},
subparagraph = {3},
number = {2}
}
\end{filecontents*}
% DBX ___________________________________________________________________________________
\begin{filecontents}{customstyles.dbx}
\DeclareDatamodelFields[type=field, datatype=literal]{
journaltitleaddon}
\DeclareDatamodelEntryfields[article,periodical]{
journaltitleaddon}
\DeclareDatamodelEntrytypes{law}
\DeclareDatamodelFields[type=field,datatype=literal]{
lawsubtitle, lawsubtitle,
lawtitle,
lawtitleaddon,
}
\DeclareDatamodelFields[type=field, datatype=verbatim]{
paragraph,
subparagraph,
article,
}
\DeclareDatamodelEntryfields[law]{
paragraph,
subparagraph,
article,
lawsubtitle,
lawtitle,
lawtitleaddon,
}
\end{filecontents}
% DBX ___________________________________________________________________________________
\documentclass[
12pt,
a4paper,
headings=standardclasses,
listof=totoc,
numbers=noenddot
]{scrartcl}
\usepackage{showframe}
\usepackage[left=2.50cm, right=2.50cm, top=2.50cm, bottom=2.00cm, footskip=1cm]{geometry}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[ngerman]{isodate}
\usepackage[ngerman]{datetime}
\usepackage[
backend=biber,
style=ext-authoryear,
sorting=nyvt,
datamodel=customstyles,
maxnames=25,
innamebeforetitle=true,
usetranslator=true,
alldates=terse,
labeldate=year,
dashed=false,
isbn=false
]{biblatex}
\usepackage{hyperref}
\addbibresource{\jobname.bib}
% editor and et al. spelling
\DefineBibliographyStrings{german}{
andothers = {et al\adddot},
byeditor = {Hg\adddotspace von},
editor = {Hg\adddot},
editors = {Hg\adddot},
urlseen = {letzter Abruf},
}
% LBX ___________________________________________________________________________________
\begin{filecontents*}{custombibstrings.lbx}
\ProvidesFile{custombibstrings.lbx}[2014/05/07 english with additions for law]
\InheritBibliographyExtras{ngerman}
\NewBibliographyString{paragraph,subparagraph,article}
\DeclareBibliographyStrings{%
inherit = {ngerman},
paragraph = {{Paragraph}{\S}},
subparagraph = {{Absatz}{Abs.}},
article = {{Artikel}{Art.}}
}
\end{filecontents*}
% LBX ___________________________________________________________________________________
\DeclareLanguageMapping{ngerman}{custombibstrings}
\renewcommand*{\titleaddonpunct}{\addspace}
\DeclareFieldFormat{titleaddon}{\mkbibbrackets{#1}}
\DeclareFieldAlias{booktitleaddon}{titleaddon}
\DeclareFieldAlias{maintitleaddon}{titleaddon}
\DeclareFieldAlias{journaltitleaddon}{titleaddon}
\DeclareFieldAlias{lawtitleaddon}{titleaddon}
\urlstyle{same}%
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\addcolon\space#1}}
\DeclareFieldFormat[law]{lawtitle}{#1\isdot}
\newbibmacro*{lawtitles}{%
\printfield{lawtitle}%
\setunit{\adddot\addspace}
\printfield{lawsubtitle}%
\setunit{\addspace}%
\printfield{lawtitleaddon}
\setunit{\addspace}%
{\printtext[parens]{%
\printdate}}%
\setunit{\adddot\addspace}%
{\printtext[smallcaps]{%
\printlist{organization}}}
\setunit{\addcolon\addspace}%
{\printtext[italics]{%
\printfield{maintitle}}}
\setunit{\addspace}%
\printfield{maintitleaddon}
\setunit{\addspace}%
}
\renewbibmacro*{paragraphs}{%
{\printtext{%
\bibstring{paragraph}%
\setunit{\addspace}%
\printfield{paragraph}}}%
\ifnameundef{paragraph}%
{}
{\printtext{%
\bibstring{article}%
\setunit{\addspace}%
\printfield{article}}}%
\setunit{\addcomma\addspace}%
\bibstring{subparagraph}%
\setunit{\addspace}%
\printfield{subparagraph}%
\setunit{\addcomma\addspace}%
\bibstring{number}%
\setunit{\addspace}%
\printfield{number}
}
\newbibmacro*{url}{%
\printfield{url}%
\setunit{\addspace}
\printfield{urldate}%
}
\DeclareBibliographyDriver{law}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{lawtitles}%
\newunit\newblock
\usebibmacro{paragraphs}%
\newunit\newblock
\usebibmacro{url}%
\newunit\newblock
\usebibmacro{finentry}}
\begin{document}
\nocite{*}
\cite{se:l3help}
\printbibliography
\end{document}
Instead of the
maintitle, it would be great if thelawtitlefield would be displayed.The linebreak is slightly off.
I have managed to get the bibstrings to work and
articleandparagraphare now displayed correctly as well! However, theifundefparameter is not setup correctly, apparently, if I usearticleinstead.After the url there should be printed the
urldatewith a certain style, seeI was wondering whether settings concerning online sources could be reused (which is why I added the following snippet to the code, however it only helped not to display the text "url:" in front of the url)
\urlstyle{same}% \DeclareFieldFormat{url}{\url{#1}} \DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{urlseen}\addcolon\space#1}}Somewhat unrelated, but I was wondering, whether it's okay to "merge" the dbx file the way I just did - (basically added my existing dbx file content in there
journaltitleaddon).
If there's anything you could assist me with, I'd be forever grateful!
Sorry for the recurring questions, but to me that's the only way to improve and I am quite happy that I managed to create a working MWE with your help!


![Kaisei minpo jobun. Tsuika [Überarbeiteter Gesetzestext des Zivilgesetzbuchs] (26.02.2012). Saik¯ o-saiban-sho: testmaintitle [testmaintitleaddon]. § 5, Abs. 3, Nr. 2. http://dl.ndl.go.jp/info:ndljp/pid/1275567 (letzter Abruf: 21.07.2019).](../../images/16f932599af4eb31f33e838a32e5b8af.webp)
filecontentsat all. It's just to make the example self-contained. The role ofdatamodel=customstylesis played by\DeclareLanguageMapping{ngerman}{custombibstrings}. I would recommend, however, to add the language to the.lbxfile name as well (will edit the answer in a moment to show what I mean). – moewe Jul 26 '19 at 13:54lawtitleinto account. If that does not work for you, please ask a new question with an example that shows the undesirable sorting and explain what you would like to see instead. – moewe Jul 27 '19 at 10:47