I am trying to compute the Laplace transform of the following wave:

According to the textbook the answer is $Y(s)=\frac{1}{s^2}\frac{1-e^{-as}}{1+e^{-as}}$. I am having trouble getting to this answer. Here's what I have done:
First, I wrote an expression for f(t). I got: $$f(t)=\frac{t}{a}, 0 \leq t \leq a$$ $$f(t)=\frac{-1}{a}(t-2a), a \leq t \leq 2a$$
Second, I expressed this in terms of Heaviside functions (only one period). Here's what I got:
$$\frac{t}{a} H(t) +[-\frac{t}{a}H(t-a) -\frac{1}{a}(t-a)H(t-a)+H(t-a)]$$
I then computed Laplace transform of these functions and divided by $\frac{1}{1-e^{-as}}$, I get the following: $$\frac{1}{1-e^{-as}}[ \frac{1-e^{-as}-e^{-as}+ase^{-as}}{as^2}]$$
I didn't simplify much so that you could see easily where everything comes from. Now the question, what's holding me from getting the right answer?
Your problem is with the initial "brick" on $[0,2a]$, often called a "tent function". See the graphic below: your curve is in blue: everything is fine but at the end where it "plunges" instead of returning to $0$ level. Here is the rectification (in all meanings of the word), the red curve (partly superimposed on the blue curve) with equation:
$$f(t)=\tfrac{t}{a}H(t)+(-2\tfrac{t}{a}+2)H(t-a)+(\tfrac{t}{a}-2)H(t-2a)$$
Remarks:
For $t \ge 2a$, all Heaviside functions have value $1$, giving a sum: $\tfrac{t}{a}-2\tfrac{t}{a}+2\tfrac{t}{a}-2=0$.
As there are 3 breaking points, you need exactly three Heaviside functions.