From a533c6289462ef5d4606afc770607aa2651c0af2 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Sat, 1 Jul 2023 15:13:20 -0700 Subject: [PATCH 1/3] refactor hardcopy themes --- assets/tex/CAPA.tex | 15 ++++++++++ assets/tex/PGML.tex | 71 +++++++++++++++++++++++++++++++++++++++++++++ assets/tex/pg.sty | 31 ++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 assets/tex/CAPA.tex create mode 100644 assets/tex/PGML.tex diff --git a/assets/tex/CAPA.tex b/assets/tex/CAPA.tex new file mode 100644 index 0000000000..11d7d32fac --- /dev/null +++ b/assets/tex/CAPA.tex @@ -0,0 +1,15 @@ +% capa tex macros + +\newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% +{\sl P}\kern-.14em\kern-.01em{\rm A}}} + +\newenvironment{choicelist} +{\begin{list}{} + {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} + \setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in} + \setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in} + \setlength{\abovedisplayskip}{0.05in} + \setlength{\abovedisplayshortskip}{-0.04in} + \setlength{\belowdisplayshortskip}{0.04in}} + } +{\end{list}} diff --git a/assets/tex/PGML.tex b/assets/tex/PGML.tex new file mode 100644 index 0000000000..a4b8c0c649 --- /dev/null +++ b/assets/tex/PGML.tex @@ -0,0 +1,71 @@ +% definitions for PGML + +\newcount\pgmlCount +\newdimen\pgmlPercent +\newdimen\pgmlPixels + +\pgmlPixels=.5pt + +{\catcode`\^^M=\active% + \gdef\pgmlSetup{% + \pgmlPercent=.01\hsize% + \parskip=0pt% + \def\par{\ifmmode\else\endgraf\fi\ignorespaces}% + \catcode`\^^M=\active% + \def^^M{\ifmmode\else\space\fi\ignorespaces}} + \global\let^^M\par}% + +\def\pgmlIndent{\par\advance\leftskip by 2em \advance\pgmlPercent by .02em \pgmlCount=0}% +\def\pgmlbulletItem{\par\indent\llap{$\bullet$ }\ignorespaces}% +\def\pgmldiscItem{\par\indent\llap{$\bullet$ }\ignorespaces}% +\def\pgmlcircleItem{\par\indent\llap{$\circ$ }\ignorespaces}% +\def\pgmlsquareItem{\par\indent\llap{\vrule height 1ex width .75ex depth -.25ex\ }\ignorespaces}% +\def\pgmlnumericItem{\par\indent\advance\pgmlCount by 1 \llap{\the\pgmlCount. }\ignorespaces}% +\def\pgmlalphaItem{\par\indent{\advance\pgmlCount by `\a \llap{\char\pgmlCount. }}\advance\pgmlCount by 1\ignorespaces}% +\def\pgmlAlphaItem{\par\indent{\advance\pgmlCount by `\A \llap{\char\pgmlCount. }}\advance\pgmlCount by 1\ignorespaces}% +\def\pgmlromanItem{\par\indent\advance\pgmlCount by 1 \llap{\romannumeral\pgmlCount. }\ignorespaces}% +\def\pgmlRomanItem{\par\indent\advance\pgmlCount by 1 \llap{\uppercase\expandafter{\romannumeral\pgmlCount}. }\ignorespaces}% + +\def\pgmlCenter{% + \par \parfillskip=0pt + \advance\leftskip by 0pt plus .5\hsize + \advance\rightskip by 0pt plus .5\hsize + \def\pgmlBreak{\break}% +}% +\def\pgmlRight{% + \par \parfillskip=0pt + \advance\leftskip by 0pt plus \hsize + \def\pgmlBreak{\break}% +}% + +\def\pgmlBreak{\\}% + +\def\pgmlHeading#1{% + \par\bfseries + \ifcase#1 \or\huge \or\LARGE \or\large \or\normalsize \or\footnotesize \or\scriptsize \fi +}% + +\def\pgmlRule#1#2{% + \par\noindent + \hbox{% + \strut% + \dimen1=\ht\strutbox% + \advance\dimen1 by -#2% + \divide\dimen1 by 2% + \advance\dimen2 by -\dp\strutbox% + \raise\dimen1\hbox{\vrule width #1 height #2 depth 0pt}% + }% + \par +}% + +\def\pgmlIC#1{\futurelet\pgmlNext\pgmlCheckIC}% +\def\pgmlCheckIC{\ifx\pgmlNext\pgmlSpace \/\fi}% +{\def\getSpace#1{\global\let\pgmlSpace= }\getSpace{} }% + +{\catcode`\ =12\global\let\pgmlSpaceChar= }% +{\catcode`\^^M=\active% + \gdef\pgmlPreformatted{\par\small\ttfamily\hsize=10\hsize\obeyspaces\catcode`\^^M=\active\let^^M=\pgmlNL\pgmlNL}}% +\def\pgmlNL{\par\bgroup\catcode`\ =12\pgmlTestSpace}% +\def\pgmlTestSpace{\futurelet\next\pgmlTestChar}% +\def\pgmlTestChar{\ifx\next\pgmlSpaceChar\ \pgmlTestNext\fi\egroup}% +\def\pgmlTestNext\fi\egroup#1{\fi\pgmlTestSpace}% diff --git a/assets/tex/pg.sty b/assets/tex/pg.sty index 7c56b89e89..c450e4ad5d 100644 --- a/assets/tex/pg.sty +++ b/assets/tex/pg.sty @@ -1,5 +1,36 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pg}[2023/06/26 version 2.18] +% packages that are needed for some PG macro to function for tex output or that +% support math mode tex macros that could reasonably appear in a PG problem +\usepackage{amsmath, amsfonts, amssymb} % math macros +\usepackage{booktabs, tabularx, colortbl, caption, xcolor} % niceTables.pl +\usepackage[version=4]{mhchem} % chemistry macros + +% some packages need to be handled differently for xelatex vs pdflatex +\usepackage{iftex} +\ifXeTeX + \usepackage{graphicx} % PGbasicmacros.pl, LiveGraphics3D.pl, unionImage.pl +\else + \usepackage[pdftex]{graphicx} % PGbasicmacros.pl, LiveGraphics3D.pl, unionImage.pl + \usepackage{epstopdf} % eps images with pdftex + \usepackage[utf8]{inputenc} + \usepackage{eurosym} % the euro symbol + \DeclareUnicodeCharacter{20AC}{\euro} % allow direct use of the UTF-8 euro symbol in problems +\fi + +% PG macro collections +\input{CAPA.tex} +\input{PGML.tex} + +% The macro alternatives for < should be used in math in PG problems to help +% avoid issus with a bare < in HMTL or XML output. The alternatives for > are +% provided for parity. +\newcommand{\lt}{<} +\newcommand{\gt}{>} +\newcommand{\less}{<} +\newcommand{\grt}{>} + +% semantic macro definitions used by PG \newcommand{\answerRule}[2][]{\raisebox{-3pt}{\parbox[t]{#2ex}{\hrulefill}}} From e211019c53ac380175ee824b3e623736fd5f85ab Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Sat, 15 Jul 2023 19:04:36 -0700 Subject: [PATCH 2/3] whitespace --- assets/tex/CAPA.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/tex/CAPA.tex b/assets/tex/CAPA.tex index 11d7d32fac..61d1ffa208 100644 --- a/assets/tex/CAPA.tex +++ b/assets/tex/CAPA.tex @@ -2,7 +2,7 @@ \newcommand{\capa}{{\sl C\kern-.10em\raise-.00ex\hbox{\rm A}\kern-.22em% {\sl P}\kern-.14em\kern-.01em{\rm A}}} - + \newenvironment{choicelist} {\begin{list}{} {\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in} From 95809817f0c4c7bfd31f7a93a58881b26a27e307 Mon Sep 17 00:00:00 2001 From: Alex Jordan Date: Thu, 20 Jul 2023 10:56:48 -0700 Subject: [PATCH 3/3] add multicol to pg.sty --- assets/tex/pg.sty | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/tex/pg.sty b/assets/tex/pg.sty index c450e4ad5d..8fcdf988df 100644 --- a/assets/tex/pg.sty +++ b/assets/tex/pg.sty @@ -5,6 +5,7 @@ % support math mode tex macros that could reasonably appear in a PG problem \usepackage{amsmath, amsfonts, amssymb} % math macros \usepackage{booktabs, tabularx, colortbl, caption, xcolor} % niceTables.pl +\usepackage{multicol} % DragNDrop.pm \usepackage[version=4]{mhchem} % chemistry macros % some packages need to be handled differently for xelatex vs pdflatex