In the following TikZ diagram, there is a node Square S on the left side and a small line segment from the node to a square. How do I get TikZ to ignore the horizontal space occupied by the node and small line segment? I would like to have the remaining diagram horizontally centered on the page.
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc, intersections}
\usetikzlibrary{intersections}
\begin{document}
\begin{tikzpicture}
%Two diagrams of intersecting, congruent squares are drawn. In each case, the vertex of one square is to be drawn at the
%center of the other square.
%Here is the first diagram. The vertices of two squares are located.
\path (0,0) coordinate (A) (7/2,0) coordinate (B) (7/2,7/2) coordinate (C) (0,7/2) coordinate (D);
%
%The center of the square is labeled O.
%
\coordinate (O) at (7/4,7/4);
%
\path ($(O) +(-32:7/2)$) coordinate (P) ($(P) +(-122:7/2)$) coordinate (Q) ($(Q) +(-212:7/2)$) coordinate (R);
\draw (O) -- (P) -- (Q) -- (R) --cycle;
%The region bounded by the two squares is shaded gray. The intersection of the two squares on AB is labeled M', and
%the intersection of the two squares on BC is labeled N'.
\path[name path=a_path_for_M'_between_squares] (A) -- (B);
\path[name path=another_path_for_M'_between_squares] (O) -- (R);
\coordinate[name intersections={of=a_path_for_M'_between_squares and another_path_for_M'_between_squares, by=M'}];
\path[line width=1.2pt, name path=a_path_for_N'_between_squares] (B) -- (C);
\path[line width=1.2pt, name path=another_path_for_N'_between_squares] (O) -- (P);
\coordinate[name intersections={of=a_path_for_N'_between_squares and another_path_for_N'_between_squares, by=N'}];
\path[fill=gray!20] (O) -- (N') -- (B) -- (M') -- cycle;
%The two squares are drawn.
\draw (A) -- (B) -- (C) -- (D) -- cycle;
\draw (O) -- (P) -- (Q) -- (R) -- cycle;
%Pins are drawn to label the two squares.
\draw ($(0,21/8) +(135:3pt)$) -- ($(0,21/8) +(135:0.5)$);
\node[font=\footnotesize, anchor=east, inner sep=0, align=center] at ($(0,21/8) +(135:0.5) +(135:3pt)$){Square \\ $S$};
%
\draw ($($(Q)!0.75!(R)$) +(-77:3pt)$) -- ($($(Q)!0.75!(R)$) +(-77:0.5)$);
\node[font=\footnotesize, anchor=north, inner sep=0, align=center] at ($($(Q)!0.75!(R)$) +(-77:0.5) +(-77:3pt)$){Square \\ $T$};
%Dashed line segments between the center O of square ABCD and the midpoints M of AB and N of BC
%are drawn.
%
\coordinate (M) at (7/4,0);
\draw[dashed] (M) -- (O);
\draw ($($(O)!0.5!(M)$)!3pt!90:(O)$) -- ($($(O)!0.5!(M)$)!3pt!-90:(O)$);
%
\coordinate (N) at (7/2,7/4);
\draw[dashed] (N) -- (O);
\draw ($($(O)!0.5!(N)$)!3pt!90:(O)$) -- ($($(O)!0.5!(N)$)!3pt!-90:(O)$);
%
\path[name path=a_path_for_label_M'] ($(A)!0.15cm!-90:(B)$) -- ($(B)!0.15cm!90:(A)$);
\path[name path=another_path_for_label_M'] let \p1=($(O)-(R)$), \n1={atan(\y1/\x1)} in (M') -- ($(M') +({0.5*(\n1-180)}:0.25)$);
\coordinate[name intersections={of=a_path_for_label_M' and another_path_for_label_M', by=label_M'}];
\path[name path=a_path_for_label_N'] ($(B)!0.15cm!-90:(C)$) -- ($(C)!0.15cm!90:(B)$);
\path[name path=another_path_for_label_N'] let \p1=($(O)-(P)$), \n1={atan(\y1/\x1)} in (N') -- ($(N') +({0.5*(\n1+90)}:0.25)$);
\coordinate[name intersections={of=a_path_for_label_N' and another_path_for_label_N', by=label_N'}];
%Here is the second diagram. The vertices of two squares are located.
\path (13/2,0) coordinate (A') (10,0) coordinate (B') (10,7/2) coordinate (C') (13/2,7/2) coordinate (D');
%
%The center of the square is labeled O.
%
\coordinate (O') at (33/4,7/4);
%
\path (49/4,7/4) coordinate (P') (49/4,-7/4) coordinate (Q') (33/4,-7/4) coordinate (R');
%The region bounded by the two squares is shaded gray.
\path[fill=gray!20] (O') -- (10,7/4) -- (10,0) -- (33/4,0) -- cycle;
%The two squares are drawn.
\draw (A') -- (B') -- (C') -- (D') -- cycle;
\draw (O') -- (P') -- (Q') -- (R') -- cycle;
%Pins are drawn to label the two squares.
\draw ($(10,21/8) +(45:3pt)$) -- ($(10,21/8) +(45:0.5)$);
\node[font=\footnotesize, anchor=west, inner sep=0, align=center] at ($(10,21/8) +(45:0.5) +(45:3pt)$){Square \\ $S$};
%
\draw ($($(Q')!0.75!(R')$) +(-45:3pt)$) -- ($($(Q')!0.75!(R')$) +(-45:0.5)$);
\node[font=\footnotesize, anchor=north, inner sep=0, align=center] at ($($(Q')!0.75!(R')$) +(-45:0.5) +(-45:3pt)$){Square \\ $T$};
%Title for the two diagrams of intersecting squares is drawn.
\node[font=\bfseries,anchor=north,inner sep=0,align=center] at ($(current bounding box.south) +(0,-0.3)$)
{\mbox{An illustration of two instances of squares \boldmath$S$ and $T$\unboldmath} \\
\mbox{intersecting at two adjacent sides}};
\end{tikzpicture}
\end{document}
\drawand\nodecommands that are to be ignored betweed\begin{scope}[overlay]and\end{scope}. – gernot Oct 11 '16 at 18:25\nodeand\drawcommands in ascopeenvironment is a much easier adaptation to my code than offered at the posts on this web site. Can I have them at any line in my code or do they have to be at the end? – A gal named Desire Oct 11 '16 at 22:58\begin{scope}[overlay]/\end{scope}without touching anything else (except for adding the missing\usetikzlibrary{intersections}), and it worked. In fact, this is one of the two methods presented on the webpage that I have linked to. The other one is thepgfinterruptboundingboxenvironment that I didn't try, but which should also work. – gernot Oct 11 '16 at 23:24intersectionsto my post. Thanks. – A gal named Desire Oct 12 '16 at 12:33