\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를 재정의하여 부울을 통합합니다. 그러나 이로 인해 어느 정도 중첩 및 반복이 발생하므로 일부 새로운 bibmacros 측면에서 원래 매크로를 재정의하는 것이 좋습니다. 즉, 원래 정의를 따르십시오.

% 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}}%
}

이는 shortjournalorigjournalbibmacros에 의존합니다. 여기서는 orig원래 bibmacro를 재활용한다는 의미입니다 journal.

\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사용되면 관련 명령도 유사하게 갱신되어야 한다는 점에 유의하십시오.

관련 정보