Giter VIP home page Giter VIP logo

matrix.skeleton's People

Contributors

dudebout avatar onursehitoglu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

onursehitoglu

matrix.skeleton's Issues

Matrix positioning breaks matrix label and nodes drawn with matrixname-n-m nodes.

Please see here for a detailed account of the issue.

I've included the code that causes the problem

\documentclass[leqno]{amsart}
\usepackage{tikz}
\usetikzlibrary{matrix,calc,positioning,tikzmark,patterns,fit,matrix.skeleton}


\begin{document}
\begin{tikzpicture}
        \matrix (x) [matrix of math nodes,style contour = {draw, very thick},style grid = {draw, thin},label=above:\( X_e \),nodes in empty cells=true,ampersand replacement=\&] {
            \& \\
            \& \\
            \& \\
            \& \\
            \& \\
        };

        \matrix (m) at (4,0) [matrix of math nodes,style contour = {draw, very thick},style grid = {draw, thin},label={above:\( A \)},nodes in empty cells=true,ampersand replacement=\&] {
            \& \& \\
            \& \& \\
            \& \& \\
            \& \& \\
            \&  \& \\
        };

        \node[black] (val-m-5-3) at (m-5-3) {1};
        \node[black,circle,draw,minimum size=2.2mm] (circle-m-5-3) at (m-5-3) {};
        \fitandstyle[background]{(m-cell-1-1) (m-cell-3-1)}{fill=Gray};
        \fitandstyle[background]{(m-cell-1-2) (m-cell-3-3)}{pattern=crosshatch};
    \end{tikzpicture}

\end{document}

This creates the following image (note how the label and drawing doesn't move with the matrix.

Screen Shot 2021-02-07 at 7 52 29 PM

Note that if I just draw the matrix m by itself without moving it I get the desired result.

Screen Shot 2021-02-07 at 8 02 01 PM

extra white space to the right of nodes

I am trying to depict more than one matrix with tikz with the tikz libraries matrix and matrix.skeleton because later I want to highlight some things and so on.

This would be my mwe:

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usetikzlibrary{matrix.skeleton}
\usetikzlibrary{calc}

\begin{document}


\begin{tikzpicture}


\matrix (X) [matrix of math nodes,
			label skeleton,
             left delimiter  = (,
             right delimiter = )] at (0,0)
{%
  \vdots & \vdots &  & \vdots  \\
  x & x & \cdots & x \\
  \vdots & \vdots &  & \vdots  \\
  x & x & \cdots & x\\
  \vdots & \vdots &  & \vdots  \\
  x & x & \cdots & x\\
  \vdots & \vdots &  & \vdots  \\
  x & x & \cdots & x\\
  \vdots & \vdots &  & \vdots  \\
  x & x & \cdots & x\\
};

\matrix (U) [matrix of math nodes,
			label skeleton,
             left delimiter  = (,
             right delimiter = )] at (4,0)
{
  \vdots  \\
  u\\
  \vdots \\
  u\\
  \vdots \\
  u\\
  \vdots \\
  u\\
  \vdots \\
  u\\
};

\end{tikzpicture}
\end{document}

outcome from mwe:

GyNcs

which creates an extra white space to the right of the second matrix. I have notice that it happens when I make use of the matrix.skeleton library by means of label skeleton. However, I can not find the solution in the manual of the package from CTAN.

Issue with two matrices and positioning

There is a significant issue with the style contour and style grid functions: any repositioning of the matrix screws up placement of the border.

Consider the following example:

\documentclass[a4paper,10pt]{report}
\usepackage{tikz}

\usetikzlibrary{matrix,matrix.skeleton}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}
    % create matrix `A'
        \matrix [ampersand replacement=\&,
                 matrix of nodes, 
                 style grid = {draw, thin}, 
                 style contour={draw, thick},
        ] (A) {
            aa \& ba \& ca \& da \\
            ab \& bb \& cb \& db \\
        };
    % create matrix `B'
    % align both matrices at the top
        \matrix [ampersand replacement=\&,
            matrix of nodes,
            style grid = {draw, thin},
            style contour={draw, thick},
            matrix anchor=north west,
            right=0pt of A.north east,
        ] (B) {
            aa \& ba \\
            ab \& bb \\
            ac \& bc \\
            ad \& bd \\
        };
    % show that matrix `A' and `B' are aligned at the top
        \fill [green] (A.north east) circle (3pt);
        \fill [red]   (B.north west) circle (2pt);
    \end{tikzpicture} 
\end{document}

(image added by @dudebout on 2021/02/09)
2021-02-09-204816_236x114_scrot

You will see that the contents of the matrix is aligned/anchored as it should, but the outline of the second matrix is off.
In general, any absolute positioning of the matrix also sends the outline flying, for example

\documentclass[a4paper,10pt]{report}
\usepackage{tikz}

\usetikzlibrary{matrix,matrix.skeleton}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[remember picture,overlay]
    % create matrix `A'
        \matrix [ampersand replacement=\&,
                 matrix of nodes,
                 style grid = {draw, thin},
                 style contour={draw, thick},
        ] at (current page.center) (A) {
            aa \& ba \& ca \& da \\
            ab \& bb \& cb \& db \\
        };
    % create matrix `B'
    % align both matrices at the top
        \matrix [ampersand replacement=\&,
            matrix of nodes,
            style grid = {draw, thin},
            style contour={draw, thick},
            matrix anchor=north west,
            right=0pt of A.north east,
        ] (B) {
            aa \& ba \\
            ab \& bb \\
            ac \& bc \\
            ad \& bd \\
        };
    % show that matrix `A' and `B' are aligned at the top
        \fill [green] (A.north east) circle (3pt);
        \fill [red]   (B.north west) circle (2pt);
    \end{tikzpicture} 
\end{document}

(image added by @dudebout on 2021/02/09)
2021-02-09-205033_409x449_scrot

I'm not sure what is happening, but somehow, the row and column coordinates aren't calculated correctly, while the cells are, see for example when you add

\path [draw, thick,red] (A-row-1.north west) -- (A-1-4.north east) -- (A-2-4.south east) -- (A-2-1.south west) -- cycle;

right before creating matrix B.
Most likely, moving ths matrix causes the row/col corrdinates to be computed twice: once with the right position, and then the shifting is applied again.

CTAN upload

Perhaps it'd be useful to upload matrix.skeleton to CTAN, making it available in various LaTeX distributions out of the box? From what I can see this would entail:

  1. Adding author and license information to README.md (this is required by CTAN; need not be added to the GitHub version, of course – just the one in the CTAN zipfile);
  2. Creating a zip or tgz file with the directory named matrix-skeleton or the like (see below); and
  3. Filling out the CTAN upload form with the suggested path being something like /graphics/pgf/contrib/matrix-skeleton (dots are not permitted here) and the version either set to the release/commit date (2014-07-23) or actually creating a versioned release here on GitHub first.

If you'd rather not have the hassle, I'd be happy to register it for you.

"Undefined control sequence." error when all the nodes in a matrix are specified

When using label skeleton on a matrix full of nodes, one receives the error:

! Undefined control sequence.\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@

The following minimal reproducing example exhibits that behavior:

\documentclass[tikz]{standalone}

\usetikzlibrary{matrix.skeleton}

\begin{document}
  \begin{tikzpicture}
    \matrix (m) [matrix of nodes, nodes in empty cells, label skeleton] {
      \node {}; & \node {}; \\
      \node {}; & \node {}; \\
    };
  \end{tikzpicture}
\end{document}

If you remove any one node from the matrix, compilation works. Note that the node is in this case created by the nodes in empty cells option.

One column matrix error

Hi,
In the appended example, errors occur because matrix.skeleton is loaded and used on a one-column-matrix. Just using the matrix-library or adding an empty second column seems to be working. Maybe this is related to pgf-tikz/pgf#267.

I don't know if you actively work on this Repo but thank you for your help.
Kind regards

\documentclass[]{article} 
\usepackage{tikz}
\usetikzlibrary{
	matrix,
	matrix.skeleton
}

\begin{document}
	\begin{tikzpicture}[]
		\matrix(m1)[matrix of nodes]  at (0,0){
			a \\
			b \\
		};
	\end{tikzpicture}
\end{document}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.