egraff / uit-thesis

LaTeX document class for writing theses
http://egraff.github.io/uit-thesis/
Other
42 stars 43 forks source link

Problem with verbatim-environment #23

Closed egraff closed 10 years ago

egraff commented 10 years ago

Check if using \begin{verbatim}\end{verbatim} causes any problems...

3inar commented 10 years ago

my one instance of verbatim is fine, but it's outside of the running text. what are we looking for?

egraff commented 10 years ago

@transmetro: I just observed that @Jaklin got errors from the tikz package when trying to use a verbatim-environment (for some reason), but I haven't had time to look into it (or see if it's even reproducible...)

egraff commented 10 years ago

I was finally able to reproduce the bug.

MNWE:

\documentclass{uit-thesis}
\usepackage{lipsum}
\begin{document}

\mainmatter

\section{A section}
\lipsum[1-4]

\begin{verbatim}
A
B
C
D
E
\end{verbatim}

\end{document}

It seems that the bug is only present with the newest version of the tikz package (or some other package). The problem is that if a verbatim environment crosses a page boundary where the running head of the first(!) page contains a UiT slash (drawn with tikz), then tikz halts with the following error message:

Sorry, some package has redefined the meaning of the math-mode dollar sign.
This is incompatible with tikz and its calc library and might cause unrecoverable errors.
egraff commented 10 years ago

A more generic MNWE:

\documentclass{book}
\usepackage{tikz}
\usepackage{lipsum}

\begin{document}

\def\testcatcode{%
  \ifnum\catcode`\$=3%
  \else
    \GenericError{}{Dollar catcode has changed}{}{}
  \fi
}%

\newcommand{\printrheadslash}[1][]{
  \testcatcode
  \typeout{^^J Before ^^J^^J}
  \begin{tikzpicture}
    \fill[color=black] (0,0) -- (1.15,3.15) -- (1.4,3.15) -- (0.25,0) -- cycle;
  \end{tikzpicture}
  \typeout{^^J After ^^J^^J}
}

\renewcommand{\sectionmark}[1]{\markboth{}{\printrheadslash}}

\section{A section}
\lipsum[1-4]

\begin{verbatim}
A
B
C
D
E
F
G
H
\end{verbatim}

\end{document}