The idea of step functions is that you draw how you want the output signal (or function) to look on a piece of graph paper, then come up with an equation to describe that. As a result, step functions and ramp functions are more pragmatic than based on a deep mathematical relationship.
There's only one part you have to worry about on the ramp functions: the slope. The t (or t-0), the (t-2), the (t-4) just gives you the start time for each function (in electrical circuits, they like to use ramp and step functions to represent a switch opening or closing at a certain time or an enabling/disabling signal or pulse being received at a certain time).
You have a slope of 2 for awhile. When the next switch closes, you have to subtract 1 from your slope (1*r(t-2)). You're still at the same point on the graph, but the slope has changed to one.
On the step functions, the amplitude is the only thing you actually do any addition or subtraction on - the (t-x) part just tells you when the switch closed to turn on the function.
Of course, the exception is when a switch opens, turning off the function. Mathematically, it's hard to come up with an expression that closes a switch, then opens the switch. Instead, you might see 3u(t-2) to represent the switch turning on the function at 2 seconds; and then a -3u(t-6) to represent a switch turning on a function that undoes the first function. In reality, at 6 seconds, you're doing the opposite of what you did at 2 seconds, or you're 'un-turning on' the function at 6 seconds.
The step functions are actually harder. There's a possibility you could have a jump depending on what's defining the amplitude of your step function. For example, if you had t^2u(t-2) as your step function, the function would turn on at 2 seconds, but the t^2 would go into effect immediately, meaning your amplitude would be 4 as soon as the function turned on, and then continue with the rest of the parabola. (That might be what you wanted your output signal to look like, but that would be unusual).
Edit: Does your second one have a typo? Until 4 seconds, you're multiplying 2*0. You could do that, but you could do the same thing with just -2u(t-4). Or are they just going to pains to illustrate the different properties of step functions?
Edit: Actually, there is a reason for writing the second equation the way they did. It might better represent what's actually happening in the circuit. The "2" might be available on the input side immediately, but not go anywhere until the inverter is turned on at 4 seconds. So there is a point in presenting it as 2u(t)u(4-t), even though it simplifies to -2u(t-4).