Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix library sometimes puts delimiter to the wrong place #1102

Closed
gabor-braun opened this issue Dec 12, 2021 · 1 comment · Fixed by #1163
Closed

Matrix library sometimes puts delimiter to the wrong place #1102

gabor-braun opened this issue Dec 12, 2021 · 1 comment · Fixed by #1163
Labels

Comments

@gabor-braun
Copy link
Contributor

Brief outline of the bug

The TikZ library matix have options "left delimiter" etc to add
delimiters to maticies. In the following example, these are obviously at a position having nothing to do with the matrix.

Minimal working example (MWE)

\documentclass[tikz]{standalone}
\usetikzlibrary{matrix}

\begin{document}
\begin{tikzpicture}[ampersand replacement=\&]
  \draw[->] (0, 0) --
  node[matrix of math nodes, anchor=north,
  left delimiter=(, right delimiter=)]
  {0 \& -1 \\ 1 \& 0 \\}
  (1, 0);
\end{tikzpicture}
\end{document}
@Mo-Gul Mo-Gul added the matrix label Dec 12, 2021
@muzimuzhi
Copy link
Member

muzimuzhi commented Jun 9, 2022

This is the sibling issue of #126, which reported wrong positioning of labels.

Each of labels, pins, and matrix delimiters use option append after command to insert another node at the end of the
"main node". But when a node is placed on a line (e.g., (0,0) -- <node> (1,0)) or curve implicitly (see pgfmanual, sec. 17.9), such node is first collected then rescanned as if it is a label (by setting \tikz@node@is@a@labeltrue). When being treated as a label, node positioning is solely controlled by pos option, which is initialized to pos=.5 at picture beginning, and never by normal at setting.

\draw (0,0) -- node[at={(1,1)}] {x}  (1,0); % this `at={(1,1)}` is ignored

To reenable at setting used by matrix delimiters, locally setting \tikz@node@is@a@labelfalse does the trick, just like how 438758d fixed #126. I've prepared a PR.

PS: Setting pos= also works, which maybe helpful in (tricky) user input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants