feat: fill test coverage gaps + fix \sdcol i18n labels
- examples/subst-chain.tex: substitution walkthrough with \sdbox/\sdsubst/\sdstep - examples/antipatterns.tex: four compile-clean-but-teach-false figures - tests/invalid/step-outside-row.tex, empty-row.tex, undeclared-role.tex, two-contrast-pkg.tex: negative fixtures for package-level warnings - test.sh: add tests/invalid/ loop - build.sh: allow superderive-build: allow directive to suppress intentional warnings in antipatterns galleries - superderive.sty: \sdcol respects [en] option for illegal/legal labels - references/api.md: complete rewrite, all ~12 macros documented
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
% Anti-patterns -- figures that compile cleanly and still teach something false.
|
||||
% ../scripts/build.sh antipatterns.tex
|
||||
% superderive-lint: allow-multiple-contrast
|
||||
% superderive-build: allow
|
||||
\documentclass[border=10pt]{standalone}
|
||||
\usepackage[cjk]{superderive}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\sdstage{AP}{四张反例}
|
||||
\sdrow{R1}
|
||||
% AP1: \sdsubst 只填了 from,to 也是同一个 -- 改写没有产生任何变化
|
||||
\sdsubst[role=rewrite]{ap1}{x+y}{x+y}
|
||||
\sdreason{ap1}{subst 的 from 和 to 相同,改写为空}
|
||||
\sdrowend
|
||||
|
||||
\sdrow{R2}
|
||||
% AP2: \sdcancel 划线后旁边又写了一遍同样的东西 -- 读者不知道划掉的是哪一部分
|
||||
\sdcancel[role=cancel]{ap2a}{x+y}
|
||||
\sdbox[role=keep]{ap2b}{x+y}
|
||||
\sdreason{ap2a}{cancel 后面紧跟同一式子,等于没有 cancel}
|
||||
\sdrowend
|
||||
|
||||
\sdrow{R3}
|
||||
% AP3: 同一行里塞了五组 role,hue budget 超了
|
||||
\sdbox[role=keep]{ap3a}{a}
|
||||
\sdbox[role=rewrite]{ap3b}{b}
|
||||
\sdbox[role=cancel]{ap3c}{c}
|
||||
\sdbox[role=intro]{ap3d}{d}
|
||||
\sdbox[role=neutral]{ap3e}{e}
|
||||
\sdrowend
|
||||
|
||||
\sdrow{R4}
|
||||
% AP4: 两个 contrast pair,第二个是多余的
|
||||
\sdcol{ap4a}{x+y}{x+y}
|
||||
\sdcol{ap4b}{a+b}{a+b}
|
||||
\sdrowend
|
||||
|
||||
\sdbbox{all}
|
||||
\sdtopformula{F}{反例见 \texttt{references/antipatterns.md}}
|
||||
\sdmeaningbox{mb}{140mm}{all}
|
||||
{subst from=to;cancel 后重复;row 内五色;两个 sdcol}
|
||||
{每一行都符合语法,但每一行都在说谎}
|
||||
{参考 antipatterns.md 的对应规则}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
@@ -0,0 +1,23 @@
|
||||
% Golden example -- a subst chain that must be seen, not just aligned.
|
||||
% ../scripts/build.sh subst-chain.tex
|
||||
\documentclass[border=10pt]{standalone}
|
||||
\usepackage[cjk]{superderive}
|
||||
|
||||
\sdsetrole{live}{sdTeal}
|
||||
|
||||
\begin{document}
|
||||
\begin{tikzpicture}
|
||||
\sdstage{D1}{换元让积分内部对齐}
|
||||
\sdrow{R1}
|
||||
\sdbox[role=keep]{x}{$u$}
|
||||
\sdsubst[role=live]{s1}{u}{x^2}
|
||||
\sdstep[role=rewrite]{s2}{\int_0^1 x\,e^{x^2}\,dx}{\tfrac12\int_0^1 e^u\,du}
|
||||
\sdrowend
|
||||
\sdbbox{all}
|
||||
\sdtopformula{F}{$\int_0^1 x\,e^{x^2}\,dx = \tfrac12\int_0^1 e^u\,du$}
|
||||
\sdmeaningbox{mb}{120mm}{all}
|
||||
{换元是恒等改写,不改值}
|
||||
{令 $u=x^2$,则 $du=2x\,dx$}
|
||||
{上下限随 $u$ 一起换掉}
|
||||
\end{tikzpicture}
|
||||
\end{document}
|
||||
Reference in New Issue
Block a user