pgf
pgf copied to clipboard
Support & in matrices without catcode change
- Support & with its usual catcode as cell separator in matrices, and no longer change the catcode in TikZ
- Correctly handle column spacing
between originsbetween columns not specified in the first row. - Simplify some code in pgfmodulematrix.code.tex, most notably that of empty cells.
The documentation has been adjusted to not promote anything else as & as cell separator. All examples now use &, except for style /tikz/ampersand replacment.
The macro \pgfmatrixnextcell is still documented.
Two examples have been slightly altered to showcase that between origins work between columns not specified in the first row.
Motivation for this change
Supporting & gets rid of the documented problems when matrices appear at less common places or have content with &.
The optional argument of & is not available immediately, so the code for column spacing needs changing anyway. It was easier not to reproduce an undocumented, unexpected behavior. For explicitness, this change occurs early in the branch.
Simplification are mostly taking the opportunity, and not necessary for the changes above, and appear near end of the branch. Empty cell handling needed change anyway to work correctly for empy cells ending with &.
Testing performed
The commits have been tested with som TikZ pictures, mostly from the documentation. With the last commit the LuaTeX version of the PGF documentation compiles succesfully. It has not been built for intermediate versions.
Checklist
This is an interesting proposal but it needs very careful testing because there are a lot of downstream consumers of this code like tikz-cd.
Please also sign-off on your commits. It can be done in batch using
git remote update
git rebase --exec 'git commit --amend --no-edit -n -s' @{upstream}
All commits should be signed off now. (Done with git rebase --signoff.)
The manual of tikz-cd version 0.9f successfully compiles under lualatex and xelatex with these changes. (I couldn't compile it with pdflatex even with the upstream version of pgf.)
I understand that lot more testing is necessary.
I have added some tests. On my machine they run successfully, but some fail on GitHub. How to access the directory build/test on GitHub, where l3build puts test results?
I have added some tests. On my machine they run successfully, but some fail on GitHub. How to access the directory build/test on GitHub, where l3build puts test results?
I've opened PR #1114 to upload *.diff files as an artifact. Before it's merged (and your branch matrix-ampersand rebased), you can download the zipped *.diff files from https://github.com/muzimuzhi/pgf/actions/runs/1597478038.
From the content of *.diff files,
- some simple lines might come from different latex2e versions
- dvips output seems OS specific
- dvisvgm generates rather different output which I can't even guess why
Thank you for the diffs, they have helped.
For dvisvgm, the font numbers differ, e.g., \FONT24 vs \FONT16. If these are LuaTeX's \fontid, then they are not supposed to be stable. dvisvgm is the only engine using LuaTeX with dvi output.
At least I see such entries with the command line
lualatex --output-format=dvi '\documentclass{article}\showoutput \begin{document} abc \end{document}'
Other egines seem to print TeX names instead: \OT1/cmr/m/n/10 and similar.
This PR is blocked by #1116.
Sorry, I had already reviewed this a year ago, but forgot to hit send.