# TikZ not working with university thesis class (another question)

For some reason, the TikZ arrow command `\draw[->]` and any thing similar like `\draw[<<->]` are not working with the university class file shown below. Can anybody figure out why?

The error is `TeX capacity exceeded, sorry [input stack size=5000]`. However, the `tikzpicture` works when I change the class file.

Any idea?

-
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Christian Hupfer Feb 27 at 22:13

The problem is that the file `csm-thesis-encoding.sty` turns `>` and `<` into active characters; search around lines 47-52 and you'll see:

``````\begingroup
\catcode`\>=\active
\csm@redefine@char{>}{\textgreater}
\catcode`\<=\active
\csm@redefine@char{<}{\textless}
\endgroup
``````

You can either:

1. Comment out those lines; this implies that now `>` and `<` have their original definition instead of the intended by the style file meaning of `\textgreater`, `\textless`.

2. Add the following lines to your `.tex` document:

``````\usepackage{etoolbox}
\BeforeBeginEnvironment{tikzpicture}{\catcode`\>=12}
\BeforeBeginEnvironment{tikzpicture}{\catcode`\<=12}
\AfterEndEnvironment{tikzpicture}{\catcode`\>=\active}
\AfterEndEnvironment{tikzpicture}{\catcode`\<=\active}
``````
-
Or, even better, removing the setting of `<` and `>` as active characters and use the T1 encoding, so those symbols can be used also in text (I'm asking why, though). Your workaround wouldn't work if `tikzpicture` (or a `\tikz...;` construction) appears as argument to another command. –  egreg Feb 28 at 9:14
You can instead use the `execute at begin picture` key to restore the cat code then place that in the `every picture` key for every picture. and similarly at end picture too. there must be babel french issue solution similar to that one. –  percusse Feb 28 at 12:29

The diagnosis made by Gonzalo Medina is good. However, the workaround he proposes is not really good.

Actually, redefining `<` and `>` as active characters expanding to `\textless` and `\textgreater` is simply wrong. The template uses the in the acknowledgment section, whereas the correct characters would be `\textlangle` and `\textrangle`. In any case, using `<` and `>` in text is quite rare and there's no reason to risk breaking compatibility with macros and packages just to be able to type `<spouse>` in the template.

For instance, you won't be able to say `\ifdim\somelength>1cm` in your document to, say, measure an object and take appropriate actions. In other words, TikZ is just one package that can give problems.

So, my advice is simply to revert the bad assignment. If you really need `<` and `>` in text, use the T1 encoding. Since modifying the `.sty` file is inappropriate, as your modificatins would be lost if a new version is issued, you can revert the setting using the following calls:

``````\usepackage{csm-thesis}
\makeatletter