Files
dela 5b24eba3c8 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
2026-08-22 10:13:36 +08:00

47 lines
1.4 KiB
TeX
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
% 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}