From b4c941797d246ffab8d18d4220be5e048b3b368d Mon Sep 17 00:00:00 2001 From: Kenneth Odle Date: Sat, 1 Feb 2025 12:59:07 -0500 Subject: [PATCH] =?UTF-8?q?Chap=202=20=C2=BB=20info=20about=20modifying=20?= =?UTF-8?q?FlashCards=20config=20files?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 006/include/chap02.tex | 83 ++++++++++++++++++++++++++++++++++++++- 006/include/kpsewhich.tex | 3 ++ 006/include/mktexlsr.tex | 3 ++ 3 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 006/include/kpsewhich.tex create mode 100644 006/include/mktexlsr.tex diff --git a/006/include/chap02.tex b/006/include/chap02.tex index 4f831c9..26ec3fc 100644 --- a/006/include/chap02.tex +++ b/006/include/chap02.tex @@ -1,2 +1,83 @@ -\chapter{This is the second chapter} +\chapter{Easy Flashcards in \LaTeX{} } + +\section{Introduction} + +\section{The FlashCards Package} + +\subsection{About the FlashCards Package} + +\subsection{Modifying the FlashCards Configuration Files} + +There's just one catch with the FlashCards package: it only includes support for business cards and $3\times5$ index cards. The documentation says that variants are easy to generate, so there has to be a way to do that, right? As it turns out, there is. The first step is to find those configuration files. + +The first step is to find those configuration files. We have a couple of options here. The first is to look in the \texttt{.log} file of any project we've used the \texttt{flashcards} package. Looking at my ``Rules of Acquisition'' log file showed me this on line 9: + +\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Location of FlashCards class file}] +(/usr/share/texlive/texmf-dist/tex/latex/flashcards/flashca rds.cls +\end{Verbatim} + +and this on lines 41-43: + +\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Location of FlashCards configuration file}] +(/usr/share/texlive/texmf-dist/tex/latex/flashcards/avery537 1.cfg +File: avery5371.cfg +) +\end{Verbatim} + +If we're on the command line, we could also the \texttt{kpsewhich} command to look for the package name \texttt{.cls} file, like this: + +\input{include/kpsewhich} + +which gives us this output: + +\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Output of kpsewhich Command}] +ls +/usr/share/texlive/texmf-dist/tex/latex/flashcards/flashcar ds.cls +\end{Verbatim} + +Since I don't want to poke around in my default \texttt{/usr} directory (which would require \texttt{sudo} and is not something that can be backed up easily), the solution is to use our own \texttt{texmf} directory, where we can install our own packages and make modifications to them easily.\footnote{See \S 7.1.2 ``Method \#2'' in issue \#3 for more information.} + +I already had that folder, so I duplicated the file path (\texttt{/tex/latex/flas\\hcards}) there, copied over the \texttt{avery5371.cfg} file, and renamed it to \texttt{avery5389.cfg}, which is the format for a 2-up $4\times6$ index card, and opened it up for editing. + +The first thing I did was to do a quick search and replace, swapping out ``5389'' for ``5371''. The second thing I did was to change the relevant lines in the config file to fit the $4\times6$ card format. So I changed all of these lines: + +\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Configuration for Avery 5371 Stock}] +\newcommand{\cardpapermode}{portrait} +\newcommand{\cardpaper}{letterpaper} +\newcommand{\cardrows}{5} +\newcommand{\cardcolumns}{2} +\setlength{\cardheight}{2.0in} +\setlength{\cardwidth}{3.5in} +\setlength{\topoffset}{0.50in} +\setlength{\oddoffset}{0.75in} +\setlength{\evenoffset}{0.75in} +\end{Verbatim} + +to have these values: + +\begin{Verbatim}[frame=lines, numbers=left, xleftmargin=5mm, framesep=3mm, breaklines=true, label=\fbox{Configuration for Avery 5389 Stock}] +\newcommand{\cardpapermode}{portrait} +\newcommand{\cardpaper}{letterpaper} +\newcommand{\cardrows}{2} +\newcommand{\cardcolumns}{1} +\setlength{\cardheight}{4.0in} +\setlength{\cardwidth}{6.0in} +\setlength{\topoffset}{1.5in} +\setlength{\oddoffset}{1.25in} +\setlength{\evenoffset}{1.25in} +\end{Verbatim} + +I then saved the file and closed it. + +The only thing left to do was to inform \TeX{} about this new file by running + +\input{include/mktexlsr} + +I then changed the first line of my ``Rules of Acquistion'' flashcards project to + +\begin{Verbatim}[] +\documentclass[avery5389,grid]{flashcards} +\end{Verbatim} + +I re-compiled the project, and indeed, I now had the Ferengi Rules of Acquistion on $4\times6$ index cards! Easy-peasy! diff --git a/006/include/kpsewhich.tex b/006/include/kpsewhich.tex new file mode 100644 index 0000000..377f1bc --- /dev/null +++ b/006/include/kpsewhich.tex @@ -0,0 +1,3 @@ +\begin{Verbatim}[] +$ kpsewhich flascards.cls +\end{Verbatim} diff --git a/006/include/mktexlsr.tex b/006/include/mktexlsr.tex new file mode 100644 index 0000000..37e7d62 --- /dev/null +++ b/006/include/mktexlsr.tex @@ -0,0 +1,3 @@ +\begin{Verbatim}[] +$ sudo mktexlsr +\end{Verbatim}