\fullcite コマンドでジャーナルタイトルを省略する

\fullcite コマンドでジャーナルタイトルを省略する

少数のジャーナルからの多数のジャーナル記事を含む参考文献があります。コマンド内でのみジャーナル タイトルを省略したいのですが、\fullcite参照リストに完全なジャーナル タイトルを表示したいのですが、どうすればよいですか? bib ファイル内のすべてのエントリを引用するソリューションは、表示したくないエントリが多数含まれているため機能しません。次のコードは、両方の状況でジャーナル タイトルを省略します。

\documentclass{article}
\usepackage{csquotes}
\usepackage[american]{babel}
\usepackage[style=apa,
            backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\begin{filecontents}{\jobname.bib}
@article{art,
    Author = {Author, A},
    Year = 2006,
    Journal = {A Journal With a Long Title},
    Number = 1,
    Pages = {1-10},
    Title = {An Article}
}
\end{filecontents}
\addbibresource{\jobname.bib}
 \DeclareSourcemap{
   \maps[datatype=bibtex,overwrite=true]{
    \map{
      \step[fieldsource=journal,
            match=\regexp{A\sJournal\sWith\sa\sLong\sTitle},
            replace={Journ}]
    }
   }
 }
\begin{document}
\fullcite{art}
\printbibliography
\end{document}

ここに画像の説明を入力してください

答え1

次のように実行できます。まず、ソースマッピングを少し変更します。

\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=true]{
    \map{
      \step[fieldsource=journal,
        match=\regexp{A\sJournal\sWith\sa\sLong\sTitle},
        fieldset=shortjournal, fieldvalue={Journ}
        % replace={Journ}
      ]
    }
  }
}

次に、ブールスイッチを作成します。

\providebool{use:shortjournal}

次に、journal( から取得したbiblatex.def) bibmacro を再定義してブール値を組み込みます。ただし、これによりネストと繰り返しが発生するため、元のマクロを新しい bibmacro で再定義する方が適切です。つまり、元の定義を取得します。

% Original definition (from biblatex.def)
% \newbibmacro*{journal}{%
%   \iffieldundef{journaltitle}
%     {}
%     {\printtext[journaltitle]{%
%        \printfield[titlecase]{journaltitle}%
%        \setunit{\subtitlepunct}%
%        \printfield[titlecase]{journalsubtitle}}}}

これを次のように書き換えます。

\renewbibmacro*{journal}{%
  \ifbool{use:shortjournal}%
    {\iffieldundef{shortjournal}%
      {\usebibmacro{origjournal}}%
      {\usebibmacro{shortjournal}}%
    }%
    {\usebibmacro{origjournal}}%
}

shortjournalこれは、およびbibmacrosに依存しています origjournal( は、orig元のjournalbibmacros を再利用しているだけであることを示します)。

\newbibmacro*{shortjournal}{%
  \printtext[journaltitle]{%
         \printfield[titlecase]{shortjournal}%
         \setunit{\subtitlepunct}%
         \printfield[titlecase]{journalsubtitle}}%
}

\newbibmacro*{origjournal}{%
  \iffieldundef{journaltitle}
      {}
      {\printtext[journaltitle]{%
       \printfield[titlecase]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{journalsubtitle}}}%
}

最後に、 のブール スイッチを追加します\fullcite。(\makeatletterと に注意してください\makeatother。これらは、ファイルに直接入力する場合に必要です.tex。)

\makeatletter
\DeclareCiteCommand{\fullcite}
  {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}%
  \usebibmacro{prenote}}
  {\usedriver
    {\DeclareNameAlias{sortname}{default}%
      \booltrue{use:shortjournal}%
      \global\boolfalse{bbx:parens}%
      \global\boolfalse{bbx:volseen}%
      \global\boolfalse{bbx:titleinauthpos}%
      \global\boolfalse{bbx:editorinauthpos}%
      \global\boolfalse{bbx:in}%
      \global\let\blx@related@loop\@empty}
    {\thefield{entrytype}}}
  {\multicitedelim}
  {\boolfalse{use:shortjournal}%
    \usebibmacro{postnote}%
   \usebibmacro{cite:post}}
\makeatother

すべてを一緒に入れて:

\documentclass{article}
\usepackage{csquotes}
\usepackage[american]{babel}
\usepackage[style=apa,
            backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{art,
    Author = {Author, A},
    Year = 2006,
    Journal = {A Journal With a Long Title},
    Number = 1,
    Pages = {1-10},
    Title = {An Article}
}

@article{art2,
    Author = {Author, A},
    Year = 2006,
    Journal = {A Journal With a Non-Matching Long Title},
    Number = 1,
    Pages = {1-10},
    Title = {An Article}
}

\end{filecontents*}
\addbibresource{\jobname.bib}

% Step 1.
\DeclareSourcemap{
  \maps[datatype=bibtex,overwrite=true]{
    \map{
      \step[fieldsource=journal,
        match=\regexp{A\sJournal\sWith\sa\sLong\sTitle},
        fieldset=shortjournal, fieldvalue={Journ}
        % replace={Journ}
      ]
    }
  }
}

% Step 2.
\providebool{use:shortjournal}

% Step 3.
% Original definition (from biblatex.def)
% \newbibmacro*{journal}{%
%   \iffieldundef{journaltitle}
%     {}
%     {\printtext[journaltitle]{%
%        \printfield[titlecase]{journaltitle}%
%        \setunit{\subtitlepunct}%
%        \printfield[titlecase]{journalsubtitle}}}}


\newbibmacro*{shortjournal}{%
  \printtext[journaltitle]{%
         \printfield[titlecase]{shortjournal}%
         \setunit{\subtitlepunct}%
         \printfield[titlecase]{journalsubtitle}}%
}

\newbibmacro*{origjournal}{%
  \iffieldundef{journaltitle}
      {}
      {\printtext[journaltitle]{%
       \printfield[titlecase]{journaltitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase]{journalsubtitle}}}%
}


\renewbibmacro*{journal}{%
  \ifbool{use:shortjournal}%
    {\iffieldundef{shortjournal}%
      {\usebibmacro{origjournal}}%
      {\usebibmacro{shortjournal}}%
    }%
    {\usebibmacro{origjournal}}%
}

% Step 4.
\makeatletter
\DeclareCiteCommand{\fullcite}
  {\renewcommand{\finalnamedelim}{\ifnum\value{liststop}>2 \finalandcomma\fi\addspace\&\space}%
  \usebibmacro{prenote}}
  {\usedriver
    {\DeclareNameAlias{sortname}{default}%
      \booltrue{use:shortjournal}%          <-- the added line
      \global\boolfalse{bbx:parens}%
      \global\boolfalse{bbx:volseen}%
      \global\boolfalse{bbx:titleinauthpos}%
      \global\boolfalse{bbx:editorinauthpos}%
      \global\boolfalse{bbx:in}%
      \global\let\blx@related@loop\@empty}
    {\thefield{entrytype}}}
  {\multicitedelim}
  {\usebibmacro{postnote}%
   \usebibmacro{cite:post}}
\makeatother

\begin{document}
\parindent0pt
\fullcite{art}\par
\fullcite{art2}\par

\printbibliography
\end{document}

ショートジャーナル.png

答え2

このトリックが適切かどうかはわかりませんが、ドキュメント全体を偽の参照セクションの下に置き、オプション[refsection=1]を追加します。map

\documentclass{article}
\usepackage{csquotes}
\usepackage[american]{babel}
\usepackage[style=apa,
backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}

% Declare an ad hoc category
\DeclareBibliographyCategory{quack} 

% Renew fullcite command
\let\oldfullcite\fullcite % this in necessary to renew the command with the same name
\renewcommand*{\fullcite}[2][]{\addtocategory{quack}{#2}\oldfullcite[#1]{#2}}

\begin{filecontents}{\jobname.bib}
    @article{art,
        Author = {Author, A},
        Year = 2006,
        Journal = {A Journal With a Long Title},
        Number = 1,
        Pages = {1-10},
        Title = {An Article}
    }
     @article{noinbib,
        Author = {Buthor, A},
        Year = 2006,
        Journal = {A Journal With a Long Title},
        Number = 1,
        Pages = {1-10},
        Title = {An Article that should not be listed in bibliography}
    }
\end{filecontents}

\DeclareSourcemap{
    \maps[datatype=bibtex,overwrite=true]{
        \map[refsection=1]{% with refsection=<n> the map is valid only for the refsection with <n> number
            \step[fieldsource=journal,
            match=\regexp{A\sJournal\sWith\sa\sLong\sTitle},
            replace={Journ}]
        }
    }
}

\addbibresource{\jobname.bib}

\begin{document}
   \begin{refsection}% fake refsection
       %\therefsection % use this to discover the number of the refsection
    \section{Title 1}
    A citation: \fullcite{art}
    some text
    \section{Title 2}
    Some other text and
    another citation: \fullcite{art}

    \end{refsection}

    \nocite{*}
    \printbibliography[category=quack] 

\end{document}

ここに画像の説明を入力してください

biblatexPS = 最新バージョンの/パッケージでのみ動作しますbiberここ

編集: コメントで要求された内容に従って回答を更新しました。

私はこのために.bib最終的な参考文献に、引用された参考文献のみ(ファイル内のすべての参考文献ではない)をリストするために、カテゴリを使用します。

以外の何らかの引用fullciteが使用される場合、関連するコマンドも同様に更新する必要があることに注意してください。

関連情報