2

As the flashcards documentclass allows use the option grid to make the grid of flashcards visible globally, i.e. on the frontside as well as the backside, I was wondering whether it is possible to suspend/intermit that option for every second page.

In other words, for practical reasons of printing off the flashcards on A4 paper and cutting out the cards, is there a way to only have the grid printed on, e.g., the front-side of the flashcards? This would avoid any misaligned black strokes, since the grid of the front- and backside are never perfectly superimposed on the paper.

Please find a MWE below (with the grid option turned on):

\documentclass[MyFlashCardsConfig, grid]{flashcards}

\cardfrontstyle[\small\slshape]{headings} \cardbackstyle[\small]{empty}

% v. https://tex.stackexchange.com/questions/115141/how-can-i-aboxed-a-matrix \usepackage{amsmath} \usepackage{amssymb} \usepackage{geometry} \geometry{ a4paper, total={210mm,297mm}, %instead of {210mm, 297mm} left=0mm, top=0mm, } %

% \setlength{\cardheight}{74.25mm} % 297/4 = 74.25 \setlength{\cardwidth}{105mm} % {a4-width} / 2 = 105 mm \setlength{\topskip}{0mm}

\setlength{\cardmargin}{15 pt} %

\cardfrontheadstyle[\bfseries\scshape]{left} \cardfrontfootstyle[\small\itshape\em\bfseries]{right}

\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue]{hyperref}

\usepackage{bibentry} \usepackage{amsfonts} \usepackage{mathtools} % for commands such as '\coloneqq' \usepackage{xcolor} \usepackage{bold-extra}

\definecolor{my-lightblue}{HTML}{00aedb}

\begin{document}

\cardfrontfoot{GRT}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\end{document}

In order to achieve compatiblity with A4-printing paper I also created a customized MyFlashCardsConfig.cfg file,

\ProvidesFile{avery5388.cfg}
\newcommand{\cardpaper}{a4paper}
\newcommand{\cardpapermode}{portrait}
\newcommand{\cardrows}{4}
\newcommand{\cardcolumns}{2}
\setlength{\cardheight}{70mm}
\setlength{\cardwidth}{100mm}
\setlength{\topoffset}{0mm}
\setlength{\oddoffset}{0mm}
\setlength{\evenoffset}{0mm}
\endinput

that is loaded through the options of the flashcards documentclass.

Diazenylium
  • 121
  • 4
  • 1
    Have a look at https://tex.stackexchange.com/questions/6143/if-then-else-for-odd-page-even-page it shows how to check for even/odd page. – Uwe Ziegenhagen Oct 26 '20 at 19:50
  • @UweZiegenhagen Thank you very much for the reference, but unfortunately I do not know how to implement the if... then condition explored there for the document class in order to suspend the grid option for every second page. But it seems, the case is not hopeless and there could be a satisfactorial solution. – Diazenylium Oct 26 '20 at 21:19
  • I just saw a comment that seems to be deleted now, which I think pointed out that there is a problem already in the correct alignment of the flashcards when I print it on A4-paper. I realized in that MWE I only focused on the grid and did not take much attention of my more sophisiticated .tex project which does take into account that one needs to replace the avery5371 option with something else. I am going to edit my MWE accordingly. – Diazenylium Oct 26 '20 at 21:22
  • Since you are not using Avery cards, it might be better to start over from scratch. You don't need to implement every option, just the ones you normally use. One could do the whole page (both sides) using saveboxes, flowfram or tikz. – John Kormylo Oct 26 '20 at 22:59

1 Answers1

1

Just for fun, I created a new version from scratch using \fbox to create the grid. If fills the text area provided by geometry.

Macros \defaulthead and \defaultfoot have one argument each, which are passed from flashcard as optional arguments. The idea was to put everything into these macros which does not change (except possibly \thecard) and pass anything that does change. You can even use \parbox or tabular^ instead of \makebox.

\documentclass{article}
\usepackage[a4paper, margin=5mm, noheadfoot]{geometry}
\pagestyle{empty}

\newcommand{\FCXrows}{4} \newcommand{\FCXcols}{2} \setlength{\fboxsep}{15pt}% card margin % start of sty \RequirePackage{xparse}

\newcounter{card} \newcommand{\defaulthead}[1]{\makebox[\cardwidth][l]{#1}} \newcommand{\defaultfoot}[1]{\makebox[\cardwidth][r]{\thecard}} \newcommand{\cardfrontstyle}{\normalfont\normalsize\centering} \newcommand{\cardbackstyle}{\normalfont\normalsize\raggedright}

\newlength{\cardwidth} \newlength{\cardheight} \AtBeginDocument{% wait until text area set \setlength{\cardwidth}{\dimexpr \textwidth/\FCXcols-2\fboxsep-2\fboxrule}% \setlength{\cardheight}{\dimexpr \textheight/\FCXrows-2\fboxsep-2\fboxrule}}

\newcounter{FCXrow} \renewcommand{\theFCXrow}{\alph{FCXrow}} \newcounter{FCXcol}[FCXrow] \renewcommand{\theFCXcol}{\alph{FCXcol}}

\loop\ifnum\value{FCXrow}<\FCXrows\relax% create saveboxes \stepcounter{FCXrow}{% only one loop per group \loop\ifnum\value{FCXcol}<\FCXcols\relax \stepcounter{FCXcol}% \expandafter\let\expandafter\front\csname front\theFCXrow\theFCXcol\endcsname \newsavebox{\front}% \global\expandafter\let\csname front\theFCXrow\theFCXcol\endcsname=\front \expandafter\let\expandafter\back\csname back\theFCXrow\theFCXcol\endcsname \newsavebox{\back}% \global\expandafter\let\csname back\theFCXrow\theFCXcol\endcsname=\back \repeat}% \repeat \setcounter{FCXrow}{0}

\newcommand{\FCXprintcards}{\setcounter{FCXrow}{0}% print front \lineskip=0pt \parskip=0pt \parindent=0pt \par \loop\ifnum\value{FCXrow}<\FCXrows\relax \stepcounter{FCXrow}{% only one loop per group \loop\ifnum\value{FCXcol}<\FCXcols\relax \stepcounter{FCXcol}% \expandafter\let\expandafter\front\csname front\theFCXrow\theFCXcol\endcsname \ifvoid\front \fbox{\parbox[c][\cardheight][c]{\cardwidth}{\hfill}}% \else \fbox{\box\front}% \fi \repeat}% \allowbreak \repeat \setcounter{FCXrow}{0}% print back \loop\ifnum\value{FCXrow}<\FCXrows\relax \stepcounter{FCXrow}{% only one loop per group \advance\fboxsep by \fboxrule% empty border \fboxrule=0pt \count1=0 \loop\ifnum\count1<\FCXcols\relax \setcounter{FCXcol}{\numexpr \FCXcols-\count1}% in reverse order \advance\count1 by 1 \expandafter\let\expandafter\back\csname back\theFCXrow\theFCXcol\endcsname \ifvoid\back \fbox{\parbox[c][\cardheight][c]{\cardwidth}{\hfill}}% \else \fbox{\box\back}% \fi \repeat}% \ifnum\value{FCXrow}<\FCXrows \allowbreak\fi% no extra page \repeat \setcounter{FCXrow}{0}% \ignorespaces}% end of \FCXprintcards

\AtEndDocument{\FCXprintcards}

\NewDocumentEnvironment{flashcard}{O{}mO{}}{% #1=head, #2=front, #3=foot \stepcounter{card}% not used internally \ifnum\value{FCXrow}=\FCXrows\relax \ifnum\value{FCXcol}=\FCXcols\relax \FCXprintcards \fi \fi \ifnum\value{FCXrow}=0\relax \stepcounter{FCXrow}% \fi \ifnum\value{FCXcol}=\FCXcols\relax \stepcounter{FCXrow}% \fi \stepcounter{FCXcol}% \expandafter\let\expandafter\front\csname front\theFCXrow\theFCXcol\endcsname \global\setbox\front=\hbox{\begin{minipage}[c][\cardheight][s]{\cardwidth} {\defaulthead{#1}\par}\vfill {\cardfrontstyle #2\par}\vfill {\defaultfoot{#3}\par}% \end{minipage}}% \expandafter\let\expandafter\back\csname back\theFCXrow\theFCXcol\endcsname \begin{lrbox}{\back}\begin{minipage}[c][\cardheight][c]{\cardwidth}% \cardbackstyle}% contents here {\end{minipage}\end{lrbox}% \global\setbox\back=\copy\back \ignorespaces} % end of sty

\renewcommand{\cardfrontstyle}{\small\slshape\centering} \renewcommand{\cardbackstyle}{\small}

\renewcommand{\defaulthead}[1]{\makebox[\cardwidth][l]{\bfseries\scshape #1}}

\renewcommand{\defaultfoot}[1]{\makebox[\cardwidth][r]{\small\itshape\em\bfseries GRT}}

\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue]{hyperref}% WTF? \usepackage{bibentry} \usepackage{amsfonts} \usepackage{mathtools} % for commands such as '\coloneqq' \usepackage{xcolor} \usepackage{bold-extra} \usepackage{blindtext}

\definecolor{my-lightblue}{HTML}{00aedb}

\begin{document} %=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

%=========================================================%

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\begin{flashcard}[{\color{my-lightblue} Definition} {\normalfont - \textbf{25.1.} Concepts of GRT}]{Front Page}

Explanations ...

\vspace*{\stretch{1}} \end{flashcard}

\end{document}

John Kormylo
  • 79,712
  • 3
  • 50
  • 120