1

I'm using the "flashcards" document class and I want to implement an automatic numbering in the front part, such that, for example, when I write:

\documentclass[avery5388,grid,frame]{flashcards}
\cardfrontstyle[\large\slshape]{headings}

\begin{document}
\begin{flashcard}[Definition]{Something}
   Text
\end{flashcard}
\end{document}

it gets rendered to "Definition (i)", where "i" is the flashcard's number in the document. For now I tried to create a custom counter, and manually writing the code to show it inside the [Definition] part of the flashcard's command, but it is unpractical in the long run. Is there a better way to do it?

  • 2
    Welcome to TeX.SE. Please post a compilable document, not such fragments only. The flashcard class is a little bit aged, dating back to 2000 and scarce updates. – user31729 Oct 27 '17 at 17:02
  • Edited with a compilable example. Is there a newer class for the same purpose? I have not the knowledge to create one myself. – Francesco Manzali Oct 27 '17 at 17:11
  • I know of no newer class, but that doesn't mean there is one nevertheless. I'll suggest the very powerful tcolorbox package with its tcbraster library, however – user31729 Oct 27 '17 at 17:14
  • Related: tex.stackexchange.com/a/346618/31729 – user31729 Oct 27 '17 at 17:26
2

A way with tcolorbox and its tcbraster environment, there is no direct connection to printer labels producers like Avery etc, the specification has to be done manually.

The auto counter provides a new counter, here named 'flashcard' (well, hidden in a complex internal name) and \thetcbcounter is a wrapper for \the... macro connected to the counter.

I chose some of the most frequently used tcolorbox options which are pretty easy to remember and are very clear in their meanings (in my opinion)

\documentclass{article}

\usepackage[margin=1cm]{geometry}

%[avery5388,grid,frame]{flashcards}
%\cardfrontstyle[\large\slshape]{headings}

\usepackage[most]{tcolorbox}

\usepackage{blindtext}


\newtcolorbox[auto counter]{flashcard}[1][]{enhanced,
 title={Definition \thetcbcounter},
 sharp corners,
 boxrule=0.5pt,
 height=5cm,
 coltitle=black,
 colback=white, 
 colbacktitle=yellow,
 #1}

\begin{document}
\begin{tcbraster}[raster columns=4,raster equal height]
\begin{flashcard}
   Text
\end{flashcard}
\begin{flashcard}
\end{flashcard}
\begin{flashcard}
\end{flashcard}
\begin{flashcard}
\end{flashcard}
\end{tcbraster}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.