The easiest way to integrate $\tan(x)$ is to recall that $$ \tan(x) = \frac{\sin(x)}{\cos(x)}\,, $$ so $$ ∫ \tan(x)\,dx = ∫ \frac{\sin(x)}{\cos(x)}\,dx\,. $$ Do you see the necessary substitution? By choosing $u = \cos(x)$, that is, “$du = -\sin(x)\,dx$” (in quotation marks because this expression does not make sense mathematically, but it does work formally), we get $$ ∫ \frac{\sin(x)}{\cos(x)}\,dx = ∫ -\frac{1}{u}\,du = -\log(u)+c = -\log(\cos(x))+c $$
Tip: Are you a non-native English speaker? I have just finished creating a Web App for people who enjoy learning by reading. Make sure to check it out; there's a lot of free content.
By the way, have you already seen my brand new web app for non-native speakers of English? It's based on reading texts and learning by having all meanings, pronunciations, grammar forms etc. easily accessible. It looks like this: