GeneralIllegal character in array arg

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
thomassligon
Posts: 2
Joined: Fri Jan 17, 2014 7:00 pm

Illegal character in array arg

Post by thomassligon »

Sorry for the newbie question. I installed MikTeX and TeXMaker today and I'm a beginner in TeX. I have created a document and copied in code created by Copasi (copasi.org). The document starts like this:

Code: Select all

\documentclass[10pt,a4paper,final]{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\begin{document}
\begin{math}
\begin{array}
\frac {\mathrm{d}\left( {{\mathrm{[Lext]}} \, \cdot \, {V}_{c} } \right) }  {\mathrm{d}{t} }  \; &=& \;  { \, - \, {V}_{c} \, \cdot \, \left( {{\mathrm{kAX}} \, \cdot \, {\mathrm{[Lext]}} } \right) } \\ 
The error looks like this:

Code: Select all

l.13 \frac
           {\mathrm{d}\left( {{\mathrm{[Lext]}} \, \cdot \, {V}_{c} } \right...

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.


! LaTeX Error: Illegal character in array arg.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
I assume I have overlooked something that needs to be in the document.
Thanks,

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Illegal character in array arg

Post by cgnieder »

The {array} environment is the math equivalent to {tabular} and just like {tabular} it has an mandatory argument for the column specifiers:

Code: Select all

\begin{array}{<column spec>}
...
\end{array}
Your code misses the argument and the {array} environment uses the text token it can find (\frac in your case) which of course doesn't work and consequently {array} issues an error.

A few remarks:
  • Your code looks a bit strange to me: I almost never see anyone use the {math} environment. (Not that it is a bad thing...)
  • It has way too much brace groups and spaces (\,).
  • The frequent use of \mathrm is unusual. Do you have a specific reason for it?
  • The \left and \right specifiers are unnecessary here.
  • It looks like you're trying to use {array} for alignment of equations. There are better environments for that provided by amsmath.
  • You may want to study mathmode for details on LaTeX's math mode and the various possibilities.
The code looks all in all as if it was produced by some program rather than a yourself by maybe I'm over-interpreting here...

Here's how I would do it:

Code: Select all

\documentclass[10pt,a4paper,final]{article}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}

\begin{document}
\begin{align*}
    \frac
      { \mathrm{d}( \mathrm{[Lext]} \cdot V_c ) }
      { \mathrm{d}t }
    &=
    -V_c \cdot ( \mathrm{kAX} \cdot \mathrm{[Lext]} ) \\
    a &= b \\
    A &= B
\end{align*}
\end{document}
array.png
array.png (6.04 KiB) Viewed 25219 times
Regards
site moderator & package author
thomassligon
Posts: 2
Joined: Fri Jan 17, 2014 7:00 pm

Re: Illegal character in array arg

Post by thomassligon »

Hello Clemens,

thanks for that. That's exactly what I needed. The next thing I will need is to make page breaks work, but for the moment I just took a small piece of the code that would fit on one page.

I didn't figure out how you created the PNG file, so I uploaded my PDF as attachment.

Yes, indeed, the code was created by a program. It is called Copasi (complex pathway simulator), a tool for simulating biochemical reaction pathways.

Tom
Attachments
ODEs.4.pdf
(63.11 KiB) Downloaded 307 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Illegal character in array arg

Post by Stefan Kottwitz »

Hi Tom,
thomassligon wrote:The next thing I will need is to make page breaks work
You can get automatic page breaks in the align* environment if you set \allowdisplaybreaks in your preamble. There's an optional argument which you could use: \allowdisplaybreaks[1] means page breaks are allowed, but should be avoided when possible, 2, 3, 4 relax it step by step and allows page breaks for more situations. 4 is the default value. As usual, the \\* command can be used to disallow a page break after the line.

Furthermore, alternatively, you can use \displaybreak to allow a page break within the environment. Similarly, \displaybreak[0] allows a break but doesn't enforce it, \displaybreak[4] forces a page break (4 is default).

Stefan
LaTeX.org admin
Post Reply