Is there any simple (method/macro,..) to replace everything inside all eqnarray* by a simple given text. More precisely for example I want to replace

x     & = & \frac{1}{2}at_1^2 + v_0t_1 + x_0\\
t_1^2 & = & \frac{2x}{g}

or any eqnarray* by

\text{Math inside}

best regards.

Edit: it would be nice if this also works for align, displaymath,.... It should save the environment structure, and replace the content inside it.

  • 2
    First of all, don't use eqnarray... See why here: tug.org/TUGboat/tb33-1/tb103madsen.pdf. Then, what you want is: whenever you use one of those environments, you want a simple text to be printed instead of its contents? – karlkoeller Nov 19 '13 at 15:05
  • 1
    Do you have any approaches yourself yet? It would be interesting to have them as a starting point, or you could explain a little more, what you want to achieve in total (hand out a script where the formulae are missing, so that the students can fill that out while attending the lecture?) – Ronny Nov 19 '13 at 15:06
  • The answers here may solve your problem: tex.stackexchange.com/questions/9771/… – Ethan Bolker Nov 19 '13 at 15:09

Is this what you mean? I should point out that it can only handle as many fields as I put c's in the array field.

{\par Math Inside\par\lrbox{\mybox}$\array{cccccccccccccc}}
Here is pre text
x     & = & \frac{1}{2}at_1^2 + v_0t_1 + x_0\\
t_1^2 & = & \frac{2x}{g}
Here is post text

Here is a method using the environ package.

\printmathsfalse % <--- Change to true to switch maths printing on.
  \centering Maths printing off. \par
A &= B \\
C &= D

I am not sure what you're actually trying to achieve, but it sounds more like a job for text editors rather than macros. For instance, if you use Notepad++, you can do the following: Go to Search -> Replace, then type


in the Find what box, and

\\begin\{eqnarray\*\}\r\\text\{Math inside\}\r\\end\{eqnarray\*\}

in the Replace with box. Now check Wrap Around, Regular expression and . matches newline boxes, then click Replace All.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.