I use latex to write papers and am often annoyed by the process of working out the order that names should appear in the list of authors - it causes too may arguments early on, just when you don't nee开发者_StackOverflowd them.
I'd like to know if there is a latex feature/snippit, they will let me enter the authors and their details, but randomise the order every time the latex is compiled. So my name might be first on one version, and then when I recompile, it would be someone else's name first.
how would I start?
You can do this using PerlTex. By embedding some Perl code within your LaTex document you can easily randomize author names. This link shows how to do it. I haven't tested if the code shown there actually works, but the principle should be clear.
There's some random number things in the probsoln package. Here's something that might get you started:
\documentclass{article}
\usepackage{probsoln}
\PSNrandseed{\time}
\begin{document}
\doforrandN{3}{\who}{Fred,Barry,Joe}{
\who
}
\end{document}
Note the seed only seems to change once per minute.
The pgfmath
package allows you to create some list data structures. Then you can implement a knuth shuffle on them. See this post on pgf-users from 2009.
pgfmath
is part of tikz
but works independently of it.
I believe that this is a bad idea, as the user could simply recompile until he likes the order. The order should be randomized only once, with randomness verified by all involved.
Get everyone together, then draw lots, or use some quick script like this:
(defun random-order (&rest items)
(when items
(let ((this (elt (random (length items)) items)))
(cons this
(random-order (remove this items
:test #'equal))))))
(random-order "Gimme Gimme" "Me First" "Allim Portant")
(You can use whatever language you want, of course.)
精彩评论