I'm trying to plot the curve of

\frac{1}{x - 1}

My code is as follows:



\draw [red] (0,0) plot [domain=0.5:4] (\x,1/(\x-1));


This throws an error.

If I write this:

\draw [red] (0,0) plot [domain=0.5:4] (\x,1/x);

It's fine. It can handle this.

The error message is:

Package tikz Error: Giving up on this path. Did you forget a semicolon?. ... plot [domain=0.5:4] (\x,1/(\x-1))

Any idea what's going on?


The issue is the double brackets. You should put the expression within {}. And then have the (x-1) within the brackets so the eventual \begin{tikzpicture} input should look like:

\draw [red] (0,0) plot [domain=0.5:4] (\x, {1/(\x-1)});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.