可以暂停偶数/奇数页的文档类别选项吗?

可以暂停偶数/奇数页的文档类别选项吗?

由于flashcardsdocumentclass 允许使用选项grid使抽认卡网格全局可见,即在正面和背面,我想知道是否可以每隔一页暂停/暂停该选项。

换句话说,出于在 A4 纸上打印抽认卡并裁剪卡片的实际原因,有没有办法只在抽认卡的正面打印网格?这样可以避免任何未对齐的黑色笔画,因为正面和背面的网格永远不会完美地叠加在纸上。

请查看下面的 MWE(选项grid已打开):

\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}

为了兼容 A4 打印纸,我还创建了一个定制的我的FlashCards配置.cfg文件,

\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

这是通过 documentclass 的选项加载的flashcards

答案1

只是为了好玩,我从头开始创建了一个新版本,用来\fbox创建网格。如果填充几何提供的文本区域。

\defaulthead\defaultfoot每个都有一个参数,它们作为可选参数传递flashcard。我们的想法是将所有内容放入这些宏中,这些内容不会改变(除了可能的\thecard),并传递任何会改变的内容。您甚至可以使用\parboxtabular^代替\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}

相关内容