Fix build, move trigonometry part and move custom commands/includes to main tex file