TITLE: Confused by $\Re(z)$ and closed contours, why isn't it the integral 0?
QUESTION [5 upvotes]: Let the contour $\gamma$ be the triangle with vertices $\ 0, 1, 1+i $, taken anticlockwise. 
As this is a closed contour and I understand $$\oint_\gamma z\ dz = 0    $$ as it is analytic inside the contour (and everywhere else).
However, how are you meant to evaluate $$\oint \Re(z) \ dz$$
As it's not analytic inside the contour, I split the triangle into three parametrised lines: 
$$\gamma_1: t\quad 0\le t\le 1 \\ 
\gamma_2: 1+it\quad 0\le t\le 1 \\
\gamma_3: 1+i -(1+i)t\quad 0\le t\le 1
$$
When you find the derivatives and substitute, then integrate, my final answer is $\not1$, but the answers say $\frac12 i$
Have I made a calculation error, or am I approaching the question the wrong way?
Edit my working, answer is still wrong now right.. :
$$ \oint_\gamma \Re(z) = \int_0^1 \Re(t)\ dt  + i\int_0^1\Re(1+i)\ dt - (1+i) \int_0^1 \Re(1+i - t(1+i))\ dt \\= \int_0^1 \not1 t\ dt + i \int_0^1 1\ dt - (1+i)\int_0^1(1 - t) \ dt \\= \not 1\frac12 + i  - \frac{(1+i)}{2} \\ = \frac12 i 
$$
Final edit: Made a error on second line, was a calculation error.

REPLY [2 votes]: $\gamma_1$ gives rise to $1/2\times 1$.
$\gamma_2$ gives rise to $1\times i$. This is from $\int 1 d(1+it)=\int 1 dt\times i$.
$\gamma_3$ gives rise to $(1-1/2)\times(-(1+i))$.
Summing gives $1/2+i-(1+i)/2=i/2$.
Edit: Your current error is that the real part of $t$ is not 1 but $t$ in the first integral.