\mkibid 不适用于自定义命令

\mkibid 不适用于自定义命令

我目前正在使用自定义的引用命令(\citearticle):

\DeclareCiteCommand{\citearticle}
  {\booltrue{citetracker}%
   \booltrue{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield{title}%
   \setunit{\addcomma\space}%
   \printfield{journaltitle}%
   \setunit{\addcolon\addspace}%
   \printfield{pages}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

我还使用自定义环境(\begin{quote}{title}),它允许我引用文本并在括号内显示其标题。

\patchcmd{\quote}{\rightmargin}{\leftmargin 1.5cm \rightmargin}{}{}

\let\oldquote\quote
\let\endoldquote\endquote

\RenewDocumentEnvironment{quote}{om}
  {\oldquote}
  {(#2\IfValueT{#1}{~---~#1})\endoldquote 
   \addvspace{\bigskipamount}}

\AtBeginEnvironment{quote}{\par\singlespacing\small}

然而\parencite和类似物) 正确使用,\mkibid如果紧接着引用相同的来源,我的自定义\citearticle命令不会检查该来源是否已被使用,如本屏幕截图所示。我该如何解决这个问题?

这是我的main.tex文件:

\documentclass[a4paper,12pt,twoside]{report}
\usepackage[utf8]{inputenc}

\usepackage[german, main=italian, english]{babel}
\selectlanguage{italian}

\usepackage{etoolbox}

\usepackage[autostyle]{csquotes}
\setquotestyle{english}
\MakeOuterQuote{"}

%=========================================%

\usepackage[backend=biber, natbib=true, citestyle=authoryear-icomp, bibstyle=authoryear-icomp, ibidpage=true, dashed=true, pagetracker=false, maxbibnames=4, maxcitenames=2, autolang=other]{biblatex}
\addbibresource{bib.bib}

%============================================%  CUSTOM \CITEARTICLE COMMAND

\DeclareCiteCommand{\citearticle}
  {\booltrue{citetracker}%
   \booltrue{pagetracker}%
   \usebibmacro{prenote}}
  {\printfield{title}%
   \setunit{\addcomma\space}%
   \printfield{journaltitle}%
   \setunit{\addcolon\addspace}%
   \printfield{pages}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

%=========================================%     CUSTOM QUOTE ENVIRONMENT

\patchcmd{\quote}{\rightmargin}{\leftmargin 1.5cm \rightmargin}{}{}

\let\oldquote\quote
\let\endoldquote\endquote

\RenewDocumentEnvironment{quote}{om}
  {\oldquote}
  {(#2\IfValueT{#1}{~---~#1})\endoldquote 
   \addvspace{\bigskipamount}}

\AtBeginEnvironment{quote}{\par\singlespacing\small}

%=========================================%

\usepackage[colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue]{hyperref}
\usepackage{titlesec, url}

%=========================================%

\usepackage[nottoc, notlot, notlof]{tocbibind}
\usepackage{tocloft}
    \renewcommand \cftchapdotsep{4.5}

%=========================================%

\usepackage{mathptmx}
\usepackage[margin=2cm]{geometry}
\usepackage[skip=0cm, indent=1.5cm]{parskip}
\pagenumbering{arabic}

%=========================================%

\usepackage{subcaption}
\usepackage[export]{adjustbox}
\usepackage{wrapfig}

\usepackage{nopageno, graphicx, setspace, longtable, pdflscape, color}

%=========================================%     PAGE INPUT

\begin{document}
    
    \pagestyle{plain}        
    \tableofcontents
  
    \spacing{1.5}    
    \input{Chapter1}

    \pagestyle{empty}    
    \spacing{1}    
    \printbibliography[heading=bibintoc, title={Bibliografia}]
    
\end{document}

这是我的\input{Chapter1}文件:

\chapter{How to}
This is a dummy text \parencite{fairclough-media.discourse}. This is an example of the fact that \verb|\mkibid| works if I cite the same source: \parencite{fairclough-media.discourse}.

\begin{quote}{\cite{gillian.yule-discourse.analysis}}
    This is a dummy text enclosed in a redefined quote environment. This is a dummy text enclosed in a redefined quote environment. This is a dummy text enclosed in a redefined quote environment. This is a dummy text enclosed in a redefined quote environment. This is a dummy text enclosed in a redefined quote environment.
\end{quote}

\LaTeX understands that Brown and Yule's text has been previously used and correctly uses \verb|\mkibid|: \parencite{gillian.yule-discourse.analysis}.

\vspace{2.5cm}

\begin{quote}{\citearticle{carolina-spartan}}
    On the contrary, if I use my custom made quote environment to cite some kind of text ... 
\end{quote}

As soon as I cite the same article outside of it, \verb|\mkibid| doesn't work. (\citearticle{carolina-spartan})

\vspace{2.5cm}

Moreover, if I simply cite the same article two times (without using my quote environment), the second time I do so it doesn't print \verb|\mkibid|.

This is a dummy text (\citearticle{carolina-spartan}) and (\citearticle{carolina-spartan})

最后是我的bib.bib文件:

@book{fairclough-media.discourse,
    author = "Norman Fairclough",
    title = "Media Discourse",
    publisher = "Arnold",
    location = "London",
    year = "1995",
}

@book{gillian.yule-discourse.analysis,
    author = "Gillian Brown and George Yule",
    title = "Discourse Analysis",
    publisher = "Cambridge University Press",
    location = "Cambridge",
    year = "1983",
    langid = "english",
}

@suppperiodical{carolina-spartan,
  author = "Anon.",
  journal = "The Carolina Spartan",
  month = "5",
  url = "https://chroniclingamerica.loc.gov/lccn/sn83025802/1856-05-29/ed-1/seq-2/",
  number = "14",  
  pages = "2",
  title = "Brooks and Sumner",
  volume = "XIII",
  year = "1856",
}

答案1

必须在引用命令的定义中明确添加对“同上”的支持。

通常的习惯用法是

\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
  {\usebibmacro{cite:ibid}}
  {[non ibidem code]}

当您使用已经支持“ibid.”的样式并定义 bibmacro 时cite:ibid(如这里的情况)。因此您\citearticle需要进行一些小的调整。

quote这与您的环境无关。

\documentclass[a4paper,12pt,twoside]{report}
\usepackage[utf8]{inputenc}

\usepackage[german, main=italian, english]{babel}

\usepackage[autostyle]{csquotes}
\setquotestyle{english}
\MakeOuterQuote{"}

\usepackage[
  backend=biber,
  style=authoryear-icomp,
  maxbibnames=4, maxcitenames=2,
  ibidpage=true, pagetracker=false,
  dashed=true,
  autolang=other,
]{biblatex}

\DeclareCiteCommand{\citearticle}
  {\booltrue{citetracker}%
   \booltrue{pagetracker}%
   \usebibmacro{prenote}}
  {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
     {\usebibmacro{cite:ibid}}
     {\printfield{title}%
      \setunit{\addcomma\space}%
      \printfield{journaltitle}%
      \setunit{\addcolon\addspace}%
      \printfield{pages}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\patchcmd{\quote}{\rightmargin}{\leftmargin 1.5cm \rightmargin}{}{}

\let\oldquote\quote
\let\endoldquote\endquote

\RenewDocumentEnvironment{quote}{om}
  {\oldquote}
  {(#2\IfValueT{#1}{~---~#1})\endoldquote
   \addvspace{\bigskipamount}}

\AtBeginEnvironment{quote}{\par\singlespacing\small}

\usepackage{setspace}
\usepackage[colorlinks=true, linkcolor=blue, urlcolor=blue, citecolor=blue]{hyperref}

\begin{filecontents}{\jobname.bib}
@book{fairclough-media.discourse,
    author = "Norman Fairclough",
    title = "Media Discourse",
    publisher = "Arnold",
    location = "London",
    year = "1995",
}
@book{gillian.yule-discourse.analysis,
    author = "Gillian Brown and George Yule",
    title = "Discourse Analysis",
    publisher = "Cambridge University Press",
    location = "Cambridge",
    year = "1983",
    langid = "english",
}
@suppperiodical{carolina-spartan,
  author = "Anon.",
  journal = "The Carolina Spartan",
  month = "5",
  url = "https://chroniclingamerica.loc.gov/lccn/sn83025802/1856-05-29/ed-1/seq-2/",
  number = "14",
  pages = "2",
  title = "Brooks and Sumner",
  volume = "XIII",
  year = "1856",
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\chapter{How to}
This is a dummy text \parencite{fairclough-media.discourse}.
This is an example of the fact that \verb|\mkibid| works if I cite the same source:
\parencite{fairclough-media.discourse}.

\begin{quote}{\cite{gillian.yule-discourse.analysis}}
    This is a dummy text enclosed in a redefined quote environment.
    This is a dummy text enclosed in a redefined quote environment.
    This is a dummy text enclosed in a redefined quote environment.
    This is a dummy text enclosed in a redefined quote environment.
    This is a dummy text enclosed in a redefined quote environment.
\end{quote}

\LaTeX understands that Brown and Yule's text has been previously used
and correctly uses \verb|\mkibid|: \parencite{gillian.yule-discourse.analysis}.

\vspace{2.5cm}

\begin{quote}{\citearticle{carolina-spartan}}
    On the contrary, if I use my custom made quote environment
    to cite some kind of text ...
\end{quote}

As soon as I cite the same article outside of it, \verb|\mkibid| doesn't work.
(\citearticle{carolina-spartan})

\vspace{2.5cm}

Moreover, if I simply cite the same article two times
(without using my quote environment),
the second time I do so it doesn't print \verb|\mkibid|.

This is a dummy text (\citearticle{carolina-spartan})
and (\citearticle{carolina-spartan})

    \printbibliography[heading=bibintoc, title={Bibliografia}]
\end{document}

这是一个虚拟文本(Brooks 和 Sumner,《卡罗莱纳斯巴达人》:第 2 页)和(同上)

相关内容