TransWikia.com

Change Chapter Placement Biblatex

TeX - LaTeX Asked on July 30, 2021

I would like to set the chapter after title (or if titleaddon, after titleaddon, or if subtitle after subtitle, or if subtitle addon, after subtitle addon) instead of the end of the entry.

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,
  doi=false,
  isbn=false,
  url=false
]{biblatex}
addbibresource{jobname.bib}
% no period after addon titles
renewcommand*{titleaddonpunct}{addspace}
DeclareFieldFormat{titleaddon}{mkbibbrackets{#1}}
DeclareFieldAlias{booktitleaddon}{titleaddon}
DeclareFieldAlias{maintitleaddon}{titleaddon}
DeclareFieldAlias{journaltitleaddon}{titleaddon}
DeclareFieldAlias{lawtitleaddon}{titleaddon}
DeclareFieldAlias{subtitleaddon}{titleaddon}
begin{filecontents}{jobname.bib}

@inbook{iKonjaku.2003,
    author = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
    crossref = {Konjaku.2003},
    chapter = {11.1},
    publisher = {Shogakukan Inc},
    title = {Sh={o}toku-taishi kono ch={o} ni shite hajimete bupp={o} o hirome tamau-go},
    titleaddon = {Die Geschichte von Prinz Sh={o}toku, dem Ersten, der das Buddha-Dharma an diesem Morgen verbreitete},
    year = {2003}}
    

@book{Konjaku.2003,
    address = {T{=o}ky{=o}},
    author = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
    keywords = {primary},
    number = {1},
    organization = {Japan Knowledge},
    publisher = {Shogakukan Inc},
    series = {Shinpen Nihon koten bungaku zensh={u} [Neuausgabe Gesamtwerke klassicher japanischer Literatur]},
    title = {Konjaku-monogatari-sh={u}},
    titleaddon = {Geschichtensammlung von Jetzt und Einst},
    volume = {35},
    year = {2003}}

end{filecontents}
% Step 3: Add defined file as resource
begin{document}
 nocite{*} 
printbibliography
end{document}

image

One Answer

The chapter is printed by the bibmacro chapter+pages, so you just need to move this bibmacro in the definition of the relevant bibliography drivers (@inbook, @incollection and @inproceedings for consistency). The definitions of those drivers can be found in ext-standard.bbx.

documentclass{scrartcl}
usepackage[main=ngerman, english]{babel}
usepackage[babel, german=quotes]{csquotes}
usepackage[
  backend=biber,
  style=ext-authoryear,
  sorting=nyvt,
  datamodel=customstyles,
  maxnames=25,
  innamebeforetitle=true,
  usetranslator=true,
  alldates=terse,
  labeldate=year,
  dashed=false,
  doi=false,
  isbn=false,
  url=false
]{biblatex}

renewcommand*{titleaddonpunct}{addspace}
DeclareFieldFormat{titleaddon}{mkbibbrackets{#1}}
DeclareFieldAlias{booktitleaddon}{titleaddon}
DeclareFieldAlias{maintitleaddon}{titleaddon}
DeclareFieldAlias{journaltitleaddon}{titleaddon}
DeclareFieldAlias{lawtitleaddon}{titleaddon}
DeclareFieldAlias{subtitleaddon}{titleaddon}

DeclareBibliographyDriver{inbook}{%
  usebibmacro{introcite:plain}%
  usebibmacro{bibindex}%
  usebibmacro{begentry}%
  usebibmacro{author/translator+others}%
  setunit{printdelim{nametitledelim}}newblock
  usebibmacro{title}%
  newunit
  usebibmacro{language}%
  newunitnewblock
  usebibmacro{byauthor}%
  newunitnewblock
  usebibmacro{chapter+pages}%
  newunitnewblock
  usebibmacro{in:}%
  usebibmacro{crosscite}{inbook:parent}%
  newunitnewblock
  usebibmacro{isbn}%
  newunitnewblock
  usebibmacro{doi+eprint+url}%
  newunitnewblock
  usebibmacro{addendum+pubstate}%
  setunit{bibpagerefpunct}newblock
  usebibmacro{pageref}%
  newunitnewblock
  ifboolexpr{togl {bbx:related} and not test {iffieldxref{related}}}
    {usebibmacro{related:init}%
     usebibmacro{related}}
    {}%
  usebibmacro{finentry}}

DeclareBibliographyDriver{incollection}{%
  usebibmacro{introcite:plain}%
  usebibmacro{bibindex}%
  usebibmacro{begentry}%
  usebibmacro{author/translator+others}%
  setunit{printdelim{nametitledelim}}newblock
  usebibmacro{title}%
  newunit
  usebibmacro{language}%
  newunitnewblock
  usebibmacro{byauthor}%
  newunitnewblock
  usebibmacro{chapter+pages}%
  newunitnewblock
  usebibmacro{in:}%
  usebibmacro{crosscite}{incollection:parent}%
  newunitnewblock
  usebibmacro{isbn}%
  newunitnewblock
  usebibmacro{doi+eprint+url}%
  newunitnewblock
  usebibmacro{addendum+pubstate}%
  setunit{bibpagerefpunct}newblock
  usebibmacro{pageref}%
  newunitnewblock
  ifboolexpr{togl {bbx:related} and not test {iffieldxref{related}}}
    {usebibmacro{related:init}%
     usebibmacro{related}}
    {}%
  usebibmacro{finentry}}

DeclareBibliographyDriver{inproceedings}{%
  usebibmacro{introcite:plain}%
  usebibmacro{bibindex}%
  usebibmacro{begentry}%
  usebibmacro{author/translator+others}%
  setunit{printdelim{nametitledelim}}newblock
  usebibmacro{title}%
  newunit
  usebibmacro{language}%
  newunitnewblock
  usebibmacro{byauthor}%
  newunitnewblock
  usebibmacro{chapter+pages}%
  newunitnewblock
  usebibmacro{in:}%
  usebibmacro{crosscite}{inproceedings:parent}%
  newunitnewblock
  usebibmacro{isbn}%
  newunitnewblock
  usebibmacro{doi+eprint+url}%
  newunitnewblock
  usebibmacro{addendum+pubstate}%
  setunit{bibpagerefpunct}newblock
  usebibmacro{pageref}%
  newunitnewblock
  ifboolexpr{togl {bbx:related} and not test {iffieldxref{related}}}
    {usebibmacro{related:init}%
     usebibmacro{related}}
    {}%
  usebibmacro{finentry}}

begin{filecontents}{jobname.bib}
@inbook{iKonjaku.2003,
  author     = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
  crossref   = {Konjaku.2003},
  chapter    = {11.1},
  publisher  = {Shogakukan Inc},
  title      = {Sh={o}toku-taishi kono ch={o} ni shite hajimete bupp={o} o hirome tamau-go},
  titleaddon = {Die Geschichte von Prinz Sh={o}toku, dem Ersten,
                der das Buddha-Dharma an diesem Morgen verbreitete},
  year       = {2003},
}
@book{Konjaku.2003,
  address      = {T{=o}ky{=o}},
  author       = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
  keywords     = {primary},
  number       = {1},
  organization = {Japan Knowledge},
  publisher    = {Shogakukan Inc},
  series       = {Shinpen Nihon koten bungaku zensh={u}
                  [Neuausgabe Gesamtwerke klassicher japanischer Literatur]},
  title        = {Konjaku-monogatari-sh={u}},
  titleaddon   = {Geschichtensammlung von Jetzt und Einst},
  volume       = {35},
  year         = {2003},
}
end{filecontents}
addbibresource{jobname.bib}

begin{document}
 nocite{*} 
printbibliography
end{document}

If you don't like to copy that much code just to move around a few lines, you can use xpatch to patch the drivers

documentclass{scrartcl}
usepackage[main=ngerman, english]{babel}
usepackage[babel, german=quotes]{csquotes}
usepackage[
  backend=biber,
  style=ext-authoryear,
  sorting=nyvt,
  datamodel=customstyles,
  maxnames=25,
  innamebeforetitle=true,
  usetranslator=true,
  alldates=terse,
  labeldate=year,
  dashed=false,
  doi=false,
  isbn=false,
  url=false
]{biblatex}

renewcommand*{titleaddonpunct}{addspace}
DeclareFieldFormat{titleaddon}{mkbibbrackets{#1}}
DeclareFieldAlias{booktitleaddon}{titleaddon}
DeclareFieldAlias{maintitleaddon}{titleaddon}
DeclareFieldAlias{journaltitleaddon}{titleaddon}
DeclareFieldAlias{lawtitleaddon}{titleaddon}
DeclareFieldAlias{subtitleaddon}{titleaddon}

usepackage{xpatch}

newcommand*{MoveChapAndPagesInDriver}[1]{%
  xpatchbibdriver{#1}
    {newunitnewblock
     usebibmacro{chapter+pages}}
    {}
    {}
    {PackageError
       {patch-biblatex}
       {Failed to remove 'chapter+pages' from @#1 driver}
       {}}%
  xpatchbibdriver{#1}
    {usebibmacro{in:}}
    {newunitnewblock
     usebibmacro{chapter+pages}%
     usebibmacro{in:}}
    {}
    {PackageError
       {patch-biblatex}
       {Failed to remove 'chapter+pages' from @#1 driver}
       {}}%
}

MoveChapAndPagesInDriver{inbook}
MoveChapAndPagesInDriver{incollection}
MoveChapAndPagesInDriver{inproceedings}

begin{filecontents}{jobname.bib}
@inbook{iKonjaku.2003,
  author     = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
  crossref   = {Konjaku.2003},
  chapter    = {11.1},
  publisher  = {Shogakukan Inc},
  title      = {Sh={o}toku-taishi kono ch={o} ni shite hajimete bupp={o} o hirome tamau-go},
  titleaddon = {Die Geschichte von Prinz Sh={o}toku, dem Ersten,
                der das Buddha-Dharma an diesem Morgen verbreitete},
  year       = {2003},
}
@book{Konjaku.2003,
  address      = {T{=o}ky{=o}},
  author       = {Mabuchi, Kazuo and Kunisaku, Fumimaro and Inagaki Taichi},
  keywords     = {primary},
  number       = {1},
  organization = {Japan Knowledge},
  publisher    = {Shogakukan Inc},
  series       = {Shinpen Nihon koten bungaku zensh={u}
                  [Neuausgabe Gesamtwerke klassicher japanischer Literatur]},
  title        = {Konjaku-monogatari-sh={u}},
  titleaddon   = {Geschichtensammlung von Jetzt und Einst},
  volume       = {35},
  year         = {2003},
}
end{filecontents}
addbibresource{jobname.bib}

begin{document}
 nocite{*} 
printbibliography
end{document}

The result

Mabuchi, Kazuo, Fumimaro Kunisaku und Inagaki Taichi (2003b). „Shotoku-taishi konocho ni shite hajimete buppo o hirome tamau-go“ [Die Geschichte von Prinz Shotoku, dem Ersten, der das Buddha-Dharma an diesem Morgen verbreitete]. Kap. 11.1. In: Konjaku-monogatari-shi [Geschichtensammlung von Jetzt und Einst]. Bd. 35. Shinpen Nihon koten bungaku zenshi [Neuausgabe Gesamtwerke klassicher japanischer Literatur] 1. Tokyo: Shogakukan Inc.

is the same in both cases.

Correct answer by moewe on July 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP