tikz 不會將繪圖放置在正確的座標中

tikz 不會將繪圖放置在正確的座標中
\draw[very thick] (12.5,0) node[left] {Nature} -- (12.5,2);

無論我在 12.5 中輸入什麼,該代碼都不起作用。它只是保留在頁面的左側部分。

幫助。

答案1

tikz(或pgf) 使用包圍影像中使用的點的最小矩形框。如果您希望該方塊包含例如原點,您可以新增一個簡單的\draw (0,0);命令:

樣本輸出

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
  \draw (0,0);
  \draw[very thick] (12.5,0) node[left] {Nature} -- (12.5,2);
\end{tikzpicture}

\end{document}

替代方法包括明確指定邊界框

\useasboundingbox (0,0) rectangle (12.5,2);

或整體移動圖片,例如

\begin{flushright}
  \begin{tikzpicture}
    ...
  \end{tikzpicture}
\end{flushright}

或使用\hspace{...}(例如\hspace{3cm}在圖片之前和/或之後。

相關內容