& を使用して bibkey をタイプセットするにはどうすればよいですか?

& を使用して bibkey をタイプセットするにはどうすればよいですか?
  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

ドキュメントの途中で catcodes を変更するのは本当に悪い考えです。何かが壊れてしまいますが、それを実行する場合はタイミングを正しくする必要があります。

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

\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

このようなbibkeyをタイプセットするにはどうすればいいですか

&常にAlignment Characterとして解釈されるので、それはできないと思います。前に変更できます。

ただし、 を使用できます\&。修正された(現在は機能している)例も参照してください。

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

よろしく、ニック

関連情報