Document Classes ⇒ An incompatible package problem
An incompatible package problem
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.
NEW: TikZ book now 40% off at Amazon.com for a short time.
And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p
- Stefan Kottwitz
- Site Admin
- Posts: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
An incompatible package problem
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
An incompatible package problem
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: 10335
- Joined: Mon Mar 10, 2008 9:44 pm
An incompatible package problem
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
Re: An incompatible package problem
Thanks Stefan.