KTUG 한국 텍 사용자 그룹

Menu

KTUG :: Q&A 마당 › Author 숫자 자동으로 세기

하늘연 | 2015.12.22 17:57:07 | 메뉴 건너뛰기 쓰기

다중저자를 입력하는 코드를 만들고 있습니다.




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

첨부 [1]

댓글 [4]

댓글 쓰기

목록

KTUG 한국 텍 사용자 그룹