我希望我的绘图的尖端位于中心,而不是位于侧面。我对图形一无所知,而且\centering
行不通。
代码生成的图片:
我想要的图片是:
我的代码:
\documentclass{article}
\usepackage{pgf,tikz}
\tikzset{>=stealth}
\begin{document}
\begin{tikzpicture}[y=0.75pt, x=0.75pt, yscale=-1, xscale=1, inner sep=0pt, outer sep=0pt, <->]
\begin{scope}
\path[color=black,draw=black,line join=round,line cap=round,miter limit=4.00,even odd rule,line width=2.000pt] (0,0) .. controls (65,85) and (105,-15) .. (135,-45) .. controls (185,-95) and (255,-70) .. (290,-120) .. controls (325,-160) and (340,30) .. (385,-10) .. controls (420,-50) and (440,-35) .. (480,-45) .. controls (505,-50) and (530,-95) .. (530,-95);
\end{scope}
\end{tikzpicture}
\end{document}
答案1
使用您的 MWE,问题似乎出在一个坏框上(特别是 \hbox 过满,这意味着图像太宽,无法放入段落中)。稍微调整一下选项中的x
和的值,我发现值可以正常工作,但图像会变小。同样,您可以尝试操纵字段和的值。y
tikzpicture
0.61pt
xscale
yscale
另一种解决方案:您可以将tikzpucture
图像包装在figure
环境中,然后使用命令\centering
将图像居中。请注意,我更改了x
和y
值,因为0.75pt
坏框仍然存在。我使用该包lipsum
只是为了编写文本以查看对齐。
\documentclass{article}
\usepackage{pgf,tikz}
\usepackage{lipsum}
\tikzset{>=stealth}
\begin{document}
\lipsum[1]
\begin{figure}[h]
\centering
\begin{tikzpicture}[y=0.64pt, x=0.64pt, yscale=-1, xscale=1, inner sep=0pt, outer sep=0pt, <->]
\begin{scope}
\path[color=black,draw=black,line join=round,line cap=round,miter limit=4.00,even odd rule,line width=2.000pt] (0,0) .. controls (65,85) and (105,-15) .. (135,-45) .. controls (185,-95) and (255,-70) .. (290,-120) .. controls (325,-160) and (340,30) .. (385,-10) .. controls (420,-50) and (440,-35) .. (480,-45) .. controls (505,-50) and (530,-95) .. (530,-95);
\end{scope}
\end{tikzpicture}
\end{figure}
\lipsum[1]
\end{document}
答案2
像这样吗?
\documentclass{article}
\usepackage{tikz,showframe}
\tikzset{>=stealth}
\begin{document}
\centering
\begin{tikzpicture}[y=0.5pt, x=0.5pt, yscale=-1, xscale=1, inner sep=0pt, outer sep=0pt, <->]
\path[draw=black, line join=round, line cap=round,miter limit=4, line width=2pt] (0,0) .. controls (65,85) and (105,-15) .. (135,-45) .. controls (185,-95) and (255,-70) .. (290,-120) .. controls (325,-160) and (340,30) .. (385,-10) .. controls (420,-50) and (440,-35) .. (480,-45) .. controls (505,-50) and (530,-95) .. (530,-95);
\end{tikzpicture}
\end{document}