다중저자를 입력하는 코드를 만들고 있습니다.
\setcounter{maximumauthor}{3}
\author{Kim 1}
\author{Kim 2}
\author{Kim 3}
라 입력하면
Kim 1, Kim 2, and Kim 3 가 나오고
\setcounter{maximumauthor}{2}
\author{Kim 1}
\author{Kim 2}
라 입력하면
Kim 1 and Kim 2
가 나옵니다.
우선 모양은 제가 원하는 대로 나오는데, maximumauthor의 카운터를 자동으로 지정하게 만들고 싶습니다.
어떻게 보완을 할 수 있는 방법이 없을까요?
\documentclass{article}
\usepackage{ifthen}
%%%%%%%%%%%%%%%%%%%%%%%%%% Coding %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\newcounter{authors}
\newcounter{maximumauthor}
\newcommand{\@authors}{}
\renewcommand{\author}[1]{\stepcounter{authors}
\ifthenelse{\equal{\value{authors}}{1}}{%
\g@addto@macro{\@authors}{#1}
}{%
\ifthenelse{\value{authors}<\value{maximumauthor}}{%
\g@addto@macro{\@authors}{, #1}
}{%
\ifthenelse{\equal{\value{maximumauthor}}{2}}{
\g@addto@macro{\@authors}{and #1}
}{%
\g@addto@macro{\@authors}{, and #1}
}
}
}
}
\newcommand{\printauthor}{\@authors}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatother
\setcounter{maximumauthor}{3}
\author{Kim 1}
\author{Kim 2}
\author{Kim 3}
\begin{document}
\printauthor
\end{document}
KTUG 한국 텍 사용자 그룹