![将一长串单词放入 latex beamer 的最佳方法是什么(演示)](https://linux22.com/image/319931/%E5%B0%86%E4%B8%80%E9%95%BF%E4%B8%B2%E5%8D%95%E8%AF%8D%E6%94%BE%E5%85%A5%20latex%20beamer%20%E7%9A%84%E6%9C%80%E4%BD%B3%E6%96%B9%E6%B3%95%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%88%E6%BC%94%E7%A4%BA%EF%BC%89.png)
答案1
使用datatool
阅读、排序和迭代单词。如何处理它们在很大程度上取决于您(除了任何列式内容都不会跨页)。如果这个单词表真的很长,我会将排序移至外部工具。对datatool
100 个左右的单词列表进行排序似乎很慢。摘自 128 页的 PDF:
\documentclass{beamer}
% https://en.wikipedia.org/wiki/Most_common_words_in_English
\begin{filecontents*}{\jobname.txt}
time
person
year
way
day
thing
man
world
life
hand
part
child
eye
woman
place
work
week
case
point
government
company
number
group
problem
fact
be
have
do
say
get
make
go
know
take
see
come
think
look
want
give
use
find
tell
ask
work
seem
feel
try
leave
call
good
new
first
last
long
great
little
own
other
old
right
big
high
different
small
large
next
early
young
important
few
public
bad
same
able
to
of
in
for
on
with
at
by
from
up
about
into
over
after
beneath
under
above
the
and
a
that
I
it
not
he
as
you
this
but
his
they
her
she
or
an
will
my
one
all
would
there
their
\end{filecontents*}
% Get data and sort it
\usepackage{datatool}
\DTLloaddb[noheader,keys={word}]{words}{\jobname.txt}
\dtlsort{word=ascending}{words}{\dtlletterindexcompare}
\begin{document}
\begin{frame}[allowframebreaks]
\frametitle{Just a bunch of sorted words}
\DTLforeach{words}{%
\word=word}{
\word}
\DTLforeach{words}{%
\word=word}{
\word}
\end{frame}
\begin{frame}[allowframebreaks]
\frametitle{An itemized list}
\begin{itemize}
\DTLforeach{words}{%
\word=word}{
\item \word}
\end{itemize}
\end{frame}
\DTLforeach{words}{%
\word=word}{
\begin{frame}
\frametitle{One word per frame: \word}
\word
\end{frame}
}
\end{document}