forked from pgf-tikz/pgf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pgf-tikz#1163 from muzimuzhi/implicite-matrix
fix: incorrectly placed matrix delimiters
- Loading branch information
Showing
5 changed files
with
205 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
\documentclass{minimal} | ||
\input{pgf-regression-test} | ||
|
||
\RequirePackage{tikz} | ||
\usetikzlibrary{calc, matrix} | ||
|
||
\begin{document} | ||
|
||
\setbox0=\hbox{$()$} % avoid logging font info cmex10 at test for "matrix delimiters" | ||
|
||
\START | ||
|
||
\SEPARATOR | ||
\TYPE{Testing that special nodes are placed at expected position^^J% | ||
when main nodes are implicitly positioned.} | ||
\SEPARATOR | ||
|
||
\BEGINTEST{labels} | ||
% adapted from https://github.com/pgf-tikz/pgf/issues/126 | ||
\begin{tikzpicture}[L/.style={label={[name=#1]above:{.}}}] | ||
\draw (0,4) -- (3,4) node[midway, L=a] (A) {A}; | ||
\draw (0,3) -- node[L=b] (B) {B} (3,3); | ||
|
||
\draw (0,2) -- (3,2) node[near end, L=c] (C) {C}; | ||
\draw (0,1) -- node[near end, L=d] (D) {D} (3,1); | ||
|
||
% `label distance` is initially 0pt | ||
\AssertTikzPointEquals{(a.south)}{(A.north)} | ||
\AssertTikzPointEquals{(b.south)}{(B.north)} | ||
\AssertTikzPointEquals{(c.south)}{(C.north)} | ||
\AssertTikzPointEquals{(d.south)}{(D.north)} | ||
\end{tikzpicture} | ||
\ENDTEST | ||
|
||
\BEGINTEST{pins} | ||
\catcode`\@=11\relax | ||
\def\distance{\tikz@pin@distance} | ||
\catcode`\@=12\relax | ||
|
||
\begin{tikzpicture}[P/.style={pin={[name=#1]above:{.}}}] | ||
\draw (0,4) -- (3,4) node[midway, P=a] (A) {A}; | ||
\draw (0,3) -- node[P=b] (B) {B} (3,3); | ||
|
||
\draw (0,2) -- (3,2) node[near end, P=c] (C) {C}; | ||
\draw (0,1) -- node[near end, P=d] (D) {D} (3,1); | ||
|
||
\AssertTikzPointEquals{(a.south)}{($ (A.north) + (0pt,\distance) $)} | ||
\AssertTikzPointEquals{(b.south)}{($ (B.north) + (0pt,\distance) $)} | ||
\AssertTikzPointEquals{(c.south)}{($ (C.north) + (0pt,\distance) $)} | ||
\AssertTikzPointEquals{(d.south)}{($ (D.north) + (0pt,\distance) $)} | ||
\end{tikzpicture} | ||
\ENDTEST | ||
|
||
\BEGINTEST{matrix delimiters} | ||
% adapted from https://github.com/pgf-tikz/pgf/issues/1102 | ||
\begin{tikzpicture}[ampersand replacement=\&, | ||
every left delimiter/.style={name=left}, | ||
every right delimiter/.style={name=right}, | ||
every above delimiter/.style={name=above}, | ||
every below delimiter/.style={name=below}] | ||
|
||
\draw[->] (0, 0) -- | ||
node[matrix of math nodes, anchor=north, | ||
left delimiter=(, right delimiter=), | ||
above delimiter=\{, below delimiter=\}] (M) | ||
{0 \& -1 \\ 1 \& 0 \\} | ||
(1, 0); | ||
|
||
\AssertTikzPointEquals{(M.south west)}{(left.south east)} | ||
\AssertTikzPointEquals{(M.south east)}{(right.south west)} | ||
\AssertTikzPointEquals{(M.north west)}{(above.south east)} | ||
\AssertTikzPointEquals{(M.south west)}{(below.south west)} | ||
\end{tikzpicture} | ||
\ENDTEST | ||
|
||
\END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
This is a generated file for the l3build validation system. | ||
Don't change this file in any respect. | ||
============================================================ | ||
Testing that special nodes are placed at expected position | ||
when main nodes are implicitly positioned. | ||
============================================================ | ||
============================================================ | ||
TEST 1: labels | ||
============================================================ | ||
PASSED | ||
PASSED | ||
PASSED | ||
PASSED | ||
============================================================ | ||
============================================================ | ||
TEST 2: pins | ||
============================================================ | ||
PASSED | ||
PASSED | ||
PASSED | ||
PASSED | ||
============================================================ | ||
============================================================ | ||
TEST 3: matrix delimiters | ||
============================================================ | ||
PASSED | ||
PASSED | ||
PASSED | ||
PASSED | ||
============================================================ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters