I have defined a .sty-file which I use in a report, which holds a lot of good information and styles for how my documents should look like. This have been working great, until when I tried making a letter. My own style loads the titling-package among others, and this seems to cause errors. I of course do not really need the titling-package in my letter, but it is necessary in my other documents. I was wondering if I could write some kind of check to only load the titling-package if the document class is not a letter. That way, it will work with all my other documents, and my letters.
In the included example, I have only loaded the titling-package, and not my personal style. The errors produced are the same.
\documentclass{letter}
\usepackage{lipsum,
titling
}
\signature{Your name}
\address{Street \\ City \\ Country}
\begin{document}
\begin{letter}{Company name \\ Street\\ City\\ Country}
\opening{Dear Sir or Madam:}
\lipsum[1-2]
\closing{Yours Faithfully,}
\ps{P.S. Here goes your ps.}
\encl{Enclosures.}
\end{letter}
\end{document}
\@ifclassloaded{...}perhaps? – Nov 19 '15 at 20:26