Hi,
I'm writing my thesis which contains several chapters. In one chapter I have psuedo-code while another contains a lot of special equations. The problem is for the psuedo-code I need the algorithmix package and the equations requires a package called zed-csp, but when I include both in my document using "usepackage", I can't compile anymore because one of the pseudo-codes files complains of a "missing $ inserted".
Is there a way to understand and hopefully fix this? If not, is there a way of using both packages in the same document?
Thanks,
Kery.
Document Classes ⇒ An incompatible package problem
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
An incompatible package problem
Hi Kery,
welcome to the board!
The packages work together. Here's an example, which is compilable without error:
To get your case fixed, you could post a
minimal working example which shows the problem, i.e. a reduced copy of your code which brings this error when tested.
Stefan
welcome to the board!
The packages work together. Here's an example, which is compilable without error:
Code: Select all
\documentclass{article}
\usepackage{algorithmicx}
\usepackage{zed-csp}
\begin{document}
\begin{schema}{Test}
text
\end{schema}
\end{document}

Stefan
LaTeX.org admin
An incompatible package problem
Hi Stefan,
Thanks for your reply. I assumed it was the algorithmicx package, but perhaps the problem is caused in algorithm or algpseudocode. Here is my header file...
And this is causing a problem in the following code...
The error message I'm getting is...
Hopefully this clarify things?
Thanks for your reply. I assumed it was the algorithmicx package, but perhaps the problem is caused in algorithm or algpseudocode. Here is my header file...
Code: Select all
\documentclass[twoside,11pt]{Latex/Classes/PhDthesisPSnPDF}
%
% PACKAGES IN USE
%
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{zed-csp}
% for psuedo-code
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{algpseudocode}
Code: Select all
\begin{algorithmic}[1]
\Function{Open}{$AtomicObject$}
\State $scratch \gets \Call{Get}{cache, AtomicObject}$
\If{$scratch = \textbf{null}$}
\State $scratch \gets \Call{Copy}{AtomicObject_{VERSION}}$
\State $\Call{Put}{cache, AtomicObject, scratch}$
\EndIf
\State \textbf{return} scratch
\EndFunction
\end{algorithmic}
Code: Select all
! Missing $ inserted.
<inserted text>
$
l.6 \If
{$scratch = \textbf{null}$}
?
- Stefan Kottwitz
- Site Admin
- Posts: 10348
- Joined: Mon Mar 10, 2008 9:44 pm
An incompatible package problem
A real MWE would be better than posting code snippets. Each reader would have to built his own test document because you did not take the time but simply copied and pasted parts. Just think about this next time - the easier you make it for the readers, the higher the chance to get a fix.
Well, I could build and test and verify this, it's just a name clash, since both
It happens sometimes, a package author can choose a name which another one already used. A solution for such clashes could be that package authors would use a common naming convention for example prefixing with the package name.
Stefan
Well, I could build and test and verify this, it's just a name clash, since both
algpseudocode
and zed-csp
define a macro \If
. Here's how you can save and restore the original algorithmicx
\If
:Code: Select all
\usepackage{algorithmicx}
\usepackage{algorithm}
\usepackage{algpseudocode}
\let\algIf\If
\usepackage{zed-csp}
\let\If\algIf
Stefan
LaTeX.org admin
Re: An incompatible package problem
Okay, I see now.
Thanks Stefan.
Thanks Stefan.