[proofplan]
We prove holomorphicity of $f$ locally by constructing an antiderivative on each disc $B(z_0, r) \subseteq U$. The vanishing triangle-integral hypothesis and the convexity of $B(z_0, r)$ allow the [Antiderivative Existence Characterisation](/theorems/340) to produce a holomorphic $F$ with $F' = f$. Since $F$ is holomorphic, [Taylor's theorem for holomorphic functions](/theorems/348) and the [Holomorphicity of Power Series](/theorems/335) show that $F$ (and hence $f = F'$) is representable by a convergent power series, establishing holomorphicity of $f$.
[/proofplan]
[step:Reduce to a local problem on a disc]
Fix $z_0 \in U$ and choose $r > 0$ with $B(z_0, r) \subseteq U$. The hypothesis gives $\int_{\partial T} f(z) \, dz = 0$ for every triangle $T \subseteq U$; in particular, this holds for every triangle $T \subseteq B(z_0, r)$.
[/step]
[step:Construct an antiderivative on $B(z_0, r)$ using the Antiderivative Existence Characterisation]
The disc $B(z_0, r)$ is convex, hence star-shaped. Since $f$ is continuous on $B(z_0, r)$ and $\int_{\partial T} f(z) \, dz = 0$ for every triangle $T \subseteq B(z_0, r)$, the [Antiderivative Existence Characterisation](/theorems/340) provides a holomorphic function $F: B(z_0, r) \to \mathbb{C}$ with $F' = f$.
[guided]
The [Antiderivative Existence Characterisation](/theorems/340) states that a continuous function on a domain has an antiderivative if and only if its integral around every closed path vanishes.
The key link is: on a convex (hence star-shaped) domain, the vanishing of triangle integrals implies the vanishing of all closed-path integrals.
This is because the proof of [Cauchy's theorem for star-shaped domains](/theorems/342) constructs an antiderivative $F(z) = \int_{[z_0, z]} f(w) \, dw$ from a star centre $z_0$ along straight-line segments, using only the triangle-integral condition.
Specifically, for any $z \in B(z_0, r)$ and small $h$, the triangle with vertices $z_0, z, z+h$ lies in the convex set $B(z_0, r)$.
The vanishing of the triangle integral gives $F(z+h) - F(z) = \int_{[z,z+h]} f(w) \, dw$, and differentiating yields $F' = f$.
The disc $B(z_0, r)$ is convex, so the star-shaped construction applies directly.
Once $F$ exists with $F' = f$, the [Fundamental Theorem of Contour Integration](/theorems/339) gives $\int_\gamma f \, dz = F(\gamma(b)) - F(\gamma(a)) = 0$ for every closed path $\gamma$ in $B(z_0, r)$.
[/guided]
[/step]
[step:Conclude that $f$ is holomorphic as the derivative of a power series]
Since $F$ is holomorphic on $B(z_0, r)$, [Taylor's theorem for holomorphic functions](/theorems/348) gives $F(z) = \sum_{n=0}^\infty c_n (z - z_0)^n$ on $B(z_0, r)$. By the [Holomorphicity of Power Series](/theorems/335), the derivative $f = F'$ is also given by a convergent power series on $B(z_0, r)$:
\begin{align*}
f(z) = F'(z) = \sum_{n=1}^\infty n c_n (z - z_0)^{n-1}.
\end{align*}
In particular, $f$ is holomorphic at $z_0$. Since $z_0 \in U$ was arbitrary, $f$ is holomorphic on $U$.
[/step]