Flashcard automation

csvsimple allows you to process a file containing your entries as CSV:

\begin{filecontents*}{\jobname.csv}
entry            ,
a book           ,
a chair          ,
a very long term ,
\end{filecontents*}

% This is a CSV file with only one column: each entry must be on it's own line **and** be followed by a comma 
% The first line is the header: the name of the column ("entry") will be assigned to command `\entry` below

\documentclass[12pt]{article}
\usepackage[paperwidth=32pc, paperheight=18pc, margin=5pc]{geometry}
\usepackage{fontspec}
  \setmainfont{Linux Libertine O}
\usepackage{fancyhdr}
  \pagestyle{empty}

\usepackage{csvsimple}

\newenvironment{vertcent}
  {\newpage\topskip0pt\vspace*{\fill}}
  {\vspace*{\fill}\newpage}

\begin{document}
\csvreader{\jobname.csv}{entry=\entry}{%
  \begin{vertcent}
    \begin{center}
      \Huge\entry
    \end{center}
  \end{vertcent}}
\end{document}

enter image description here

If you have latex code in your entries, enclose them in braces { \somecommand{text} } ,:

\begin{filecontents*}{\jobname.csv}
entry               ,
{ \arb{ muslimuN} } ,
{ \arb{muslimAni} } ,
{ \arb{muslimUna} } ,
\end{filecontents*}

% This is a CSV file with only one column: each entry must be on it's own line **and** be followed by a comma 
% The first line is the header: the name of the column ("entry") will be assigned to command `\entry` below

\documentclass[12pt]{article}
\usepackage[paperwidth=32pc, paperheight=18pc, margin=5pc]{geometry}
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
\usepackage[fullvoc]{arabluatex}

\usepackage{fancyhdr}
  \pagestyle{empty}

\usepackage{csvsimple}

\newenvironment{vertcent}
  {\newpage\topskip0pt\vspace*{\fill}}
  {\vspace*{\fill}\newpage}

\begin{document}
\csvreader{\jobname.csv}{entry=\entry}{%
  \begin{vertcent}
    \begin{center}
      \Huge\entry
    \end{center}
  \end{vertcent}}
\end{document}

enter image description here


Something like this? Usage, a comma-separated list: \makecards{card 1, card 2}:

\documentclass[12pt]{article}
\usepackage[paperwidth=32pc, paperheight=18pc, margin=5pc]{geometry}
\usepackage{fontspec,pgffor}
%\setmainfont{Linux Libertine O}

\usepackage{fancyhdr}
\pagestyle{empty}

\newenvironment{vertcent}
{\newpage\topskip0pt\vspace*{\fill}}
{\vspace*{\fill}\newpage}

\newcommand{\makecards}[1]{%
    \foreach \c in {#1}{%
        \begin{vertcent}
           \begin{center}
                \Huge
                \c
            \end{center}
    \end{vertcent}%
    }%
}

\begin{document}

\makecards{a book,a chair}

\end{document}

Update

If the desired comma-separated list is in an external file (in this case listtext.txt, which contains a comma-separated list) then this works (thanks to Rmano in Tikz foreach does not work with \input or \directlua):

\documentclass[12pt]{article}
\usepackage[paperwidth=32pc, paperheight=18pc, margin=5pc]{geometry}
\usepackage{fontspec,pgffor,catchfile}
%\setmainfont{Linux Libertine O}

\usepackage{fancyhdr}
\pagestyle{empty}

\newenvironment{vertcent}
{\newpage\topskip0pt\vspace*{\fill}}
{\vspace*{\fill}\newpage}

\newcommand\loaddata[1]{\CatchFileDef\loadeddata{#1}{\endlinechar=-1}}

\newcommand{\makecards}[1]{%
    \loaddata{#1}
    \foreach \c in \loadeddata{%
        \begin{vertcent}
           \begin{center}
                \Huge
                \c
            \end{center}
    \end{vertcent}%
    }%
}

\begin{document}

\makecards{listtext.txt}

\end{document}

enter image description here

Update 2

It is simple to have a more complex \foreach statement using a forward slash to separate elements. The file listtext2.txt contains this:

a chair/living room,
a table/kitchen,
a lamp/bedroom,
something else/elsewhere,
and some more/some unknown place,
a horse/on a farm

And the code that typesets this:

\documentclass[12pt]{article}
\usepackage[paperwidth=32pc, paperheight=18pc, margin=5pc]{geometry}
\usepackage{fontspec,pgffor,catchfile}
%\setmainfont{Linux Libertine O}

\usepackage{fancyhdr}
\pagestyle{empty}

\newenvironment{vertcent}
    {\newpage\topskip0pt\vspace*{\fill}}
    {\vspace*{\fill}\newpage}

\newcommand\loaddata[1]{\CatchFileDef\loadeddata{#1}{\endlinechar=-1}}

\newcommand{\makecards}[1]{%
    \loaddata{#1}%
    \foreach \c/\d in \loadeddata{%
        \begin{vertcent}
          \begin{center}
                \Huge
                \c\par  
                \vspace{.2in}
                \d
            \end{center}
    \end{vertcent}%
    }%
}

\begin{document}

\makecards{listtext2.txt}

\end{document}

...and produces the following:

enter image description here

I'd wondered how to do this -- now I know! Thanks.