\citet*의 렌더링 수정

\citet*의 렌더링 수정

\citet*더 작은 글꼴 크기와 특정 색상을 사용하는 렌더링을 변경하고 싶습니다 .

아래 MWE는 별표가 없는 버전에서 작동하며 \citet다음을 생성합니다.

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

\documentclass{article}

\usepackage{filecontents}
\usepackage{natbib}
\usepackage{color}

\let\oldcitet=\citet
\renewcommand{\citet}[1]{{\footnotesize\textcolor[rgb]{.8, .1, .4}{\oldcitet{#1}}}}

\begin{filecontents}{refs.bib}
@book{ref,
title = {title},
author = {john and abi and fein},
location = {here},
publisher = {publisher},
year = {2017},
}
\end{filecontents}

\begin{document}

\citet{ref}

\citet*{ref}

\bibliography{refs.bib}

\bibliographystyle{plainnat}

\end{document}

의 재정의는 \citet별표 버전의 재정의를 깨뜨립니다. 이 문제를 해결하는 방법에 대한 제안이 있으십니까?

답변1

설정에서 별표 버전을 수용하려면 *다음과 같은 사용을 조건으로 해야 합니다.

\let\oldcitet=\citet
\makeatletter
\renewcommand{\citet}{\@ifstar\newcitetstar\newcitet}
\newcommand{\newcitet}[1]{{\footnotesize\textcolor[rgb]{.8, .1, .4}{\oldcitet{#1}}}}
\newcommand{\newcitetstar}[1]{{\footnotesize\textcolor[rgb]{.8, .1, .4}{\oldcitet*{#1}}}}
\makeatother

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

선택적 인수(예:)와 같은 다른 옵션을 협상하는 더 쉬운 방법도 있습니다. 보다 일반적인 접근 방식을 고려하면xparse.

관련 정보