# creating conditional array using iopart

I need to write a conditional equation using iopart.cls, a class that doesn't work with amsmath. Usually I'd use the cases environment from amsmath like so:

$$\mathrm{sgn}(t) = \begin{cases} 1, & \text{if t>0}.\\ -1, & \text{if t<0}. \end{cases}$$


Unfortunately, I can't do this in iopart, and have failed to find any way to do it thus far. Any help would be appreciated!

EDIT: I just solved my own question by messing around on the codecogs equation editor- I just made my own conditional array thusly:

\setlength{\arraycolsep}{2pt}

$$\mathrm{sgn}(t) = \left\{ \begin{array}{r@{\quad}cr} 1 & \mathrm{if} & t > 0 \\ -1 & \mathrm{if} & t < 0 \end{array}\right.$$

• Welcome to TeX.SE! The iopart document class does not seem to be available on the CTAN. Could you point to a depository from where it might be obtained?
– Mico
Commented Oct 26, 2014 at 18:32
• The iopart infor can be found here: wiki.lyx.org/Layouts/Iopart Commented Oct 26, 2014 at 18:37
• the spacing between "if" and "$t>0$ will look off with this setup unless you adjust the amount of intercolumn whitespace, which is governed by the parameter \arraycolsep.
– Mico
Commented Oct 26, 2014 at 18:47
• Edited my fix accordingly, thanks- it looks great now! Commented Oct 26, 2014 at 19:01
• By resetting \arraycolsep globally, you're losing the wide space that's conventionally inserted between the result part and condition part of the statement. To fix that, you should insert somethinglike @{\quad} between the first r and the middle c. Note also that \bigg\{ may be OK for a statement with exactly two rows but will fail if you have three or more rows. You should use \left\{.
– Mico
Commented Oct 26, 2014 at 19:05

Here's a do-it-yourself version of the cases environment. By specifying only two columns in the array, you'll get a normal interword space between "if" and "$t>0". \documentclass{iopart} \usepackage{array} \newcolumntype{L}{>{$}l<{\$}} % text mode "l" in an "array"
\begin{document}
$$\mathrm{sgn}(t) = \left\{ \begin{array}{@{\kern2.5pt}lL} \hfill 1 & if t>0.\\ \hfill 0 & if t=0,\\ -1 & if t<0. \end{array}\right.$$
\end{document}

• Awesome, thanks! I'd upvote your comment, but I don't have enough rep yet. Commented Oct 26, 2014 at 18:48
• Wouldn't an r column be better? Commented Oct 26, 2014 at 18:55
• @crubster - Hopefully a few more people will upvote your posting, giving you enough rep points to do your own upvoting. :-)
– Mico
Commented Oct 26, 2014 at 18:56
• @egreg - I did think about this too, but in the end I chose to go with the cases setup (which, as you know, uses l for the first column). If the OP's use case calls for the use of r for the first column of the array, I trust he/she can adapt the code without too much effort.
– Mico
Commented Oct 26, 2014 at 18:59