
경제학에서 저자 순서는 전통적으로 알파벳순입니다. 이 순서로 인해 발생하는 알려진 편견으로 인해 논문 저자를 무작위로 정렬하려는 작은 움직임이 있습니다(예).
를 사용하여 컴파일 타임에 문서 작성자의 순서를 지정할 수 있지만 pgfmathrandom
이는 무작위성이 부족합니다. 보기 시간에 동적으로 작성자를 정렬하고 싶습니다. LaTeX/PDF에서 Javascript 기능을 구현하는 방법에 대해 찾을 수 있는 예제는 문서 내용 조정을 직접 처리하지 않기 때문에 적용할 수 없습니다(예).
원하는 MWE( \maketitle
재정의할 필요가 없으며 해당 부분은 간단합니다):
\documentclass{article}
\usepackage{[magic-package]}
\addauthor{Aaron}
\addauthor{Zhang}
\begin{document}
\maketitle
\end{document}
다음을 산출해야 합니다:
+--------------+ +--------------+
| Aaron, Zhang | | Zhang, Aaron |
| | | |
| Lorem ipsum | w.p. 1/2, | Lorem ipsum | w.p. 1/2.
답변1
다음은eforms
패키지.
JavaScript를 사용하여 문서를 열 때 작성자를 무작위로 선정하고 일반적으로 제목 페이지에 작성자가 삽입되는 양식 필드에 결과를 넣습니다.
하지만 몇 가지 제한 사항이 있습니다.
- PDF 양식 텍스트 필드에 비표준 글꼴을 사용하는 것은 실제로 쉽지 않기 때문에 모든 곳에서 Times를 사용했습니다.
- 텍스트 필드의 높이를 지정해야 하므로 작성자 수가 한 줄을 초과하는 경우 수동으로 조정해야 합니다. 당신이 정말로 관심이 있다면 이것은 아마도 자동화될 수 있을 것입니다.
- 물론 Adobe Reader가 필요합니다.
MWE
\documentclass{article}
\usepackage{newtxtext,newtxmath}
\usepackage[useui]{eforms}
\newcommand{\randauthorformat}{%
border={invisible},
textsize={11.5},
textfont={Times-Roman},
align={centered},
fieldflags={readonly,multiline,noscrolling},
% Default value for readers that don't support JavaScript
value={Author One, Author Two, Author Three, and Author Four},
pageopen={%
% Add authors to array
var array = ["Author One", "Author Two", "Author Three", "Author Four"];
% Shuffling algorithm from https://stackoverflow.com/a/2450976/12652399
var currentIndex = array.length, temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
var i = array.length;
currentIndex = 0;
var authors = "";
while (currentIndex < array.length) {
authors += array[currentIndex];
if (currentIndex < array.length - 1) {
authors += ", ";
}
if (currentIndex == array.length - 2) {
authors += "and ";
}
currentIndex += 1;
}
var f = this.getField("author");
f.value = authors;
}
}
\newcommand{\randauthor}{%
\textField[\ui{presets=\randauthorformat}]{author}{\linewidth}{11.5pt}}
\title{Randomised Authors}
\author{\randauthor}
\begin{document}
\maketitle
\end{document}