1

Consider the following LaTeX manuscript featuring a TikZ picture of a matrix with a single cell.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \matrix[draw,nodes=draw]
  {
    \node {*}; \\
  };
\end{tikzpicture}
\end{document}

The resulting image is

                                                                A matrix with a single cell

How can I adjust the padding surrounding the cell? For instance, suppose I wish to get rid of the padding all together. I attempted to add inner sep=0pt to the matrix's option list, but then not only did the padding surrounding the cell collapse, but also the padding surrounding the asterisk inside the cell:

                                                                   inner sep=0

P.S. If the matrix has more than one cell, I don't wish to alter the spacing between the rows or the spacing between the columns; only the padding inside the matrix that surrounds the entire grid of cells.

Evan Aad
  • 11,066
  • 1
    inner sep=2pt, nodes={draw, inner sep=0} or inner sep=0, nodes={draw, inner sep=2pt} – percusse Jul 13 '17 at 16:09
  • @percusse: Thanks, however (1) What if I want to keep the current inner sep of the cells, but I don't know what it is? (2) Is there a way to adjust the four margins separately? inner sep affects all four of them uniformly. – Evan Aad Jul 13 '17 at 16:13
  • 1
    inner xsep and ysep are different ways to adjust. also there is every matrix style – percusse Jul 13 '17 at 16:22
  • @percusse: The inner xsep and inner ysep partly solve problem #2, but only partly, and only problem #2. As for the every matrix style: I don't think that, in itself, it solves either of the problems. For instance, if I add the option every matrix/.style={inner sep=0pt} to the tikzpicture's option list, the inner sep inside the cell collapses as well as the surrounding padding. – Evan Aad Jul 13 '17 at 16:27
  • 1
    Can you give an example what you want to do? There are new problems coming up. There are no individual sep values only x and y. Same with outer x and y sep – percusse Jul 13 '17 at 16:34
  • @percusse: OK, but what about problem #1? Is there a way to retain the cells' inner sep without specifying it explicitly? – Evan Aad Jul 13 '17 at 16:38
  • 2
    you can get the current xsep and ysep values \pgfkeysvalueof{/pgf/inner xsep} if that's a concern and reset the nodes after setting inner sep=0. – percusse Jul 13 '17 at 16:48

0 Answers0