Em minha antiga busca para combinar um estilo de bibliografia solicitado com biblatex
, gostaria de descobrir como posso trocar os campos "edição" e "editor" em biblatex-philosophy
.
Aqui está o formato que preciso:
Estou quase lá com o seguinte:
\documentclass[11pt, a4paper]{scrartcl}
% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern]{biblatex}
\addbibresource{testbib.bib}
% Some tweaks I've already made
\DeclareFieldFormat{postnote}{#1}% no postnote prefix in "normal" citation commands
\DeclareFieldFormat{multipostnote}{#1}% no postnote prefix in "multicite" commands
\DeclareFieldFormat{pages}{#1}% no prefix for the `pages` field in the bibliography
\DeclareFieldFormat[article]{title}{#1} % Remove quotations from Article title
\setlength{\yeartitle}{5.4em} % Set greater spacing between the year and the title
\setlength{\postnamesep}{2.5ex plus 2pt minus 1pt}
\begin{document}
Sentence containing citation \parencite{auerbach2003}.
\printbibliography
\end{document}
e .bib
arquivo:
@book{auerbach2003,
Author = {Auerbach, Erich},
Publisher = {Princeton University Press},
Title = {Mimesis: the representation of reality in Western literature},
date = {2003},
Editor = {Trask, Willard R.},
editortype = {translator},
Location = {Princeton},
edition = {2nd ed.}}
Quais saídas:
Espero que o processo também seja reproduzível em outras áreas, pois estou realmente interessado em adquirir as habilidades para fazer isso. A resposta principalaquitem sido muito útil ao fornecer uma visão geral de alto nível, mas os detalhes ainda estão além da minha compreensão nesta fase.
Responder1
Nem sempre é simples alterar a ordem dos campos biblatex
com apenas algumas linhas de código. Isto se deve à estrutura de biblatex
tratamento da bibliografia. biblatex
possui um 'driver' para cada tipo de entrada que define quais campos são impressos e em que ordem. Esses drivers, porém, nem sempre chamam \printfield
diretamente, muitas vezes chamam bibmacros auxiliares que fazem a impressão.
Pegue o driver como @book
exemplophilosophy-standard.bbx
\DeclareBibliographyDriver{book}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/editor+others/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{maintitle+title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{byeditor+others}%
\newunit\newblock
\printfield{edition}%
\newunit
\printfield{volumes}%
\newunit\newblock
\usebibmacro{series+number}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\usebibmacro{publisher+location+date}%
\newunit
\iffieldundef{maintitle}
{\printfield{volume}%
\printfield{part}}
{}%
\newunit\newblock
\usebibmacro{chapter+pages}%
\newunit
\printfield{pagetotal}%
\newunit\newblock
\iftoggle{bbx:isbn}
{\printfield{isbn}}
{}%
\newunit\newblock
\usebibmacro{doi+eprint+url}%
\newunit\newblock
\usebibmacro{addendum+pubstate}%
\newblock
\usebibmacro{phil:related}%
\newunit\newblock
\usebibmacro{pageref}%
\usebibmacro{finentry}}
Você pode ver que alguns campos são impressos diretamente ( \printfield{edition}
), enquanto muitas outras coisas são impressas por uma bibmacro ( \usebibmacro{byeditor+others}
).
Se você tiver sorte, existe um bibmacro razoavelmente curto que imprime os dois campos que você deseja trocar. Então alterar a ordem dos campos é tão fácil quanto redefinir aquela bibmacro. Se você quisesse alterar a ordem de e publisher
, por exemplo, você poderia simplesmente redefinir e pronto. Freqüentemente, essas macros são usadas por todos os tipos de entrada, então você nem precisa se preocupar com isso.location
date
publisher+location+date
Mas se você quiser trocar dois campos que são impressos por macros diferentes em um driver específico, será necessário essencialmente reescrever esse driver. Você copiaria a definição do driver e simplesmente reorganizaria os campos. Isso pode ser cansativo e fazer com que seu preâmbulo seja preenchido rapidamente com muitas linhas de código, já que seu bibdriver médio tem cerca de 40 a 50 linhas. E você terá que modificar todos os drivers afetados.
Nessas situações pode ser mais prático usar o pacote xpatch
. Usando o \xpatchbibdriver
comando você pode substituir certos bits da definição de um driver. Para remover edition
o driver, @book
você diria
\xpatchbibdriver{book}
{\printfield{edition}%
\newunit}
{}
{}
{\typeout{failed to remove edition from driver for 'book'}}
você pode adicioná-lo onde realmente quiser
\xpatchbibdriver{book}
{\printlist{language}%
\newunit\newblock}
{\printlist{language}%
\newunit\newblock
\printfield{edition}%
\newunit}
{}
{\typeout{failed to add edition to bibmacro 'book'}}
Patches estruturalmente semelhantes também devem ser aplicados a outros drivers e bibmacros.
Para que isso funcione, é crucial que você conheça a estrutura do driver subjacente.
Na íntegra com todos os tipos de entrada corrigidos
\documentclass[11pt, a4paper]{scrartcl}
% Bibliography preamble
\usepackage[giveninits=true, style=philosophy-modern]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{auerbach2003,
Author = {Auerbach, Erich},
Publisher = {Princeton University Press},
Title = {Mimesis: the representation of reality in Western literature},
date = {2003},
Editor = {Trask, Willard R.},
editortype = {translator},
Location = {Princeton},
edition = {2}}
\end{filecontents}
\addbibresource{\jobname.bib}
% Some tweaks I've already made
\DeclareFieldFormat{postnote}{#1}% no postnote prefix in "normal" citation commands
\DeclareFieldFormat{multipostnote}{#1}% no postnote prefix in "multicite" commands
\DeclareFieldFormat{pages}{#1}% no prefix for the `pages` field in the bibliography
\DeclareFieldFormat[article]{title}{#1} % Remove quotations from Article title
\setlength{\yeartitle}{5.4em} % Set greater spacing between the year and the title
\setlength{\postnamesep}{2.5ex plus 2pt minus 1pt}
\usepackage{xpatch}
\newcommand*{\removeeditiondriver}[1]{%
\xpatchbibdriver{#1}
{\printfield{edition}%
\newunit}
{}
{}
{\typeout{failed to remove edition from driver for '#1'}}}
\forcsvlist{\removeeditiondriver}{book,collection,manual,jurisdiction}
\newcommand*{\removeeditionbibmacro}[1]{%
\xpatchbibdriver{#1}
{\printfield{edition}%
\newunit}
{}
{}
{\typeout{failed to remove edition from bibmacro '#1'}}}
\forcsvlist{\removeeditionbibmacro}{inbook:full,incollection:full,xrefdata}
\newcommand*{\addeditiondriver}[1]{%
\xpatchbibdriver{#1}
{\printlist{language}%
\newunit\newblock}
{\printlist{language}%
\newunit\newblock
\printfield{edition}%
\newunit}
{}
{\typeout{failed to add edition to driver for '#1'}}}
\forcsvlist{\addeditiondriver}{book,collection,manual,jurisdiction}
\newcommand*{\addeditionbibmacroin}[1]{%
\xpatchbibdriver{#1}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock}
{\usebibmacro{maintitle+booktitle}%
\newunit\newblock
\printfield{edition}%
\newunit}
{}
{\typeout{failed to add edition to bibmacro '#1'}}}
\forcsvlist{\addeditionbibmacroin}{inbook:full,incollection:full}
\xpretobibmacro{xrefdata}
{\printfield{edition}%
\newunit}
{}
{\typeout{failed to add edition to bibmacro '#1'}}
\begin{document}
Sentence containing citation \parencite{nietzsche:ksa,companion,auerbach2003}.
\printbibliography
\end{document}