括弧内にテキストを記載し、セミコロンで囲んだ引用

括弧内にテキストを記載し、セミコロンで囲んだ引用

私の質問は、これです受け入れられた回答の一部を私の質問の参考として使って、

\begin{filecontents*}{\jobname.bib}
@book{01,
 author={Caesar, Gaius Iulius},
 title={Commentarii de bello {Gallico}},
 year={703},
}
\end{filecontents*}
\documentclass{article}

\makeatletter
\let\cite\relax
\DeclareRobustCommand{\cite}{%
  \let\new@cite@pre\@gobble
  \@ifnextchar[\new@cite{\@citex[]}}
\def\new@cite[#1]{\@ifnextchar[{\new@citea{#1}}{\@citex[#1]}}
\def\new@citea#1{\def\new@cite@pre{#1}\@citex}
\def\@cite#1#2{[{\new@cite@pre\space#1\if\relax\detokenize{#2}\relax\else, #2\fi}]}
\makeatother

\begin{document}

Here's a citation \cite[See:][p.~2]{01}

Another: \cite[p.~3]{01}.

Another: \cite{01}.

Again: \cite[See:][]{01}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

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

しかし、レンダリングされたドキュメントの最初の 2 行には、コンマではなくセミコロンを使いたいのですが、どうすればよいでしょうか?

答え1

,の定義の\@cite、 の直前の行\makeatother、 の直後にあります\else。そのコンマをセミコロンに置き換えます。

サンプル出力

\begin{filecontents*}{\jobname.bib}
@book{01,
 author={Caesar, Gaius Iulius},
 title={Commentarii de bello {Gallico}},
 year={703},
}
\end{filecontents*}
\documentclass{article}

\makeatletter
\let\cite\relax
\DeclareRobustCommand{\cite}{%
  \let\new@cite@pre\@gobble
  \@ifnextchar[\new@cite{\@citex[]}}
\def\new@cite[#1]{\@ifnextchar[{\new@citea{#1}}{\@citex[#1]}}
\def\new@citea#1{\def\new@cite@pre{#1}\@citex}
\def\@cite#1#2{[{\new@cite@pre\space#1\if\relax\detokenize{#2}\relax\else; #2\fi}]}
\makeatother

\begin{document}

Here's a citation \cite[See:][p.~2]{01}

Another: \cite[p.~3]{01}.

Another: \cite{01}.

Again: \cite[See:][]{01}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}

ちなみに、bibtexこの作品の出版社が見つからないという警告です :-)

関連情報