Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Yes, I have custom expressions which I want to have such custom syntax. – Suzan Cioc Mar 4 '13 at 15:02
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 – Oleksandr R. Mar 4 '13 at 15:10
@Oleksandr I think the problem with that is the shrinking point size. – Mr.Wizard Mar 4 '13 at 15:14

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

share|improve this answer
Thanks a lot! Will learn of your examples! First ones are better (without shrinking). – Suzan Cioc Mar 4 '13 at 15:55
@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. – Mr.Wizard Mar 4 '13 at 15:59
Ok will wait for other points... – Suzan Cioc Mar 4 '13 at 17:07
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. – Mike Honeychurch Mar 4 '13 at 22:11
@Mike Thanks for the tips; I'll try them out later. Or, you could post your own answer if you prefer. – Mr.Wizard Mar 4 '13 at 22:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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