In Section 3.2 of Convex Optimization by Stephen Boyd and Lieven Vandenberghe, it shows that a convex function could be represented as the supermum of affine functions:

I don't quite understand the difference between variable $x$ and $z$ here.
In my understanding, the original function $g$ should have both $x$ and $z$ as variables, and then each $x$ refers to a function $g(z)$ whose supremum is represented as $f(x)$.
But if my understanding is right, why is the function $g$ here not written as $g(x,z)$ instead of $g(x)$? Thanks.
Your original function is $f$ which is convex, and depends only on one variable $x$. Then you look at all possible affine minorants $g$ ($z$ is their argument). At any given point $x$ the value of $f(x)$ is the maximum of the values of all affine minorants at that point. It is easier to think geometrically. Consider all the tangents to the graph. They all lie below the graph. If you fix a point on the graph, all tangents evaluated at that point take values less than $f(x)$ except for the one that is tangent at the given point $x$. That value is precisely $f(x)$.