我已经从 geogebra 生成了 tikz 代码......
\documentclass[12pt,a4paper]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\definecolor{qqqqff}{rgb}{0,0,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=black] (-2,0) -- (5,0);
\foreach \x in {-2,-1,1,2,3,4}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-1) -- (0,5);
\foreach \y in {-1,1,2,3,4}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-2,-1) rectangle (5,5);
%\draw[smooth,samples=100,domain=5.00000000131904E-6:5.0] plot(\x,{((\x)*>*0)*(1+1/(\x))});
\draw (1.04,2.87) node[anchor=north west] {$(1,1+a)$};
\draw (0,2)-- (1,2);
\draw (1,2)-- (1,0);
\draw (-1.5,2.66) node[anchor=north west] {$1+a$};
\begin{scriptsize}
\fill [color=qqqqff] (1,2) circle (1.5pt);
\fill [color=qqqqff] (0,2) circle (1.5pt);
\fill [color=qqqqff] (1,0) circle (1.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}
我得到了如下的图表...
但我应该有我的图表,因为这里缺少曲线。我应该怎么做才能得到图表。帮帮我。。
答案1
plot
参见pgf 手册第 329 页附近的正确语法。也许 Geogebra 犯了一些错误......
\documentclass[12pt,a4paper]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\definecolor{qqqqff}{rgb}{0,0,1}
\begin{figure}
\begin{center}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45]
\draw[->,color=black] (-2,0) -- (5,0);
\foreach \x in {-2,-1,1,2,3,4}
\draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};
\draw[->,color=black] (0,-1) -- (0,5);
\foreach \y in {-1,1,2,3,4}
\draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt);
\draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};
\clip(-2,-1) rectangle (5,5);
\draw[smooth,samples=100,domain=.1:5.0] plot(\x,{1+1/(\x)});
\draw (1.04,2.87) node[anchor=north west] {$(1,1+a)$};
\draw (0,2)-- (1,2);
\draw (1,2)-- (1,0);
\draw (-1.5,2.66) node[anchor=north west] {$1+a$};
\begin{scriptsize}
\fill [color=qqqqff] (1,2) circle (1.5pt);
\fill [color=qqqqff] (0,2) circle (1.5pt);
\fill [color=qqqqff] (1,0) circle (1.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{center}
\caption{Nice curve !}
\end{figure}
\end{document}