저는 다양한 유형의 참조를 구별하기 위해 multibib 패키지를 사용하고 있습니다. 또한 \cite{}
명령을 정의했습니다 \citemine{}
.
인용은 완벽하게 작동하지만 때로는 하나의 괄호 안에 두 유형의 참조가 모두 포함되고 싶습니다. 즉, \cite{RefA}\citemine{RefB}
[1][2]가 되기보다는 [1,2]를 갖고 싶습니다.
4월 28일 업데이트: 저는 약간의 사소한 세부 사항이 누락된 (불쾌한) 해결책을 찾았습니다. 업데이트된 MWE의 결과는 [1, 2]이지만 물론 저는 [1, 2]를 선호합니다. 이 추가 공간이 어디서 나오는지 전혀 모르기 때문에 매우 혼란스럽습니다. 도움을 주시면 감사하겠습니다!
\documentclass[]{scrbook}
% bibstlye
\usepackage{cite}
\usepackage{multibib}
\newcites{mine}{my stuff}
\newcommand{\citeBoth}[2]{
\renewcommand{\citeleft}{}
\renewcommand{\citeright}{}
[#1,#2]
\renewcommand{\citeleft}{[}
\renewcommand{\citeright}{]}
}
\begin{document}
Two cite examples:
\cite{foo}
\cite{foo2}
\citemine{bar}
\citeBoth{\cite{foo, foo2}}{\citemine{bar}}
\bibliographystylemine{plain}
\bibliographymine{bibfile}
\bibliographystyle{plain}
\bibliography{bibfile}
\end{document}
및 해당 bibfile:
@Article{foo,
author={foo},
title={foo},
journal={foo},
year={200},
volume={60},
number={23},
pages={6641--8},
}
@Article{bar,
author={foo},
title={foo},
journal={foo},
year={200},
volume={60},
number={23},
pages={6641--8},
}
@Article{foo2,
author={foo2},
title={foo2},
journal={foo2},
year={200},
volume={60},
number={23},
pages={6641--8},
}
답변1
내 댓글을 답변으로 바꾸는 중...
외부 공간은 의 구현이 \cite
인용의 왼쪽 괄호 앞에 공백을 발행하여 인용이 다음과 같이 나타나기 때문에 발생합니다. my citation [1].
OP가 \cite
내부에서 인수로 사용하므로 \citeBoth
, 이제 내부에서 발생하는 발행된 공간을 제거하기 위한 수단이 필요합니다. 의 괄호 \citeBoth
.
이를 달성하는 방법은 \citeleft
단순히 빈 매크로로 재정의하는 것이 아니라 {}
, 이전에 발급받은 공간을 건너뛰지 않도록 재정의하는 것입니다. 따라서 \renewcommand{\citeleft}{\unskip}
정의에 사용하면 \citeBoth
문제가 해결됩니다.
참고 쉼표 뒤에 작은 공백을 삽입하기 위해 \citeBoth
as 내부에도 인용문을 발행했습니다 .[#1,\,#2]
\newcommand{\citeBoth}[2]{
\renewcommand{\citeleft}{\unskip}
\renewcommand{\citeright}{}
[#1,\,#2]
\renewcommand{\citeleft}{[}
\renewcommand{\citeright}{]}
}
multibib
왜 제대로 작동하지 않는지 알 수 없습니다 \citemine
(수정 전후에 작동하지 않음). 그러나 OP에서 언급한 간격 문제는 해결되었습니다.
\documentclass[]{scrbook}
\usepackage{filecontents}
\begin{filecontents}{bibfile.bib}
@Article{foo,
author={foo},
title={foo},
journal={foo},
year={200},
volume={60},
number={23},
pages={6641--8},
}
@Article{bar,
author={foo},
title={foo},
journal={foo},
year={200},
volume={60},
number={23},
pages={6641--8},
}
@Article{foo2,
author={foo2},
title={foo2},
journal={foo2},
year={200},
volume={60},
number={23},
pages={6641--8},
}
\end{filecontents}
% bibstlye
\usepackage{cite}
\usepackage{multibib}
\newcites{mine}{my stuff}
\newcommand{\citeBoth}[2]{
\renewcommand{\citeleft}{\unskip}
\renewcommand{\citeright}{}
[#1,\,#2]
\renewcommand{\citeleft}{[}
\renewcommand{\citeright}{]}
}
\begin{document}
Two cite examples:
\cite{foo}
\cite{foo2}
\citemine{bar}
\citeBoth{\cite{foo, foo2}}{\citemine{bar}}
\bibliographystylemine{plain}
\bibliographymine{bibfile}
\bibliographystyle{plain}
\bibliography{bibfile}
\end{document}