3
$\begingroup$

Let's consider a slightly complicated expression in TraditionalForm:

Reduce[#, Backsubstitution -> True] & /@ 
  BooleanMinimize@
   CylindricalDecomposition[
    x^2 + y^2 <= 1 && y <= x, {x, y}] // TraditionalForm

$(y=0\land x=1)\lor \left(y=-\frac{1}{\sqrt{2}}\land x=-\frac{1}{\sqrt{2}}\right)\lor \left(-\frac{1}{\sqrt{2}}<x\leq \frac{1}{\sqrt{2}}\land -\sqrt{1-x^2}\leq y\leq x\right)\lor \left(\frac{1}{\sqrt{2}}<x<1\land -\sqrt{1-x^2}\leq y\leq \sqrt{1-x^2}\right)$

My question is: How do I split this result for improved readability so that each subexpression of this disjunctive normal form expression is on its own line, and $\lor$ ends the line?

$\endgroup$
4
$\begingroup$
exp = Reduce[#, Backsubstitution -> True] & /@ 
   BooleanMinimize@ CylindricalDecomposition[x^2 + y^2 <= 1 && y <= x, {x, y}];

ToBoxes[TraditionalForm @ exp] /. "\[Or]" -> "\[Or]\n" // RawBoxes

enter image description here

Or, wrap with TraditionalForm:

ToBoxes[TraditionalForm@exp] /. "\[Or]" -> "\[Or]\n" // RawBoxes // TraditionalForm 

enter image description here

Original size of $\lor$s can be retained by replacing them with a separate $\lor$ and a newline:

ToBoxes[TraditionalForm@exp] /.
  "\[Or]" -> Sequence["\[Or]", "\n"] // RawBoxes // TraditionalForm

enter image description here

$\endgroup$
  • $\begingroup$ Even better if you add // TraditionalForm in the end. Size of $\lor$s seems to change, though. That would be fixed with "\[Or]" -> Sequence["\[Or]", "\n"] $\endgroup$ – kirma May 12 '15 at 16:31
  • $\begingroup$ @kirma, updated with the suggested change. $\endgroup$ – kglr May 12 '15 at 16:35

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.