Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16456 > unrolled thread

Re: Unnecessary parentheses around TagBox for MakeBoxes?

Started byJohn Fultz <jfultz@wolfram.com>
First post2014-01-21 08:40 +0000
Last post2014-01-21 08:40 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Unnecessary parentheses around TagBox for MakeBoxes? John Fultz <jfultz@wolfram.com> - 2014-01-21 08:40 +0000

#16456 — Re: Unnecessary parentheses around TagBox for MakeBoxes?

FromJohn Fultz <jfultz@wolfram.com>
Date2014-01-21 08:40 +0000
SubjectRe: Unnecessary parentheses around TagBox for MakeBoxes?
Message-ID<lblbpd$mhb$1@smc.vnet.net>
You can use the SyntaxForm option of TagBox to resolve this.  A common pattern that you'll find with many template styles in Core.nb for situations very much like this (i.e., where the TagBox should simply act as a standalone thing and not as a thing with a given precedence) is using a value of SyntaxForm->=94symbol=94.

MakeBoxes[test, form_] :=
 TagBox[RowBox[{"test", "END"}], "myBox", SyntaxForm -> "symbol=94]

While the meme of using SyntaxForm->=94symbol=94 isn't documented, SyntaxForm is otherwise documented and I encourage you to look it up.

John Fultz
jfultz@wolfram.com
User Interface Group
Wolfram Research, Inc.



On Jan 18, 2014, at 4:01 AM, Yi Wang <tririverwangyi@gmail.com> wrote:

> Hello,
>
> I was trying to generate pretty output for some expressions. To assist interpretation, a TagBox is used.
>
> A problem is that, Mathematica always insert unnecessary parentheses outside TagBox. For example,
>
> MakeBoxes[test, form_] := TagBox[RowBox[{"test", "END"}], "myBox"]
>
> In[] := 2 test
> Out[] = 2 (test END)
>
> Here the TagBox already has clear boundary thus the parentheses shouldn't be necessary. Would it be possible to remove it?
>
> Note that the "END" in this simple example will be replaced by a complicated structure (GridBox) in actually usage. Thus I cannot simply write "testEND" together as a single string. Also, the parentheses appears in TraditioinalForm, which further appear in all forms as TeXForm, etc.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web