1

Is there a way to make tikz not start in the middle of the page? I've tried the solutions in How to start tikzpicture on top-left of page and Force wide Tikz figure to move left, but neither have worked. It seems only the right half of the page exists. Is it possible to fit more than one image on a page in tikz? If so, how? The attached image is what I'm trying to fit on the pageenter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}

\begin{scope}%[xshift=-1e6km]% this does nothing \node at (0,0) {\includegraphics[width=10cm]{Figure a}}; \end{scope}

\begin{scope}[xshift=0cm, yshift=3cm] % Top left \clip (0,0) circle (2cm); \node at (5,3) {\includegraphics[width=25cm]{Figure b1}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=3cm] % Top Right \clip (0,0) circle (2cm); \node at (5,3) {\includegraphics[width=25cm]{Figure b2}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope}

\begin{scope}[xshift=0cm, yshift=-3cm] % Bottom Left \clip (0,0) circle (2cm); \node at (4,2) {\includegraphics[width=25cm]{Figure b3}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=-3cm] % Bottom Right \clip (0,0) circle (2cm); \node at (4,2) {\includegraphics[width=25cm]{Figure b4}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope}

\end{tikzpicture} \end{document}

Sal
  • 13
  • 2
  • 4
    a tikzpicture is positioned like a letter x it has no positioning logic of its own, it just forms part of a paragraph and is only centred if it is in \begin{center} or similar – David Carlisle Nov 10 '22 at 15:15
  • Use \draw[red] (current bounding box.south west) rectangle (current bounding box.north east); at the end to see precisely where the tikzpicture is located. – John Kormylo Nov 11 '22 at 16:10

2 Answers2

1

Your image is not centered but moved to right for indent. Also inner sep of nodes influence on position of included images. To push images to the left border of a text block, you can do the following:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{tikz}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\begin{document} \noindent\begin{tikzpicture}[inner sep=0pt] % <---

\begin{scope}%[xshift=-1e6km]% this does nothing \node at (0,0) {\includegraphics[width=10cm]{Figure a}}; \end{scope}

\begin{scope}[xshift=0cm, yshift=3cm] % Top left \clip (0,0) circle (2cm); \node at (5,3) {\includegraphics[width=25cm]{Figure b1}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=3cm] % Top Right \clip (0,0) circle (2cm); \node at (5,3) {\includegraphics[width=25cm]{Figure b2}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope}

\begin{scope}[xshift=0cm, yshift=-3cm] % Bottom Left \clip (0,0) circle (2cm); \node at (4,2) {\includegraphics[width=25cm]{Figure b3}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=-3cm] % Bottom Right \clip (0,0) circle (2cm); \node at (4,2) {\includegraphics[width=25cm]{Figure b4}}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope}

\end{tikzpicture} \end{document}

enter image description here

(red lines indicate text block borders)

Zarko
  • 296,517
  • Thank you. Being able to visualize the border helped me to understand better. – Sal Nov 11 '22 at 08:00
  • @Sal, you are welcome! BTW, if answer help you (solve your problem), you may consider to accept it (by clicking on the check mark at top left side of the answer). – Zarko Nov 11 '22 at 08:06
0

To expand on David's comment, try:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\hspace{1cm}
\begin{tikzpicture}
\begin{scope}%[xshift=-1e6km]% this does nothing
    \node at (0,0) {};
\end{scope}
\begin{scope}[xshift=0cm, yshift=3cm] % Top left
    \clip (0,0) circle (2cm);
    \node at (5,3) {};
    \draw[color=black, thick] (0,0) circle (2cm);
\end{scope}
\begin{scope}[xshift=3cm, yshift=3cm] % Top Right
    \clip (0,0) circle (2cm);
    \node at (5,3) {};
    \draw[color=black, thick] (0,0) circle (2cm);
\end{scope}
\end{tikzpicture}

\hspace{5cm} \begin{tikzpicture} \begin{scope}%[xshift=-1e6km]% this does nothing \node at (0,0) {}; \end{scope} \begin{scope}[xshift=0cm, yshift=3cm] % Top left \clip (0,0) circle (2cm); \node at (5,3) {}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=3cm] % Top Right \clip (0,0) circle (2cm); \node at (5,3) {}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \end{tikzpicture}

\hspace{10cm} \begin{tikzpicture} \begin{scope}%[xshift=-1e6km]% this does nothing \node at (0,0) {}; \end{scope} \begin{scope}[xshift=0cm, yshift=3cm] % Top left \clip (0,0) circle (2cm); \node at (5,3) {}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \begin{scope}[xshift=3cm, yshift=3cm] % Top Right \clip (0,0) circle (2cm); \node at (5,3) {}; \draw[color=black, thick] (0,0) circle (2cm); \end{scope} \end{tikzpicture} \end{document}

you will see that the various tikzpictures are not centered.

Denis
  • 5,267