将一长串单词放入 latex beamer 的最佳方法是什么(演示)

将一长串单词放入 latex beamer 的最佳方法是什么(演示)

我有一个单词列表,这个列表可能还会越来越大,我想用 beamer 包把它们放到 latex 中(也就是说,用这些单词做一个演示文稿)。第一个明显的问题是它们不能放在一张幻灯片上。第二件事是我想对它进行排序(但不是手动的)。重要的事实是这个单词列表可能会增长。

例如,我可以制作一个单词列表,对它们进行排序并将它们分成幻灯片,但问题在于当我添加新单词时,因为那时我需要更改所有内容。那么,最好的方法是什么?(也许将单词放在表格中?或使用列表?或其他方法)

编辑:图片...示例 1示例 2

答案1

使用datatool阅读、排序和迭代单词。如何处理它们在很大程度上取决于您(除了任何列式内容都不会跨页)。如果这个单词表真的很长,我会将排序移至外部工具。对datatool100 个左右的单词列表进行排序似乎很慢。摘自 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}

相关内容