Skip to main content
Chemistry LibreTexts

6: Advanced PGML Techniques

  • Page ID
    488663
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    This chapter introduces advanced PGML authoring patterns for richer layouts and interaction patterns. It covers CSS-based emphasis, tables with niceTables.pl, modern matching layouts, statement-by-statement evaluation, safer randomization habits, display graphs with PGgraphmacros.pl, and chemical structure rendering with RDKit.js.

    Matching layouts include the one place where MODES(HTML => ...) is required: wrapper HTML built inside eval blocks for dynamic content.

    These techniques assume the PG 2.17 subset used in ADAPT and webwork-pg-renderer, so some macros from full WeBWorK installs are not available. Use the patterns here when the basic PGML tools in Chapter 3 are not enough.

    Start here (task first)

    Quick patterns

    Quick patterns: need, use, and page.
    Need Use Page
    Emphasize key words HTML spans and PGML wrappers Text Coloring and Emphasis
    Structured data display DataTable or LayoutTable Making Tables with niceTables
    Two-column matching PopUp widgets + flexbox Randomized Matching Problems
    Evaluate multiple statements RadioButtons per statement Randomized MC True and False Statements
    Stable random variants problemSeed + guard checks Advanced Randomization Techniques
    Display graph (curve, data plot) PGgraphmacros.pl + init_graph Making Graphs
    Chemical structure rendering RDKit.js + SMILES strings Rendering Chemical Structures with RDKit
    Chemical formula / reaction display mhchem via MathJax \ce{} Displaying Chemical Formulas

    • 6.1: Text Coloring and Emphasis
      Covers dilution-series prompts and standard-curve setups as a reliable life-science pattern. After finishing, you can write dilution questions that avoid unit drift and rounding disputes. Use it when building wet-lab prompts for stocks, working solutions, and serial dilutions.
    • 6.2: Making Tables with niceTables
      Summarizes Michaelis-Menten question patterns that stay focused and grade reliably. After finishing, you can separate parameter reading from calculation and keep units and tolerances explicit. Use it when building kinetics items around Vmax, Km, and substrate concentration.
    • 6.3: Making Graphs
      Explains qPCR Ct and relative-expression prompts as a log-scale grading trap and shows how to make expectations explicit. After finishing, you can design Ct and fold-change questions where the model and reporting format are unambiguous. Use it when writing delta Ct, Ct comparison, and simple fold-change interpretation items.
    • 6.4: Advanced Randomization Techinques
      Describes gel and blot interpretation patterns that remain robust even when images fail to render. After finishing, you can separate what the data shows from the single inference you want graded. Use it when writing band-ordering, lane-identification, and expression interpretation items.
    • 6.5: Randomized Matching Problems
      Frames genotype-to-phenotype items as a mix of small computations and explicit interpretation checks. After finishing, you can write genetics prompts that avoid notation ambiguity and keep formatting consistent. Use it when building cross problems, genotype frequency items, and phenotype interpretation checks.
    • 6.6: Randomized MC True and False Statements
      Outlines pathway-logic patterns that test inference without turning into a long reading task. After finishing, you can design matching and selection prompts with clear assumptions about activation and inhibition. Use it when writing pathway regulation questions and perturbation reasoning checks.
    • 6.7: Rendering Chemical Structures with RDKit
      Covers pedigree and inheritance probability prompts with explicit model assumptions. After finishing, you can write probability questions that avoid hidden autosomal vs sex-linked or dominance assumptions. Use it when building family-probability and affected-offspring computation items.
    • 6.8: Displaying Chemical Formulas
      Shows how to display chemical formulas and reaction equations using the mhchem MathJax extension with \ce{} syntax, covering inline formulas, display-mode equations, ions, charges, and reaction arrows. After finishing, you can typeset formulas like glucose or sulfuric acid, write balanced equations, and handle ionic charges cleanly in PGML prompts. Use it when a problem needs chemical notation and you want proper typesetting rather than plain text or manual math-mode formatting.


    This page titled 6: Advanced PGML Techniques is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by Neil R. Voss.