scrlayer-notecolumn `\makenote`와 `BibLaTeX`

scrlayer-notecolumn `\makenote`와 `BibLaTeX`

BibLaTeX + scrlayer-notecolumn으로의 여행을 계속합니다. 나는 생각했다.BibLaTeX를 사용하게 되자\marginpar 모든 것이 쉬울 것입니다.. 하지만 그렇지 않습니다.

scrlayer-notecolumn을 사용하여 사이드바를 만들고 싶습니다 \makenote.

MWE:

\documentclass{scrbook}

\usepackage{scrlayer-notecolumn}

% bib-file
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
  @book{Knu86,
    author = {Knuth, Donald E.},
    year = {1986},
    title = {The \TeX book},
  }
}  
\end{filecontents}

\usepackage[backend=bibtex, citestyle=authoryear]{biblatex}
\addbibresource{\jobname}

\DeclareCiteCommand{\tcite}
{\usebibmacro{prenote}}
{   %loopcode
    \usebibmacro{cite}
    \makenote{\printfield{title}}
    %\marginpar{\printfield{title}}
}
{\multicitedelim}
{\usebibmacro{postnote}}


\begin{document}
    hi
    \makenote{a side note}

    \tcite{Knu86}
\end{document}

\marginpar{

주석 처리된 내용을 사용하면 \marginpar문제가 없습니다.

marginpar 작업 데모


\makenote{

사용 \makenote하지 않습니다.

메이크노트가 작동하지 않아요

오류가 있는 경우: line 35: Undefined control sequence. \end{document} : Overwriting file `./dco2.bib'. : Using fall-back BibTeX(8) backend:(biblatex) functionality may be reduced/unavailable. : \clearnotecolumns while active non-layer page style. line 35: Flush note box `marginpar' : \pdfmdfivesum unavailable.


\makenote{\보호

나에게는 이것이 깨지기 쉬운 것 같아서 나는 protect 다음과 같이 바꾸 곤 했다.\makenote{\protect\printfield{title}}

보호됨

기본적으로 동일한 오류 집합이 발생했습니다.

line 35: Undefined control sequence. \end{document}
: Overwriting file `./dco2.bib'.
: Using fall-back BibTeX(8) backend:(biblatex) functionality may be reduced/unavailable.
: \clearnotecolumns while active non-layer page style.
line 35: Note moved down from(scrlayer-notecolumn) 11.0pt to 15.08002pt(scrlayer-notecolumn) at note box `marginpar'
line 35: Flush note box `marginpar'
: \pdfmdfivesum unavailable.

답변1

이것은 실제로 확장 문제입니다. \makenote보조 파일에 씁니다. 따라서 쓰기 확장이 사용됩니다. 그러나 \printfield{title}제목으로 확장되지는 않습니다. 그리고 이를 보호하면 \printfield{title}해당 파일에 기록됩니다. 보조 파일의 읽기 상태는 \printfield{title}제목까지 확장될 수 없기 때문에 이는 도움이 되지 않습니다.

그래서 필요한 것은 의 인수에 넣을 제목입니다 \makenote. 이를 수행하는 표준 접근 방식은 \edef\helpermacro{\printfield{title}}또는 를 사용한 \protected@edef\helpermacro{\printfield{title}}다음 을 사용하는 것입니다 \makenote{\helpermacro}. 그러나 cite 명령을 사용하는 \printfield{title}동안에는 \printfield {title}.

하지만 사용할 수 있는 또 다른 후크가 있습니다. 바로 field 의 필드 형식입니다 title. 필드를 인쇄하는 데 makenote사용되는 새 필드 형식을 정의 하고 이 새 형식을 사용하여 필드를 인쇄할 수 있습니다 .\makenotetitle

\documentclass{scrbook}

\usepackage{scrlayer-notecolumn}

\usepackage[backend=bibtex, citestyle=authoryear]{biblatex}
\addbibresource{biblatex-examples}

\DeclareFieldFormat{makenote}{\makenote{#1}}% define new makenote field format

\DeclareCiteCommand{\tcite}
{\usebibmacro{prenote}}
{   %loopcode
    \usebibmacro{cite}%
    \printfield[makenote]{title}% use makenote format to print field title
    %\makenote{\printfield{title}}
    %\marginpar{\printfield{title}}
}
{\multicitedelim}
{\usebibmacro{postnote}}


\begin{document}
    hi\makenote{a side note}

    Here a \verb|\tcite{knuth:ct}|: \tcite{knuth:ct}
\end{document}

결과 형식 지정

형식과 반대로 다음 \mkbibmakenote과 유사한 새 래퍼를 정의할 수도 있습니다 \mkbibfootnote.

\documentclass{scrbook}

\usepackage{scrlayer-notecolumn}

\usepackage[backend=bibtex, citestyle=authoryear]{biblatex}
\addbibresource{biblatex-examples}

\newrobustcmd{\mkbibmakenote}[1]{%
  \makenote*{\blxmkmakenote{#1}}%
}
\makeatletter
\newrobustcmd{\blxmkmakenote}[1]{%
  \begingroup
    \blx@blxinit
    \blx@setsfcodes
    \blx@postpunct@agroup
    #1%
  \endgroup
}
\makeatother

\DeclareCiteCommand{\tcite}[\mkbibmakenote]
{\usebibmacro{prenote}}
{%
    \usebibmacro{author}%
    \newunit
    \usebibmacro{title}%
}
{\multicitedelim}
{\usebibmacro{postnote}}


\begin{document}
    hi\makenote{a side note}

    Here a \verb|\tcite{knuth:ct}|: \tcite{knuth:ct}done.
\end{document}

래퍼 결과

둘 다 필요한 경우 텍스트에 인용 인쇄가 있고 여백에 인용 인쇄가 필요한 경우 a \cite및 a를 수행하는 고유한 명령을 정의해야 합니다 \tcite.

관련 정보