自定义日记标题

自定义日记标题

我想知道您是否可以像 titleaddon 一样使用 journalsubtitle,因为 journaltitles 没有插件选项,对吗?

我已经定制了 addontitles 的样式,以便它们可以作为原始标题的翻译,例如:绿色 = 正确,红色 = 错误

绿色 = 正确,红色 = 错误

现在,我希望 journalsubtitle 能够以完全相同的方式使用,省略一个点 [此处翻译标题] 添加点

有没有办法做到这一点?

梅威瑟:

\documentclass[
  12pt,
  a4paper,
  headings=standardclasses,
  numbers=noenddot
]{scrartcl}
\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{filecontents}
\usepackage[
  backend=biber,
  style=ext-authoryear,
  sorting=nyvt,
  maxnames=25
]{biblatex}
\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},
}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \pertype{article}
      \step[fieldsource=entrysubtype, match=\regexp{\Anewspaper\Z}, final]
      \step[fieldsource=journal, final]
      \step[fieldset=author, origfieldval, final]
      \step[fieldsource=author, match=\regexp{\A(.*)\Z}, replace=\regexp{\{$1\}}]
      \step[fieldset=author+an, fieldvalue={1=journalauthor}]
      \step[fieldset=options, fieldvalue={journalauthor}]
    }
  }
}

\newtoggle{bbx@journalauthor}
\DeclareEntryOption[boolean]{journalauthor}[true]{%
\settoggle{bbx@journalauthor}{#1}}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifitemannotation{journalauthor}
    {\mkbibemph{#1}}
    {\textsc{#1}}}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}


% no period after addon titles
\renewcommand*{\titleaddonpunct}{\addspace}
\DeclareFieldFormat{titleaddon}{\mkbibbrackets{#1}}
\DeclareFieldAlias{booktitleaddon}{titleaddon}
\DeclareFieldAlias{maintitleaddon}{titleaddon}

\newbibmacro{online:editor+maintitle}{% organization in front of maintitle
  \printlist{organization}%
  \clearlist{organization}%
  \setunit*{\addcolon\space}%
  \printnames{editor}%
  \setunit*{\addcolon\space}%
  \usebibmacro{maintitle}}

\usepackage{xpatch}
\xpatchbibdriver{online}
  {\usebibmacro{byeditor+others}}
  {\usebibmacro{online:editor+maintitle}}
  {}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}

\renewbibmacro*{in:}{%
  \iftoggle{bbx@journalauthor}
    {}
    {\printtext{%
     \bibstring{in}\intitlepunct}}}

\DeclareNameAlias{ineditor}{sortname}

\renewcommand*{\volnumdelim}{\addcomma\space}

% set articles as per IOA
\DeclareListWrapperFormat[article]{parenlocation}{\mkbibparens{#1}}
\DeclareListAlias{parenlocation}{location}
\renewbibmacro*{journal}{%
  \ifboolexpr{
    (test {\iffieldundef{journaltitle}}
     and
     test {\iffieldundef{journalsubtitle}})
    or
    togl {bbx@journalauthor}
  }
    {\ifboolexpr{
       togl {bbx@journalauthor}
       and
       test {\iffieldequalstr{entrysubtype}{newspaper}}
     }
       {\printlist{location}}
       {}}
    {\printtext[journaltitle]{%
       \printfield[titlecase]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{journalsubtitle}}%
     \iffieldequalstr{entrysubtype}{newspaper}
       {\setunit{\addspace}%
        \printlist[parenlocation]{location}}
       {}}}

\renewbibmacro*{issue+date}{%
  \usebibmacro{bbx:ifmergeddate}
    {}
    {\printtext[issuedate]{%
       \printdate}}%
  \setunit{\addcomma\space}%
  \printfield{issue}%
  \setunit{\addcomma\space}}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\jourvoldelim}%
  \iffieldundef{series}
    {}
    {\setunit*{\jourserdelim}%
     \printfield{series}%
     \setunit{\servoldelim}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\volnumdatedelim}%
  \iftoggle{bbx@journalauthor}
    {}
    {}
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}


\begin{filecontents}{jobname.bib}
@article{Ueda.2005,
 title = {Heian-ky\={o} no seiritsu to higashiajia},
 titleaddon = {Die Errichtung von Heian-ky\={o} und Ostasien},
 journaltitle = {Kodai higashi ajia no rekishi to bunka},
 journalsubtitle = {Geschichte und Kultur im ostasiatischen Altertum},
 author = {Ueda, Masaaki},
 year = {2005},
 volume = {122},
 publisher = {Higashiajia no kodai bunka kodai-gaku kenky\={u}-jo},
 location = {Japan},
 pages = {2-8},
 Catalogue-Link* = {http://iss.ndl.go.jp/books/R000000004-I7260043-00}
}

 @incollection{Ki.1957,
 author = {Ki, Tsurayuki},
 title = {Tosa Nikki},
 titleaddon = {Das Tagebuch von Tosa},
 pages = {5--81},
 publisher = {{Iwanami Shoten}},
 maintitle = {Nihon Koten Bungaku Taikei},
 maintitleaddon = {Japanische klassische Literatur},
 editor = {Suzuki, Tomotar\={o} and Kawaguchi, Hisao and End\={o}, Yoshimoto and Nishishita, Tsunekazu},
 booktitle = {Tosa Nikki. Kager\={o} Nikki. Izumi Shikibu Nikki. Sarashina Nikki},
 year = {1957},
 location = {T\={o}ky\={o}},
 volume = {20},
 keywords = {primary}
}
\end{filecontents}

\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc,title={Literaturverzeichnis}]
\end{document}

答案1

可能会修改宏来格式化journalsubtitle像(虚构的)那样journaltitleaddon,但对我来说仅仅定义似乎更干净、更漂亮journaltitleaddon

这需要一个新的数据模型 ( .dbx) 文件来注册新字段,并添加\setunit{\titleaddonpunct}%\printfield{journaltitleaddon}%以便\renewbibmacro*{journal}打印它。另请比较将字段“tome”添加到 biblatex 条目

\documentclass[
  12pt,
  a4paper,
  headings=standardclasses,
  numbers=noenddot
]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[main=ngerman, english]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage{filecontents}
\begin{filecontents}{journaltitleaddon.dbx}
\DeclareDatamodelFields[type=field, datatype=literal]{
  journaltitleaddon}

\DeclareDatamodelEntryfields[article,periodical]{
  journaltitleaddon}
\end{filecontents}


\usepackage[
  backend=biber,
  datamodel=journaltitleaddon,
  style=ext-authoryear,
  sorting=nyvt,
  maxnames=25
]{biblatex}


% editor and et al. spelling
\DefineBibliographyStrings{german}{
  andothers = {et al\adddot},
  byeditor  = {Hg\adddotspace von},
  editor    = {Hg\adddot},
  editors   = {Hg\adddot},
  urlseen   = {letzter Abruf},
}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[overwrite=false]{
      \pertype{article}
      \step[fieldsource=entrysubtype, match=\regexp{\Anewspaper\Z}, final]
      \step[fieldsource=journal, final]
      \step[fieldset=author, origfieldval, final]
      \step[fieldsource=author, match=\regexp{\A(.*)\Z}, replace=\regexp{\{$1\}}]
      \step[fieldset=author+an, fieldvalue={1=journalauthor}]
      \step[fieldset=options, fieldvalue={journalauthor}]
    }
  }
}

\newtoggle{bbx@journalauthor}
\DeclareEntryOption[boolean]{journalauthor}[true]{%
\settoggle{bbx@journalauthor}{#1}}

\renewcommand{\mkbibnamefamily}[1]{%
  \ifitemannotation{journalauthor}
    {\mkbibemph{#1}}
    {\textsc{#1}}}

\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}


% no period after addon titles
\renewcommand*{\titleaddonpunct}{\addspace}
\DeclareFieldFormat{titleaddon}{\mkbibbrackets{#1}}
\DeclareFieldAlias{booktitleaddon}{titleaddon}
\DeclareFieldAlias{maintitleaddon}{titleaddon}
\DeclareFieldAlias{journaltitleaddon}{titleaddon}

\newbibmacro{online:editor+maintitle}{% organization in front of maintitle
  \printlist{organization}%
  \clearlist{organization}%
  \setunit*{\addcolon\space}%
  \printnames{editor}%
  \setunit*{\addcolon\space}%
  \usebibmacro{maintitle}}

\usepackage{xpatch}
\xpatchbibdriver{online}
  {\usebibmacro{byeditor+others}}
  {\usebibmacro{online:editor+maintitle}}
  {}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}
\xpatchbibmacro{editorstrg}{\bibstring}{\bibcpstring}{}{}

\renewbibmacro*{in:}{%
  \iftoggle{bbx@journalauthor}
    {}
    {\printtext{%
     \bibstring{in}\intitlepunct}}}

\DeclareNameAlias{ineditor}{sortname}

\renewcommand*{\volnumdelim}{\addcomma\space}

% set articles as per IOA
\DeclareListWrapperFormat[article]{parenlocation}{\mkbibparens{#1}}
\DeclareListAlias{parenlocation}{location}
\renewbibmacro*{journal}{%
  \ifboolexpr{
    (test {\iffieldundef{journaltitle}}
     and
     test {\iffieldundef{journalsubtitle}})
    or
    togl {bbx@journalauthor}
  }
    {\ifboolexpr{
       togl {bbx@journalauthor}
       and
       test {\iffieldequalstr{entrysubtype}{newspaper}}
     }
       {\printlist{location}}
       {}}
    {\printtext[journaltitle]{%
       \printfield[titlecase]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{journalsubtitle}}%
     \setunit{\titleaddonpunct}%
     \printfield{journaltitleaddon}%
     \iffieldequalstr{entrysubtype}{newspaper}
       {\setunit{\addspace}%
        \printlist[parenlocation]{location}}
       {}}}

\renewbibmacro*{issue+date}{%
  \usebibmacro{bbx:ifmergeddate}
    {}
    {\printtext[issuedate]{%
       \printdate}}%
  \setunit{\addcomma\space}%
  \printfield{issue}%
  \setunit{\addcomma\space}}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\jourvoldelim}%
  \iffieldundef{series}
    {}
    {\setunit*{\jourserdelim}%
     \printfield{series}%
     \setunit{\servoldelim}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\volnumdatedelim}%
  \iftoggle{bbx@journalauthor}
    {}
    {}
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}


\begin{filecontents}{\jobname.bib}
@article{Ueda.2005,
 title             = {Heian-ky\={o} no seiritsu to higashiajia},
 titleaddon        = {Die Errichtung von Heian-ky\={o} und Ostasien},
 journaltitle      = {Kodai higashi ajia no rekishi to bunka},
 journaltitleaddon = {Geschichte und Kultur im ostasiatischen Altertum},
 author            = {Ueda, Masaaki},
 year              = {2005},
 volume            = {122},
 publisher         = {Higashiajia no kodai bunka kodai-gaku kenky\={u}-jo},
 location          = {Japan},
 pages             = {2-8},
 Catalogue-Link*   = {http://iss.ndl.go.jp/books/R000000004-I7260043-00}
}

 @incollection{Ki.1957,
 author         = {Ki, Tsurayuki},
 title          = {Tosa Nikki},
 titleaddon     = {Das Tagebuch von Tosa},
 pages          = {5--81},
 publisher      = {{Iwanami Shoten}},
 maintitle      = {Nihon Koten Bungaku Taikei},
 maintitleaddon = {Japanische klassische Literatur},
 editor         = {Suzuki, Tomotar\={o} and Kawaguchi, Hisao
                   and End\={o}, Yoshimoto and Nishishita, Tsunekazu},
 booktitle      = {Tosa Nikki. Kager\={o} Nikki. Izumi Shikibu Nikki. Sarashina Nikki},
 year           = {1957},
 location       = {T\={o}ky\={o}},
 volume         = {20},
 keywords       = {primary}
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc,title={Literaturverzeichnis}]
\end{document}

上田正明 (2005):《平安京的统治与东方》[Die Errichtung von Heian-kyo und Ostasien]。收录于:《古代东方的历史与文化》122,第2-8页。

相关内容