我想将 x 轴上的一个额外刻度标记向左移动约 2pt。我尝试在\hspace*{-2pt}
标签前和\hspace*{2pt}
标签后使用间距命令。刻度标记没有移动。我问过类似的问题,被告知间距命令\hspace*{}
会移动刻度标记。我已经实现了它,它确实移动了刻度标记。但是,它不会在以下代码中移动刻度标记。(指定了两个刻度标记。我只是试图移动 $-\sqrt[5]{6}$。)
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\noindent \hspace*{\fill}
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,
axis lines=middle,
xmin=-4,xmax=4,samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-10,ymax=10,
restrict y to domain=-10:10,
enlargelimits={abs=0.5cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
extra x ticks={-1.43097,1.08447},
extra x tick labels={$-\sqrt[\uproot{1} \leftroot{-1} 5]{6}$\hspace{10pt},$\sqrt[\uproot{1} \leftroot{-1} 5]{\frac{3}{2}}$},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
/pgfplots/xlabel shift={10pt};
\addplot[samples=501,domain=-9:-0.01,blue] {x^2 + 1/(x^3)} node[anchor=west,pos=0.1,font=\footnotesize]{$y=f(x)$};
\addplot[samples=501,domain=0.01:9,blue] {x^2 + 1/(x^3)};
\draw [fill] (1.08447,1.96013) circle [radius=1.5pt];
\draw [fill] (-1.43097,1.70639) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\hspace{\fill}
\end{document}
答案1
使用\phantom
类似
$-\sqrt[\uproot{1} \leftroot{-1} 5]{6}\phantom{ab}$
答案2
您可以使用\hspace*{10pt}
:
代码:
\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{calc,angles,positioning,intersections,quotes,decorations.markings}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\begin{document}
\noindent
\begin{tikzpicture}
\begin{axis}[width=6in,axis equal image,
axis lines=middle,
xmin=-4,xmax=4,samples=201,
xlabel=$x$,ylabel=$y$,
ymin=-10,ymax=10,
restrict y to domain=-10:10,
enlargelimits={abs=0.5cm},
axis line style={latex-latex},
ticklabel style={font=\tiny,fill=white},
xtick={\empty},ytick={\empty},
extra x ticks={-1.43097,1.08447},
extra x tick labels={$-\sqrt[\uproot{1} \leftroot{-1} 5]{6}$\hspace*{10pt},$\sqrt[\uproot{1} \leftroot{-1} 5]{\frac{3}{2}}$},
xlabel style={at={(ticklabel* cs:1)},anchor=north west},
ylabel style={at={(ticklabel* cs:1)},anchor=south west}
]
/pgfplots/xlabel shift={10pt};
\addplot[samples=501,domain=-9:-0.01,blue] {x^2 + 1/(x^3)} node[anchor=west,pos=0.1,font=\footnotesize]{$y=f(x)$};
\addplot[samples=501,domain=0.01:9,blue] {x^2 + 1/(x^3)};
\draw [fill] (1.08447,1.96013) circle [radius=1.5pt];
\draw [fill] (-1.43097,1.70639) circle [radius=1.5pt];
\end{axis}
\end{tikzpicture}
\end{document}