# Missing \begin{document} error when using .sty file

I am a fairly new LaTeX-user and I've come across a problem I can't solve related to a custom style. I keep getting a Missing \begin{document} error among others and I have no idea why. I am using MikTex 2.9. I am trying to figure out why it is giving me the errors and how to get it to compile.

Style

The .sty I am trying to use is this particular one: http://www.phantasia.org/miju/rpg/harn/harn.sty

Code

The \usepackage for the custom style is the last one before \begin{document}

\documentclass[a4paper,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{enumerate}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[finnish]{babel}
\usepackage{float}
\usepackage{listings}
\usepackage{footnote}
\usepackage{amsthm}
\usepackage{enumitem}
\usepackage{icomma}
\usepackage{cancel}
\usepackage{csvsimple}
\usepackage{url}
\makeatletter
\makeatother
\usepackage{amsfonts}
\title{Title}
\author{Author}
\usepackage{ifthen}
\usepackage{calc}
\usepackage{fancybox}
\usepackage{wrapfig}
\usepackage{harn}

\begin{document}
asd
\end{document}


This works fine if I comment out the harn package which leads me to believe the problem is in there, I just can't find it.

Error log

Here is the error log I get: http://pastebin.com/3X8GNy4Q

I've already tried commenting out empty lines, deleting aux files (usual suspects) with no effect. I really have no idea what could be the problem. Any help would be much appreciated.

• Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – Martin Schröder Mar 1 '16 at 18:26
• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Mar 1 '16 at 18:27
• you are using pstricks with pdflatex (which does not work) and is the cause of the \c@lor@to@ps error but you may have other errors – David Carlisle Mar 1 '16 at 18:56

\setlength{\headrulewidth}{0mm}

\renewcommand{\headrulewidth}{0mm}