I am writing some flashcards. The command \flashc
is the essential one which is used to typeset the content of a flashcard. It works like this:
The counter is printed (on the first page of the flashcard). It gets incremented immediately after that.
Then the question gets printed.
A new page is reached by using
\newpage
. On that new, second page (or backside) of the flashcard, the reply is printed.
There are a few characteristics in regards to the content I want to consider:
The flashcards I am writing are on specific topics in a field. I chose to follow the scripture of the main author John Smith and mirror his structure. So every topic gets put in its own section.
Besides the main author, there are at least 2 more important authors whose work I would like to use as well. I would like to incorporate the content of all authors (3, at the moment) in one document.
This yields the following structure: content by John Smith is put in the first subsection of each section, the second author (an "institute") is featured in the second subsection and an arguably young-ish author in the field gets put in the third subsection.
However, sometimes an author has not covered a topic, so I would then call the command and the immediately continue with the next subsection, i.e. the subsection would be empty.
My approach
My approach so far has been to simply "clone" and rename the original definition of \flashc
. Then I worked 3 different counters into all versions of the command/macro.
Vision
I would just like to use \flashc
instead of n versions of it.
This new command should "remember" the counter in the corresponding subsection for each author/source, so it can be continued/used in the next section, for the same nth subsection for the same author/source. This can be observed in the MWE.
Is this possible without defining n command duplicates of \flashc
?
Or is there another elegant way to re-use the command definition with a new counter perhaps? If so, what could it look like?
MWE
\documentclass[
german,
fontsize=11pt,
paper=a6,
landscape,
]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%%%%%%%%%%%%%%%%%%%%%%%%
% the 1st counter - used by \flashc
%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{firstcount}
\setcounter{firstcount}{1}
\newcommand{\thefirstcounter}{\arabic{firstcount}\addtocounter{firstcount}{1}}
\newcommand{\flashc}[2]{%
\begin{flushleft}
\fbox{\thefirstcounter}~%
\begin{minipage}[t]{0.9\textwidth}
{#1}
\end{minipage}\end{flushleft}\newpage%
\noindent{%
#2}\newpage}
%%%%%%%%%%%%%%%%%%%%%%%%
% the 2nd counter - used by \firstcloneofflashc
%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{secondcount}
\setcounter{secondcount}{1}
\newcommand{\thesecondcounter}{\arabic{secondcount}\addtocounter{secondcount}{1}}
\newcommand{\firstcloneofflashc}[2]{%
\begin{flushleft}
\fbox{\thesecondcounter}~%
\begin{minipage}[t]{0.9\textwidth}
{#1}
\end{minipage}\end{flushleft}\newpage%
\noindent{%
#2}\newpage}
%%%%%%%%%%%%%%%%%%%%%%%%
% the 3rd counter - used by \secondcloneofflashc
%%%%%%%%%%%%%%%%%%%%%%%%
\newcounter{thirdcount}
\setcounter{thirdcount}{1}
\newcommand{\thethirdcounter}{\arabic{thirdcount}\addtocounter{thirdcount}{1}}
\newcommand{\secondcloneofflashc}[2]{%
\begin{flushleft}
\fbox{\thethirdcounter}~%
\begin{minipage}[t]{0.9\textwidth}
{#1}
\end{minipage}\end{flushleft}\newpage%
\noindent{%
#2}\newpage}
\begin{document}
\section{The first field/topic, Walls}
\subsection{The first subsection is from a specific literature source, John Smith}
\flashc{Walls are\ldots}{not that exciting to look at.}
\subsection{Content in the second subsection(s) is always from a certain institute}
\firstcloneofflashc{Wall can be\ldots}{incredibly boring to observe. They just stand still!}
\subsection{The third subsection is for another author, namely Jane Doe}
\secondcloneofflashc{Walls are great, but\ldots}{need some proper building first.}
\secondcloneofflashc{The 2nd flashcard by Jane Doe about walls}{No idea.}
\secondcloneofflashc{Another flashcard to memorize}{How much can someone write about walls, really??}
\section{The second field/topic, Trees}
\subsection{Again the first subsection with content by John Smith}
\flashc{Yes}{No}
\subsection{The second subsection is again from content by that certain institute}
\firstcloneofflashc{Leafs}{Green}
\subsection{The third subsection for Jane Doe's comments on the matter}
\secondcloneofflashc{Trees are not}{my thing. Too woody.}
\end{document}