有没有办法让 tikz 不在页面中间启动?我尝试过以下解决方案如何在页面左上角启动 tikzpicture和强制宽 Tikz 图形向左移动,但都没有成功。似乎只有页面的右半部分存在。tikz 中是否可以在一个页面上放置多张图片?如果可以,怎么做?所附图片是我试图放在页面上的图片
\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}
答案1
您的图像未居中,而是向右移动indent
。inner sep
节点也会影响所包含图像的位置。要将图像推到文本块的左边框,您可以执行以下操作:
\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}
(红线表示文本块边框)
答案2
要扩展 David 的评论,请尝试:
\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}
您将会看到各种东西tikzpictures
都不居中。