Standard FractionBox syntax allows only 2 arguments and creates 2-part fraction for numerator and denominator.

Is it possible to draw similar construction, but with more than 2 parts? Some sort of column with separators only between inner parts?

The following code

Column[{"x", 200, Integrate[Sin[x^2], x]}, Alignment -> Center, Dividers -> Center]

draws best what I found but it does dividers of similar length in entire column. I would like dividers to accommodate two adjacent parts only.

  • $\begingroup$ Yes, I have custom expressions which I want to have such custom syntax. $\endgroup$
    – Suzan Cioc
    Commented Mar 4, 2013 at 15:02
  • $\begingroup$ I'm not totally clear on what you want. Could you describe why nested FractionBoxes aren't suitable? For instance, Fold[FractionBox, x, Range[5]] // DisplayForm $\endgroup$ Commented Mar 4, 2013 at 15:10
  • $\begingroup$ @Oleksandr I think the problem with that is the shrinking point size. $\endgroup$
    – Mr.Wizard
    Commented Mar 4, 2013 at 15:14

1 Answer 1


Interesting question. I don't have much experience with this sort of thing so I imagine there is a better way but this is what I could hack together at the moment:

frac[lst_List] := Column[
  Column /@ Partition[Riffle[lst, \[HorizontalLine]], 2, 2, -1, {}], 
  Alignment -> Center, Spacings -> 0]

{"x", 200, Integrate[Sin[x^2], x]} // frac

Mathematica graphics

Here is another approach, probably closer to "correct":

frac2[lst_List] :=
  Style[Fold[FractionBox, #, {##2}], ScriptSizeMultipliers -> 1] & @@
    (ToBoxes@Style[#, ScriptSizeMultipliers -> 0.71] & /@ lst) // DisplayForm

{"x", 200, Integrate[Sin[x^2], x]} // frac2

Mathematica graphics

I am assuming that you want expressions at any tier of the notation to be the same size. If you are fine with them shrinking as they go up then a much simpler form can be used without Style and ScriptSizeMultipliers:

frac3[lst_List] :=
  Fold[FractionBox, #, {##2}] & @@ (ToBoxes /@ lst) // DisplayForm

{"x", 200, Integrate[Sin[x^2], x], Integrate[Sin[x^2], x]} // frac3

Mathematica graphics

  • $\begingroup$ Thanks a lot! Will learn of your examples! First ones are better (without shrinking). $\endgroup$
    – Suzan Cioc
    Commented Mar 4, 2013 at 15:55
  • $\begingroup$ @Suzan You're welcome, but you may want to leave this question open (no Accepted answer) for a while longer. I am hardly an expert at output formatting. $\endgroup$
    – Mr.Wizard
    Commented Mar 4, 2013 at 15:59
  • $\begingroup$ Ok will wait for other points... $\endgroup$
    – Suzan Cioc
    Commented Mar 4, 2013 at 17:07
  • $\begingroup$ For ScriptSizeMultipliers less than one you might like to also add ScriptMinSize. Also ScriptLevel -> 1 may or may not be preferrable. The OP might like to try it out. $\endgroup$ Commented Mar 4, 2013 at 22:11
  • $\begingroup$ @Mike Thanks for the tips; I'll try them out later. Or, you could post your own answer if you prefer. $\endgroup$
    – Mr.Wizard
    Commented Mar 4, 2013 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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