&로 턱받이를 어떻게 조판할 수 있나요?

&로 턱받이를 어떻게 조판할 수 있나요?
  1. 내 모든 BibTeX 항목의 카탈로그를 조판하고 싶습니다.

  2. 나는 &.bibkeyAuthor&Editor:2000

  3. 하지만 \catcode38=12전 세계적으로는 할 수 없습니다.

내 질문은: bibkey섹션 제목과 목차 모두에서 이러한 내용을 어떻게 조판하고 인용할 수 있습니까?

이것이 내가 달성하고 싶은 것입니다:

여기에 이미지 설명을 입력하세요

와 함께:

\newcommand\entry[1]{%
 \catcode38=12\relax
 \section{#1}
 \fullcite{#1}}

\entry{Author&Editor:2000}

하지만 나는 다음을 얻습니다.

! Misplaced alignment tab character &.

예를 들어:

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{foo.bib}

\usepackage{filecontents}
\begin{filecontents}{foo.bib}
@book{Author&Editor:2000, author={Author}, editor={Editor}, title={Title 0}, year={2000}}
@book{Author&Editor:2001, author={Author}, editor={Editor}, title={Title 1}, year={2001}}
@book{Author&Editor:2002, author={Author}, editor={Editor}, title={Title 2}, year={2002}}
\end{filecontents}

\newcommand\entry[1]{%
 \catcode38=12\relax
 \section{#1}
 \fullcite{#1}}

\begin{document}

\tableofcontents

\entry{Author&Editor:2000}
\entry{Author&Editor:2001}
\entry{Author&Editor:2002}

\end{document}

답변1

카테고리 코드를 변경할 필요가 없습니다. 우리는 단지 강력한 버전의 \detokenize.

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{foo.bib}

\usepackage{filecontents}
\begin{filecontents}{foo.bib}
@book{Author&Editor:2000, author={Author}, editor={Editor}, title={Title 0}, year={2000}}
@book{Author&Editor:2001, author={Author}, editor={Editor}, title={Title 1}, year={2001}}
@book{Author&Editor:2002, author={Author}, editor={Editor}, title={Title 2}, year={2002}}
\end{filecontents}

\newcommand\entry[1]{%
 \section{\keep{#1}}%
 \fullcite{#1}}
%%% \newrobustcmd is from etoolbox, loaded by biblatex
\newrobustcmd{\keep}[1]{\detokenize{#1}}

\begin{document}

\tableofcontents

\entry{Author&Editor:2000}
\entry{Author&Editor:2001}
\entry{Author&Editor:2002}

\end{document}

확장 프로그램을 추가해야 합니다.\addbibresource{foo.bib}

답변2

문서 중간에 catcode를 변경하는 것은 정말 나쁜 생각입니다. 문제가 발생할 수 있지만 그렇게 하려면 타이밍을 올바르게 잡아야 합니다.

여기에 이미지 설명을 입력하세요

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{foo}

\usepackage{filecontents}
\begin{filecontents}{foo.bib}
@book{Author&Editor:2000, author={Author}, editor={Editor}, title={Title 0}, year={2000}}
@book{Author&Editor:2001, author={Author}, editor={Editor}, title={Title 1}, year={2001}}
@book{Author&Editor:2002, author={Author}, editor={Editor}, title={Title 2}, year={2002}}
\end{filecontents}

\newcommand\entry{\bgroup\catcode`\&=12 \xentry}
\newcommand\xentry[1]{\egroup
 \section{#1}%
 \fullcite{#1}}

\begin{document}

{\catcode`\&=12 \tableofcontents}

\entry{Author&Editor:2000}
\entry{Author&Editor:2001}
\entry{Author&Editor:2002}



\end{document}

답변3

그런 턱받이를 어떻게 조판할 수 있나요?

&항상 정렬 문자로 해석되므로 그렇게 할 수 없다고 확신합니다.~ 전에당신은 그것을 변경할 수 있습니다.

하지만 사용할 수 있습니다 \&. 수정된(현재 작동하는) 예제도 참조하세요.

\documentclass{article}

\usepackage[backend=biber]{biblatex}
\addbibresource{foo}

\usepackage{filecontents}
\begin{filecontents}{foo.bib}
@book{Author\&Editor:2000, author={Author}, editor={Editor}, title={Title 0}, year={2000}}
@book{Author\&Editor:2001, author={Author}, editor={Editor}, title={Title 1}, year={2001}}
@book{Author\&Editor:2002, author={Author}, editor={Editor}, title={Title 2}, year={2002}}
\end{filecontents}

\newcommand\entry[1]{%
 \catcode38=12\relax
 \section{#1}
 \fullcite{#1}}

\begin{document}

\tableofcontents

\entry{Author\&Editor:2000}
\entry{Author\&Editor:2001}
\entry{Author\&Editor:2002}

\end{document}

감사합니다, 닉

관련 정보