Group Abstract Group Abstract

Message Boards Message Boards

0
|
2K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

Two-dimensional expression input in the help text

Posted 3 years ago

I wrote the following custom command:

SetEqualQ//ClearAll;
SetEqualQ::usage =
"SetEqualQ[Subscript[list, 1],Subscript[list, 2]]
    yields True if Subscript[list, 1] is a equal to Subscript[list, 2], and False otherwise.";

SetEqualQ[l1_List,l2_List]:=SubsetQ[l1,l2] && SubsetQ[l2,l1];

When I run ?SetEqualQ, the following information will appear:

enter image description here

As you can see, the Subscript symbol is not formatted here. I further tried the following method, but still failed:

SetEqualQ//ClearAll;
SetEqualQ::usage =
StringForm["SetEqualQ[`1`, `2`]
    yields True if `1` is a equal to `2`, \
and False otherwise.", Subscript[list, 1],Subscript[list, 2]];
SetEqualQ[l1_List,l2_List]:=SubsetQ[l1,l2] && SubsetQ[l2,l1];

MessageName::messg: SetEqualQ::usage cannot be set to SetEqualQ[Subscript[list, 1], Subscript[list, 2]]
    yields True if Subscript[list, 1] is a equal to Subscript[list, 2], and False otherwise.. It must be set to a string.

Any hints for achieving this gold?

Regards, Zhao

POSTED BY: Hongyi Zhao
4 Replies
Posted 3 years ago

Enter the subscript by pressing Ctrl and - at the same time. See this.

enter image description here

POSTED BY: Hans Milton
Posted 3 years ago

In any case, this is not a WYSIWYG approach, and there seems to be no better way than this.

POSTED BY: Hongyi Zhao
Posted 3 years ago

Yes, I experience the same. Also with simple formatting such as italics. If one wants to edit the formatted parts one has to type in the whole new text.

As an aid during editing one can evaluate the following to get a readable version of the existing text:

Information[SetEqualQ, "Usage"]
POSTED BY: Hans Milton
Posted 3 years ago

I tried this approach, but when I re-open the Wolfram script file, it will look like this:

SetEqualQ//ClearAll;
SetEqualQ::usage="SetEqualQ[\!\(\*SubscriptBox[\(list\), \(1\)]\),\!\(\*SubscriptBox[\(list\), \(2\)]\)]
    yields True if \!\(\*SubscriptBox[\(list\), \(1\)]\) is equal to \!\(\*SubscriptBox[\(list\), \(2\)]\), and False otherwise.";
SetEqualQ[l1_List,l2_List]:=SubsetQ[l1,l2] && SubsetQ[l2,l1];

As you can see, it is messy and difficult to read and understand.

POSTED BY: Hongyi Zhao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard